avoid-duplicate-exports

Path
lint/correctness/avoid-duplicate-exports
Default
Off, opt in
Origin
Falcon
Rule
48 of 512

Flags export directives whose visible names are already covered by another export. URI values and conditional branches must match; show/hide chains are compared as sets, so disjoint or partially overlapping visibility remains untouched.

Invalid

example.dartdart
export 'a.dart';
export 'a.dart';
export 'b.dart';
export 'b.dart' show B;
export 'c.dart' show C, D;
export 'c.dart' show C;
export 'd.dart' hide D;
export 'd.dart' show E;
export 'e.dart' hide E;
export 'e.dart' hide E, F;
export 'f.dart' show F;
export 'f.dart';
export 'g.dart' if (dart.library.io) 'io.dart';
export 'g.dart' if (dart.library.io) 'io.dart' show G;
export 'h.dart';
export "h.dart";
export 'relative.dart';
export './relative.dart' show Relative;
export 'nested/../relative.dart' show Relative;
export 'sub/a.dart';
export './sub/a.dart' show A;
This export adds no names beyond another export of the same library — remove the redundant directive.
1export 'a.dart';
2export 'a.dart';
This export adds no names beyond another export of the same library — remove the redundant directive.
3export 'b.dart';
4export 'b.dart' show B;
This export adds no names beyond another export of the same library — remove the redundant directive.
5export 'c.dart' show C, D;
6export 'c.dart' show C;
This export adds no names beyond another export of the same library — remove the redundant directive.
7export 'd.dart' hide D;
8export 'd.dart' show E;
This export adds no names beyond another export of the same library — remove the redundant directive.
9export 'e.dart' hide E;
10export 'e.dart' hide E, F;
This export adds no names beyond another export of the same library — remove the redundant directive.
10export 'e.dart' hide E, F;
11export 'f.dart' show F;
This export adds no names beyond another export of the same library — remove the redundant directive.
13export 'g.dart' if (dart.library.io) 'io.dart';
14export 'g.dart' if (dart.library.io) 'io.dart' show G;
This export adds no names beyond another export of the same library — remove the redundant directive.
15export 'h.dart';
16export "h.dart";
This export adds no names beyond another export of the same library — remove the redundant directive.
17export 'relative.dart';
18export './relative.dart' show Relative;
This export adds no names beyond another export of the same library — remove the redundant directive.
18export './relative.dart' show Relative;
19export 'nested/../relative.dart' show Relative;
This export adds no names beyond another export of the same library — remove the redundant directive.
20export 'sub/a.dart';
21export './sub/a.dart' show A;

Valid

example.dartdart
export 'a.dart' show A;
export 'a.dart' show B;
export 'b.dart' show B, C;
export 'b.dart' show C, D;
export 'c.dart' hide C;
export 'c.dart' show C;
export 'd.dart' hide A;
export 'd.dart' hide B;
export 'e.dart';
export 'e.dart' if (dart.library.io) 'io.dart';
export 'f.dart' if (dart.library.io) 'one.dart';
export 'f.dart' if (dart.library.io) 'two.dart';
export 'g.dart' if (dart.library.io) 'io.dart';
export 'g.dart' if (dart.library.html) 'html.dart';
export '//host/a/../network.dart';
export '/host/network.dart';
export 'percent%2E.dart';
export 'percent.dart';

Configure avoid-duplicate-exports

Set its severity in falcon.json. See the configuration guide.

falcon.jsonjson
{
  "linter": {
    "rules": {
      "correctness": {
        "avoid-duplicate-exports": "error"
      }
    }
  }
}

Or silence one occurrence with a suppression comment; the reason is required.

example.dartdart
// falcon-ignore lint/correctness/avoid-duplicate-exports: <reason>