eslint "Definition for rule 'no-explicit-any' was not found" 始终显示

eslint "Definition for rule 'no-explicit-any' was not found" always shown

使用 react-scripts 启动了一个 react/typescript 项目,添加了一个包含以下内容的 .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"
    }
}

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

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

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

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

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

您通过 "@typescript-eslint/no-explicit-any": "error",

启用了规则