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.

Add an option to not throw an error on an unmatched pattern

See original GitHub issue

The version of ESLint you are using.

ESLint: 5.1.0.

The problem you want to solve.

Since breaking behaviour change 8b7c6eaed39e8506dba1aa6e57b1d0e2fdc351c3 #7390 #10143 bundled in ESLint 5, a fatal error is thrown if any file pattern return no files.

My company is using a generic ESLint configuration/runner for all our projects, and we are pretty happy with that:

eslint \
  --ext .js --ext .jsx --ext .mjs \
  -- src test "packages/*/src" "package/*/test"

The problem is that not ALL of our projects matches the same patterns, and we got this error since we upgraded to eslint@5

No files matching the pattern "test" were found.
Please check for typing mistakes in the pattern.

We don’t want to implement custom code to check for pattern existence before appending them to eslint CLI parameters (and we where really happy with eslint@4 behaviour on this particular case).

NOTE: This issue is a bit related to https://github.com/eslint/eslint/issues/9977

Your take on the correct solution to problem.

Add a CLI option (exactly like how proposed here) not to throw errors on unmatched patterns.

Something like --no-error-on-missing-files or --no-error-on-unmatched-pattern

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:60
  • Comments:40 (15 by maintainers)

github_iconTop GitHub Comments

34reactions
not-an-aardvarkcommented, Jul 12, 2018

I think there are relatively few use cases for this option (one of which might be running eslint in an integration), but I don’t object to adding it. That said, if you’re encountering an error like this when running ESLint from the command line, the solution should usually be to stop trying to lint non-existing files, not to add a flag to make ESLint ignore your errors. This issue has a lot of 👍s in comparison with the narrowness of the use case, which makes me suspect that some people are misunderstanding what the error message is saying.

26reactions
reveltcommented, Jan 3, 2019

I think this issue was closed prematurely. Many people (including me) want to be able to save time and share ESLint scripts across different projects (with sometimes non-existing paths in the glob).

It could be easily solved by adding a new CLI flag to skip glob entries that result in no paths.

If somebody from admin team are still reading this, please consider reopening this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I suppress the "No files matching the pattern ...
If no JS files exist, it's currently throwing an error. I'd prefer if it'd succeeded when no JS files exist. Is this possible?...
Read more >
Ignoring Errors - PHPStan
Ignoring in configuration file #​​ To ignore errors by a regular expression only in a specific file, add an entry with message or...
Read more >
Error handling, "try...catch" - The Modern JavaScript Tutorial
First, the code in try {...} is executed. If there were no errors, then catch (err) is ignored: the execution reaches the end...
Read more >
SML/NJ Error Messages
SML/NJ Error and Warning Messages. This document contains lists of error and warning messages produced by the SML/NJ Version 110 compiler, ...
Read more >
CLI - Prettier
If no config file is found, CLI options will evaluate as normal. This option adds support to editor integrations where users define their...
Read more >

github_iconTop Related Medium Post

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