Comments (5)
I see there is this in code:
static final DiagnosticType UNREACHABLE_CODE = DiagnosticType.warning(
"JSC_UNREACHABLE_CODE", "unreachable code");
and running node cli.js --help
gives
Available Error Groups: accessControls, checkPrototypalTypes,
checkRegExp, checkTypes, checkVars, conformanceViolations, const,
constantProperty, deprecated, deprecatedAnnotations, duplicateMessage,
es5Strict, externsValidation, functionParams, globalThis, invalidCasts,
lintVarDeclarations, misplacedTypeAnnotation, missingOverride,
missingPolyfill, missingProperties, missingProvide, missingRequire,
missingReturn, missingSourcesWarnings, moduleLoad, moduleImport,
msgDescriptions, nonStandardJsDocs, partialAlias, polymer,
reportUnknownTypes, strictCheckTypes, strictMissingProperties,
strictModuleDepCheck, strictPrimitiveOperators, suspiciousCode,
typeInvalidation, undefinedVars, underscore, unknownDefines,
unusedLocalVariables, unusedPrivateMembers, uselessCode,
untranspilableFeatures,visibility
but I don't know how to translate that code JSC_UNREACHABLE_CODE
into the correct error group? Maybe that is supposed to be uselessCode
?
from closure-compiler.
Yep, it's uselessCode
.
You can look this up in https://github.com/google/closure-compiler/wiki/@suppress-annotations#error-to-suppression-map. I added a link from https://github.com/google/closure-compiler/wiki/Warnings#warnings-categories.
from closure-compiler.
Great, thanks! Btw, I wonder if it might make sense to directly print it in the warning/error that appears, like GCC and Clang do?
E.g. currently the warning prints WARNING - [JSC_UNREACHABLE_CODE] unreachable code
.
Why not print WARNING - [uselessCode] unreachable code
?
from closure-compiler.
Or alternatively, would it be possible to support @suppress{JSC_UNREACHABLE_CODE}
in addition to @suppress{uselessCode}
?
The two different warning code namespaces makes me confused, wondering why both need to exist, and why I as user need to know to map between the two. Would seem to be easier to just present and use one code namespace?
from closure-compiler.
I agree it's confusing. We talked as a team earlier this year about both possibilities you've suggested but I don't see that we ever filed an issue to track it, so created #4114.
from closure-compiler.
Related Issues (20)
- Not possible to suppress warning on initializing WebAssembly object HOT 2
- MediaStreamTrackProcessor Constructor HOT 5
- Unknown diagnostic group: '2022' HOT 2
- Make it easier to go from an errors/warnings to `@suppress` tag
- ADVANCED compilation mode produces code in wrong execution order HOT 9
- Bug: static class members defined via an IIFE cause the class to not be removed HOT 1
- ES2020 private members not supported HOT 1
- Cannot convert ECMASCRIPT_2018 feature "RegExp unicode property escape" HOT 2
- import/export directives ignored when not at the start of line HOT 2
- `var` is not hoisted to the nearest variable scope HOT 1
- add getTargetRanges()
- Compiler crashes with dymamic imports (`IllegalStateException`) HOT 3
- com.google.guava vulnerability issue in closure-compiler-20220502 HOT 4
- Assigning a variable while passing to a function fails AC HOT 6
- A for loop compiles incorrectly in WHITESPACE_ONLY and SIMPLE_OPTIMIZATIONS HOT 3
- CommandLineRunner: "renaming cannot be disabled when ADVANCED_OPTIMIZATIONS is used" is wrong HOT 4
- "Copyright The Closure Library Authors" always shows up as the first comment even in code that is ultimately not Apache 2.0 licensed HOT 2
- ADVANCED compilation mode incorrectly removes non-dead code HOT 7
- BUG in Whitespace only for online compiler
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from closure-compiler.