TypeScript linter 警告:不推荐使用 no-unused-variable;但我没有使用这个配置
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.
但是我的tsconfig.json
好像没有用这个
{
"compilerOptions": {
"lib": ["es6"],
"module": "commonjs",
"noImplicitReturns": true,
"outDir": "lib",
"sourceMap": true,
"target": "es6",
"allowJs" : true
},
"compileOnSave": true,
"include": [
"src"
]
}
可能它是任何先前配置中隐含的配置。
你能告诉我如何解决它吗?
如果有用
$ node -v
v10.3.0
$ npm -v
6.1.0
这些 devDependencies
与我的 package.json
中的类型脚本有关
"devDependencies": {
...
"tslint": "^5.11.0",
"typescript": "^2.9.1"
...
},
正如它所说,tslint 弃用了该规则(更多信息在这里 https://github.com/palantir/tslint/pull/3919)
检查您的 tslint.json
,然后删除规则,警告应该会消失。
不仅支持 no-unused-variable
规则,而且支持整个 TSLint has been deprecated in favor of typescript-eslint.
考虑 migration 新的 linter。
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
从您的 or 依赖项中删除已弃用的 no-unused-variable
tslint.json
文件。
在您的文件中指定以下编译器选项
tsconfig.json
文件.
"compilerOptions": {
"noUnusedLocals": true, /* Report errors on unused locals. */
"noUnusedParameters": true /* Report errors on unused parameters. */
}
今天我在3个月后刷新的项目中看到这个警告。
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
但是我的tsconfig.json
好像没有用这个
{
"compilerOptions": {
"lib": ["es6"],
"module": "commonjs",
"noImplicitReturns": true,
"outDir": "lib",
"sourceMap": true,
"target": "es6",
"allowJs" : true
},
"compileOnSave": true,
"include": [
"src"
]
}
可能它是任何先前配置中隐含的配置。
你能告诉我如何解决它吗?
如果有用
$ node -v
v10.3.0
$ npm -v
6.1.0
这些 devDependencies
与我的 package.json
"devDependencies": {
...
"tslint": "^5.11.0",
"typescript": "^2.9.1"
...
},
正如它所说,tslint 弃用了该规则(更多信息在这里 https://github.com/palantir/tslint/pull/3919)
检查您的 tslint.json
,然后删除规则,警告应该会消失。
不仅支持 no-unused-variable
规则,而且支持整个 TSLint has been deprecated in favor of typescript-eslint.
考虑 migration 新的 linter。
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
从您的 or 依赖项中删除已弃用的
no-unused-variable
tslint.json 文件。在您的文件中指定以下编译器选项 tsconfig.json 文件.
"compilerOptions": {
"noUnusedLocals": true, /* Report errors on unused locals. */
"noUnusedParameters": true /* Report errors on unused parameters. */
}