Skip to content Skip to sidebar Skip to footer

How To Set The Jslint Es6 Directive In Brackets?

I get this error: 'expected an identifier and instead saw 'const'', I'm using brackets text editor. I found this answer: 'You need to specify the es6 directive. See JSLint Help'. B

Solution 1:

One File

If I remember right, you put the following at the very top of your file:

/*jslint es6:true*/

Project Wide

If you want all files in your project to abide ES6, you can add a .brackets.json file to the root of your project.

Brackets Wide

If you want all files to abide ES6, you can modify your User-global preferences by clicking the following menu items: Debug -> Open Preferences and then adding the jslint.options property to your preferences.

See How-to-Use-Brackets: Preferences for more information.


However, I just tried to do this with my Brackets installation with all extensions disabled and Brackets doesn't understand the directive. I think Brackets has a very old version of jslint installed by default. You may want to use some extensions to try to supplement the old version.

What I ended up doing was installing the brackets-jshint and changing my brackets preferences file to use jshint by default with the following option:

{
    "language": {
        "javascript": {
            "linting.prefer": [
                "JSHint"
            ],
            "linting.usePreferredOnly": true
        }
    }
}

Solution 2:

Try putting a comment at the top of the file like this, as documented in JSLint Help...

/*jslint
    es6
*/const singleQuotes = '<p>Single quotes</p>';
const doubleQuotes = "<p>Double quotes</p>";
const stringLiterals = `<p>String literlas</p>`;

const result = singleQuotes + doubleQuotes + stringLiterals;
document.querySelector('.basic').innerHTML = result;

Post a Comment for "How To Set The Jslint Es6 Directive In Brackets?"