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

Extending react-app eslint config in non-typescript app #10502

Open
thisismydesign opened this issue Feb 4, 2021 · 1 comment
Open

Extending react-app eslint config in non-typescript app #10502

thisismydesign opened this issue Feb 4, 2021 · 1 comment

Comments

@thisismydesign
Copy link

thisismydesign commented Feb 4, 2021

Describe the bug

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
@mrmckeb
Copy link
Contributor

mrmckeb commented 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 .ts and .tsx files.
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants