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 is not running, error: "Cannot find module" #3998

Closed
jpaulomotta opened this issue Feb 8, 2018 · 4 comments
Closed

ESLint is not running, error: "Cannot find module" #3998

jpaulomotta opened this issue Feb 8, 2018 · 4 comments

Comments

@jpaulomotta
Copy link

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes.

yarn --version 1.3.2

Which terms did you search for in User Guide?

Displaying Lint Output in the Editor

Environment

  1. node -v: v8.9.4
  2. npm -v: 5.6.0
  3. yarn --version :1.32
  4. npm ls react-scripts (if you haven’t ejected):
    eslint-test@0.1.0 /Users/Joao/code/node/eslint-test
    └── react-scripts@1.1.0
  5. yarn eslint --version: v4.17.0

Node LTS, latest version of yarn

Then, specify:

  1. Operating system: MacOS High Sierra 10.13.2
  2. Browser and version (if relevant):

Steps to Reproduce

  1. Run in terminal
create-react-app eslint-test
cd eslint-test/
yarn add eslint -D
  1. Create file .eslintrc in project root
  2. Add this content to the .eslintrc file:
{
  "extends": "react-app"
}
  1. Run yarn
  2. Run yarn eslint src/App.js --debug

Expected Behavior

I though ESLINT would parse the file App.js
ESLint was supposed to work because I have followed the instructions on the documentation at "Displaying Lint Output in the Editor"

Actual Behavior

I'm getting the error Cannot find module 'eslint-config-react-app'

The output of yarn eslint src/App.js --debug:

screen shot 2018-02-08 at 4 41 53 pm

The command npm ls eslint-config-react-app prints:

eslint-test@0.1.0 /Users/Joao/code/node/eslint-test
└─┬ react-scripts@1.1.0
  └── eslint-config-react-app@2.1.0 

This issue was fixed running the command: yarn add -D eslint-config-react-app babel-eslint@^7.2.3 eslint@^4.1.1 eslint-plugin-flowtype@^2.34.1 eslint-plugin-import@^2.6.0 eslint-plugin-jsx-a11y@^5.1.1 eslint-plugin-react@^7.1.0

This issue took quite a while to be resolved.
Should this command be documented at "Displaying Lint Output in the Editor" or "Troubeshoot"? Others could be facing the same problem.

Reproducible Demo

Run the commands on Steps to reproduce.

@gaearon
Copy link
Contributor

gaearon commented Feb 9, 2018

Yeah I think our docs currently assume the dependency is being hoisted but Yarn probably doesn’t do this.

@gaearon
Copy link
Contributor

gaearon commented Feb 9, 2018

Maybe we could re-export the config as react-scripts/eslint so we don’t need to rely on hoisting.

@jpaulomotta
Copy link
Author

How could I help with this?

I read the source code of eslint-config-react-app but I don't know how this re-export could be made.

@stale
Copy link

stale bot commented Nov 2, 2018

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs.

@stale stale bot added the stale label Nov 2, 2018
@Timer Timer closed this as completed Nov 2, 2018
@lock lock bot locked and limited conversation to collaborators Jan 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants