File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ class CamelCaseTypes extends LintRule {
59
59
registry.addClassTypeAlias (this , visitor);
60
60
registry.addFunctionTypeAlias (this , visitor);
61
61
registry.addEnumDeclaration (this , visitor);
62
+ registry.addExtensionTypeDeclaration (this , visitor);
62
63
}
63
64
}
64
65
@@ -89,6 +90,11 @@ class _Visitor extends SimpleAstVisitor<void> {
89
90
check (node.name);
90
91
}
91
92
93
+ @override
94
+ void visitExtensionTypeDeclaration (ExtensionTypeDeclaration node) {
95
+ check (node.name);
96
+ }
97
+
92
98
@override
93
99
void visitFunctionTypeAlias (FunctionTypeAlias node) {
94
100
check (node.name);
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ import 'avoid_unused_constructor_parameters_test.dart'
41
41
import 'avoid_void_async_test.dart' as avoid_void_async;
42
42
import 'await_only_futures_test.dart' as await_only_futures;
43
43
import 'camel_case_extensions_test.dart' as camel_case_extensions;
44
+ import 'camel_case_types_test.dart' as camel_case_types;
44
45
import 'cancel_subscriptions_test.dart' as cancel_subscriptions;
45
46
import 'cast_nullable_to_non_nullable_test.dart'
46
47
as cast_nullable_to_non_nullable;
@@ -251,6 +252,7 @@ void main() {
251
252
avoid_void_async.main ();
252
253
await_only_futures.main ();
253
254
camel_case_extensions.main ();
255
+ camel_case_types.main ();
254
256
cancel_subscriptions.main ();
255
257
cast_nullable_to_non_nullable.main ();
256
258
collection_methods_unrelated_type.main ();
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2
+ // for details. All rights reserved. Use of this source code is governed by a
3
+ // BSD-style license that can be found in the LICENSE file.
4
+
5
+ import 'package:test_reflective_loader/test_reflective_loader.dart' ;
6
+
7
+ import '../rule_test_support.dart' ;
8
+
9
+ main () {
10
+ defineReflectiveSuite (() {
11
+ defineReflectiveTests (CamelCaseTypesTest );
12
+ });
13
+ }
14
+
15
+ @reflectiveTest
16
+ class CamelCaseTypesTest extends LintRuleTest {
17
+ @override
18
+ String get lintRule => 'camel_case_types' ;
19
+
20
+ test_extensionType_lowerCase () async {
21
+ // No need to test all the variations. Name checking is shared with other
22
+ // declaration types.
23
+ await assertDiagnostics (r'''
24
+ extension type fooBar(int i) {}
25
+ ''' , [
26
+ lint (15 , 6 ),
27
+ ]);
28
+ }
29
+
30
+ test_extensionType_wellFormed () async {
31
+ await assertNoDiagnostics (r'''
32
+ extension type FooBar(int i) {}
33
+ ''' );
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments