ESLint 选项 - overrideConfig 未加载

Sla*_*hew 7 node.js eslint visual-studio-code vscode-extensions

我安装了 ESLint 并在 setting.json 中设置了这些设置,但 EsLint 无法在 VS Code 全局正常启动。

Invalid Options: - Unknown options: envs, globals, parserOptions, rules
 - 'envs' has been removed. Please use the 'overrideConfig.env' option instead.
 - 'globals' has been removed. Please use the 'overrideConfig.globals' option instead.
 - 'parserOptions' has been removed. Please use the 'overrideConfig.parserOptions' option instead. 
 - 'rules' has been removed. Please use the 'overrideConfig.rules' option instead.
Run Code Online (Sandbox Code Playgroud)

这些是我的设置:

"eslint.options": {
        "envs": [
            "es6",
            "browser",
            "node",
            "mocha"
        ],
        "globals": [
            "expect"
        ],
        "parserOptions": {
            "ecmaVersion": 2019,
            "sourceType": "module",
            "ecmaFeatures": {
                "jsx": true
            }
        },
        "rules": {
            "semi": "error",
            "curly": "error",
            "quotes": [
                "warn",
                "single"
            ],
            "no-undef": "error"
        }
    },
Run Code Online (Sandbox Code Playgroud)

小智 1

如果您仍在寻找答案,我也遇到了同样的问题..您需要将 eslint 选项包装到一个overrideConfig对象中。overrideConfig.(...)在这种情况下,将正确提供错误消息中的目标对象。类似的问题在这里