eslint“未找到规则‘no-explicit-any’的定义”始终显示

A-S*_*A-S 2 typescript eslint

使用启动了一个react/typescript项目react-scripts,添加了一个.eslintrc.json包含以下内容的文件:

{
    "env": {
        "browser": true,
        "es2021": true
    },
    "extends": [
        "eslint:recommended",
        "plugin:react/recommended",
        "plugin:@typescript-eslint/recommended",
        "react-app",
        "react-app/jest"
    ],
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "ecmaVersion": 12,
        "sourceType": "module"
    },
    "plugins": [
        "react",
        "@typescript-eslint"
    ],
    "rules": {
        "import/no-anonymous-default-export": "off",
        "no-explicit-any": "error",
        "@typescript-eslint/no-extra-semi": "off",
        "@typescript-eslint/no-explicit-any": "error",
        "@typescript-eslint/no-unused-vars": "off",
        "@typescript-eslint/explicit-module-boundary-types": "error",
        "@typescript-eslint/no-non-null-assertion": "off",
        "@typescript-eslint/no-inferrable-types": "off",
        "@typescript-eslint/no-empty-interface": "off"
    }
}
Run Code Online (Sandbox Code Playgroud)

现在,由于某种我不知道的原因,每个文件都以 warning/error: 开头Line 1:1: Definition for rule 'no-explicit-any' was not found no-explicit-any,即使文件甚至没有类型any,即使文件是空的!

这是一条重要的规则,我不想忽视它。

这是一个错误吗?难道我做错了什么?

出现此错误的几乎为空的文件示例: 空文件示例

Ale*_*min 6

尝试删除,"no-explicit-any": "error"因为这不是有效的 eslint 规则,并且这是引发错误的地方。

您已通过启用该规则"@typescript-eslint/no-explicit-any": "error",