Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.eslintrc throws errors when extending airbnb config

I have the following .eslintrc and whenever I lint my project with the aribnb and/or airplus extensions, I get the following error:

// .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"
  ]
}

... and the error:

> 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
    ...
like image 393
Detuned Avatar asked Feb 06 '23 16:02

Detuned


2 Answers

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

Add "extends": "airbnb-base" to .eslintrc file. Finally, SUCCESS eslint-config-airbnb-base and its peerDeps were installed successfully.

Issue Snap Shot Here

like image 103
Mahesh Joshi Avatar answered Feb 16 '23 04:02

Mahesh Joshi


In my case, there was an .eslintrc.js config file on the parent directory so IntelijIdea was using that one. I removed it and the problem was solved.

like image 35
SayJeyHi Avatar answered Feb 16 '23 04:02

SayJeyHi