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.

Should not be an error: No files matching the pattern "entry.js" were found.

See original GitHub issue

Due to rule:

{
    rules: {
        'import/no-unused-modules': [
            'error',
            {
                ignoreExports: ['index.js', 'entry.js', 'main.js'],
                missingExports: true,
                unusedExports: true
            }
        ]
    }
}

I get the error:

> eslint . --ext .js


Oops! Something went wrong! :(

ESLint: 6.8.0.

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

If I dont have an “entry.js” file, it should just ignore it and move on.

However, I get the error even if I have an “entry.js” file 😦

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
astorijecommented, Mar 12, 2020

I agree with you that my-tool my-file.js should fail if my-file.js does not exist because you’re explicitly passing an argument to a command, but that’s a different use case IMO. Ignore lists do not usually cause a tool to fail if there is not at least one file from the ignore list that actually exists.

Until this behavior changes, we will not be able to use this rule organization-wide unfortunately, and I wouldn’t be surprised if other teams that have shared configurations encountered the same issue. I understand we can extend shared configurations per-repositories, but it makes it harder to ensure good practices organization-wide.

1reaction
astorijecommented, Mar 12, 2020

@ljharb, it’s however pretty standard practice to have configurations silently ignore files that do not exist: .gitignore, .eslintignore, etc. And that’s not just among *ignore files: include/exclude fields of tsconfig.json, files field of package.json, to name just a few.

In our projects, some have a webpack.config.ts we need this rule to ignore and some don’t, some projects have a top-level index.ts and others have index.tsx where all things available outside the boundaries of each projects live (not the best example because index.ts{,x} is a valid pattern here). Another example is our configuration has an entry for **/*.d.ts, which will break the linter when a project does not have any declaration files, but would work ok as long as there is a single file in the entire repo.

It does seem counter-intuitive to me, and the opposite of what most tools out there accustomed us to. Would you be open to reconsider your position on this? 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should not be an error: No files matching the pattern "entry.js ...
Yes, it works now. But I was hoping that it'd just ignore if it can't find the file. Because I want the config...
Read more >
How can I suppress the "No files matching the pattern ...
I have the same error. No files matching the pattern ".ts," were found. I just removed spaces between types .js, .ts, .tsx in...
Read more >
eslint/eslint - Gitter
Running yarn lint on Linux/Mac works, but on Windows I get this error: No files matching the pattern "'**/*.ts'" were found.
Read more >
Prettier [Error] No Files Matching The Pattern Were Found
Failed to compile No files matching 'C:/some folder/myapp/src/.' were found. If i use a path works fine. Is important to note that this...
Read more >
Getting an error 'No files matching the pattern were ... - YouTube
HTML : Getting an error ' No files matching the pattern were found ' when using prettier [ Beautify Your Computer ...
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