ESLint showing errors in Brackets

ぃ、小莉子 提交于 2019-12-04 07:35:33

问题


My javascript code is working perfectly except ESLint is showing that I have errors, such as:

"ERROR: 'myFunction' is defined but never used. [no-unused-vars]"

and

"ERROR: 'document' is not defined. [no-undef]"

This is only a problem because I am using an external js file. What can I put into "brackets.json" or "defaultPreferences.json" to stop these ESLint error markers/notifications from appearing?

Any help is much appreciated.


回答1:


I had the same problem: create a package.json file a the root of your project and put you ESLint configuration in a eslintConfig object as defined in the ESLint documentation:

{
    "eslintConfig": {
        "globals": {
            "Vue": true
        },
        "env": {
            "browser": true,
            "es6": true,
            "jquery": true
        },
        "extends": [
            "eslint:recommended"
        ],
        "parserOptions": {
            "sourceType": "module"
        },
        "rules": {
            "no-console": 0,
            "indent": [
                "error",
                4
            ],
            "linebreak-style": [
                "error",
                "unix"
            ],
            "quotes": [
                "error",
                "double"
            ]
        }
    }
}

Good coding!



来源:https://stackoverflow.com/questions/51067263/eslint-showing-errors-in-brackets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!