ecmascript-6 - 导入的 ESLint 规则错误

标签 ecmascript-6 atom-editor eslint

我通过 eslint 收到以下错误。

我还在 .eslintrc 文件中添加了 ecmaFeatures: { "modules": true }

enter image description here

最佳答案

因为您收到了这条消息,看起来您已经升级到 ESLint 2.0,这太棒了!我可以看到您将对配置进行的两项更改,但如果出现其他任何问题,它可能包含在 2.0 migration guide 中。 :

  1. 在 2.0 中,"ecmaFeatures": { "modules": true } 已变为 "parserOptions": { "sourceType": "module"}
  2. 我们替换了space-after-keywords使用新规则,keyword-spacing ,它是在 2.0 测试版之一中引入的。如果您使用的是 "space-after-keywords: 2,您现在可以将其更改为 "keyword-spacing": 2

综上所述,ESLint 2.0 的 .eslintrc 应该包括如下内容:

{
    "parserOptions": {
        "sourceType": "module"
    },
    "env": {
        "es6": true
    },
    "rules": {
        "keyword-spacing": 2
    }
}

关于ecmascript-6 - 导入的 ESLint 规则错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35834879/

相关文章:

javascript - TS错误: Cannot invoke an expression whose type lacks a call signature

JavaScript - 正确提取深层对象属性并构造新对象

javascript - JavaScript 匿名函数中的 this 值

javascript - Electron 应用程序 : How to 'lock' a computer?

regex - Atom 文本编辑器中的正则表达式,从字符串开头排除字符串 "abc"

git - 如何用企业级git配置GitHub的Atom Editor

javascript - 实例化每个键都等于 null 的对象的最佳方法?

vue.js - 如何修复 Vue 中的解析错误 : invalid-first-character-of-tag-name. eslint (vue/no-parsing-error)

react-native - ESLint:Require 语句不是导入语句的一部分。(@typescript-eslint/no-var-requires)

eslint - 为什么这会触发eslint中的逗号分隔规则?