import-js/eslint-plugin-import

[import/no-unused-modules] - "No files matching the pattern" error

Open

#1645 aperta il 5 feb 2020

Vedi su GitHub
 (39 commenti) (1 reazione) (0 assegnatari)JavaScript (1540 fork)batch import
help wanted

Metriche repository

Star
 (4946 star)
Metriche merge PR
 (Merge medio 138g 22h) (3 PR mergiate in 30 g)

Descrizione

I'm using both eslint-plugin-import and eslint-plugin-json. When there are only *.json files in my project, I get "No files matching the pattern" error from the import/no-unused-modules rule, and ESLint crashes.

Steps to reproduce:

  1. Clone this minimal reproducible case: https://github.com/EvgenyOrekhov/eslint-config-hardcore/tree/no-files-matching-the-pattern-bug
  2. npm install
  3. npm test

Actual result:

> no-files-matching-the-pattern-bug@0.0.0 test C:\eslint-config-hardcore
> eslint --ext .js,.json .


Oops! Something went wrong! :(

ESLint: 6.8.0.

No files matching the pattern "C:\eslint-config-hardcore" were found.
Please check for typing mistakes in the pattern.

npm ERR! Test failed.  See above for more details.

Expected result: there should be no "No files matching the pattern" error, there should be only one warning from eslint-plugin-json

> no-files-matching-the-pattern-bug@0.0.0 test C:\eslint-config-hardcore
> eslint --ext .js,.json .


C:\eslint-config-hardcore\invalid.json
  1:2  error  Expected a JSON object, array or literal  json/*

✖ 1 problem (1 error, 0 warnings)

npm ERR! Test failed.  See above for more details.

When I remove the import/no-unused-modules rule from .eslintrc.json, the problem goes away.

Guida contributor