@neralabs/rerail-pack-vue 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,749 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "eslint-plugin-vue-no-template-shadow",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "Avoid naming a v-for alias or slot parameter after an outer template variable, prop, data, computed, method or setup binding; it shadows that name.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*.vue"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "upstream",
16
+ "forbid": {
17
+ "ast": {
18
+ "language": "vue",
19
+ "embedded": "script-block",
20
+ "utils": {
21
+ "view-arrow": {
22
+ "kind": "arrow_function",
23
+ "any": [
24
+ {
25
+ "inside": {
26
+ "kind": "expression_statement"
27
+ }
28
+ },
29
+ {
30
+ "inside": {
31
+ "kind": "sequence_expression",
32
+ "inside": {
33
+ "kind": "expression_statement"
34
+ }
35
+ }
36
+ }
37
+ ],
38
+ "inside": {
39
+ "stopBy": "end",
40
+ "kind": "statement_block",
41
+ "host": {
42
+ "kind": "template_element"
43
+ }
44
+ }
45
+ },
46
+ "view-param": {
47
+ "all": [
48
+ {
49
+ "any": [
50
+ {
51
+ "kind": "identifier"
52
+ },
53
+ {
54
+ "kind": "shorthand_property_identifier_pattern"
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ "binds": {
60
+ "form": "parameter"
61
+ }
62
+ },
63
+ {
64
+ "inside": {
65
+ "stopBy": "end",
66
+ "kind": "formal_parameters",
67
+ "inside": {
68
+ "matches": "view-arrow"
69
+ }
70
+ }
71
+ }
72
+ ]
73
+ },
74
+ "setup-statement": {
75
+ "follows": {
76
+ "stopBy": "end",
77
+ "kind": "empty_statement",
78
+ "host": {
79
+ "kind": "start_tag",
80
+ "regex": "^<script(?:\\s+[^\\s\"'<>/=]+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s\"'<>=`]+))?)*\\s+setup(?:[\\s/>=]|$)"
81
+ }
82
+ },
83
+ "not": {
84
+ "follows": {
85
+ "stopBy": "end",
86
+ "kind": "empty_statement",
87
+ "host": {
88
+ "kind": "start_tag",
89
+ "regex": "^<script\\b",
90
+ "not": {
91
+ "regex": "^<script(?:\\s+[^\\s\"'<>/=]+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s\"'<>=`]+))?)*\\s+setup(?:[\\s/>=]|$)"
92
+ }
93
+ },
94
+ "follows": {
95
+ "stopBy": "end",
96
+ "kind": "empty_statement",
97
+ "host": {
98
+ "kind": "start_tag",
99
+ "regex": "^<script(?:\\s+[^\\s\"'<>/=]+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s\"'<>=`]+))?)*\\s+setup(?:[\\s/>=]|$)"
100
+ }
101
+ }
102
+ }
103
+ }
104
+ },
105
+ "component-object": {
106
+ "kind": "object",
107
+ "any": [
108
+ {
109
+ "inside": {
110
+ "kind": "export_statement"
111
+ }
112
+ },
113
+ {
114
+ "inside": {
115
+ "kind": "arguments",
116
+ "inside": {
117
+ "kind": "call_expression",
118
+ "has": {
119
+ "field": "function",
120
+ "any": [
121
+ {
122
+ "regex": "^(defineNuxtComponent|Vue\\.(component|mixin|extend)|[A-Za-z_$][\\w$]*\\.(component|mixin))$"
123
+ },
124
+ {
125
+ "kind": "identifier",
126
+ "regex": "^(defineComponent|component|createApp)$",
127
+ "not": {
128
+ "resolves": {
129
+ "binding": {
130
+ "only": true,
131
+ "site": {
132
+ "any": [
133
+ {
134
+ "kind": "import_specifier",
135
+ "not": {
136
+ "inside": {
137
+ "stopBy": "end",
138
+ "kind": "import_statement",
139
+ "has": {
140
+ "field": "source",
141
+ "kind": "string",
142
+ "value": {
143
+ "regex": "^(?:vue|@vue/composition-api|@nuxtjs/composition-api|#imports)$"
144
+ }
145
+ }
146
+ }
147
+ }
148
+ },
149
+ {
150
+ "kind": "function_declaration"
151
+ },
152
+ {
153
+ "kind": "generator_function_declaration"
154
+ },
155
+ {
156
+ "kind": "class_declaration"
157
+ },
158
+ {
159
+ "kind": "catch_clause"
160
+ },
161
+ {
162
+ "kind": "variable_declarator",
163
+ "all": [
164
+ {
165
+ "has": {
166
+ "field": "name",
167
+ "kind": "object_pattern"
168
+ }
169
+ },
170
+ {
171
+ "has": {
172
+ "field": "value",
173
+ "kind": "call_expression",
174
+ "all": [
175
+ {
176
+ "has": {
177
+ "field": "function",
178
+ "kind": "identifier",
179
+ "regex": "^require$"
180
+ }
181
+ },
182
+ {
183
+ "not": {
184
+ "has": {
185
+ "field": "arguments",
186
+ "has": {
187
+ "kind": "string",
188
+ "value": {
189
+ "regex": "^(?:vue|@vue/composition-api|@nuxtjs/composition-api|#imports)$"
190
+ }
191
+ }
192
+ }
193
+ }
194
+ }
195
+ ]
196
+ }
197
+ }
198
+ ]
199
+ }
200
+ ]
201
+ }
202
+ }
203
+ }
204
+ }
205
+ }
206
+ ]
207
+ }
208
+ }
209
+ }
210
+ },
211
+ {
212
+ "inside": {
213
+ "kind": "arguments",
214
+ "inside": {
215
+ "kind": "new_expression",
216
+ "has": {
217
+ "field": "constructor",
218
+ "regex": "^Vue$"
219
+ }
220
+ }
221
+ }
222
+ }
223
+ ]
224
+ },
225
+ "group-pair": {
226
+ "kind": "pair",
227
+ "has": {
228
+ "field": "key",
229
+ "regex": "^['\"]?(props|computed|data|asyncData|methods|setup)['\"]?$"
230
+ },
231
+ "inside": {
232
+ "matches": "component-object"
233
+ }
234
+ },
235
+ "group-method": {
236
+ "kind": "method_definition",
237
+ "has": {
238
+ "field": "name",
239
+ "regex": "^['\"]?(props|computed|data|asyncData|methods|setup)['\"]?$"
240
+ },
241
+ "inside": {
242
+ "matches": "component-object"
243
+ }
244
+ },
245
+ "group-function": {
246
+ "any": [
247
+ {
248
+ "matches": "group-method"
249
+ },
250
+ {
251
+ "any": [
252
+ {
253
+ "kind": "function_expression"
254
+ },
255
+ {
256
+ "kind": "generator_function"
257
+ },
258
+ {
259
+ "kind": "arrow_function"
260
+ }
261
+ ],
262
+ "inside": {
263
+ "matches": "group-pair"
264
+ }
265
+ }
266
+ ]
267
+ },
268
+ "group-object": {
269
+ "kind": "object",
270
+ "any": [
271
+ {
272
+ "inside": {
273
+ "matches": "group-pair"
274
+ }
275
+ },
276
+ {
277
+ "inside": {
278
+ "kind": "return_statement",
279
+ "inside": {
280
+ "kind": "statement_block",
281
+ "inside": {
282
+ "matches": "group-function"
283
+ }
284
+ }
285
+ }
286
+ },
287
+ {
288
+ "inside": {
289
+ "kind": "parenthesized_expression",
290
+ "inside": {
291
+ "kind": "arrow_function",
292
+ "matches": "group-function"
293
+ }
294
+ }
295
+ }
296
+ ]
297
+ },
298
+ "member-key": {
299
+ "any": [
300
+ {
301
+ "kind": "pair",
302
+ "any": [
303
+ {
304
+ "has": {
305
+ "field": "key",
306
+ "any": [
307
+ {
308
+ "kind": "property_identifier"
309
+ },
310
+ {
311
+ "kind": "string"
312
+ }
313
+ ],
314
+ "pattern": "$K"
315
+ }
316
+ },
317
+ {
318
+ "has": {
319
+ "field": "key",
320
+ "kind": "computed_property_name",
321
+ "has": {
322
+ "kind": "string",
323
+ "pattern": "$K"
324
+ }
325
+ }
326
+ }
327
+ ]
328
+ },
329
+ {
330
+ "kind": "method_definition",
331
+ "any": [
332
+ {
333
+ "has": {
334
+ "field": "name",
335
+ "any": [
336
+ {
337
+ "kind": "property_identifier"
338
+ },
339
+ {
340
+ "kind": "string"
341
+ }
342
+ ],
343
+ "pattern": "$K"
344
+ }
345
+ },
346
+ {
347
+ "has": {
348
+ "field": "name",
349
+ "kind": "computed_property_name",
350
+ "has": {
351
+ "kind": "string",
352
+ "pattern": "$K"
353
+ }
354
+ }
355
+ }
356
+ ]
357
+ },
358
+ {
359
+ "kind": "shorthand_property_identifier",
360
+ "pattern": "$K"
361
+ }
362
+ ]
363
+ },
364
+ "define-props-call": {
365
+ "kind": "call_expression",
366
+ "has": {
367
+ "field": "function",
368
+ "kind": "identifier",
369
+ "regex": "^defineProps$"
370
+ },
371
+ "inside": {
372
+ "stopBy": "end",
373
+ "matches": "setup-statement"
374
+ }
375
+ }
376
+ },
377
+ "rule": {
378
+ "pattern": "$NAME",
379
+ "all": [
380
+ {
381
+ "matches": "view-param"
382
+ },
383
+ {
384
+ "any": [
385
+ {
386
+ "inside": {
387
+ "stopBy": "end",
388
+ "kind": "formal_parameters",
389
+ "inside": {
390
+ "matches": "view-arrow",
391
+ "inside": {
392
+ "stopBy": "end",
393
+ "matches": "view-arrow",
394
+ "has": {
395
+ "stopBy": "neighbor",
396
+ "kind": "formal_parameters",
397
+ "has": {
398
+ "stopBy": "end",
399
+ "all": [
400
+ {
401
+ "any": [
402
+ {
403
+ "kind": "identifier"
404
+ },
405
+ {
406
+ "kind": "shorthand_property_identifier_pattern"
407
+ }
408
+ ]
409
+ },
410
+ {
411
+ "binds": {
412
+ "form": "parameter"
413
+ }
414
+ },
415
+ {
416
+ "pattern": "$Q"
417
+ },
418
+ {
419
+ "compare": {
420
+ "left": "NAME",
421
+ "op": "eq",
422
+ "right": "Q"
423
+ }
424
+ }
425
+ ]
426
+ }
427
+ }
428
+ }
429
+ }
430
+ }
431
+ },
432
+ {
433
+ "inside": {
434
+ "kind": "program",
435
+ "stopBy": "end",
436
+ "has": {
437
+ "stopBy": "end",
438
+ "all": [
439
+ {
440
+ "any": [
441
+ {
442
+ "kind": "identifier"
443
+ },
444
+ {
445
+ "kind": "shorthand_property_identifier_pattern"
446
+ }
447
+ ]
448
+ },
449
+ {
450
+ "binds": {
451
+ "scope": [
452
+ "module",
453
+ "global"
454
+ ]
455
+ }
456
+ },
457
+ {
458
+ "pattern": "$K"
459
+ },
460
+ {
461
+ "compare": {
462
+ "left": "NAME",
463
+ "op": "eq",
464
+ "right": "K",
465
+ "text": "unquoted"
466
+ }
467
+ },
468
+ {
469
+ "inside": {
470
+ "stopBy": "end",
471
+ "matches": "setup-statement"
472
+ }
473
+ }
474
+ ]
475
+ }
476
+ }
477
+ },
478
+ {
479
+ "inside": {
480
+ "kind": "program",
481
+ "stopBy": "end",
482
+ "has": {
483
+ "stopBy": "end",
484
+ "any": [
485
+ {
486
+ "all": [
487
+ {
488
+ "matches": "member-key"
489
+ },
490
+ {
491
+ "compare": {
492
+ "left": "NAME",
493
+ "op": "eq",
494
+ "right": "K",
495
+ "text": "unquoted"
496
+ }
497
+ },
498
+ {
499
+ "inside": {
500
+ "kind": "object",
501
+ "inside": {
502
+ "kind": "arguments",
503
+ "inside": {
504
+ "matches": "define-props-call"
505
+ }
506
+ }
507
+ }
508
+ }
509
+ ]
510
+ },
511
+ {
512
+ "all": [
513
+ {
514
+ "kind": "string",
515
+ "pattern": "$K"
516
+ },
517
+ {
518
+ "compare": {
519
+ "left": "NAME",
520
+ "op": "eq",
521
+ "right": "K",
522
+ "text": "unquoted"
523
+ }
524
+ },
525
+ {
526
+ "inside": {
527
+ "kind": "array",
528
+ "inside": {
529
+ "kind": "arguments",
530
+ "inside": {
531
+ "matches": "define-props-call"
532
+ }
533
+ }
534
+ }
535
+ }
536
+ ]
537
+ },
538
+ {
539
+ "all": [
540
+ {
541
+ "any": [
542
+ {
543
+ "kind": "property_signature"
544
+ },
545
+ {
546
+ "kind": "method_signature"
547
+ }
548
+ ]
549
+ },
550
+ {
551
+ "has": {
552
+ "field": "name",
553
+ "any": [
554
+ {
555
+ "kind": "property_identifier"
556
+ },
557
+ {
558
+ "kind": "string"
559
+ }
560
+ ],
561
+ "pattern": "$K"
562
+ }
563
+ },
564
+ {
565
+ "compare": {
566
+ "left": "NAME",
567
+ "op": "eq",
568
+ "right": "K",
569
+ "text": "unquoted"
570
+ }
571
+ },
572
+ {
573
+ "inside": {
574
+ "kind": "object_type",
575
+ "inside": {
576
+ "kind": "type_arguments",
577
+ "inside": {
578
+ "matches": "define-props-call"
579
+ }
580
+ }
581
+ }
582
+ }
583
+ ]
584
+ },
585
+ {
586
+ "all": [
587
+ {
588
+ "any": [
589
+ {
590
+ "kind": "property_signature"
591
+ },
592
+ {
593
+ "kind": "method_signature"
594
+ }
595
+ ]
596
+ },
597
+ {
598
+ "has": {
599
+ "field": "name",
600
+ "any": [
601
+ {
602
+ "kind": "property_identifier"
603
+ },
604
+ {
605
+ "kind": "string"
606
+ }
607
+ ],
608
+ "pattern": "$K"
609
+ }
610
+ },
611
+ {
612
+ "compare": {
613
+ "left": "NAME",
614
+ "op": "eq",
615
+ "right": "K",
616
+ "text": "unquoted"
617
+ }
618
+ },
619
+ {
620
+ "inside": {
621
+ "any": [
622
+ {
623
+ "kind": "interface_body"
624
+ },
625
+ {
626
+ "kind": "object_type"
627
+ }
628
+ ],
629
+ "inside": {
630
+ "any": [
631
+ {
632
+ "kind": "interface_declaration"
633
+ },
634
+ {
635
+ "kind": "type_alias_declaration"
636
+ }
637
+ ],
638
+ "has": {
639
+ "field": "name",
640
+ "kind": "type_identifier",
641
+ "pattern": "$TD"
642
+ }
643
+ }
644
+ }
645
+ },
646
+ {
647
+ "inside": {
648
+ "kind": "program",
649
+ "stopBy": "end",
650
+ "has": {
651
+ "stopBy": "end",
652
+ "kind": "type_identifier",
653
+ "pattern": "$TU",
654
+ "compare": {
655
+ "left": "TD",
656
+ "op": "eq",
657
+ "right": "TU"
658
+ },
659
+ "inside": {
660
+ "kind": "type_arguments",
661
+ "inside": {
662
+ "matches": "define-props-call"
663
+ }
664
+ }
665
+ }
666
+ }
667
+ }
668
+ ]
669
+ }
670
+ ]
671
+ }
672
+ }
673
+ },
674
+ {
675
+ "inside": {
676
+ "kind": "program",
677
+ "stopBy": "end",
678
+ "has": {
679
+ "stopBy": "end",
680
+ "any": [
681
+ {
682
+ "all": [
683
+ {
684
+ "matches": "member-key"
685
+ },
686
+ {
687
+ "compare": {
688
+ "left": "NAME",
689
+ "op": "eq",
690
+ "right": "K",
691
+ "text": "unquoted"
692
+ }
693
+ },
694
+ {
695
+ "inside": {
696
+ "matches": "group-object"
697
+ }
698
+ }
699
+ ]
700
+ },
701
+ {
702
+ "all": [
703
+ {
704
+ "kind": "string",
705
+ "pattern": "$K"
706
+ },
707
+ {
708
+ "compare": {
709
+ "left": "NAME",
710
+ "op": "eq",
711
+ "right": "K",
712
+ "text": "unquoted"
713
+ }
714
+ },
715
+ {
716
+ "inside": {
717
+ "kind": "array",
718
+ "inside": {
719
+ "matches": "group-pair"
720
+ }
721
+ }
722
+ }
723
+ ]
724
+ }
725
+ ]
726
+ }
727
+ }
728
+ }
729
+ ]
730
+ }
731
+ ]
732
+ }
733
+ }
734
+ },
735
+ "violation": {
736
+ "anchor": "witness.span",
737
+ "code": "vue/no-template-shadow",
738
+ "message": "Variable '$NAME' is already declared in the upper scope.",
739
+ "suppress": {
740
+ "eslint": {
741
+ "rules": [
742
+ "vue/no-template-shadow"
743
+ ]
744
+ }
745
+ }
746
+ }
747
+ }
748
+ ]
749
+ }