-3

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.

srWebDev
  • 374
  • 1
  • 7
  • 17

1 Answers1

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!

Orden
  • 589
  • 3
  • 13
  • Thank you! I've never used a .json file before. I'm rather new to javascript. Is it possible to link this code as default into Brackets so that it will apply to all my future projects or will I have to link it each time? If you are able to point me in the right direction as to where I can learn how to link a .json file to my .js file I would be eternally grateful. Cheers – srWebDev Jul 27 '18 at 09:09