简体   繁体   中英

vscode not picking up .eslintrc settings

VSCode shows unnecessary escape character error - no-useless-escape setting.

But the .eslintrc has the following settings and does not contain the no-useless-escape settings:

{
    "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:

"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.
To fix it you just turn that rule explicitly off by adding the following rule to your eslint.rc file:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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