@@ -208,6 +208,40 @@ tester.run('attributes-order', rule, {
208
208
'EVENTS' ,
209
209
'CONTENT' ]
210
210
} ]
211
+ } ,
212
+ {
213
+ filename : 'test.vue' ,
214
+ code :
215
+ `<template>
216
+ <div
217
+ v-if="!visible"
218
+ v-for="item in items"
219
+ v-text="textContent"
220
+ v-once
221
+ is="header"
222
+ v-on:click="functionCall"
223
+ ref="header"
224
+ :prop="headerData"
225
+ id="uniqueID"
226
+ myProp="prop"
227
+ >
228
+ </div>
229
+ </template>` ,
230
+ options : [
231
+ { order :
232
+ [
233
+ 'CONDITIONALS' ,
234
+ 'LIST_RENDERING' ,
235
+ 'CONTENT' ,
236
+ 'RENDER_MODIFIERS' ,
237
+ 'DEFINITION' ,
238
+ 'EVENTS' ,
239
+ 'UNIQUE' ,
240
+ 'BINDING' ,
241
+ 'GLOBAL' ,
242
+ 'OTHER_ATTR'
243
+ ]
244
+ } ]
211
245
}
212
246
] ,
213
247
@@ -339,6 +373,143 @@ tester.run('attributes-order', rule, {
339
373
message : 'Attribute "is" should go before "v-cloak".' ,
340
374
type : 'VIdentifier'
341
375
} ]
376
+ } ,
377
+ {
378
+ filename : 'test.vue' ,
379
+ code :
380
+ `<template>
381
+ <div
382
+ v-if="!visible"
383
+ v-for="item in items"
384
+ v-once
385
+ is="header"
386
+ v-on:click="functionCall"
387
+ ref="header"
388
+ :prop="headerData"
389
+ v-text="textContent"
390
+ id="uniqueID"
391
+ myProp="prop"
392
+ >
393
+ </div>
394
+ </template>` ,
395
+ output :
396
+ `<template>
397
+ <div
398
+ v-for="item in items"
399
+ v-if="!visible"
400
+ is="header"
401
+ v-once
402
+ ref="header"
403
+ v-on:click="functionCall"
404
+ :prop="headerData"
405
+ id="uniqueID"
406
+ v-text="textContent"
407
+ myProp="prop"
408
+ >
409
+ </div>
410
+ </template>` ,
411
+ errors : [
412
+ {
413
+ message : 'Attribute "v-for" should go before "v-if".' ,
414
+ type : 'VDirectiveKey'
415
+ } ,
416
+ {
417
+ message : 'Attribute "is" should go before "v-once".' ,
418
+ type : 'VIdentifier'
419
+ } ,
420
+ {
421
+ message : 'Attribute "ref" should go before "v-on:click".' ,
422
+ type : 'VIdentifier'
423
+ } ,
424
+ {
425
+ message : 'Attribute ":prop" should go before "v-on:click".' ,
426
+ type : 'VDirectiveKey'
427
+ } ,
428
+ {
429
+ message : 'Attribute "id" should go before "v-text".' ,
430
+ type : 'VIdentifier'
431
+ } ,
432
+ {
433
+ message : 'Attribute "myProp" should go before "v-text".' ,
434
+ type : 'VIdentifier'
435
+ }
436
+ ]
437
+ } ,
438
+ {
439
+ filename : 'test.vue' ,
440
+ code :
441
+ `<template>
442
+ <div
443
+ v-if="!visible"
444
+ v-for="item in items"
445
+ v-once
446
+ is="header"
447
+ v-on:click="functionCall"
448
+ ref="header"
449
+ :prop="headerData"
450
+ v-text="textContent"
451
+ id="uniqueID"
452
+ myProp="prop"
453
+ >
454
+ </div>
455
+ </template>` ,
456
+ options : [
457
+ { order :
458
+ [
459
+ 'EVENTS' ,
460
+ 'BINDING' ,
461
+ 'UNIQUE' ,
462
+ 'DEFINITION' ,
463
+ 'CONDITIONALS' ,
464
+ 'LIST_RENDERING' ,
465
+ 'RENDER_MODIFIERS' ,
466
+ 'GLOBAL' ,
467
+ 'OTHER_ATTR' ,
468
+ 'CONTENT'
469
+ ]
470
+ } ] ,
471
+ output :
472
+ `<template>
473
+ <div
474
+ v-if="!visible"
475
+ v-for="item in items"
476
+ is="header"
477
+ v-once
478
+ v-on:click="functionCall"
479
+ ref="header"
480
+ :prop="headerData"
481
+ id="uniqueID"
482
+ v-text="textContent"
483
+ myProp="prop"
484
+ >
485
+ </div>
486
+ </template>` ,
487
+ errors : [
488
+ {
489
+ message : 'Attribute "is" should go before "v-once".' ,
490
+ nodeType : 'VIdentifier'
491
+ } ,
492
+ {
493
+ message : 'Attribute "v-on:click" should go before "v-once".' ,
494
+ nodeType : 'VDirectiveKey'
495
+ } ,
496
+ {
497
+ message : 'Attribute "ref" should go before "v-once".' ,
498
+ nodeType : 'VIdentifier'
499
+ } ,
500
+ {
501
+ message : 'Attribute ":prop" should go before "v-once".' ,
502
+ nodeType : 'VDirectiveKey'
503
+ } ,
504
+ {
505
+ message : 'Attribute "id" should go before "v-text".' ,
506
+ nodeType : 'VIdentifier'
507
+ } ,
508
+ {
509
+ message : 'Attribute "myProp" should go before "v-text".' ,
510
+ nodeType : 'VIdentifier'
511
+ }
512
+ ]
342
513
}
343
514
]
344
515
} )
0 commit comments