Vague error when eslintrc.js is invalid
See original GitHub issueDescribe 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
npx create-react-app eslint-test
cd eslint-test
touch .eslintrc.js
(or.eslintrc.json
,.eslintrc.yml
)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
Reproducible demo
https://github.com/klaaspieter/create-react-app-eslintrc
Steps to reproduce:
git clone https://github.com/klaaspieter/create-react-app-eslintrc.git
cd create-react-app-eslintrc
yarn
(Note thatyarn.lock
changes, is this a separate issue?)EXTEND_ESLINT=true yarn start
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:8
Top GitHub Comments
Not stale. I was just out for vacation.
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.