create-react-app-typescript icon indicating copy to clipboard operation
create-react-app-typescript copied to clipboard

(After ejecting) Error while running ESLint: Cannot find module 'eslint-config-react-app'

Open aurerua opened this issue 6 years ago • 3 comments

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

--

Which terms did you search for in User Guide?

eject, eslint

Environment

  1. npm ls react-scripts-ts (if you haven’t ejected):
  2. node -v: v8.9.4
  3. npm -v: 6.0.0
  4. yarn --version (if you use Yarn): 1.7.0
  5. npm ls react-scripts-ts (if you haven’t ejected):

Then, specify:

  1. Operating system: linux (Pop!_OS)
  2. Browser and version (if relevant):

Steps to Reproduce

npx create-react-app my-app --scripts-version=react-scripts-ts
cd my-app
npm run eject
  1. Open a JS file, e.g. ./scripts/start.js
  2. I am using Atom editor with linter-eslint, so it picks up the eslintConfig from ./package.json and it throws the Error: Error while running ESLint: Cannot find module 'eslint-config-react-app'

Expected Behavior

No ESLint Error on opening a JS file.

Which would probably be solved by either have no eslintConfig in ./package.json or have the stated react-app dependency installed.

Actual Behavior

After ejecting, if one then scrolls down to the bottom of ./package.json, it shows:

{
  "eslintConfig": {
    "extends": "react-app"
  }
}

Yet the dependency is missing:

npm ls eslint-config-react-app
[email protected] /home/aurelien/tmp/my-app
└── (empty)

Reproducible Demo

--

aurerua avatar Jun 11 '18 11:06 aurerua

Thanks for this report. Definitely looks like an issue.

We need to stop the config from being added to package.json on ejecting. On 11 Jun 2018, 12:56 +0100, Aurelien Giraud [email protected], wrote:

Is this a bug report? Yes Can you also reproduce the problem with npm 4.x?

Which terms did you search for in User Guide? eject, eslint Environment

  1. npm ls react-scripts-ts (if you haven’t ejected):
  2. node -v: v8.9.4
  3. npm -v: 6.0.0
  4. yarn --version (if you use Yarn): 1.7.0
  5. npm ls react-scripts-ts (if you haven’t ejected):

Then, specify:

  1. Operating system: linux (Pop!_OS)
  2. Browser and version (if relevant):

Steps to Reproduce

npx create-react-app my-app --scripts-version=react-scripts-ts cd my-app npm run eject

  1. Open a JS file, e.g. ./scripts/start.js
  2. I am using Atom editor with linter-eslint, so it picks up the eslintConfig from ./package.json and it throws the Error: Error while running ESLint: Cannot find module 'eslint-config-react-app'

Expected Behavior No ESLint Error on opening a JS file. Which would probably be solved by either have no eslintConfig in ./package.json or have the stated react-app dependency installed. Actual Behavior After ejecting, if one then scrolls down to the bottom of ./package.json, it shows: { "eslintConfig": { "extends": "react-app" } } Yet the dependency is missing: npm ls eslint-config-react-app [email protected] /home/aurelien/tmp/my-app └── (empty) Reproducible Demo

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

wmonk avatar Jun 11 '18 11:06 wmonk

I've created a PR: fix: do not add ESLint config to ejected app #351

I hope this is welcome.

aurerua avatar Jun 28 '18 11:06 aurerua

Looks like this is fixed!

paulmelnikow avatar Jul 25 '18 21:07 paulmelnikow