Eslint-plugin-import: Exclude package main files by default from `no-unused-modules`

Created on 14 Apr 2019  路  5Comments  路  Source: benmosher/eslint-plugin-import

unusedExports: true with the no-unused-modules rule should never report files that are exported as the main file (main, browser or bin fields in package.json). What do you think?

enhancement help wanted

All 5 comments

That sounds like a good enhancement, no need for it to be behind an option, even.

What package.json should be used for this purpose?

  • the package.json from the working directory,
  • the package.json from the folder specified as src in the rule options (if existing) or
  • the package.json closest to the file currently being linted (if existing and not the same as in the working directory)?

For a given file, the closest package.json to it, that has a main, does not have private true, and points to it, marks it as used.

Thanks for implementing this @ljharb! :tada:

Thank @rfermann :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ThomasdenH picture ThomasdenH  路  31Comments

rhettlivingston picture rhettlivingston  路  31Comments

msuntharesan picture msuntharesan  路  29Comments

JustFly1984 picture JustFly1984  路  41Comments

steve-taylor picture steve-taylor  路  24Comments