-1

When I write:

let name = "Henry"; 

The following warning message appear:

'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

I don't have any idea what to do for correct that warning. The answers I found are create a file named .jshintrc and then add this:

{
    "esversion": 6
}

The thing is, It just work for the current project I'm programming, If a create a new one, I have to do again the same file. There is another way to do it that apply all the new projects?

Joan-GS
  • 15
  • 1
  • 6
  • you could `use 'esversion: 6'` – Jaromanda X May 12 '20 at 23:59
  • 2
    Does this answer your question? [Why does JSHint throw a warning if I am using const?](https://stackoverflow.com/questions/27441803/why-does-jshint-throw-a-warning-if-i-am-using-const) – ASDFGerte May 13 '20 at 00:00

2 Answers2

0

You need to add a tag to let JSHint know you want to you ES6.

/* jshint esversion: 6 */
let name = "Henry";
jasonandmonte
  • 1,869
  • 2
  • 15
  • 24
0

You need to enable es6 in your jshint options with the esversion option. If you do not have a .jshintrc file at top level, create one and add this

{ "esversion": 6 }

Optionally, you can add this to the file, but it could get rather annoying if you have to add this to every file

/* jshint esversion: 6 */

https://jshint.com/docs/options/#esversion

gramlichm
  • 16
  • 1