node.js - .eslintrc 扩展爱彼迎配置时抛出错误

标签 node.js eslint lint eslint-config-airbnb

我有以下 .eslintrc ,每当我使用 aribnb 和/或 airplus 扩展检查我的项目时,我都会收到以下错误:

// .eslintrc
{
  "parser": "babel-eslint",
  "rules": {
    "id-length": 0,
    "indent": [
      2,
      2,
      {
        "SwitchCase": 1
      }
    ],
    "quotes": [
      2,
      "single"
    ],
    "linebreak-style": [
      2,
      "unix"
    ],
    "semi": [
      2,
      "always"
    ],
    "no-duplicate-case": 1,
    "no-else-return": 0,
    "react/sort-comp": [
      1,
      {}
    ],
    "no-undef": 1,
    "no-unused-vars": [
      1,
      {
        "args": "none",
        "argsIgnorePattern": "store|action|next"
      }
    ],
    "object-curly-spacing": [
      1,
      "always"
    ],
    "react/no-did-mount-set-state": [
      1
    ]
  },
  "env": {
    "es6": true,
    "node": true,
    "browser": true
  },
  "globals": {
    "_": true,
    "__ENV__": true
  },
  "extends": [
    "airbnb",
    "airplus"
  ],
  "ecmaFeatures": {
    "jsx": true,
    "experimentalObjectRestSpread": true
  },
  "plugins": [
    "react"
  ]
}

...以及错误:

> esw webpack src tools

.../node_modules/eslint-config-airbnb/rules/react.js:
    Configuration for rule "react/display-name" is invalid:
    Value "data["0"].acceptTranspilerName" has additional properties.

Referenced from: airbnb
Referenced from: airplus
Referenced from: /.../.eslintrc
Error: /.../node_modules/eslint-config-airbnb/rules/react.js:
    Configuration for rule "react/display-name" is invalid:
    Value "data["0"].acceptTranspilerName" has additional properties.

Referenced from: airbnb
Referenced from: airplus
Referenced from: .../.eslintrc
    at validateRuleOptions (.../node_modules/eslint/lib/config/config-validator.js:116:15)
    at .../node_modules/eslint/lib/config/config-validator.js:163:13
    ...

最佳答案

npm install
npm info "eslint-config-airbnb-base@latest" peerDependencies
npm install -g install-peerdeps
install-peerdeps --dev eslint-config-airbnb-base

将 "extends": "airbnb-base"添加到 .eslintrc 文件。 最后,SUCCESS eslint-config-airbnb-base及其peerDeps安装成功。

Issue Snap Shot Here

关于node.js - .eslintrc 扩展爱彼迎配置时抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38087660/

相关文章:

performance - 有什么加速静态分析工具 PC-Lint 的技巧吗?有使用 .LOB 文件的经验吗?

javascript - 无法加载配置 "react"以从

javascript - Javascript 和 ESLint 中的全局变量

android - AndroidX 迁移后命令行 lint 错误

javascript - Canvas 无法正确保存为图像,只是空白的透明图像

reactjs - 导入路径不能以 '.tsx' 扩展名结尾

angular - 在 Angular html 模板中整理属性顺序

mysql - 在nodejs和mysql中发送后无法设置 header

node.js - Excel 的 csv 文件中的重音字符串无法正确显示

node.js - 使用 Node.js 构建 PCI 兼容的应用程序