Is there a way to indicate in the tsconfig.json file the options noUnusedLocals and noUnusedParameters as warnings instead of errors that block the compilation?
Currently I use them in the tsconfig.json file like this :
"compilerOptions": {
"noUnusedLocals": true,
"noUnusedParameters": true
},
I tried the option :
"no-unused-variable": true,
in the tslint.json file but it doesn't detect errors like the tsc, and in visual studio code I can't see them underlined.
As you may have seen, Visual Studio Code has a hack to display noUnusedLocals and noUnusedParameters problems as warnings during live editing (the typescript.reportStyleChecksAsWarnings
setting, which defaults to true). The tslint extension does not display these problems at all because they require type information, which the tslint extension does not support.
If the issue is that you are using something like tsc --noEmitOnError
and you don't want noUnusedLocals/noUnusedParameters errors to block the emit, then you could have Visual Studio Code use one tsconfig.json
that has noUnusedLocals/noUnusedParameters enabled and have your command line builds use tsc
with a separate tsconfig.json
that has the options disabled, plus tslint
with no-unused-variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With