Skip to content

Lint for merging equal import/exports with different show combinators #59722

Open
@FMorschel

Description

@FMorschel

When you have duplicate import/exports like:

export 'lib1.dart' show A;
export 'lib1.dart' show B;

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 with show/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 other show/hide values. This should be warned to make them a single export. Even more important if they are using the hide combinator since the other may show unwanted things.

export 'lib1.dart' show A;
export 'lib1.dart' show B;

export 'lib2.dart' hide C;
export 'lib2.dart' hide D;

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagelinter-lint-proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions