import-js/eslint-plugin-import

Use globbing with `no-unused-modules` options

Aperta

#1326 aperta il 14 apr 2019

 (3 commenti) (1 reazione) (0 assegnatari)JavaScript (1549 fork)batch import
enhancementhelp wantedquestion

Metriche repository

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

Descrizione

I would like to check for dead code in my test helpers using the no-unused-modules rule.

My test folder is test/ and my helpers are in test/helpers/ (which is a common setup with Ava).

The src and ignoreExports are file paths, which makes it hard to use in such a setup. Indeed I need src to target my test files + helpers (test/) but ignoreExports should exclude the test files since they do not export anything.

One possible solution would be to allow globbing in src and ignoreExports, e.g. { src: 'test/', ignoreExports: ['test/', '!test/helpers'] }. What do you think?

Guida contributor