I’m getting some suspicious code warnings in one function. I want to suppress warning errors of type suspiciousCode in that function – not the whole file.
Google closure wiki tells me to use @suppress {suspiciousCode} but that doesn’t work and gives me another warning: JSC_PARSE_ERROR: Parse error. unknown @suppress parameter: suspiciousCode.
important lines of code:
/**
* This is a function where type checking is disabled.
* @suppress {suspiciousCode}
*/
(function(a,b){
Could this have anything to do with the wrapping function?
EDIT:
These are the error codes I’d like to suppress:
JSC_SUSPICIOUS_SEMICOLON: If this if/for/while really shouldnt have a body, use {}JSC_USELESS_CODE: Suspicious code. The result of the 'getprop' operator is not being used.JSC_USELESS_CODE: Suspicious code. This code lacks side-effects. Is there a bug?
I’ve checked the warnings and they to exactly what I want.
It is an oversight, it will be fixed in the next release. You can get it now by building from source. Here is the change adding it to list of diagnostic groups that can be used for suppression:
https://code.google.com/p/closure-compiler/source/diff?spec=svn155a2e434bde40d325bbc92cdbe988ece4582e2c&r=155a2e434bde40d325bbc92cdbe988ece4582e2c&format=side&path=/src/com/google/javascript/jscomp/parsing/ParserConfig.properties