简体   繁体   English

vscode无法获取.eslintrc设置

[英]vscode not picking up .eslintrc settings

VSCode shows unnecessary escape character error - no-useless-escape setting. VSCode显示unnecessary escape character error - no-useless-escape设置。

But the .eslintrc has the following settings and does not contain the no-useless-escape settings: 但是.eslintrc具有以下设置,并且不包含no-useless-escape设置:

{
    "root": true,
    "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "script"
    },
    "env": {
        "node": true,
        "browser": false
    },
    "extends": "eslint:recommended",
    "rules": {
        "semi": ["error", "always"],
        "indent": ["error", 4, {
            "VariableDeclarator": 1,
            "SwitchCase": 1,
            "MemberExpression": 1,
            "ArrayExpression": "first"
        }],
        "no-mixed-requires": "off",
        "no-restricted-imports": "off",
        "no-undef":"off",
        "no-console":"off",
        "no-trailing-spaces": "error",
        "no-unused-vars": "warn",
        "no-empty": ["error", {"allowEmptyCatch": true}]
    }
}

My workspace setting refer to the .eslintrc file correctly: 我的工作空间设置正确地引用了.eslintrc文件:

"eslint.options": {"configFile": ".eslintrc"}

What is wrong here? 怎么了 Are there some global configurations that need to be overridden? 是否存在一些需要覆盖的全局配置?

Saugat Acharya already mentioned the cause for the problem in the comments. Saugat Acharya在评论中已经提到了问题的原因。
To fix it you just turn that rule explicitly off by adding the following rule to your eslint.rc file: 要解决此问题,只需将以下规则添加到eslint.rc文件中,即可明确关闭该规则:

{
    "rules": {
        "no-useless-escape": "off" 
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM