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
Fix: Ignore re-export all in no-duplicate-imports (fixes #12760) #12767
Conversation
Thanks for working on this!
export * from "mod";
export * from "mod";
I hadn't considered this. I wonder if it would make sense to still warn on this case, since it really is a duplicate? |
I think it makes a lot of sense, as it's entire reason for enabling the rule 🙂 I think this ties in closely to #12758, and that the implementation I believe will be required for that would also solve this: effectively, This logic would be the same for handling exports, with a minor adjustment for namespace exports. I'm happy to implement this, or for @mdjermanovic to do so, but I think only one of us should so that we end up with nicely mirrored code for both export & import. |
I thought Agreed, let's discuss everything in #12758 first. If it turns out that this doesn't make sense as a separate fix, I'll close it. |
@kaicataldo @mdjermanovic thoughts on how to proceed here? |
What is the purpose of this pull request? (put an "X" next to item)
[X] Bug fix #12760
What changes did you make? (Give an overview)
After this PR,
no-duplicate-imports
will ignoreexport * from "mod"
, since it isn't possible to merge these exports with any other imports/exports.I believe it's actually even impossible to rewrite such code in any other way, so it seems that taking into account these declarations was a bug.
Also, documentation was missing the explanation for the
includeExports
option. There was just a special case with bothimport
andexport
declarations.Is there anything you'd like reviewers to focus on?
Yes. Ignoring
export * from
will also ignore duplicates:This looks like a possible error in exporting rather than a stylistic issue in importing (which is what this rule is about?). So, this indeed might not belong here, but after this fix there will be no rule to report it.