-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Lint for merging equal import/exports with different show
combinators
#59722
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
Comments
This sounds to me like a style preference. There's nothing semantically wrong with having multiple exports of different parts of the same library. (Though I agree that the more concise form is closer to the Dart style.) That makes it a lint rather than a warning, but we're essentially not adding any new lints at this time that aren't requested by the language team, typically in order to facilitate adoption of new language features. So I suspect that we won't want to add this one. |
Yes, exports with hides have the same issue. |
I've decided to leave #59907 as a request for handling the Here I'm asking for an actual lint for merging equal imports/exports that differ @bwilkerson, do you think that if I have one import/export with a import 'b.dart';
import 'b.dart' show B; //does nothing since everything is shown above We should add the warning here as a lint or at the current warnings for duplicate exports/imports? If you think it should be handled at the current warnings I can create a new issue for tracking that. EditJust to point another similarly related issue: #56879 |
show
combinators
show
combinatorsshow
combinators
We already have an Beyond that, I think we need to stop and think about a consistent way of handling all of the cases. |
It does nothing if you are using |
True, "redundant" is probably the better diagnostic. |
I think this should be triggering on:
It could be called something like |
When you have duplicate import/exports like:
we could have a lint for merging them together.
Old description
Say you have a package (happened to mine - due_date). You have an API that should be exported separately outside the project in different libraries (one file with multiple declarations or a barrel file).
So you write down an
export
directive withshow
/hide
. But later you add more things and you add another entry (forgot about the original one or didn't see it) with the same file but othershow
/hide
values. This should be warned to make them a single export. Even more important if they are using thehide
combinator since the other may show unwanted things.Today if we have the exact same values for the combinators it shows:
Duplicate export. Try removing all but one export of the library. dart(duplicate_export)
The text was updated successfully, but these errors were encountered: