找不到规则“@typescript-eslint/no-shadow”的定义

Ari*_*oth 5 typescript-eslint

不知道这里发生了什么。

我正在努力从 tslint 迁移到 eslint。基本的迁移似乎进行得很顺利(嗯,“顺利”——显然需要制定一些规则),但我遇到过这个,我不知道如何克服它:

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"
                    ]
                }
            }
        ]
    }
};
Run Code Online (Sandbox Code Playgroud)

我正在使用的插件的版本是(从 package.json 复制):

"eslint-plugin-import": "^2.19.1",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
Run Code Online (Sandbox Code Playgroud)

我不知道发生了什么,我的谷歌搜索除了“use”之外什么也没有出现"no-shadow": "off",我就是这么做的。

Bra*_*her 6

typescript-eslint 软件包的 v2.34.0 已经存在9 个月了。

升级到最新版本的 typescript-eslint。

@typescript-eslint/no-shadow在 v4.0.0 中添加