question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vague error when eslintrc.js is invalid

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:8

github_iconTop GitHub Comments

1reaction
klaaspietercommented, Jan 6, 2020

Not stale. I was just out for vacation.

0reactions
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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint configuration in ..\..\..\..\.eslintrc is invalid: - Unexpected ...
im using airbnb-eslint along with babel-plugin-module-resolver. I get this error in every js file where i've used an alias to import.
Read more >
ESLINT Configuration Error - Visual Studio Feedback
I got an warning: internal-error (ESLint) ESLint configuration in .eslintrc is invalid: - Unexpected top-level property “overrides[1].extends”.
Read more >
Migrating to v6.0.0 - ESLint - Pluggable JavaScript Linter
In ESLint v6.0.0, RuleTester will raise an error if a rule has an invalid default keyword in its schema. To address: If RuleTester ......
Read more >
eslint-plugin-import - npm
Start using eslint-plugin-import in your project by running `npm i ... Report any invalid exports, i.e. re-export of the same name ( export...
Read more >
eslint | Yarn - Package Manager
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found