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.

Cannot use `.eslintignore` for generated files

See original GitHub issue

Describe the bug

When running yarn start, the ESLint errors are shown from files I have ignored with .eslintignore and the app won’t start.

Did you try recovering your dependencies?

Reproducible in a fresh new project.

Which terms did you search for in User Guide?

eslintignore (yielded https://github.com/facebook/create-react-app/issues/6871)

Environment

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Binaries:
    Node: 10.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.16.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.17763.1.0
    Internet Explorer: 11.0.17763.1
  npmPackages:
    react: ^16.8.6 => 16.8.6
    react-dom: ^16.8.6 => 16.8.6
    react-scripts: 3.0.1 => 3.0.1
  npmGlobalPackages:
    create-react-app: Not Found

Expected behavior

To ignore specified files from ESLint checks and start the app. Talking here mostly about generated files which we cannot just modify with the comment to disable eslint. The best course of action is to just ignore these.

Quite an exhaustive issue https://github.com/facebook/create-react-app/issues/6871 talks about customizing ESLint config, but not much of the mention of utilizing .eslintignore which isn’t exactly huge customization and shouldn’t be prohibited like that.

I can use a workaround with cra-override, but I don’t want to disable a conflicting rule for a whole project when the only a bunch of generated files is affected.

Actual behavior

image

I have VSCode properly working with ESLint in the project. The specified file is correctly ignored there.

Reproducible demo

https://github.com/FredyC/cra-eslint-ignore

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
silverwindcommented, Jul 10, 2019

I too suggested removing this pesky ignore: false in the webpack config in https://github.com/facebook/create-react-app/pull/7036. My use case is for ignoring manually vendored JS libs in src.

Change should be fully backwards compatible.

5reactions
bugzpoddercommented, Jul 9, 2019

I think it makes sense to re-evaluate whether this is viable, given that we are working towards allowing custom eslint configs. However it is a breaking change so it would only be included in a major release that might be a while away.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignoring Code - ESLint - Pluggable JavaScript Linter
When ESLint is run, it looks in the current working directory to find a .eslintignore file before determining which files to lint. If...
Read more >
javascript - .eslintignore file not working
eslintignore file may need to be placed at the root of the workspace folder, in order to be recognized by the vscode plugin....
Read more >
eslintignore file doesn't seem to be working
In my solution, I'm trying to use .eslintignore files in two separate projects to filter out ... I am asking because I cannot...
Read more >
ESLint | IntelliJ IDEA Documentation
Configure ESLint manually. With manual configuration, you can use a custom ESLint package, configuration file, and working directories, ...
Read more >
How to use ESLint with TypeScript
Ignoring files we don't want to lint. Create an .eslintignore in order to prevent ESLint from linting stuff we don't want it to....
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