google / closure-compiler

A JavaScript checker and optimizer.

Home Page:https://developers.google.com/closure/compiler/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How does --warnings_allowlist_file works? I tried many ways but no luck

bamtang-dev opened this issue · comments

Hello,
I'm trying to use --warnings_allowlist_file to dismiss this warning type:

warning JSC_UNRECOGNIZED_TYPE_ERROR: Bad type annotation. Unknown type XYZ

I know it is reading my file because if it doesn't find the file the compiler just crash with:

java.lang.RuntimeException: java.io.FileNotFoundException: pallowlist.txt (The system cannot find the file specified)

Is the path absolute, relative?, what is the format of the line? I feel my warning is not correct or not accepted, but no error is shown

image

Could you give an example of how your file is currently formatted?

From https://github.com/google/closure-compiler/wiki/Flags-and-Options#warning-and-error-management:

A file containing warnings to suppress. Each line should be of the form
<file-name>:<line-number>? <warning-description> (default: )

The file name should match how it's reported in the compiler error message.

Could you give an example of how your file is currently formatted?

Yes, I just tried changing the file path to exactly match the compiler output error, this is the error:

swit/js/swit/phys/PhysBody.js:9:13: WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

I edited the name for clarity, the type doesn't exist because it is just legacy old code and this is the only warning on our code.
I'm trying now with:

swit/js/swit/B2D/B2DBody.js:9? JSC_UNRECOGNIZED_TYPE_ERROR

but I also tried pasting the whole line exactly, not luck, maybe it is just something dumb I'm missing. I'm using v20240317 version of the compiler.

Does this work?

swit/js/swit/phys/PhysBody.js:9 Bad type annotation. Unknown type XYZ

Does this work?

swit/js/swit/phys/PhysBody.js:9 Bad type annotation. Unknown type XYZ

No luck, I tried with (?) character also. For the record the class is more like X.Y.Z not sure if that is important.
Does this work for you? In the mean time we added an exception in our build scripts and are ignoring this warning, it was getting annoying. Thanks.

Can you try pasting the warning message from JSCompiler exactly how it appears. i.e. swit/js/swit/phys/PhysBody.js:9:13: WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

Can you try pasting the warning message from JSCompiler exactly how it appears. i.e. swit/js/swit/phys/PhysBody.js:9:13: WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

I remember I tried that, just in case I tried all these, none works:

swit/js/swit/B2D/B2DBody.js:9:13: WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

swit/js/swit/B2D/B2DBody.js:9:13? WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

swit/js/swit/B2D/B2DBody.js:9? WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

swit/js/swit/B2D/B2DBody.js:9 WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type XYZ

swit/js/swit/B2D/B2DBody.js:9? Bad type annotation. Unknown type XYZ