This repository was archived by the owner on Jul 16, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 9 files changed +16
-12
lines changed
lib/src/analyzers/lint_analyzer/rules/rules_list
avoid_preserve_whitespace_false
component_annotation_arguments_ordering
prefer_on_push_cd_strategy Expand file tree Collapse file tree 9 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class _Visitor extends RecursiveAstVisitor<void> {
8
8
@override
9
9
void visitAnnotation (Annotation node) {
10
10
if (node.name.name == 'Component' &&
11
- node.atSign.type.lexeme == '@' &&
11
+ node.atSign.type == TokenType . AT &&
12
12
node.parent is ClassDeclaration ) {
13
13
final preserveWhitespaceArg = node.arguments? .arguments
14
14
.whereType <NamedExpression >()
Original file line number Diff line number Diff line change 1
1
import 'package:analyzer/dart/ast/ast.dart' ;
2
+ import 'package:analyzer/dart/ast/token.dart' ;
2
3
import 'package:analyzer/dart/ast/visitor.dart' ;
3
4
import 'package:analyzer/dart/element/type.dart' ;
4
5
import 'package:collection/collection.dart' ;
Original file line number Diff line number Diff line change @@ -40,12 +40,11 @@ class _Visitor extends RecursiveAstVisitor<void> {
40
40
TypeAnnotation ? returnType, {
41
41
required bool isSetter,
42
42
}) {
43
- final hasIgnoredAnnotation = node.metadata.firstWhereOrNull (
44
- (node) =>
45
- _ignoredAnnotations.contains (node.name.name) &&
46
- node.atSign.type.lexeme == '@' ,
47
- ) !=
48
- null ;
43
+ final hasIgnoredAnnotation = node.metadata.any (
44
+ (node) =>
45
+ _ignoredAnnotations.contains (node.name.name) &&
46
+ node.atSign.type == TokenType .AT ,
47
+ );
49
48
50
49
if (! hasIgnoredAnnotation && ! isSetter && ! _isIgnored (name.name)) {
51
50
final type = returnType? .type;
@@ -84,8 +83,7 @@ class _Visitor extends RecursiveAstVisitor<void> {
84
83
type? .getDisplayString (withNullability: false ) == 'Widget' ;
85
84
86
85
bool _isSubclassOfWidget (DartType ? type) =>
87
- type is InterfaceType &&
88
- type.allSupertypes.firstWhereOrNull (_isWidget) != null ;
86
+ type is InterfaceType && type.allSupertypes.any (_isWidget);
89
87
90
88
bool _isIgnored (String name) =>
91
89
name == 'build' || _ignoredNames.contains (name);
Original file line number Diff line number Diff line change 1
1
import 'package:analyzer/dart/ast/ast.dart' ;
2
2
import 'package:analyzer/dart/ast/syntactic_entity.dart' ;
3
+ import 'package:analyzer/dart/ast/token.dart' ;
3
4
import 'package:analyzer/dart/ast/visitor.dart' ;
4
5
import 'package:collection/collection.dart' ;
5
6
Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ class _Visitor extends RecursiveAstVisitor<void> {
22
22
}
23
23
24
24
final isOverride = node.metadata.any (
25
- (node) => node.name.name == 'override' && node.atSign.type.lexeme == '@' ,
25
+ (node) =>
26
+ node.name.name == 'override' && node.atSign.type == TokenType .AT ,
26
27
);
27
28
28
29
if (isOverride) {
Original file line number Diff line number Diff line change 1
1
import 'package:analyzer/dart/ast/ast.dart' ;
2
+ import 'package:analyzer/dart/ast/token.dart' ;
2
3
import 'package:analyzer/dart/ast/visitor.dart' ;
3
4
import 'package:collection/collection.dart' ;
4
5
import 'package:meta/meta.dart' ;
Original file line number Diff line number Diff line change @@ -69,7 +69,8 @@ class _Visitor extends SimpleAstVisitor<List<_ArgumentInfo>> {
69
69
_groupsOrder.indexOf (argumentGroup);
70
70
71
71
bool _isComponentAnnotation (Annotation node) =>
72
- node.name.name == 'Component' && node.atSign.type.lexeme == '@' ;
72
+ node.name.name == 'Component' &&
73
+ node.atSign.type == TokenType .TokenType .AT ;
73
74
}
74
75
75
76
@immutable
Original file line number Diff line number Diff line change 1
1
import 'package:analyzer/dart/ast/ast.dart' ;
2
+ import 'package:analyzer/dart/ast/token.dart' ;
2
3
import 'package:analyzer/dart/ast/visitor.dart' ;
3
4
import 'package:collection/collection.dart' ;
4
5
Original file line number Diff line number Diff line change @@ -33,6 +33,6 @@ class _Visitor extends RecursiveAstVisitor<void> {
33
33
34
34
bool _isComponentAnnotation (Annotation node) =>
35
35
node.name.name == 'Component' &&
36
- node.atSign.type.lexeme == '@' &&
36
+ node.atSign.type == TokenType . AT &&
37
37
node.parent is ClassDeclaration ;
38
38
}
You can’t perform that action at this time.
0 commit comments