https://github.com/James2516/eslint-airbnb
The repo is created with create-react-app + npm run eject.
Running npm i && npm start gives an error:
./src/index.js
Module build failed: Error: /Users/a/Desktop/eslint-not-working/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: /Users/a/Desktop/eslint-not-working/node_modules/eslint-config-airbnb/index.js
Referenced from: /Users/a/Desktop/eslint-not-working/.eslintrc
at Array.forEach (<anonymous>)
at Array.reduceRight (<anonymous>)
at Array.reduceRight (<anonymous>)
This only happens with v16.0.0.
Run npm ls - does it exit nonzero? If so, the dep graph is invalid, and nothing can be expected to work.
If this is the case, then it's a bug in CRA (probably not handling peer deps properly), and it'd be great to file it there.
What did it turn out to be?
https://github.com/James2516/eslint-airbnb/blob/master/package.json#L23-L63
I had 2 different versions installed and it seems like either CRA/airbnb is using the wrong version of its dependencies.
indeed, eslint-config-airbnb v16 requires v6 of eslint-plugin-jsx-a11y (also, all eslint things should be devDeps, not runtime deps).
CRA put it in runtime deps. See https://github.com/facebookincubator/create-react-app/issues/3209
Same issue here.
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-jsx-a11y": "6.0.2",
Found the issue. After ejecting CRA, there is a dep on eslint-config-react-app which depends on an earlier version of eslint-plugin-jsx-a11y. After removing eslint-config-react-app, and moving all eslint deps to dev-deps, everything started working as expected.
After moving dev-dependencies run this command.
(
export PKG=eslint-config-airbnb;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)
remove eslint-config-react-app
install npm i --save-dev eslint eslint-loader eslint-plugin-flowtype eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y
Doesn't work for me too
Me too.
Most helpful comment
Same issue here.
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-jsx-a11y": "6.0.2",