mirror of
https://github.com/dart-lang/sdk
synced 2024-10-03 00:45:16 +00:00
camel_case_types
support for macros
Fixes: https://github.com/dart-lang/linter/issues/4882 Change-Id: I2a70fb7ccd2d55dfcc0045969a861a1b8e158033 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352992 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
parent
fe67789e43
commit
7b63c20fba
|
@ -77,6 +77,9 @@ class _Visitor extends SimpleAstVisitor<void> {
|
|||
|
||||
@override
|
||||
void visitClassDeclaration(ClassDeclaration node) {
|
||||
// Don't lint augmentation classes.
|
||||
if (node.augmentKeyword != null) return;
|
||||
|
||||
check(node.name);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,20 @@ class CamelCaseTypesTest extends LintRuleTest {
|
|||
@override
|
||||
String get lintRule => 'camel_case_types';
|
||||
|
||||
test_augmentationClass_lowerCase() async {
|
||||
newFile('$testPackageLibPath/a.dart', r'''
|
||||
import augment 'test.dart';
|
||||
|
||||
class a { }
|
||||
''');
|
||||
|
||||
await assertNoDiagnostics(r'''
|
||||
library augment 'a.dart';
|
||||
|
||||
augment class a { }
|
||||
''');
|
||||
}
|
||||
|
||||
test_extensionType_lowerCase() async {
|
||||
// No need to test all the variations. Name checking is shared with other
|
||||
// declaration types.
|
||||
|
@ -32,4 +46,12 @@ extension type fooBar(int i) {}
|
|||
extension type FooBar(int i) {}
|
||||
''');
|
||||
}
|
||||
|
||||
test_macroClass_lowerCase() async {
|
||||
await assertDiagnostics(r'''
|
||||
macro class a { }
|
||||
''', [
|
||||
lint(12, 1),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue