TypeScript linter warning: no-unused-variable is deprecated; but I'm not using this config
今天,我在3个月后刷新的项目中看到此警告。
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
但是我的
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | { "compilerOptions": { "lib": ["es6"], "module":"commonjs", "noImplicitReturns": true, "outDir":"lib", "sourceMap": true, "target":"es6", "allowJs" : true }, "compileOnSave": true, "include": [ "src" ] } |
可能是任何先前配置中都隐含的配置。
您能指出我该怎么做吗?
如果有用
1 2 3 4 | $ node -v v10.3.0 $ npm -v 6.1.0 |
这些是
1 2 3 4 5 6 | "devDependencies": { ... "tslint":"^5.11.0", "typescript":"^2.9.1" ... }, |
就像上面说的那样,tslint不赞成使用该规则(更多信息请参见https://github.com/palantir/tslint/pull/3919)
检查您的
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
从您的或依赖项中删除不推荐使用的
tslint.json
文件。
在您的计算机中指定以下编译器选项
tsconfig.json
文件。
1 2 3 4 | "compilerOptions": { "noUnusedLocals": true, /* Report errors on unused locals. */ "noUnusedParameters": true /* Report errors on unused parameters. */ } |
不仅支持
考虑迁移到新的lint。