不确定这里发生了什么。
我正在努力从 tslint 迁移到 eslint。基本迁移似乎进行得很顺利(好吧,“顺利”——显然需要制定一些规则),但我遇到了这个问题,我不知道如何克服它:< /p> <块引用>
1:1 错误定义“@typescript-eslint/no-shadow”规则不是 找到@typescript-eslint/no-shadow
我已经像这样修改了 .eslintrc.js 文件(为了简洁起见,部分被剪掉了):
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": [
"eslint-plugin-import",
"@angular-eslint/eslint-plugin",
"@typescript-eslint",
"@typescript-eslint/tslint"
],
"rules": {
// Many unrelated plugins, all rules, none mentioning no-shadow
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error", { "hoist": "all" }],
// Many other unrelated plugins, all rules, none mentioning no-shadow. But I thought
// This next one may be helpful.
"@typescript-eslint/tslint/config": [
"error",
{
"rules": {
"import-spacing": true,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
}
}
]
}
};
我正在使用的插件版本是(从 package.json 复制的):
"eslint-plugin-import": "^2.19.1",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
我不知道发生了什么,除了“使用 "no-shadow": "off"
”之外,我的谷歌搜索一无所获。
答案 0 :(得分:2)
typescript-eslint 软件包的 v2.34.0 已9 个月。
升级到更新版本的 typescript-eslint。
@typescript-eslint/no-shadow
已在 v4.0.0 中添加