Solved – JSHint Error (use ‘esversion: 6’) in VS Code

You have an ES6 project and use Visual Studio Code as code editor for this project, you may hit the following JSHint‘s errors while developing:

'export' is only available in ES6 (use 'esversion: 6')
'import' is only available in ES6 (use 'esversion: 6')
'class' is only available in ES6 (use 'esversion: 6')
'const' is only available in ES6 (use 'esversion: 6')
'let' is only available in ES6 (use 'esversion: 6')
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6')
'default parameters' is only available in ES6 (use 'esversion: 6')
'rest operator' is only available in ES6 (use 'esversion: 6')
'spread operator' is only available in ES6 (use 'esversion: 6')
'template literal syntax' is only available in ES6 (use 'esversion: 6')
etc.

To solve this you need to tell JSHint your project is developed in ES6 by creating the .jshintrc file to the root project directory with the below config:

.jshintrc
{
  "esversion": 6
}

Leave a Reply

avatar