1

According to JSHint documentation, esnext option will be deprecated soon:

esnext: Warning This option has been deprecated and will be removed in the next major release of JSHint. Use esversion: 6 instead.

However, IntelliJ doesn't seem to recognize the option 'esversion', showing ES6 syntax-related warnings when used (these do not show up when I use esnext:true instead).

Has anyone else encountered this issue?

AviJo
  • 11
  • 1
  • 3

3 Answers3

8

Go to Preference->Languages & Frameworks -> JavaScript -> Code Quality Tools -> JSHint -> Click on "Warn about incompatibilities with the specified ECMAScript Version". Click "SET, "Put "6" in the input.

screenshot

DaveyDaveDave
  • 9,821
  • 11
  • 64
  • 77
user3238692
  • 87
  • 1
  • 2
3

You can add comment in the JS file such as follows:

/*jshint esversion: 6 */

const Suites = {
    Spade: 1,
    Heart: 2,
    Diamond: 3,
    Club: 4
};

Or you can add a file named .jshintrc in your app's root with the following content to apply this setting for the whole solution:

{ "esversion": 6 }

More detail:Why does JSHint throw a warning if I am using const?

Community
  • 1
  • 1
Maze
  • 41
  • 5
0

I think that IntelliJ is using its own bundled jshint version, which could be a bit older than the latest. I wouldn't worry too much about this. Use the old option until IntelliJ catches up. If it doesn't cause any problems, add the 'esversion' flag too, in case you're using the same project outside IntelliJ (e.g. running jshint from the command line).

Nikolaos Georgiou
  • 2,792
  • 1
  • 26
  • 32
  • 1
    Have any of the answers in this topic been tested. I have the latest IntelliJ with JSHint 2.9.4 install (Which is currently the latest). The issue still occurs. – Gabriel Kohen Dec 27 '16 at 17:15