Git Product home page Git Product logo

Comments (5)

juj avatar juj commented on May 18, 2024

I see there is this in code:

https://github.com/google/closure-compiler/blob/43850b5db8bd10fcea312a174e469da6343110a4/src/com/google/javascript/jscomp/CheckUnreachableCode.java#L32C1-L34

  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.

lauraharker avatar lauraharker commented on May 18, 2024

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.

juj avatar juj commented on May 18, 2024

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.

juj avatar juj commented on May 18, 2024

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.

lauraharker avatar lauraharker commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.