Closure Compiler has an API for configuring the errors and warnings that you would like to see, and what level they're emitted at.
| Flag API | Java API | Effect | Default Value |
| accessControls | DiagnosticGroups.ACCESS_CONTROLS | Warnings when @deprecated, @private, or @protected are violated. | OFF |
| ambiguousFunctionDecl | DiagnosticGroups.AMBIGUOUS_FUNCTION_DECL | Warnings about ambiguous definitions of functions | WARNING |
| checkDebuggerStatement | DiagnosticGroups.DEBUGGER_STATEMENT_PRESENT | Check for the use of the debugger statement | OFF |
| checkRegExp | DiagnosticGroups.CHECK_REGEXP | Check for regular expression literal problems | OFF |
| checkTypes | DiagnosticGroups.CHECK_TYPES | Type-checking | OFF by default, WARNING on --warning_level=VERBOSE |
| checkVars | DiagnosticGroups.CHECK_VARS | Warnings when vars are not declared. | OFF by default, ERROR on --warning_level=VERBOSE |
| const | DiagnosticGroups.CONST | Warnings when @const annotated properties or variables are reassigned or deleted. | OFF |
| constantProperty | DiagnosticGroups.CONSTANT_PROPERTY | Warnings when @const annotated properties are reassigned or deleted. | OFF |
| deprecated | DiagnosticGroups.DEPRECATED | Warnings when non-deprecated code accesses code that's marked @deprecated | OFF by default, WARNING on --warning_level=VERBOSE |
| duplicate | DiagnosticGroups.DUPLICATE | Warnings when a variable is declared twice in the global scope | OFF by default, ERROR on --warning_level=VERBOSE |
| es5strict | DiagnosticGroups.ES5_STRICT | Warnings about code that is invalid in EcmaScript 5 Strict mode | WARNING |
| externsValidation | DiagnosticGroups.EXTERNS_VALIDATION | Warnings about malformed externs files | WARNING |
| fileoverviewTags | DiagnosticGroups.FILEOVERVIEW_JSDOC | Warnings about duplicate @fileoverview tags | WARNING |
| globalThis | DiagnosticGroups.GLOBAL_THIS | Warnings about improper use of the global this. | OFF by default, WARNING on --warning_level=VERBOSE |
| internetExplorerChecks | DiagnosticGroups.INTERNET_EXPLORER_CHECKS | Warnings about syntax errors on Internet Explorer, like trailing commas. | ERROR |
| invalidCasts | DiagnosticGroups.INVALID_CASTS | Warnings about invalid type casts. | OFF by default, WARNING when type checking is on |
| missingProperties | DiagnosticGroups.MISSING_PROPERTIES | Warnings about whether a property will ever be defined on an object. Part of type-checking. | OFF by default, WARNING on --warning_level=VERBOSE |
| nonStandardJsDocs | DiagnosticGroups.NON_STANDARD_JS_DOCS | Warnings when JSDoc has annotations that the compiler thinks you misspelled. | WARNING |
| strictModuleDepCheck | DiagnosticGroups.STRICT_MODULE_DEP_CHECK | Warnings about all references potentially violating module dependencies | OFF |
| undefinedNames | DiagnosticGroups.UNDEFINED_NAMES | Warnings when properties of global names are undefined. | OFF by default, WARNING on --warning_level=VERBOSE |
| undefinedVars | DiagnosticGroups.UNDEFINED_VARS | Warnings when variables are undefined. | OFF by default, ERROR on --warning_level=VERBOSE |
| unknownDefines | DiagnosticGroups.UNKNOWN_DEFINES | Warnings when unknown @define values are specified. | WARNING |
| uselessCode | DiagnosticGroups.USELESS_CODE | Warnings when the compiler sees useless code that it plans to remove. | WARNING |
| visibility | DiagnosticGroups.VISIBILITY | Warnings when @private and @protected are violated. | OFF |
If there is a category of warnings that you would like to configure but is not listed in the table above, it is easy to define a new one.
This is how we "canary" new warnings until we feel they're stable.
You can also silence warnings by adding JSDoc annotations to your code. All of the warnings categories above can be used in a @suppress tag in a @fileoverview JSDoc comment or a function JSDoc comment. For example,
There is also one warning category that you can suppress with @suppress tags, but is not available from the command-line.
Suppresses warnings about a declaration of the same method or property twice in the global scope.
It would be super nice if there was a way to tell compiler to ignore things like "getters aren't supported in Internet Explorer" because --jscomp_off internetExplorerChecks doesn't work. What if I'm not compiling the code for IE? Is there no way to bypass this problem?
yes, use --language_in=ECMASCRIPT5
itemContainer is a @type{Element},
How to suppress warning: "actual parameter 1 of goog.dom.append does not match formal parameter"? I was trying to use: /** @suppress {checkTypes} */ but without result.
Ask on closure-compiler-discuss@googlegroups.com, as far I can tell you shouldn't get a warning here. But regarding @suppress, it only applies to a function or file.