Skip to content

Existing eslint rule configuration fails starting in 3.1.0 #7548

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

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

Existing eslint rule configuration fails starting in 3.1.0 #7548

klaaspieter opened this issue Aug 16, 2019 · 15 comments

Comments

@klaaspieter
Copy link

Describe the bug

After upgrading to 3.1.1 (and 3.1.0) it's no longer possible to configure eslint rules that are part of the editor configuration. yarn start will fail with an error about an eslint rule it doesn't know about.

Definition for rule 'graphql/template-strings' was not found  graphql/template-strings

This makes sense since starting with eslint@6 it will raise errors when attempting to configure unknown rules. However I do not expect existing projects to break because they've decided to setup editor only eslint configuration.

I guess eventually this could be solved with the experimental eslint extension, but that's still experimental unfortunately and still seems to have issues of it's own.

Did you try recovering your dependencies?

n.a.

Which terms did you search for in User Guide?

https://create-react-app.dev/docs/setting-up-your-editor
https://create-react-app.dev/docs/troubleshooting

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 test-app
  2. cd test-app
  3. yarn add -D eslint-config-prettier
  4.  echo "module.exports = {
       extends: [
         'react-app',
         'prettier/prettier',
       ],
       plugins: ['prettier']
     }
     " > .eslintrc.js
    
  5. echo "/* eslint-disable prettier/prettier */" >> src/App.js
  6. yarn start

Expected behavior

The app to continue to be started. At least in the case of an already existing app with already existing editor configuration.

Actual behavior

Definition for rule 'prettier/prettier' was not found  prettier/prettier

image

Reproducible demo

https://github.com/klaaspieter/create-react-app-eslint-editor-configuration

@stale
Copy link

stale bot commented Sep 15, 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 Sep 15, 2019
@klaaspieter
Copy link
Author

Still reproducible on the latest master.

@stale stale bot removed the stale label Sep 16, 2019
@stale
Copy link

stale bot commented Oct 16, 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 Oct 16, 2019
@ianschmitz ianschmitz removed the stale label Oct 16, 2019
@ianschmitz
Copy link
Contributor

Can you confirm this is still an issue in 3.2.0 @klaaspieter?

@klaaspieter
Copy link
Author

Just checked. Still reproducible on the latest master.

@ianschmitz
Copy link
Contributor

ianschmitz commented Oct 18, 2019

Ah i'm guessing you haven't enabled the experimental flag @klaaspieter. See https://create-react-app.dev/docs/setting-up-your-editor/#experimental-extending-the-eslint-config.

My guess is the error you're seeing sounds related to #7712. If you haven't set the experimental flag then your configuration isn't being picked up by eslint in our webpack config, and will show that error when you try to disable rules that it doesn't know about.

@klaaspieter
Copy link
Author

Ah i'm guessing you haven't enabled the experimental flag @klaaspieter. See create-react-app.dev/docs/setting-up-your-editor/#experimental-extending-the-eslint-config.

I haven't because I feel this is a regression from previous versions of create react app. Before 3.1.0 I could run my app with custom eslint rules. Starting at 3.1.0 I have to EXTEND_ESLINT=true which, when first introduced at least, had it's own set of problems (#7552).

@robertvansteen
Copy link
Contributor

That was not supported before 3.1.0 but there was nothing in create-react-app stopping your browser from picking up the eslint configuration in your project.

@klaaspieter
Copy link
Author

I feel many teams had eslint in place anyway (without the browser integration) but I have no numbers to back this up. I created this issue because upgrading to 3.1.0 broke our build. Feel free to close it if custom ESLint rules were just accidentally supported and 3.1.0 'fixed' it.

@robertvansteen
Copy link
Contributor

I was just pointing out that create-react-app just ignored custom eslint rules before. And as far as I know that should still be the case if EXTEND_ESLINT is set to false so if that is breaking your build that sounds like a bug.

@micahstubbs
Copy link

also experiencing this bug with my existing eslint config

@stale
Copy link

stale bot commented Nov 27, 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 Nov 27, 2019
@klaaspieter
Copy link
Author

I'm having trouble reproducing this issue because yarn create-react-app test-app no longer works.

I'm going to assume this issue wasn't fixed, but unfortunately I cannot say for certain.

@stale stale bot removed the stale label Nov 28, 2019
@stale
Copy link

stale bot commented Dec 28, 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 28, 2019
@stale
Copy link

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

4 participants