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

Vague error when eslintrc.js is invalid #7552

Closed
klaaspieter opened this issue Aug 16, 2019 · 8 comments
Closed

Vague error when eslintrc.js is invalid #7552

klaaspieter opened this issue Aug 16, 2019 · 8 comments

Comments

@klaaspieter
Copy link

klaaspieter commented Aug 16, 2019

Describe the bug

When a project has an invalid .eslintrc.js and is started with EXTEND_ESLINT=true create-react-app will fail to compile.

Did you try recovering your dependencies?

Not sure if applicable since this happens in a newly generated project too.

Which terms did you search for in User Guide?

I mostly looked at which does not mention existing .eslintrc.js https://create-react-app.dev/docs/setting-up-your-editor#displaying-lint-output-in-the-editor

Environment

Environment Info:

  System:
    OS: macOS 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  Binaries:
    Node: 8.15.0 - ~/.asdf/shims/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.asdf/shims/npm
  Browsers:
    Chrome: Not Found
    Firefox: 68.0.2
    Safari: Not Found
  npmPackages:
    react: ^16.9.0 => 16.9.0
    react-dom: ^16.9.0 => 16.9.0
    react-scripts: 3.1.1 => 3.1.1
  npmGlobalPackages:
    create-react-app: Not Found

Steps to reproduce

  1. npx create-react-app eslint-test
  2. cd eslint-test
  3. touch .eslintrc.js (or .eslintrc.json, .eslintrc.yml)
  4. EXTEND_ESLINT=true yarn start

Note that in step 3 the contents of eslintrc doesn't matter. A valid eslintrc will also fail.
Edit: This is a bit more nuanced. The following works:

module.exports = {
}

This does not:

module.exports = {
  extends: 'eslint:recommended',
}

but this does:

module.exports = {
  extends: ['react-app', 'eslint:recommended']
}

Expected behavior

The server to start
Edit: I expect to see an error about an invalid eslintrc. Perhaps suggesting that react-app needs to be extended.

Actual behavior

Compile errors like

./src/serviceWorker.js
  Line 13:  Parsing error: The keyword 'const' is reserved

image

Reproducible demo

https://github.com/klaaspieter/create-react-app-eslintrc

Steps to reproduce:

  1. git clone https://github.com/klaaspieter/create-react-app-eslintrc.git
  2. cd create-react-app-eslintrc
  3. yarn (Note that yarn.lock changes, is this a separate issue?)
  4. EXTEND_ESLINT=true yarn start
@stale
Copy link

stale bot commented Sep 18, 2019

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

@stale stale bot added stale and removed stale labels Sep 18, 2019
@klaaspieter
Copy link
Author

Still reproducible on the latest master.

@klaaspieter klaaspieter changed the title EXTEND_ESLINT does not work with existing .eslintrc.js Vague error when eslintrc.js is invalid Sep 30, 2019
@klaaspieter
Copy link
Author

Looks like the PR fixed it somewhat. This now shows the following error:

./src/index.js
  Line 1:  Parsing error: 'import' and 'export' may appear only with 'sourceType: module'

That's presumably the error eslint throws. However from the error it's not clear what the actual problem is and how to fix it.

@stale
Copy link

stale bot commented Oct 30, 2019

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

@stale stale bot added stale and removed stale labels Oct 30, 2019
@stale
Copy link

stale bot commented Nov 29, 2019

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

@stale stale bot added stale and removed stale labels Nov 29, 2019
@stale
Copy link

stale bot commented Dec 29, 2019

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

@stale stale bot added the stale label Dec 29, 2019
@stale
Copy link

stale bot commented Jan 3, 2020

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

@stale stale bot closed this as completed Jan 3, 2020
@klaaspieter
Copy link
Author

Not stale. I was just out for vacation.

@lock lock bot locked and limited conversation to collaborators Jan 11, 2020
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

1 participant