@@ -121,6 +121,13 @@ ruleTester.run('prop-name-casing', rule, {
121
121
}
122
122
}
123
123
` ,
124
+ output : `
125
+ export default {
126
+ props: {
127
+ greetingText: String
128
+ }
129
+ }
130
+ ` ,
124
131
parserOptions,
125
132
errors : [ {
126
133
message : 'Prop "greeting_text" is not in camelCase.' ,
@@ -138,6 +145,13 @@ ruleTester.run('prop-name-casing', rule, {
138
145
}
139
146
` ,
140
147
options : [ 'camelCase' ] ,
148
+ output : `
149
+ export default {
150
+ props: {
151
+ greetingText: String
152
+ }
153
+ }
154
+ ` ,
141
155
parserOptions,
142
156
errors : [ {
143
157
message : 'Prop "greeting_text" is not in camelCase.' ,
@@ -155,6 +169,13 @@ ruleTester.run('prop-name-casing', rule, {
155
169
}
156
170
` ,
157
171
options : [ 'snake_case' ] ,
172
+ output : `
173
+ export default {
174
+ props: {
175
+ greeting_text: String
176
+ }
177
+ }
178
+ ` ,
158
179
parserOptions,
159
180
errors : [ {
160
181
message : 'Prop "greetingText" is not in snake_case.' ,
@@ -172,6 +193,13 @@ ruleTester.run('prop-name-casing', rule, {
172
193
}
173
194
` ,
174
195
options : [ 'camelCase' ] ,
196
+ output : `
197
+ export default {
198
+ props: {
199
+ 'greetingText': String
200
+ }
201
+ }
202
+ ` ,
175
203
parserOptions,
176
204
errors : [ {
177
205
message : 'Prop "greeting-text" is not in camelCase.' ,
@@ -189,12 +217,156 @@ ruleTester.run('prop-name-casing', rule, {
189
217
}
190
218
` ,
191
219
options : [ 'snake_case' ] ,
220
+ output : `
221
+ export default {
222
+ props: {
223
+ 'greeting_text': String
224
+ }
225
+ }
226
+ ` ,
192
227
parserOptions,
193
228
errors : [ {
194
229
message : 'Prop "greeting-text" is not in snake_case.' ,
195
230
type : 'Property' ,
196
231
line : 4
197
232
} ]
233
+ } ,
234
+ {
235
+ filename : 'test.vue' ,
236
+ code : `
237
+ export default {
238
+ props: {
239
+ 'greeting_text': String
240
+ }
241
+ }
242
+ ` ,
243
+ output : `
244
+ export default {
245
+ props: {
246
+ 'greetingText': String
247
+ }
248
+ }
249
+ ` ,
250
+ parserOptions,
251
+ errors : [ {
252
+ message : 'Prop "greeting_text" is not in camelCase.' ,
253
+ type : 'Property' ,
254
+ line : 4
255
+ } ]
256
+ } ,
257
+ {
258
+ // computed property name
259
+ filename : 'test.vue' ,
260
+ code : `
261
+ export default {
262
+ props: {
263
+ ['greeting-text']: String
264
+ }
265
+ }
266
+ ` ,
267
+ output : null ,
268
+ parserOptions,
269
+ errors : [ {
270
+ message : 'Prop "greeting-text" is not in camelCase.' ,
271
+ type : 'Property' ,
272
+ line : 4
273
+ } ]
274
+ } ,
275
+ {
276
+ // shorthand
277
+ filename : 'test.vue' ,
278
+ code : `
279
+ export default {
280
+ props: {
281
+ greeting_text
282
+ }
283
+ }
284
+ ` ,
285
+ output : null ,
286
+ parserOptions,
287
+ errors : [ {
288
+ message : 'Prop "greeting_text" is not in camelCase.' ,
289
+ type : 'Property' ,
290
+ line : 4
291
+ } ]
292
+ } ,
293
+ {
294
+ // valiable computed property name
295
+ filename : 'test.vue' ,
296
+ code : `
297
+ export default {
298
+ props: {
299
+ [greeting_text]: String
300
+ }
301
+ }
302
+ ` ,
303
+ output : null ,
304
+ parserOptions,
305
+ errors : [ {
306
+ // bug ?
307
+ message : 'Prop "greeting_text" is not in camelCase.' ,
308
+ type : 'Property' ,
309
+ line : 4
310
+ } ]
311
+ } ,
312
+ {
313
+ // emoji
314
+ filename : 'test.vue' ,
315
+ code : `
316
+ export default {
317
+ props: {
318
+ '\u{1F37B}': String
319
+ }
320
+ }
321
+ ` ,
322
+ output : null ,
323
+ parserOptions,
324
+ errors : [ {
325
+ message : 'Prop "\u{1F37B}" is not in camelCase.' ,
326
+ type : 'Property' ,
327
+ line : 4
328
+ } ]
329
+ } ,
330
+ {
331
+ // Japanese characters
332
+ filename : 'test.vue' ,
333
+ code : `
334
+ export default {
335
+ props: {
336
+ '漢字': String
337
+ }
338
+ }
339
+ ` ,
340
+ output : null ,
341
+ parserOptions,
342
+ errors : [ {
343
+ message : 'Prop "漢字" is not in camelCase.' ,
344
+ type : 'Property' ,
345
+ line : 4
346
+ } ]
347
+ } ,
348
+ {
349
+ filename : 'test.vue' ,
350
+ code : `
351
+ export default {
352
+ props: {
353
+ 'abc-123-def': String
354
+ }
355
+ }
356
+ ` ,
357
+ output : `
358
+ export default {
359
+ props: {
360
+ 'abc123Def': String
361
+ }
362
+ }
363
+ ` ,
364
+ parserOptions,
365
+ errors : [ {
366
+ message : 'Prop "abc-123-def" is not in camelCase.' ,
367
+ type : 'Property' ,
368
+ line : 4
369
+ } ]
198
370
}
199
371
]
200
372
} )
0 commit comments