You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
The reasoning I cam surmise is that there's no purpose in having this file - the consumers of it can (and should) be directly importing from foo.js or bar.js (I don't see any discussion about it in #1142 tho).
A PR for an option is reasonable, but when enabled, it should actually check that somebody is importing from that file - iow, if the file in your OP is index.js, and nobody is importing from index.js, then that file should be reported as unused.
Similarly, if that option is enabled, and only one of the foo.js exports (let's say "baz") is imported from index.js, and none of the bar.js exports, I would expect the rule to error until index.js has been reduced to export { baz } from './foo.js'.
The rule
no-unused-modules
reports files which only have re-export all declarations for not having exports, eg: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.
The text was updated successfully, but these errors were encountered: