-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New-rule: force re-export style #3158
Comments
Re-exporting in general is something best avoided, especially in a barrel-file context. Rather than having a rule that enforces a consistent way to do something unadvisable, I'd rather have one that discourages re-exports entirely in favor of requiring consumers to deep-import. |
I do agree that it's a bad practice ; but we have some legacy code bases where it's used all over the place, and a rule enforcing a particular writing style would be really appreciated. |
If you're going to be making changes to those files based on a rule, why not remove the barrel file instead at that time? |
Unfortunately this would require to rewrite thousands of imports across hundreds of files, plus update the |
Most IDEs can automate rewriting imports, but sure, a lot of tech debt means a lot of work to fix it. |
Here is a proposal for a new rule: forbidding imports followed by equivalent exports, and prefer re-export syntax instead.
Example:
I didn't find any similar rule in the docs, and I think it would be nice to have one to enforce consistent styling of re-exports.
The text was updated successfully, but these errors were encountered: