import-js/eslint-plugin-import

Rule no-unused-modules does not count re-export all declarations

Open

#1,945 opened on Nov 12, 2020

View on GitHub
 (8 comments) (1 reaction) (0 assignees)JavaScript (1,540 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (4,946 stars)
PR merge metrics
 (Avg merge 138d 22h) (3 merged PRs in 30d)

Description

The rule no-unused-modules reports files which only have re-export all declarations for not having exports, eg:

export * from './foo.js';
export * from './bar.js';

This seems to be intentional as the re-exports are deleted from the count before the check. I did not find any information on the reasoning for this behavior.

My proposed solution is to add an option flag, eg. allowReExportOnly, to allow this. The rule would still report if not a single re-export has an export. I am willing to create a PR for this functionality if this change is approved.

Contributor guide