File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
+ import 'package:analyzer/dart/analysis/features.dart' ;
5
6
import 'package:analyzer/dart/ast/ast.dart' ;
6
7
import 'package:analyzer/dart/ast/visitor.dart' ;
7
8
@@ -65,6 +66,11 @@ class UnnecessaryLibraryName extends LintRule {
65
66
@override
66
67
void registerNodeProcessors (
67
68
NodeLintRegistry registry, LinterContext context) {
69
+ if (! context.currentUnit.unit.featureSet
70
+ .isEnabled (Feature .unnamedLibraries)) {
71
+ return ;
72
+ }
73
+
68
74
var visitor = _Visitor (this );
69
75
registry.addLibraryDirective (this , visitor);
70
76
}
Original file line number Diff line number Diff line change @@ -25,6 +25,13 @@ library name;
25
25
]);
26
26
}
27
27
28
+ test_namedLibrary_preUnnamedLibraries () async {
29
+ await assertNoDiagnostics (r'''
30
+ // @dart = 2.14
31
+ library name;
32
+ ''' );
33
+ }
34
+
28
35
test_unnamedLibrary () async {
29
36
await assertNoDiagnostics (r'''
30
37
library;
You can’t perform that action at this time.
0 commit comments