This is the error I get when using const:
I got this same warning when using an export statement. I'm using VS Code and used a similar approach to Wenlong Jiang's solution.
User Settings
JSHint config
"jshint.config": {}
(Edit)
Use double quotes when specifying "esversion"
Or copy this snippet into User Settings:
"jshint.options": {
"esversion": 6,
}
Creating a .jshintrc
file isn't necessary if you want to configure the global jshint settings for your editor
If you're using VSCode:
1.
cmd + ,
)jshint.options
into the search bar"esversion": 6
to the options object.2.
Or simply add this to your user settings:
"jshint.options": {
"esversion": 6
}
[UPDATE] new vscode settings
cmd + ,
)jshint
into search2.
For SublimeText 3 on Mac:
# .jshintrc
{
"esversion": 6
}
// SublimeLinter Settings - User
{
"linters": {
"jshint": {
"args": ["--config", "/Users/[your_username]/.jshintrc"]
}
}
}
When you start using ECMAScript 6 this error thrown by your IDE.
There are two options available:
if you have only one file and want to use the es6 then simply add below line at the top of the file.
/*jshint esversion: 6 */
Or if you have number of js file or you are using any framework(like nodejs express)you can create a new file named .jshintrc
in your root directory and add code below in the file:
{
"esversion": 6
}
If you want to use the es6 version onward for each project you can configure your IDE.
If you are using Grunt configuration, You need to do the following steps
Warning message in Jshint:
Solution:
{ "esversion": 6 }
After configured this, Run again It will skip the warning,
Create .jshintrc
file in the root dir and add there the latest js version: "esversion": 9
and asi version: "asi": true
(it will help you to avoid using semicolons)
{
"esversion": 9,
"asi": true
}