Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint-config-airbnb v16.0.0 doesn't work with CRA after eject #1586

Closed
James2516 opened this issue Oct 12, 2017 · 11 comments
Closed

eslint-config-airbnb v16.0.0 doesn't work with CRA after eject #1586

James2516 opened this issue Oct 12, 2017 · 11 comments

Comments

@James2516
Copy link

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.

@ljharb
Copy link
Collaborator

ljharb commented Oct 12, 2017

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.

@airbnb airbnb deleted a comment from Kandychen88 Oct 12, 2017
@airbnb airbnb deleted a comment from Kandychen88 Oct 12, 2017
@ljharb
Copy link
Collaborator

ljharb commented Oct 13, 2017

What did it turn out to be?

@James2516
Copy link
Author

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.

@ljharb
Copy link
Collaborator

ljharb commented Oct 14, 2017

indeed, eslint-config-airbnb v16 requires v6 of eslint-plugin-jsx-a11y (also, all eslint things should be devDeps, not runtime deps).

@James2516
Copy link
Author

CRA put it in runtime deps. See facebook/create-react-app#3209

@yummyelin
Copy link

Same issue here.

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

@heyitshannes
Copy link

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.

@vickvasquez
Copy link

vickvasquez commented Oct 26, 2017

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

@coderbit-net
Copy link

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

@lionel95200x
Copy link

Doesn't work for me too

@hiyangguo
Copy link

Me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants