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

Bug: inconsistent ignoring files #15931

Closed
1 task
vitonsky opened this issue May 28, 2022 · 4 comments
Closed
1 task

Bug: inconsistent ignoring files #15931

vitonsky opened this issue May 28, 2022 · 4 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly repro:needed
Projects

Comments

@vitonsky
Copy link

Environment

Node version: 14.18
npm version: 6.14.15
Local ESLint version: 7.32
Global ESLint version: 7.32
Operating System: ubuntu

What parser are you using?

@typescript-eslint/parser

What did you do?

  • add node_modules to .eslintignore file
  • run eslint --fix **/*.{ts,tsx,js}

What did you expect to happen?

All files in project except node_modules will scanned and fixed

What actually happened?

Eslint confused and don't understand what i want. Eslint display a weird and pointless suggestions.

image

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

Probably it may be solved if i will modify comand eslint --fix **/*.{ts,tsx,js} to exclude node_modules, but in this case a file .eslintignore absolutely useless, so i don't think it's expected behavior

@vitonsky vitonsky added bug ESLint is working incorrectly repro:needed labels May 28, 2022
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage May 28, 2022
@mdjermanovic mdjermanovic moved this from Needs Triage to Triaging in Triage May 28, 2022
@mdjermanovic
Copy link
Member

Hi @vitonsky, thanks for the issue!

  • run eslint --fix **/*.{ts,tsx,js}

Your shell expands the glob and sends a list of files to eslint, which then sees them as if they were entered one by one on the command line and reports the ignored ones because it assumes you would not want to skip linting any files that were explicitly listed on the command line.

Can you try with quotes:

eslint --fix "**/*.{ts,tsx,js}"

This way, eslint will get the glob instead of a list of files.

@vitonsky
Copy link
Author

Yes, it's solve my problem, thank you.

But what about some CLI flag allowed ignore to all files listed explicitly?

It's useful to other cases. For example, when i use eslint with lint-staged, all files will specify explicitly. In case when all these files should be ignored, we may got this error. I got this error just now, but for stylelint.

I think it's be useful if we can do something like eslint --fix --allow-ignore-all foo.js bar.ts

@mdjermanovic
Copy link
Member

Actually, for an ignored file eslint will just return a lint warning. In your example, node_modules/big.js is a directory (npm package named big.js).

Since lint-staged specifies a list of files, it should work well because lint warnings do not cause exit with error status.

Unless you're using --max-warnings flag. For that use case, we have accepted issue #15010 and we are working on the design in eslint/rfcs#90 .

@vitonsky
Copy link
Author

Ok, thanks for explaining. Now all clear for me.
I hope other users will find this page while googling this error.

Triage automation moved this from Triaging to Complete May 28, 2022
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Nov 25, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Nov 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly repro:needed
Projects
Archived in project
Triage
Complete
Development

No branches or pull requests

2 participants