admin管理员组文章数量:1345897
I am using eslint-config-airbnb-base
npm package for eslint
...I just created .eslintrc.json
file and also setup eslint package in my IDE ..the problem is that I am getting warning for const
about ES6 can any one please provide me the details that how I can config ES6 for const
I am getting this warning "const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz). (W104)jshint(W104)"...
please Provide me details that how to config for this warning..thank you
.eslintrc.json file
{
"extends": "airbnb-base"
}
I am using eslint-config-airbnb-base
npm package for eslint
...I just created .eslintrc.json
file and also setup eslint package in my IDE ..the problem is that I am getting warning for const
about ES6 can any one please provide me the details that how I can config ES6 for const
I am getting this warning "const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz). (W104)jshint(W104)"...
please Provide me details that how to config for this warning..thank you
.eslintrc.json file
{
"extends": "airbnb-base"
}
Share
Improve this question
edited Oct 14, 2021 at 20:02
TylerH
21.1k78 gold badges79 silver badges114 bronze badges
asked Feb 12, 2019 at 9:57
Nisar SaiyedNisar Saiyed
7881 gold badge9 silver badges18 bronze badges
9
- airbnb-base already enables ES6. Make sure you have the latest version and make sure eslintrc you listed is in effect. – Estus Flask Commented Feb 12, 2019 at 10:14
- The latest airbnb-base version is 13. – Estus Flask Commented Feb 12, 2019 at 10:21
- 13.1.0 version for the same but ...issue is still persist – Nisar Saiyed Commented Feb 12, 2019 at 10:25
- Then the second part, make sure eslintrc you listed is in effect. It should be either one or another. Otherwise you wouldn't have this problem. – Estus Flask Commented Feb 12, 2019 at 10:26
- 1 No, you don't have to. I expect airbnb-base to work out of the box, and the answer already correctly explains how ES6 could be enabled alone, it should work as well. That neither of them don't work suggests that something is wrong on your side. It's impossible to say what exactly it is. There could be another eslintrc file elsewhere that overrides the file you listed. You can start with making syntax mistake in the file and checking if ESLint will plain. You didn't mention anything about IDE, it could be a problem that is specific to it and not ESLint in general. – Estus Flask Commented Feb 12, 2019 at 11:00
2 Answers
Reset to default 5eslint: Specifying Parser Options
you should add parserOptions
to your .eslintrc.json
file
{
"parserOptions": {
"ecmaVersion": 6
}
}
In addition to Zaan Chi's answer,
If you want to use ES6 only for a particular file, or dont want to change the eslint json, You can add this ment to the top of the file.
/* jshint esversion: 6 */
Note that if you are using ES6 for your entire project, it is better to add it to the JSON.
本文标签: javascript39const39 is available in ES6 (use 39esversion 639)Stack Overflow
版权声明:本文标题:javascript - 'const' is available in ES6 (use 'esversion: 6') - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743798458a2540868.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论