File tree Expand file tree Collapse file tree 4 files changed +17
-6
lines changed
test_data/integration/depend_on_referenced_packages Expand file tree Collapse file tree 4 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -84,11 +84,24 @@ class DependOnReferencedPackages extends LintRule {
84
84
}
85
85
86
86
class _Visitor extends SimpleAstVisitor {
87
+ /// Virtual packages will not have explicit dependencies
88
+ /// and get skipped.
89
+ static const virtualPackages = [
90
+ //https://github.com/dart-lang/linter/issues/3308
91
+ 'flutter_gen' ,
92
+ ];
93
+
87
94
final DependOnReferencedPackages rule;
88
95
final List <String > availableDeps;
89
96
90
97
_Visitor (this .rule, this .availableDeps);
91
98
99
+ @override
100
+ void visitExportDirective (ExportDirective node) => _checkDirective (node);
101
+
102
+ @override
103
+ void visitImportDirective (ImportDirective node) => _checkDirective (node);
104
+
92
105
void _checkDirective (UriBasedDirective node) {
93
106
// Is it a package: uri?
94
107
var uriContent = node.uriContent;
@@ -100,13 +113,8 @@ class _Visitor extends SimpleAstVisitor {
100
113
if (firstSlash == - 1 ) return ;
101
114
102
115
var packageName = uriContent.substring (8 , firstSlash);
116
+ if (virtualPackages.contains (packageName)) return ;
103
117
if (availableDeps.contains (packageName)) return ;
104
118
rule.reportLint (node.uri);
105
119
}
106
-
107
- @override
108
- void visitImportDirective (ImportDirective node) => _checkDirective (node);
109
-
110
- @override
111
- void visitExportDirective (ExportDirective node) => _checkDirective (node);
112
120
}
Original file line number Diff line number Diff line change
1
+ flutter_gen:vendor/flutter_gen
1
2
sample_project:lib/
2
3
public_dep:vendor/public_dep/
3
4
private_dep:vendor/private_dep/
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:flutter_gen/gen.dart' ; // OK
6
+
5
7
import 'package:sample_project/sample_project.dart' ; // OK
6
8
import 'package:public_dep/public_dep.dart' ; // OK
7
9
import 'package:private_dep/private_dep.dart' ; // LINT
You can’t perform that action at this time.
0 commit comments