Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 625
Ron I Avatar asked May 16 '16 05:05

Ron I


3 Answers

The filename should be .jshintrc, and the content is

{
  "esversion": 6
}
like image 55
Micheal Vu Avatar answered Nov 13 '22 13:11

Micheal Vu


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

/*jshint esversion: 6 */ 
like image 75
Noam Manos Avatar answered Nov 13 '22 15:11

Noam Manos


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 */
like image 11
Tony Avatar answered Nov 13 '22 15:11

Tony