导入的ESLint规则错误 [英] ESLint rule error for import
本文介绍了导入的ESLint规则错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到eslint出现以下错误.
I am getting the below error by eslint.
我也在.eslintrc
文件中添加了ecmaFeatures: { "modules": true }
.
I have added ecmaFeatures: { "modules": true }
in the .eslintrc
file as well.
推荐答案
由于您收到该消息,因此您似乎已升级到ESLint 2.0,这太好了!我可以看到您将对配置进行两项更改,尽管如果有其他任何更改,它可能已包含在
Because you're getting that message, it looks like you've upgraded to ESLint 2.0, which is great! I can see two changes that you'll make to your configuration, though if anything else comes up, it's probably covered under the 2.0 migration guide:
- 在2.0中,
"ecmaFeatures": { "modules": true }
已变为"parserOptions": { "sourceType": "module" }
. - 我们将空格-关键字替换为新规则关键字间距,它是在2.0测试版之一中引入的.如果您使用的是
"space-after-keywords: 2
,则可以立即将其更改为"keyword-spacing": 2
.
- In 2.0,
"ecmaFeatures": { "modules": true }
has become"parserOptions": { "sourceType": "module" }
. - We replaced space-after-keywords with a new rule, keyword-spacing, which was introduced in one of the 2.0 betas. If you were using
"space-after-keywords: 2
, you can change that to"keyword-spacing": 2
now.
总而言之,您的ESLint 2.0的.eslintrc
应该包括以下内容:
Putting that all together, your .eslintrc
for ESLint 2.0 should include something like this:
{
"parserOptions": {
"sourceType": "module"
},
"env": {
"es6": true
},
"rules": {
"keyword-spacing": 2
}
}
这篇关于导入的ESLint规则错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文