eslint-plugin-import
eslint-plugin-import copied to clipboard
no-unused-modules: option to warn only if all exports unused (file unused)
This is the best plugin I've found that works to find unused files with webpack. However I like keeping some exports available even if unused, this makes it difficult to find the files that have no used exports at all.
Can you elaborate on why you'd want to keep around anything unused?
because in a project being developed with other people you would like to keep the API of your modules open instead of only restricting to whats used currently
Seems like a project in that kind of flux wouldn't want this rule enabled at all?
Hi everyone, I figured I'd chime in with our use case in favor of this, in case it makes a difference.
We have a pretty large frontend / react project, where some developers may be considered "responsible" for some shared components, while others are merely consumers of it. The producer of a shared component may chose to explicitly export its property-types, as a service to anyone requiring more advanced type-play. Meanwhile, the first consumer may simply use the types implicitly, IE. never actually referencing the type export.
This means that we have a quite a lot of components with excess exports, components that kind of exhibit library-like characteristics, despite still residing alongside the consumer. These all error with no-unused-modules of course. Meanwhile we'd still like to eliminate unused components.
Try knip