3
votes

I am trying to get ESLint work in WebStorm IDE. I am furnishing my config file and the error.

Error

Error: /usr/local/lib/node_modules/eslint-config-airbnb/rules/react.js: Configuration for rule "react/jsx-boolean-value" is invalid: Value "never,[object Object]" should NOT have more than 1 items. Referenced from: /usr/local/lib/node_modules/eslint-config-airbnb/index.js Referenced from: /Users/xxx/WebstormProjects/xx-xx-ui/xx/code/.eslintrc.js at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:113:15)

.eslintrc.js

module.exports = {
    "extends": "airbnb",
    "rules": {
      "import/extensions": 1,
      "import/first": 1,
      "import/prefer-default-export": 1,
      "max-len": 1,
      "no-case-declarations": 1,
      "no-console": 1,
      "no-empty": 0,
      "no-fallthrough": 1,
      "no-mixed-spaces-and-tabs": 1,
      "no-param-reassign": 0,
      "no-tabs": 1,
      "no-undef": 0,
      "no-unused-vars": 1,
      "one-var": 1,
      "prefer-const": 1,
    }
};

package.json

These are dev dependencies

    "eslint-config-airbnb": "^15.1.0",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-jsx-a11y": "^5.1.1",
    "eslint-plugin-react": "^7.4.0",
2
override that rule in you eslintrc fileDane
@Dane Which rule are you talking about..alowsarwar
add "react/jsx-boolean-value": "never" to your eslintrc.. looks like there's some error in the airbnb file, so you better override itDane
npm install eslint-plugin-import --save-dev ?zloctb

2 Answers

1
votes

I've managed to solve it by

npm uninstall eslint-config-airbnb
npm i --save-dev eslint-config-airbnb
npm i --save-dev eslint
npm i --save-dev babel-eslint
npm i --save-dev eslint-plugin-jsx-a11y
npm i --save-dev eslint-plugin-react

I ended up with those packages

    "eslint": "^4.15.0",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-plugin-import": "^2.8.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.5.1"

The main idea behind fix is to let eslint-config-airbnb install peer dependencies, after doing so I have no errors after lint and no warnings inside IDE(Webstorm2017.3.3)

0
votes

Here is the working set of dependencies:

  "dependencies": {
    "eslint": "^4",
    "eslint-config-airbnb": "^16",
    "eslint-plugin-import": "^2",
    "eslint-plugin-jsx-a11y": "^6",
    "eslint-plugin-react": "^7",
    "babel-eslint": "^8",
    "eslint-plugin-compat": "^2"
  }

Check this npm package:

https://www.npmjs.com/package/eslint-config-airbnb-bundle

There you'll find instructions for WebStrom IDE.