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.

Remove warnings when linting ignored files

See original GitHub issue

The version of ESLint you are using. v7.22.0

The problem you want to solve. When running eslint with globs or explicit paths to files and that file is ignored in .eslintignore, a warning is shown. For example, if .eslintignore contains file.js and you run eslint file.js, it will show warning File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

This becomes a problem when using tools like lint-staged along with eslint --max-warnings 0 flag. For example, when you’re working on a large project and during a branch merge some .eslintignored files are staged, lint-staged passes the whole staged file list to eslint. Since --max-warnings 0 causes eslint to exit with status code 1, commits are being prevented by the aforementioned warning. This is frustrating because those files are explicitly ignored.

There have already been discussions about this: https://github.com/eslint/eslint/issues/12249 https://github.com/eslint/eslint/issues/12206 https://github.com/eslint/eslint/issues/9977

Your take on the correct solution to problem.

  • Instead of a warning, maybe this should be logged as info? Though I’m not sure if it’s possible to set lower severity than a warning in eslint.
  • This functionality is not configurable in any way. A CLI option --no-warn-ignored or similar would solve such cases.

Are you willing to submit a pull request to implement this change? Yes

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:32
  • Comments:38 (12 by maintainers)

github_iconTop GitHub Comments

26reactions
domnantascommented, May 13, 2022

I was putting this off for a long time, sorry about that. Finished the RFC: https://github.com/eslint/rfcs/pull/90

9reactions
btmillscommented, Sep 12, 2021

We decided in the TSC meeting that we’d like to provide a solution to this. We can discuss possible options here on the issue. One option is replicating eslint.lintText()'s warnIgnored option on eslint.lintFiles() and exposing it via a CLI option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to silence warnings about ignored files in eslint
One workaround I know at the moment is --quiet option, which suppresses all warnings. Of course that doesn't make sense if you have...
Read more >
Ignoring Code - ESLint - Pluggable JavaScript Linter
Ignored File Warnings ... This message occurs because ESLint is unsure if you wanted to actually lint the file or not. As the...
Read more >
Suppressing Lint Warnings - Android Studio Project Site
In both Android Studio and Eclipse you can easily suppress lint issues directly ... Lint will automatically look at this file and use...
Read more >
Suppressing Lint Checks - Google Samples
Lint errors can be suppressed in a variety of ways: ... To suppress a lint warning with an annotation, add a @SuppressLint("id") annotation...
Read more >
Errors and Warnings — Verilator 5.005 documentation
Disable the warning using Configuration Files with a lint_off command. ... Ignoring this warning will only suppress the lint check; it will simulate ......
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