11import {
22 convertVariableName ,
3- IgnoreLeadingTrailingUnderscoreMsg ,
3+ ConstRequiredForAllCapsMsg ,
44 ForbiddenLeadingTrailingIdentifierMsg ,
55 IgnoreLeadingTrailingIdentifierMsg ,
6- ForbiddenPascalSnakeMsg ,
7- ConstRequiredForAllCapsMsg ,
8- IgnoreOnlyLeadingUnderscoreMsg ,
9- IgnoreOnlyTrailingUnderscoreMsg ,
106} from "../variable-name" ;
117
128describe ( convertVariableName , ( ) => {
@@ -18,8 +14,15 @@ describe(convertVariableName, () => {
1814 expect ( result ) . toEqual ( {
1915 rules : [
2016 {
21- notices : [ IgnoreLeadingTrailingUnderscoreMsg ] ,
22- ruleName : "camelcase" ,
17+ ruleName : "@typescript-eslint/naming-convention" ,
18+ rules : [
19+ {
20+ selector : "variable" ,
21+ format : [ "camelCase" , "UPPER_CASE" ] ,
22+ leadingUnderscore : "forbid" ,
23+ trailingUnderscore : "forbid" ,
24+ } ,
25+ ] ,
2326 } ,
2427 {
2528 notices : [ ForbiddenLeadingTrailingIdentifierMsg ] ,
@@ -35,16 +38,23 @@ describe(convertVariableName, () => {
3538 } ) ;
3639 } ) ;
3740
38- test ( "conversion with require-const-for-all-caps argument" , ( ) => {
41+ test ( "conversion with require-const-for-all-caps argument without check-format argument " , ( ) => {
3942 const result = convertVariableName ( {
4043 ruleArguments : [ "require-const-for-all-caps" ] ,
4144 } ) ;
4245
4346 expect ( result ) . toEqual ( {
4447 rules : [
4548 {
46- notices : [ IgnoreLeadingTrailingUnderscoreMsg , ConstRequiredForAllCapsMsg ] ,
47- ruleName : "camelcase" ,
49+ ruleName : "@typescript-eslint/naming-convention" ,
50+ rules : [
51+ {
52+ selector : "variable" ,
53+ format : [ "camelCase" , "UPPER_CASE" ] ,
54+ leadingUnderscore : "forbid" ,
55+ trailingUnderscore : "forbid" ,
56+ } ,
57+ ] ,
4858 } ,
4959 {
5060 notices : [ ForbiddenLeadingTrailingIdentifierMsg ] ,
@@ -60,16 +70,23 @@ describe(convertVariableName, () => {
6070 } ) ;
6171 } ) ;
6272
63- test ( "conversion with allow-pascal-case argument" , ( ) => {
73+ test ( "conversion with allow-pascal-case argument without check-format argument " , ( ) => {
6474 const result = convertVariableName ( {
6575 ruleArguments : [ "allow-pascal-case" ] ,
6676 } ) ;
6777
6878 expect ( result ) . toEqual ( {
6979 rules : [
7080 {
71- notices : [ IgnoreLeadingTrailingUnderscoreMsg , ForbiddenPascalSnakeMsg ] ,
72- ruleName : "camelcase" ,
81+ ruleName : "@typescript-eslint/naming-convention" ,
82+ rules : [
83+ {
84+ selector : "variable" ,
85+ format : [ "camelCase" , "UPPER_CASE" ] ,
86+ leadingUnderscore : "forbid" ,
87+ trailingUnderscore : "forbid" ,
88+ } ,
89+ ] ,
7390 } ,
7491 {
7592 notices : [ ForbiddenLeadingTrailingIdentifierMsg ] ,
@@ -85,16 +102,23 @@ describe(convertVariableName, () => {
85102 } ) ;
86103 } ) ;
87104
88- test ( "conversion with allow-snake-case argument" , ( ) => {
105+ test ( "conversion with allow-snake-case argument without check-format argument " , ( ) => {
89106 const result = convertVariableName ( {
90107 ruleArguments : [ "allow-snake-case" ] ,
91108 } ) ;
92109
93110 expect ( result ) . toEqual ( {
94111 rules : [
95112 {
96- ruleName : "camelcase" ,
97- notices : [ IgnoreLeadingTrailingUnderscoreMsg , ForbiddenPascalSnakeMsg ] ,
113+ ruleName : "@typescript-eslint/naming-convention" ,
114+ rules : [
115+ {
116+ selector : "variable" ,
117+ format : [ "camelCase" , "UPPER_CASE" ] ,
118+ leadingUnderscore : "forbid" ,
119+ trailingUnderscore : "forbid" ,
120+ } ,
121+ ] ,
98122 } ,
99123 {
100124 notices : [ ForbiddenLeadingTrailingIdentifierMsg ] ,
@@ -118,8 +142,15 @@ describe(convertVariableName, () => {
118142 expect ( result ) . toEqual ( {
119143 rules : [
120144 {
121- ruleName : "camelcase" ,
122- notices : [ IgnoreLeadingTrailingUnderscoreMsg ] ,
145+ ruleName : "@typescript-eslint/naming-convention" ,
146+ rules : [
147+ {
148+ selector : "variable" ,
149+ format : [ "camelCase" , "UPPER_CASE" ] ,
150+ leadingUnderscore : "forbid" ,
151+ trailingUnderscore : "forbid" ,
152+ } ,
153+ ] ,
123154 } ,
124155 {
125156 ruleName : "no-underscore-dangle" ,
@@ -143,8 +174,15 @@ describe(convertVariableName, () => {
143174 expect ( result ) . toEqual ( {
144175 rules : [
145176 {
146- notices : [ IgnoreLeadingTrailingUnderscoreMsg ] ,
147- ruleName : "camelcase" ,
177+ ruleName : "@typescript-eslint/naming-convention" ,
178+ rules : [
179+ {
180+ selector : "variable" ,
181+ format : [ "camelCase" , "UPPER_CASE" ] ,
182+ leadingUnderscore : "forbid" ,
183+ trailingUnderscore : "forbid" ,
184+ } ,
185+ ] ,
148186 } ,
149187 {
150188 notices : [ ForbiddenLeadingTrailingIdentifierMsg ] ,
@@ -168,8 +206,48 @@ describe(convertVariableName, () => {
168206 expect ( result ) . toEqual ( {
169207 rules : [
170208 {
171- notices : [ IgnoreLeadingTrailingUnderscoreMsg ] ,
172- ruleName : "camelcase" ,
209+ ruleName : "@typescript-eslint/naming-convention" ,
210+ rules : [
211+ {
212+ selector : "variable" ,
213+ format : [ "camelCase" , "UPPER_CASE" ] ,
214+ leadingUnderscore : "forbid" ,
215+ trailingUnderscore : "forbid" ,
216+ } ,
217+ ] ,
218+ } ,
219+ {
220+ notices : [ ForbiddenLeadingTrailingIdentifierMsg ] ,
221+ ruleName : "no-underscore-dangle" ,
222+ } ,
223+ {
224+ ruleName : "id-blacklist" ,
225+ } ,
226+ {
227+ ruleName : "id-match" ,
228+ } ,
229+ ] ,
230+ } ) ;
231+ } ) ;
232+
233+ test ( "conversion with require-const-for-all-caps argument and check-format argument" , ( ) => {
234+ const result = convertVariableName ( {
235+ ruleArguments : [ "check-format" , "require-const-for-all-caps" ] ,
236+ } ) ;
237+
238+ expect ( result ) . toEqual ( {
239+ rules : [
240+ {
241+ notices : [ ConstRequiredForAllCapsMsg ] ,
242+ ruleName : "@typescript-eslint/naming-convention" ,
243+ rules : [
244+ {
245+ selector : "variable" ,
246+ format : [ "camelCase" , "UPPER_CASE" ] ,
247+ leadingUnderscore : "forbid" ,
248+ trailingUnderscore : "forbid" ,
249+ } ,
250+ ] ,
173251 } ,
174252 {
175253 notices : [ ForbiddenLeadingTrailingIdentifierMsg ] ,
@@ -193,8 +271,15 @@ describe(convertVariableName, () => {
193271 expect ( result ) . toEqual ( {
194272 rules : [
195273 {
196- notices : [ IgnoreOnlyLeadingUnderscoreMsg ] ,
197- ruleName : "camelcase" ,
274+ ruleName : "@typescript-eslint/naming-convention" ,
275+ rules : [
276+ {
277+ selector : "variable" ,
278+ format : [ "camelCase" , "UPPER_CASE" ] ,
279+ leadingUnderscore : "allow" ,
280+ trailingUnderscore : "forbid" ,
281+ } ,
282+ ] ,
198283 } ,
199284 {
200285 notices : [ IgnoreLeadingTrailingIdentifierMsg ] ,
@@ -219,8 +304,15 @@ describe(convertVariableName, () => {
219304 expect ( result ) . toEqual ( {
220305 rules : [
221306 {
222- notices : [ IgnoreOnlyTrailingUnderscoreMsg ] ,
223- ruleName : "camelcase" ,
307+ ruleName : "@typescript-eslint/naming-convention" ,
308+ rules : [
309+ {
310+ selector : "variable" ,
311+ format : [ "camelCase" , "UPPER_CASE" ] ,
312+ leadingUnderscore : "forbid" ,
313+ trailingUnderscore : "allow" ,
314+ } ,
315+ ] ,
224316 } ,
225317 {
226318 notices : [ IgnoreLeadingTrailingIdentifierMsg ] ,
@@ -249,8 +341,15 @@ describe(convertVariableName, () => {
249341 expect ( result ) . toEqual ( {
250342 rules : [
251343 {
252- notices : [ ] ,
253- ruleName : "camelcase" ,
344+ ruleName : "@typescript-eslint/naming-convention" ,
345+ rules : [
346+ {
347+ selector : "variable" ,
348+ format : [ "camelCase" , "UPPER_CASE" ] ,
349+ leadingUnderscore : "allow" ,
350+ trailingUnderscore : "allow" ,
351+ } ,
352+ ] ,
254353 } ,
255354 {
256355 notices : [ IgnoreLeadingTrailingIdentifierMsg ] ,
@@ -283,8 +382,16 @@ describe(convertVariableName, () => {
283382 expect ( result ) . toEqual ( {
284383 rules : [
285384 {
286- ruleName : "camelcase" ,
287- notices : [ ConstRequiredForAllCapsMsg , ForbiddenPascalSnakeMsg ] ,
385+ ruleName : "@typescript-eslint/naming-convention" ,
386+ rules : [
387+ {
388+ selector : "variable" ,
389+ format : [ "camelCase" , "UPPER_CASE" ] ,
390+ leadingUnderscore : "allow" ,
391+ trailingUnderscore : "allow" ,
392+ } ,
393+ ] ,
394+ notices : [ ConstRequiredForAllCapsMsg ] ,
288395 } ,
289396 {
290397 ruleName : "no-underscore-dangle" ,
0 commit comments