suwu150
suwu150
采纳率44.3%
2017-11-21 02:28 阅读 2.2k
已采纳

Unexpected top-level property "comma-dangle".怎么解决

我在配置eslint的时候出现了如下错误:

 ERROR in ./src/index.js
Module build failed: Error: ESLint configuration in /home/suwu150/WebStormProject/electron-desktop-tools/.eslintrc is invalid:
        - Unexpected top-level property "comma-dangle".

    at validateConfigSchema (/home/suwu150/WebStormProject/electron-desktop-tools/node_modules/eslint/lib/config/config-validator.js:214:15)
    at Object.validate (/home/suwu150/WebStormProject/electron-desktop-tools/node_modules/eslint/lib/config/config-validator.js:231:5)

.eslintrc文件

{
  "parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true,
      "experimentalObjectRestSpread": true
    }
  },
  "rules": {
    "semi": 2
  },
  "comma-dangle": [1,"always-multiline"],
  "plugins": ["react"],
  "extends": "airbnb"
}
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    suwu150 suwu150 2017-11-21 03:36
    {
      "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "module",
        "ecmaFeatures": {
          "jsx": true,
          "experimentalObjectRestSpread": true
        }
      },
      "rules": {
        "semi": 2,
        "comma-dangle": ["off"],
        "import/no-named-as-default": 0
      },
      "plugins": ["react"],
      "extends": "airbnb"
    }
    

    规则的位置写错了

    点赞 评论 复制链接分享

相关推荐