ES6 in JShint - .jshintrc has esversion, but still getting warning (using atom)

JavascriptEcmascript 6JshintAtom Editor

Javascript Problem Overview


I am using atom, and I've tried several different jshint packages and they all give a warning which says

"template literal syntax' is only available in ES6 (use 'esversion: 6')"

I created a top level .jshintrc file (at root), and added the following json:

{
  "esversion":6
}

However, it is still throwing the same error. Any ideas how to resolve. I've included the link to the JSHint options page. I'd like to start playing around with ES6 syntax, but would prefer not to have extra warnings.

Thanks SO community!

Javascript Solutions


Solution 1 - Javascript

The filename should be .jshintrc, and the content is

{
  "esversion": 6
}

Solution 2 - Javascript

Instead of creating .jshintrc file, you can simply add at the top of your js file:

/*jshint esversion: 6 */ 

Solution 3 - Javascript

We have two choices.

##1. Using .jshintrc file.
Create .jshintrc file in root directory and type as below. It applies to all codes

{
    "esversion": 6
}

> If you're still getting warning, close and re-open your editor.


##2. Using hint. Type as below at the top of the your code. It applies to just the code.

/* jshint esversion: 6 */

Solution 4 - Javascript

Remember to close then reopen your JS file / text editor.

Solution 5 - Javascript

Has to be the first entry of the jshintrc file. Doesn't make much sense but that's what fixed it for me.

{
"esversion": 6,
"browser": true,
    ...
    ...
    ...
"globals": {... }
}

Solution 6 - Javascript

Using the atom packages linter and linter-jshint, I got it to work by uninstalling and then reinstalling the packages and then restarting atom. I did download ESLint and installed it per people's suggestions, looking forward to testing it out.

Solution 7 - Javascript

Create a file .jshintrc with content

{
    "esversion": 6
}

Put this file to your project root directory. Reopen your js file (no need restart atom). It will work for your current project.

Put this file to your home directory (eg: C, D, E, Desktop, Lirary,...). Reopen your js.file (no need restart atom). It will work for all project inside home directory

Solution 8 - Javascript

The config file in which you have enabled es6 should be enabled through your IDE; eg:for Intellij there's a clear option for adding config files.JSHint for Intellij

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRon IView Question on Stackoverflow
Solution 1 - JavascriptMicheal VuView Answer on Stackoverflow
Solution 2 - JavascriptNoam ManosView Answer on Stackoverflow
Solution 3 - JavascriptTonyView Answer on Stackoverflow
Solution 4 - Javascriptlvnam96View Answer on Stackoverflow
Solution 5 - JavascriptTimar Ivo BatisView Answer on Stackoverflow
Solution 6 - JavascriptRon IView Answer on Stackoverflow
Solution 7 - JavascriptLinhView Answer on Stackoverflow
Solution 8 - JavascriptRegeView Answer on Stackoverflow