@@ -652,24 +652,24 @@ ruleTester.run('naming-convention', rule, {
652
652
...createInvalidTestCases ( cases ) ,
653
653
{
654
654
code : `
655
- declare const string_camelCase : string;
656
- declare const string_camelCase : string | null;
657
- declare const string_camelCase : string | null | undefined;
658
- declare const string_camelCase : 'a' | null | undefined;
659
- declare const string_camelCase : string | 'a' | null | undefined;
660
-
661
- declare const number_camelCase : number;
662
- declare const number_camelCase : number | null;
663
- declare const number_camelCase : number | null | undefined;
664
- declare const number_camelCase : 1 | null | undefined;
665
- declare const number_camelCase : number | 2 | null | undefined;
666
-
667
- declare const boolean_camelCase : boolean;
668
- declare const boolean_camelCase : boolean | null;
669
- declare const boolean_camelCase : boolean | null | undefined;
670
- declare const boolean_camelCase : true | null | undefined;
671
- declare const boolean_camelCase : false | null | undefined;
672
- declare const boolean_camelCase : true | false | null | undefined;
655
+ declare const string_camelCase01 : string;
656
+ declare const string_camelCase02 : string | null;
657
+ declare const string_camelCase03 : string | null | undefined;
658
+ declare const string_camelCase04 : 'a' | null | undefined;
659
+ declare const string_camelCase05 : string | 'a' | null | undefined;
660
+
661
+ declare const number_camelCase06 : number;
662
+ declare const number_camelCase07 : number | null;
663
+ declare const number_camelCase08 : number | null | undefined;
664
+ declare const number_camelCase09 : 1 | null | undefined;
665
+ declare const number_camelCase10 : number | 2 | null | undefined;
666
+
667
+ declare const boolean_camelCase11 : boolean;
668
+ declare const boolean_camelCase12 : boolean | null;
669
+ declare const boolean_camelCase13 : boolean | null | undefined;
670
+ declare const boolean_camelCase14 : true | null | undefined;
671
+ declare const boolean_camelCase15 : false | null | undefined;
672
+ declare const boolean_camelCase16 : true | false | null | undefined;
673
673
` ,
674
674
options : [
675
675
{
@@ -694,5 +694,46 @@ ruleTester.run('naming-convention', rule, {
694
694
parserOptions,
695
695
errors : Array ( 16 ) . fill ( { messageId : 'doesNotMatchFormat' } ) ,
696
696
} ,
697
+ {
698
+ code : `
699
+ declare const function_camelCase1: (() => void);
700
+ declare const function_camelCase2: (() => void) | null;
701
+ declare const function_camelCase3: (() => void) | null | undefined;
702
+ declare const function_camelCase4: (() => void) | (() => string) | null | undefined;
703
+ ` ,
704
+ options : [
705
+ {
706
+ selector : 'variable' ,
707
+ types : [ 'function' ] ,
708
+ format : [ 'snake_case' ] ,
709
+ prefix : [ 'function_' ] ,
710
+ } ,
711
+ ] ,
712
+ parserOptions,
713
+ errors : Array ( 4 ) . fill ( { messageId : 'doesNotMatchFormat' } ) ,
714
+ } ,
715
+ {
716
+ code : `
717
+ declare const array_camelCase1: Array<number>;
718
+ declare const array_camelCase2: ReadonlyArray<number> | null;
719
+ declare const array_camelCase3: number[] | null | undefined;
720
+ declare const array_camelCase4: readonly number[] | null | undefined;
721
+ declare const array_camelCase5: number[] | (number | string)[] | null | undefined;
722
+ declare const array_camelCase6: [] | null | undefined;
723
+ declare const array_camelCase7: [number] | null | undefined;
724
+
725
+ declare const array_camelCase8: readonly number[] | Array<string> | [boolean] | null | undefined;
726
+ ` ,
727
+ options : [
728
+ {
729
+ selector : 'variable' ,
730
+ types : [ 'array' ] ,
731
+ format : [ 'snake_case' ] ,
732
+ prefix : [ 'array_' ] ,
733
+ } ,
734
+ ] ,
735
+ parserOptions,
736
+ errors : Array ( 8 ) . fill ( { messageId : 'doesNotMatchFormat' } ) ,
737
+ } ,
697
738
] ,
698
739
} ) ;
0 commit comments