suwu150 2017-11-21 02:28 采纳率: 20%
浏览 2951
已采纳

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 博客专家认证 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"
    }
    

    规则的位置写错了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题