javascript - Supressing or resolving compiler errors in goog.base -
javascript - Supressing or resolving compiler errors in goog.base -
i utilize closure compiler on sources , decided enable strict mode via --jscomp_warning=reportunknowntypes. alas, triggered lot of warnings within goog.base itself! i've fixed problems in own code , i'm looking way silence/remove errors in closure library code.
i tried prepare errors in base.js realized it's infeasible. there approximately 108 errors in file , in cases real errors becasue of goog.base doesn't care much types: it's mutual practice there define type {?} or {*}.
i tried utilize --warnings_whitelist_file quiet warnings don't care didn't work either. error:
..\js\google\base.js:204: warning - not determine type of look cur[part] = opt_object; ^
i tried different forms in whitelist file none has worked:
..\\js\\google\\base.js:204 not determine type of look ..\\js\\google\\base.js:204 warning - not determine type of look ..\js\google\base.js:204 not determine type of look ..\js\google\base.js:204 warning - not determine type of look ../js/google/base.js:204 not determine type of look ../js/google/base.js:204 warning - not determine type of look ..\js\google\base.js:204 warning - not determine type of look cur[part] = opt_object;
does have working solution have mode enabled , not spammed errors closure library itself?
i utilize latest closure compiler is: version: v20150315 built on: 2015/03/17 14:18
so, decided go path silencing warnings in base.js. i've investigated compiler sources (thanks authors it's open source) , found out flag description doesn't match actual effect. description says:
a file containing warnings suppress. each line should of form <file-name>:<line-number>? <warning-description>
but in fact guard intercepts matching errors , converts them warnings. moreover, line numbers ignored. see no utilize of flag such behavior bet authors had reason implement way.
anyways, forked main branch , fixed flag's behavior. matched errors , warnings suppressed (silenced). line numbers considered in matching.
syntax of whitelist file similar error/warning output. illustration if error (or warning) this:
..\js\google\base.js:120: error - not determine type of look if (goog.getobjectbyname(namespace)) { ^
then relevant record in whitelist file be:
..\js\google\base.js:120 not determine type of expression
you may add together content of multiline errors comments preceding them # first line used matching.
if need may obtain binary via 1 of 2 ways:
get patched sources , build binary yourself: ihsoft/closure-compiler - wiki get pre-built compiler binary: ihsoft/closure-compiler - release v1.0-tuned javascript google-closure-compiler google-closure
Comments
Post a Comment