@@ -24,18 +24,82 @@ const ruleTester = new RuleTester({
2424ruleTester . run ( "camelcase" ,  ruleCamelcase ,  { 
2525    valid : [ 
2626        { 
27-             code : "interface Foo { b_ar: null  }" , 
27+             code : "interface Foo { b_ar: number  }" , 
2828            options : [ {  properties : "never"  } ] 
2929        } , 
3030        { 
31-             code : "interface Foo { bar: null }" , 
31+             code : "interface Foo { bar: number }" , 
32+             options : [ {  properties : "always"  } ] 
33+         } , 
34+         { 
35+             code : "class Foo { b_ar: number; }" , 
36+             options : [ {  properties : "never"  } ] 
37+         } , 
38+         { 
39+             code : "class Foo { bar: number; }" , 
40+             options : [ {  properties : "always"  } ] 
41+         } , 
42+         { 
43+             code : "class Foo { b_ar: number = 0; }" , 
44+             options : [ {  properties : "never"  } ] 
45+         } , 
46+         { 
47+             code : "class Foo { bar: number = 0; }" , 
48+             options : [ {  properties : "always"  } ] 
49+         } , 
50+         { 
51+             code : "class Foo { constructor(private b_ar: number) {} }" , 
52+             options : [ {  properties : "never"  } ] 
53+         } , 
54+         { 
55+             code : "class Foo { constructor(private bar: number) {} }" , 
56+             options : [ {  properties : "always"  } ] 
57+         } , 
58+         { 
59+             code : "class Foo { constructor(private b_ar: number = 0) {} }" , 
60+             options : [ {  properties : "never"  } ] 
61+         } , 
62+         { 
63+             code : "class Foo { constructor(private bar: number = 0) {} }" , 
64+             options : [ {  properties : "always"  } ] 
65+         } , 
66+         { 
67+             code : "abstract class Foo { b_ar: number; }" , 
68+             options : [ {  properties : "never"  } ] 
69+         } , 
70+         { 
71+             code : "abstract class Foo { bar: number; }" , 
72+             options : [ {  properties : "always"  } ] 
73+         } , 
74+         { 
75+             code : "abstract class Foo { b_ar: number = 0; }" , 
76+             options : [ {  properties : "never"  } ] 
77+         } , 
78+         { 
79+             code : "abstract class Foo { bar: number = 0; }" , 
80+             options : [ {  properties : "always"  } ] 
81+         } , 
82+         { 
83+             code : "abstract class Foo { abstract b_ar: number; }" , 
84+             options : [ {  properties : "never"  } ] 
85+         } , 
86+         { 
87+             code : "abstract class Foo { abstract bar: number; }" , 
88+             options : [ {  properties : "always"  } ] 
89+         } , 
90+         { 
91+             code : "abstract class Foo { abstract b_ar: number = 0; }" , 
92+             options : [ {  properties : "never"  } ] 
93+         } , 
94+         { 
95+             code : "abstract class Foo { abstract bar: number = 0; }" , 
3296            options : [ {  properties : "always"  } ] 
3397        } 
3498    ] , 
3599
36100    invalid : [ 
37101        { 
38-             code : "interface Foo { b_ar: null  }" , 
102+             code : "interface Foo { b_ar: number  }" , 
39103            options : [ {  properties : "always"  } ] , 
40104            errors : [ 
41105                { 
@@ -44,6 +108,83 @@ ruleTester.run("camelcase", ruleCamelcase, {
44108                    column : 17 
45109                } 
46110            ] 
111+         } , 
112+         { 
113+             code : "class Foo { b_ar: number; }" , 
114+             options : [ {  properties : "always"  } ] , 
115+             errors : [ 
116+                 { 
117+                     message : "Identifier 'b_ar' is not in camel case." , 
118+                     line : 1 , 
119+                     column : 13 
120+                 } 
121+             ] 
122+         } , 
123+         { 
124+             code : "class Foo { constructor(private b_ar: number) {} }" , 
125+             options : [ {  properties : "always"  } ] , 
126+             errors : [ 
127+                 { 
128+                     message : "Identifier 'b_ar' is not in camel case." , 
129+                     line : 1 , 
130+                     column : 33 
131+                 } 
132+             ] 
133+         } , 
134+         { 
135+             code : "class Foo { constructor(private b_ar: number = 0) {} }" , 
136+             options : [ {  properties : "always"  } ] , 
137+             errors : [ 
138+                 { 
139+                     message : "Identifier 'b_ar' is not in camel case." , 
140+                     line : 1 , 
141+                     column : 33 
142+                 } 
143+             ] 
144+         } , 
145+         { 
146+             code : "abstract class Foo { b_ar: number; }" , 
147+             options : [ {  properties : "always"  } ] , 
148+             errors : [ 
149+                 { 
150+                     message : "Identifier 'b_ar' is not in camel case." , 
151+                     line : 1 , 
152+                     column : 22 
153+                 } 
154+             ] 
155+         } , 
156+         { 
157+             code : "abstract class Foo { b_ar: number = 0; }" , 
158+             options : [ {  properties : "always"  } ] , 
159+             errors : [ 
160+                 { 
161+                     message : "Identifier 'b_ar' is not in camel case." , 
162+                     line : 1 , 
163+                     column : 22 
164+                 } 
165+             ] 
166+         } , 
167+         { 
168+             code : "abstract class Foo { abstract b_ar: number; }" , 
169+             options : [ {  properties : "always"  } ] , 
170+             errors : [ 
171+                 { 
172+                     message : "Identifier 'b_ar' is not in camel case." , 
173+                     line : 1 , 
174+                     column : 31 
175+                 } 
176+             ] 
177+         } , 
178+         { 
179+             code : "abstract class Foo { abstract b_ar: number = 0; }" , 
180+             options : [ {  properties : "always"  } ] , 
181+             errors : [ 
182+                 { 
183+                     message : "Identifier 'b_ar' is not in camel case." , 
184+                     line : 1 , 
185+                     column : 31 
186+                 } 
187+             ] 
47188        } 
48189    ] 
49190} ) ; 
0 commit comments