You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extending react-app eslint config in non-typescript app #10502
I'm trying the DISABLE_ESLINT_PLUGIN flag added to react-scripts in v4.0.2. In .eslintrc.js:
extends: [
"react-app",
]
This gives me
$ eslint .
Oops! Something went wrong! :(
ESLint: 7.19.0
Error: Failed to load parser '@typescript-eslint/parser' declared in '.eslintrc.js » eslint-config-react-app#overrides[0]': Cannot find module 'typescript'
I'm on a non-typescript project. Do I still have to configure it as if it was a typescript project if I want to use the react-app ruleset? This is what the readme of https://www.npmjs.com/package/eslint-config-react-app indicates as well, but it would be great to be able to use it without all of these dependencies. Especially when using create-react-app.
Environment
Environment Info:
current version of create-react-app: 4.0.2
running from /root/.npm/_npx/13859/lib/node_modules/create-react-app
System:
OS: Linux 4.19 Ubuntu 18.04.1 LTS (Bionic Beaver)
CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Binaries:
Node: 14.10.0 - ~/.nvm/versions/node/v14.10.0/bin/node
Yarn: 1.22.5 - ~/.nvm/versions/node/v14.10.0/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.10.0/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
npmPackages:
react: ^16.13.1 => 16.13.1
react-dom: ^16.13.1 => 16.13.1
react-scripts: 4.0.2 => 4.0.2
npmGlobalPackages:
create-react-app: Not Found
I'm not 100% sure how to solve this - we have the same problem with an ESLint config in my company, but ignored it as we only use TS on new projects anyway... So I get that it can be a pain-point.
Do you have any thoughts on this? Maybe @ianschmitz has some ideas too.
Activity
mrmckeb commentedon Feb 5, 2021
Hi @thisismydesign, this has been an issue for a long time now I think.
It's because we use TS dependencies in the config, even if those are scoped to
.tsand.tsxfiles.https://github.com/facebook/create-react-app/blob/master/packages/eslint-config-react-app/index.js#L34
I'm not 100% sure how to solve this - we have the same problem with an ESLint config in my company, but ignored it as we only use TS on new projects anyway... So I get that it can be a pain-point.
Do you have any thoughts on this? Maybe @ianschmitz has some ideas too.