I got no error during compilation with tsc option "noUnusedLocals" even if my linter find several of these errors. Is that the normal behaviour ? I use ts with next.js and webpack. Here's my tsconfig file :
{
"compileOnSave": false,
"compilerOptions": {
"target": "es6",
"module": "esnext",
"checkJs": false,
"sourceMap": true,
"strict": true,
"noImplicitAny":true,
"strictFunctionTypes": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"rootDir": "src",
"outDir": "build",
"lib": [
"dom",
"dom.iterable",
"esnext",
"es2017"
],
"allowJs": true,
"noEmit": false,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"suppressImplicitAnyIndexErrors": false
}
}
Thanks for your help.
That is not the expected behaviour. noUnusedLocals: true
causes a tsc
compilation error.
Confusingly, linters may ignore or warn on the error.
See the @microsoft/TypeScript closed issue Classify lintish diagnostics as warnings and open issues Add support for diagnostic severities and Feature Request: Linting should be a core feature of the language server for the unresolved discussion on this and similar "lintish" rules.