Javascript: eslint-config-airbnb v16.0.0 doesn't work with CRA after eject

Created on 12 Oct 2017  路  11Comments  路  Source: airbnb/javascript

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.

Most helpful comment

Same issue here.

"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-jsx-a11y": "6.0.2",

All 11 comments

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).

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

graingert picture graingert  路  3Comments

felixsanz picture felixsanz  路  3Comments

weihongyu12 picture weihongyu12  路  3Comments

danielfttorres picture danielfttorres  路  3Comments

surfaceowl picture surfaceowl  路  3Comments