TypeScript linter 警告:不推荐使用 no-unused-variable;但我没有使用这个配置 [英] TypeScript linter warning: no-unused-variable is deprecated; but I'm not using this config
问题描述
今天我在一个 3 个月后刷新的项目中看到了这个警告.
Today I see this warning in a project being refreshed after 3 months.
no-unused-variable 已弃用.从 TypeScript 2.9 开始.请改用内置的编译器检查.
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
但是我的 tsconfig.json
似乎没有使用这个.
But my tsconfig.json
does not seem to use this.
{
"compilerOptions": {
"lib": ["es6"],
"module": "commonjs",
"noImplicitReturns": true,
"outDir": "lib",
"sourceMap": true,
"target": "es6",
"allowJs" : true
},
"compileOnSave": true,
"include": [
"src"
]
}
可能它是任何先前配置中隐含的配置.
Probably it's a config implicit in any of the previous configs.
你能指出我该怎么做才能解决这个问题吗?
Could you point me to what to do to fix it?
如果有用
$ node -v
v10.3.0
$ npm -v
6.1.0
这些是与我的 package.json
"devDependencies": {
...
"tslint": "^5.11.0",
"typescript": "^2.9.1"
...
},
推荐答案
正如它所说,tslint 弃用了该规则(更多信息在此 https://github.com/palantir/tslint/pull/3919)
As it says, tslint deprecated that rule (more info here https://github.com/palantir/tslint/pull/3919)
检查您的 tslint.json
,然后删除规则,警告就会消失.
Check your tslint.json
, and remove the rule and the warning should disappear.
这篇关于TypeScript linter 警告:不推荐使用 no-unused-variable;但我没有使用这个配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!