首页 > 解决方案 > ESLint 选项 - overrideConfig 未加载

问题描述

我安装了 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.

这些是我的设置:

"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"
        }
    },

标签: node.jseslintvscode-settingsvscode-extensions

解决方案


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


推荐阅读