Create-react-app: Latest rule change breaks with crash and no alternative

Created on 25 May 2017  Â·  7Comments  Â·  Source: facebook/create-react-app

This commit breaks with eslint 3.19.0:
https://github.com/facebookincubator/create-react-app/commit/42efedbeb24c5370ea52340f7c62300d52dbc23b

Module build failed: Error: node_modules/eslint-config-react-app/index.js:
    Configuration for rule "no-use-before-define" is invalid:
    Value "[object Object]" no (or more than one) schemas match.

Referenced from:
    at Array.forEach (native)
    at Array.reduceRight (native)

Description

Running npm run build

"build": "cross-env BABEL_ENV=production react-scripts build",

Actual behavior

Crash with mentioned error.

Environment

Run these commands in the project folder and fill in their results:

[email protected]
v6.6.0
4.2.0

Most helpful comment

This problem appears when using yarn. Does not happen with npm.

I'll share the link to the project repository. After I push it online.

All 7 comments

Temporary fix is to use this (edited: does not work):

  "eslint-config-react-app": "1.0.3",
  "react-scripts": "1.0.5",

I'm not sure why you have both ESLint preset and react-scripts in package.json. Can you share your complete package.json before you made any changes?

Also can you reproduce this on a newly created project? If not it sounds like something is wrong with your specific project and we'll need to take a look at it to figure it out.

This problem appears when using yarn. Does not happen with npm.

I'll share the link to the project repository. After I push it online.

Sorry, this seems to be related to an incompatibility with our current version of standard which also installs eslint. Yarn seems to guess the wrong minimal dependency to eslint and chooses the one from our version of standard: 3.10.2:

> npm ls eslint
[email protected] .../git/cerebral
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected] (git://github.com/gaspard/standard.git#65b7c10934a6ae79dac1f74b55bbea8194d67b5f)
  └── [email protected]

(PS: yes, we have a temporary fork of standard due to default ignores not allowing packages in node_modules type monorepo).

There was a bug in Yarn when it could symlink to node_modules/.bin/eslint from a deeper version of eslint instead of the one at the top.
This will be fixed in 0.25 and 0.26 https://github.com/yarnpkg/yarn/pull/3545.

But to be 100% sure which eslint you want to use in your app better add the correct one as the top level dependency in your package.json.

I started getting same error this morning, tried both yarn start and npm start, didn't worked. cleaned my node_modules and did npm install and it is working with both yarn and npm.

Yes, this is because it is a Yarn bug (so occurs with installations produced by yarn). Whether you use yarn start or npm start later doesn’t matter—they do exactly the same thing.

Was this page helpful?
0 / 5 - 0 ratings