@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,1627 @@
1
+ {
2
+ "format": "rerail.policy/v1",
3
+ "id": "eslint-plugin-vue-no-side-effects-in-computed-properties",
4
+ "revision": 1,
5
+ "mode": "steer",
6
+ "description": "Keep Vue computed properties free of side effects such as assigning to or mutating component state; a computed should only derive a value.",
7
+ "scope": {
8
+ "include": [
9
+ "**/*.vue"
10
+ ],
11
+ "exclude": []
12
+ },
13
+ "clauses": [
14
+ {
15
+ "id": "shared",
16
+ "define": {
17
+ "language": "vue",
18
+ "utils": {
19
+ "fn-like": {
20
+ "any": [
21
+ {
22
+ "kind": "function_declaration"
23
+ },
24
+ {
25
+ "kind": "function_expression"
26
+ },
27
+ {
28
+ "kind": "arrow_function"
29
+ },
30
+ {
31
+ "kind": "generator_function"
32
+ },
33
+ {
34
+ "kind": "generator_function_declaration"
35
+ },
36
+ {
37
+ "kind": "method_definition"
38
+ }
39
+ ]
40
+ },
41
+ "fn-expr": {
42
+ "any": [
43
+ {
44
+ "kind": "function_expression"
45
+ },
46
+ {
47
+ "kind": "generator_function"
48
+ }
49
+ ]
50
+ },
51
+ "paren-as": {
52
+ "any": [
53
+ {
54
+ "kind": "parenthesized_expression"
55
+ },
56
+ {
57
+ "kind": "as_expression"
58
+ }
59
+ ]
60
+ },
61
+ "setup-marker": {
62
+ "kind": "empty_statement",
63
+ "host": {
64
+ "kind": "start_tag",
65
+ "regex": "^<script(?:\\s+[^\\s\"'<>/=]+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s\"'<>=`]+))?)*\\s+setup(?:[\\s/>=]|$)"
66
+ }
67
+ },
68
+ "any-marker": {
69
+ "kind": "empty_statement",
70
+ "host": {
71
+ "kind": "start_tag",
72
+ "regex": "^<script\\b"
73
+ }
74
+ },
75
+ "top-in-setup": {
76
+ "all": [
77
+ {
78
+ "inside": {
79
+ "stopBy": "neighbor",
80
+ "kind": "program"
81
+ }
82
+ },
83
+ {
84
+ "follows": {
85
+ "stopBy": {
86
+ "matches": "any-marker"
87
+ },
88
+ "matches": "setup-marker"
89
+ }
90
+ }
91
+ ]
92
+ },
93
+ "in-setup": {
94
+ "any": [
95
+ {
96
+ "matches": "top-in-setup"
97
+ },
98
+ {
99
+ "inside": {
100
+ "stopBy": "end",
101
+ "matches": "top-in-setup"
102
+ }
103
+ }
104
+ ]
105
+ },
106
+ "file-setup": {
107
+ "inside": {
108
+ "stopBy": "end",
109
+ "kind": "program",
110
+ "has": {
111
+ "stopBy": "neighbor",
112
+ "matches": "setup-marker"
113
+ }
114
+ }
115
+ },
116
+ "file-plain": {
117
+ "not": {
118
+ "matches": "file-setup"
119
+ }
120
+ },
121
+ "key-computed": {
122
+ "any": [
123
+ {
124
+ "regex": "^(?:computed|'computed'|\"computed\")$",
125
+ "not": {
126
+ "kind": "computed_property_name"
127
+ }
128
+ },
129
+ {
130
+ "kind": "computed_property_name",
131
+ "has": {
132
+ "stopBy": "neighbor",
133
+ "kind": "string",
134
+ "regex": "^(?:'computed'|\"computed\")$"
135
+ }
136
+ }
137
+ ]
138
+ },
139
+ "key-get": {
140
+ "any": [
141
+ {
142
+ "regex": "^(?:get|'get'|\"get\")$",
143
+ "not": {
144
+ "kind": "computed_property_name"
145
+ }
146
+ },
147
+ {
148
+ "kind": "computed_property_name",
149
+ "has": {
150
+ "stopBy": "neighbor",
151
+ "kind": "string",
152
+ "regex": "^(?:'get'|\"get\")$"
153
+ }
154
+ }
155
+ ]
156
+ },
157
+ "key-setup": {
158
+ "any": [
159
+ {
160
+ "regex": "^(?:setup|'setup'|\"setup\")$",
161
+ "not": {
162
+ "kind": "computed_property_name"
163
+ }
164
+ },
165
+ {
166
+ "kind": "computed_property_name",
167
+ "has": {
168
+ "stopBy": "neighbor",
169
+ "kind": "string",
170
+ "regex": "^(?:'setup'|\"setup\")$"
171
+ }
172
+ }
173
+ ]
174
+ },
175
+ "last-arg": {
176
+ "any": [
177
+ {
178
+ "all": [
179
+ {
180
+ "inside": {
181
+ "stopBy": "neighbor",
182
+ "kind": "arguments"
183
+ }
184
+ },
185
+ {
186
+ "nthChild": {
187
+ "position": 1,
188
+ "reverse": true,
189
+ "ofRule": {
190
+ "not": {
191
+ "kind": "comment"
192
+ }
193
+ }
194
+ }
195
+ }
196
+ ]
197
+ },
198
+ {
199
+ "inside": {
200
+ "stopBy": "neighbor",
201
+ "all": [
202
+ {
203
+ "matches": "paren-as"
204
+ },
205
+ {
206
+ "matches": "last-arg"
207
+ }
208
+ ]
209
+ }
210
+ }
211
+ ]
212
+ },
213
+ "first-arg": {
214
+ "any": [
215
+ {
216
+ "all": [
217
+ {
218
+ "inside": {
219
+ "stopBy": "neighbor",
220
+ "kind": "arguments"
221
+ }
222
+ },
223
+ {
224
+ "nthChild": {
225
+ "position": 1,
226
+ "ofRule": {
227
+ "not": {
228
+ "kind": "comment"
229
+ }
230
+ }
231
+ }
232
+ }
233
+ ]
234
+ },
235
+ {
236
+ "inside": {
237
+ "stopBy": "neighbor",
238
+ "all": [
239
+ {
240
+ "matches": "paren-as"
241
+ },
242
+ {
243
+ "matches": "first-arg"
244
+ }
245
+ ]
246
+ }
247
+ }
248
+ ]
249
+ },
250
+ "define-callee": {
251
+ "any": [
252
+ {
253
+ "kind": "member_expression",
254
+ "all": [
255
+ {
256
+ "has": {
257
+ "field": "object",
258
+ "kind": "identifier"
259
+ }
260
+ },
261
+ {
262
+ "has": {
263
+ "field": "property",
264
+ "regex": "^(?:component|mixin)$"
265
+ }
266
+ }
267
+ ]
268
+ },
269
+ {
270
+ "kind": "member_expression",
271
+ "all": [
272
+ {
273
+ "has": {
274
+ "field": "object",
275
+ "kind": "identifier",
276
+ "regex": "^Vue$"
277
+ }
278
+ },
279
+ {
280
+ "has": {
281
+ "field": "property",
282
+ "regex": "^extend$"
283
+ }
284
+ }
285
+ ]
286
+ },
287
+ {
288
+ "kind": "identifier",
289
+ "regex": "^defineNuxtComponent$"
290
+ },
291
+ {
292
+ "kind": "identifier",
293
+ "regex": "^(?:component|createApp|defineComponent)$",
294
+ "not": {
295
+ "resolves": {
296
+ "binding": {
297
+ "site": {
298
+ "any": [
299
+ {
300
+ "kind": "import_specifier",
301
+ "not": {
302
+ "inside": {
303
+ "stopBy": "end",
304
+ "kind": "import_statement",
305
+ "has": {
306
+ "field": "source",
307
+ "kind": "string",
308
+ "value": {
309
+ "regex": "^(?:vue|@vue/composition-api|@nuxtjs/composition-api|#imports)$"
310
+ }
311
+ }
312
+ }
313
+ }
314
+ },
315
+ {
316
+ "kind": "function_declaration"
317
+ },
318
+ {
319
+ "kind": "generator_function_declaration"
320
+ },
321
+ {
322
+ "kind": "class_declaration"
323
+ },
324
+ {
325
+ "kind": "catch_clause"
326
+ }
327
+ ]
328
+ }
329
+ }
330
+ }
331
+ }
332
+ }
333
+ ]
334
+ },
335
+ "vue-object": {
336
+ "kind": "object",
337
+ "any": [
338
+ {
339
+ "inside": {
340
+ "stopBy": {
341
+ "not": {
342
+ "kind": "parenthesized_expression"
343
+ }
344
+ },
345
+ "kind": "export_statement",
346
+ "not": {
347
+ "matches": "top-in-setup"
348
+ }
349
+ }
350
+ },
351
+ {
352
+ "all": [
353
+ {
354
+ "matches": "last-arg"
355
+ },
356
+ {
357
+ "inside": {
358
+ "stopBy": {
359
+ "not": {
360
+ "matches": "paren-as"
361
+ }
362
+ },
363
+ "kind": "arguments",
364
+ "inside": {
365
+ "stopBy": "neighbor",
366
+ "kind": "call_expression",
367
+ "has": {
368
+ "field": "function",
369
+ "matches": "define-callee"
370
+ }
371
+ }
372
+ }
373
+ }
374
+ ]
375
+ },
376
+ {
377
+ "all": [
378
+ {
379
+ "matches": "first-arg"
380
+ },
381
+ {
382
+ "inside": {
383
+ "stopBy": {
384
+ "not": {
385
+ "matches": "paren-as"
386
+ }
387
+ },
388
+ "kind": "arguments",
389
+ "inside": {
390
+ "stopBy": "neighbor",
391
+ "kind": "new_expression",
392
+ "has": {
393
+ "field": "constructor",
394
+ "kind": "identifier",
395
+ "regex": "^Vue$"
396
+ }
397
+ }
398
+ }
399
+ }
400
+ ]
401
+ },
402
+ {
403
+ "not": {
404
+ "not": {
405
+ "all": [
406
+ {
407
+ "pattern": "$VUEOBJ"
408
+ },
409
+ {
410
+ "inside": {
411
+ "stopBy": "end",
412
+ "kind": "program",
413
+ "has": {
414
+ "stopBy": "end",
415
+ "kind": "comment",
416
+ "regex": "@vue/component",
417
+ "layout": {
418
+ "after": {
419
+ "to": "capture.VUEOBJ",
420
+ "breaks": {
421
+ "eq": 1
422
+ }
423
+ }
424
+ }
425
+ }
426
+ }
427
+ }
428
+ ]
429
+ }
430
+ }
431
+ }
432
+ ]
433
+ },
434
+ "computed-object": {
435
+ "kind": "object",
436
+ "inside": {
437
+ "field": "value",
438
+ "stopBy": "neighbor",
439
+ "kind": "pair",
440
+ "all": [
441
+ {
442
+ "has": {
443
+ "field": "key",
444
+ "matches": "key-computed"
445
+ }
446
+ },
447
+ {
448
+ "inside": {
449
+ "stopBy": "neighbor",
450
+ "matches": "vue-object"
451
+ }
452
+ }
453
+ ]
454
+ }
455
+ },
456
+ "opt-getter": {
457
+ "any": [
458
+ {
459
+ "kind": "method_definition",
460
+ "all": [
461
+ {
462
+ "has": {
463
+ "field": "name",
464
+ "pattern": "$K"
465
+ }
466
+ },
467
+ {
468
+ "inside": {
469
+ "stopBy": "neighbor",
470
+ "matches": "computed-object"
471
+ }
472
+ }
473
+ ]
474
+ },
475
+ {
476
+ "all": [
477
+ {
478
+ "matches": "fn-expr"
479
+ },
480
+ {
481
+ "inside": {
482
+ "stopBy": {
483
+ "not": {
484
+ "matches": "paren-as"
485
+ }
486
+ },
487
+ "kind": "pair",
488
+ "all": [
489
+ {
490
+ "has": {
491
+ "field": "key",
492
+ "pattern": "$K"
493
+ }
494
+ },
495
+ {
496
+ "inside": {
497
+ "stopBy": "neighbor",
498
+ "matches": "computed-object"
499
+ }
500
+ }
501
+ ]
502
+ }
503
+ }
504
+ ]
505
+ },
506
+ {
507
+ "kind": "method_definition",
508
+ "all": [
509
+ {
510
+ "has": {
511
+ "field": "name",
512
+ "matches": "key-get"
513
+ }
514
+ },
515
+ {
516
+ "inside": {
517
+ "stopBy": "neighbor",
518
+ "kind": "object",
519
+ "inside": {
520
+ "stopBy": {
521
+ "not": {
522
+ "matches": "paren-as"
523
+ }
524
+ },
525
+ "kind": "pair",
526
+ "all": [
527
+ {
528
+ "has": {
529
+ "field": "key",
530
+ "pattern": "$K"
531
+ }
532
+ },
533
+ {
534
+ "inside": {
535
+ "stopBy": "neighbor",
536
+ "matches": "computed-object"
537
+ }
538
+ }
539
+ ]
540
+ }
541
+ }
542
+ }
543
+ ]
544
+ },
545
+ {
546
+ "all": [
547
+ {
548
+ "matches": "fn-expr"
549
+ },
550
+ {
551
+ "inside": {
552
+ "stopBy": {
553
+ "not": {
554
+ "kind": "parenthesized_expression"
555
+ }
556
+ },
557
+ "kind": "pair",
558
+ "all": [
559
+ {
560
+ "has": {
561
+ "field": "key",
562
+ "matches": "key-get"
563
+ }
564
+ },
565
+ {
566
+ "inside": {
567
+ "stopBy": "neighbor",
568
+ "kind": "object",
569
+ "inside": {
570
+ "stopBy": {
571
+ "not": {
572
+ "matches": "paren-as"
573
+ }
574
+ },
575
+ "kind": "pair",
576
+ "all": [
577
+ {
578
+ "has": {
579
+ "field": "key",
580
+ "pattern": "$K"
581
+ }
582
+ },
583
+ {
584
+ "inside": {
585
+ "stopBy": "neighbor",
586
+ "matches": "computed-object"
587
+ }
588
+ }
589
+ ]
590
+ }
591
+ }
592
+ }
593
+ ]
594
+ }
595
+ }
596
+ ]
597
+ }
598
+ ]
599
+ },
600
+ "computed-callee": {
601
+ "any": [
602
+ {
603
+ "kind": "identifier",
604
+ "resolves": {
605
+ "binding": {
606
+ "site": {
607
+ "kind": "import_specifier",
608
+ "all": [
609
+ {
610
+ "has": {
611
+ "field": "name",
612
+ "regex": "^computed$"
613
+ }
614
+ },
615
+ {
616
+ "inside": {
617
+ "stopBy": "end",
618
+ "kind": "import_statement",
619
+ "has": {
620
+ "field": "source",
621
+ "kind": "string",
622
+ "value": {
623
+ "regex": "^(?:vue|@vue/composition-api|@nuxtjs/composition-api|#imports)$"
624
+ }
625
+ }
626
+ }
627
+ }
628
+ ]
629
+ }
630
+ }
631
+ }
632
+ },
633
+ {
634
+ "kind": "member_expression",
635
+ "all": [
636
+ {
637
+ "has": {
638
+ "field": "property",
639
+ "regex": "^computed$"
640
+ }
641
+ },
642
+ {
643
+ "has": {
644
+ "field": "object",
645
+ "kind": "identifier",
646
+ "resolves": {
647
+ "binding": {
648
+ "site": {
649
+ "kind": "namespace_import",
650
+ "inside": {
651
+ "stopBy": "end",
652
+ "kind": "import_statement",
653
+ "has": {
654
+ "field": "source",
655
+ "kind": "string",
656
+ "value": {
657
+ "regex": "^(?:vue|@vue/composition-api|@nuxtjs/composition-api|#imports)$"
658
+ }
659
+ }
660
+ }
661
+ }
662
+ }
663
+ }
664
+ }
665
+ }
666
+ ]
667
+ }
668
+ ]
669
+ },
670
+ "computed-arg": {
671
+ "any": [
672
+ {
673
+ "all": [
674
+ {
675
+ "nthChild": {
676
+ "position": 1,
677
+ "ofRule": {
678
+ "not": {
679
+ "kind": "comment"
680
+ }
681
+ }
682
+ }
683
+ },
684
+ {
685
+ "inside": {
686
+ "stopBy": "neighbor",
687
+ "kind": "arguments",
688
+ "inside": {
689
+ "stopBy": "neighbor",
690
+ "kind": "call_expression",
691
+ "has": {
692
+ "field": "function",
693
+ "matches": "computed-callee"
694
+ }
695
+ }
696
+ }
697
+ }
698
+ ]
699
+ },
700
+ {
701
+ "inside": {
702
+ "stopBy": "neighbor",
703
+ "all": [
704
+ {
705
+ "kind": "parenthesized_expression"
706
+ },
707
+ {
708
+ "matches": "computed-arg"
709
+ }
710
+ ]
711
+ }
712
+ }
713
+ ]
714
+ },
715
+ "fn-or-arrow": {
716
+ "any": [
717
+ {
718
+ "matches": "fn-expr"
719
+ },
720
+ {
721
+ "kind": "arrow_function"
722
+ }
723
+ ]
724
+ },
725
+ "comp-getter": {
726
+ "any": [
727
+ {
728
+ "all": [
729
+ {
730
+ "matches": "fn-or-arrow"
731
+ },
732
+ {
733
+ "matches": "computed-arg"
734
+ }
735
+ ]
736
+ },
737
+ {
738
+ "kind": "method_definition",
739
+ "all": [
740
+ {
741
+ "has": {
742
+ "field": "name",
743
+ "matches": "key-get"
744
+ }
745
+ },
746
+ {
747
+ "inside": {
748
+ "stopBy": "neighbor",
749
+ "kind": "object",
750
+ "matches": "computed-arg"
751
+ }
752
+ }
753
+ ]
754
+ },
755
+ {
756
+ "all": [
757
+ {
758
+ "matches": "fn-or-arrow"
759
+ },
760
+ {
761
+ "inside": {
762
+ "stopBy": {
763
+ "not": {
764
+ "kind": "parenthesized_expression"
765
+ }
766
+ },
767
+ "kind": "pair",
768
+ "all": [
769
+ {
770
+ "has": {
771
+ "field": "key",
772
+ "matches": "key-get"
773
+ }
774
+ },
775
+ {
776
+ "inside": {
777
+ "stopBy": "neighbor",
778
+ "kind": "object",
779
+ "matches": "computed-arg"
780
+ }
781
+ }
782
+ ]
783
+ }
784
+ }
785
+ ]
786
+ }
787
+ ]
788
+ },
789
+ "in-vue-object": {
790
+ "inside": {
791
+ "stopBy": "end",
792
+ "matches": "vue-object"
793
+ }
794
+ },
795
+ "comp-ctx": {
796
+ "any": [
797
+ {
798
+ "all": [
799
+ {
800
+ "matches": "file-setup"
801
+ },
802
+ {
803
+ "matches": "in-setup"
804
+ }
805
+ ]
806
+ },
807
+ {
808
+ "all": [
809
+ {
810
+ "matches": "file-plain"
811
+ },
812
+ {
813
+ "matches": "in-vue-object"
814
+ }
815
+ ]
816
+ }
817
+ ]
818
+ },
819
+ "this-ish": {
820
+ "any": [
821
+ {
822
+ "kind": "this"
823
+ },
824
+ {
825
+ "kind": "identifier",
826
+ "resolves": {
827
+ "binding": {
828
+ "only": true,
829
+ "site": {
830
+ "kind": "variable_declarator",
831
+ "all": [
832
+ {
833
+ "has": {
834
+ "field": "name",
835
+ "kind": "identifier"
836
+ }
837
+ },
838
+ {
839
+ "has": {
840
+ "field": "value",
841
+ "kind": "this"
842
+ }
843
+ },
844
+ {
845
+ "inside": {
846
+ "stopBy": "neighbor",
847
+ "kind": "lexical_declaration",
848
+ "has": {
849
+ "stopBy": "neighbor",
850
+ "regex": "^const$"
851
+ }
852
+ }
853
+ }
854
+ ]
855
+ }
856
+ }
857
+ }
858
+ }
859
+ ]
860
+ },
861
+ "root-opt": {
862
+ "all": [
863
+ {
864
+ "matches": "this-ish"
865
+ },
866
+ {
867
+ "matches": "file-plain"
868
+ },
869
+ {
870
+ "inside": {
871
+ "stopBy": {
872
+ "matches": "fn-like"
873
+ },
874
+ "matches": "opt-getter"
875
+ }
876
+ }
877
+ ]
878
+ },
879
+ "base-opt": {
880
+ "any": [
881
+ {
882
+ "matches": "root-opt"
883
+ },
884
+ {
885
+ "kind": "parenthesized_expression",
886
+ "has": {
887
+ "stopBy": "neighbor",
888
+ "matches": "base-opt"
889
+ }
890
+ },
891
+ {
892
+ "all": [
893
+ {
894
+ "any": [
895
+ {
896
+ "kind": "member_expression"
897
+ },
898
+ {
899
+ "kind": "subscript_expression"
900
+ }
901
+ ]
902
+ },
903
+ {
904
+ "has": {
905
+ "field": "object",
906
+ "matches": "base-opt"
907
+ }
908
+ }
909
+ ]
910
+ }
911
+ ]
912
+ },
913
+ "chain-opt": {
914
+ "any": [
915
+ {
916
+ "kind": "parenthesized_expression",
917
+ "has": {
918
+ "stopBy": "neighbor",
919
+ "matches": "chain-opt"
920
+ }
921
+ },
922
+ {
923
+ "all": [
924
+ {
925
+ "any": [
926
+ {
927
+ "kind": "member_expression"
928
+ },
929
+ {
930
+ "kind": "subscript_expression"
931
+ }
932
+ ]
933
+ },
934
+ {
935
+ "has": {
936
+ "field": "object",
937
+ "matches": "base-opt"
938
+ }
939
+ }
940
+ ]
941
+ }
942
+ ]
943
+ },
944
+ "callee-mut-opt": {
945
+ "any": [
946
+ {
947
+ "kind": "parenthesized_expression",
948
+ "has": {
949
+ "stopBy": "neighbor",
950
+ "matches": "callee-mut-opt"
951
+ }
952
+ },
953
+ {
954
+ "any": [
955
+ {
956
+ "kind": "member_expression",
957
+ "all": [
958
+ {
959
+ "has": {
960
+ "field": "object",
961
+ "matches": "chain-opt"
962
+ }
963
+ },
964
+ {
965
+ "has": {
966
+ "field": "property",
967
+ "regex": "^(?:push|pop|shift|unshift|reverse|splice|sort|copyWithin|fill)$"
968
+ }
969
+ }
970
+ ]
971
+ },
972
+ {
973
+ "kind": "subscript_expression",
974
+ "all": [
975
+ {
976
+ "has": {
977
+ "field": "object",
978
+ "matches": "chain-opt"
979
+ }
980
+ },
981
+ {
982
+ "has": {
983
+ "field": "index",
984
+ "kind": "string",
985
+ "has": {
986
+ "stopBy": "neighbor",
987
+ "kind": "string_fragment",
988
+ "regex": "^(?:push|pop|shift|unshift|reverse|splice|sort|copyWithin|fill)$"
989
+ }
990
+ }
991
+ }
992
+ ]
993
+ }
994
+ ]
995
+ }
996
+ ]
997
+ },
998
+ "mutation-opt": {
999
+ "any": [
1000
+ {
1001
+ "kind": "assignment_expression",
1002
+ "has": {
1003
+ "field": "left",
1004
+ "matches": "chain-opt"
1005
+ }
1006
+ },
1007
+ {
1008
+ "kind": "augmented_assignment_expression",
1009
+ "has": {
1010
+ "field": "left",
1011
+ "matches": "chain-opt"
1012
+ }
1013
+ },
1014
+ {
1015
+ "kind": "update_expression",
1016
+ "has": {
1017
+ "field": "argument",
1018
+ "matches": "chain-opt"
1019
+ }
1020
+ },
1021
+ {
1022
+ "kind": "unary_expression",
1023
+ "all": [
1024
+ {
1025
+ "has": {
1026
+ "field": "operator",
1027
+ "regex": "^delete$"
1028
+ }
1029
+ },
1030
+ {
1031
+ "has": {
1032
+ "field": "argument",
1033
+ "matches": "chain-opt"
1034
+ }
1035
+ }
1036
+ ]
1037
+ },
1038
+ {
1039
+ "kind": "call_expression",
1040
+ "any": [
1041
+ {
1042
+ "has": {
1043
+ "field": "function",
1044
+ "matches": "callee-mut-opt"
1045
+ }
1046
+ },
1047
+ {
1048
+ "all": [
1049
+ {
1050
+ "has": {
1051
+ "field": "function",
1052
+ "kind": "member_expression",
1053
+ "all": [
1054
+ {
1055
+ "has": {
1056
+ "field": "object",
1057
+ "kind": "identifier",
1058
+ "regex": "^Object$"
1059
+ }
1060
+ },
1061
+ {
1062
+ "has": {
1063
+ "field": "property",
1064
+ "regex": "^assign$"
1065
+ }
1066
+ }
1067
+ ]
1068
+ }
1069
+ },
1070
+ {
1071
+ "arguments": {
1072
+ "signature": [
1073
+ "target"
1074
+ ],
1075
+ "bind": {
1076
+ "T": "target"
1077
+ },
1078
+ "mode": "estree"
1079
+ }
1080
+ }
1081
+ ]
1082
+ }
1083
+ ]
1084
+ }
1085
+ ]
1086
+ },
1087
+ "setup-fn": {
1088
+ "any": [
1089
+ {
1090
+ "kind": "method_definition",
1091
+ "all": [
1092
+ {
1093
+ "has": {
1094
+ "field": "name",
1095
+ "matches": "key-setup"
1096
+ }
1097
+ },
1098
+ {
1099
+ "inside": {
1100
+ "stopBy": "neighbor",
1101
+ "matches": "vue-object"
1102
+ }
1103
+ }
1104
+ ]
1105
+ },
1106
+ {
1107
+ "all": [
1108
+ {
1109
+ "matches": "fn-or-arrow"
1110
+ },
1111
+ {
1112
+ "inside": {
1113
+ "stopBy": "neighbor",
1114
+ "kind": "pair",
1115
+ "all": [
1116
+ {
1117
+ "has": {
1118
+ "field": "key",
1119
+ "matches": "key-setup"
1120
+ }
1121
+ },
1122
+ {
1123
+ "inside": {
1124
+ "stopBy": "neighbor",
1125
+ "matches": "vue-object"
1126
+ }
1127
+ }
1128
+ ]
1129
+ }
1130
+ }
1131
+ ]
1132
+ }
1133
+ ]
1134
+ },
1135
+ "root-comp": {
1136
+ "kind": "identifier",
1137
+ "all": [
1138
+ {
1139
+ "matches": "comp-ctx"
1140
+ },
1141
+ {
1142
+ "inside": {
1143
+ "stopBy": {
1144
+ "matches": "fn-like"
1145
+ },
1146
+ "matches": "comp-getter",
1147
+ "pattern": "$F"
1148
+ }
1149
+ },
1150
+ {
1151
+ "resolves": {
1152
+ "binding": {
1153
+ "only": true,
1154
+ "site": {
1155
+ "all": [
1156
+ {
1157
+ "not": {
1158
+ "kind": "import_specifier"
1159
+ }
1160
+ },
1161
+ {
1162
+ "not": {
1163
+ "kind": "import_clause"
1164
+ }
1165
+ },
1166
+ {
1167
+ "not": {
1168
+ "kind": "namespace_import"
1169
+ }
1170
+ },
1171
+ {
1172
+ "any": [
1173
+ {
1174
+ "all": [
1175
+ {
1176
+ "matches": "file-setup"
1177
+ },
1178
+ {
1179
+ "matches": "in-setup"
1180
+ }
1181
+ ]
1182
+ },
1183
+ {
1184
+ "all": [
1185
+ {
1186
+ "matches": "file-plain"
1187
+ },
1188
+ {
1189
+ "inside": {
1190
+ "stopBy": "end",
1191
+ "kind": "statement_block",
1192
+ "inside": {
1193
+ "field": "body",
1194
+ "stopBy": "neighbor",
1195
+ "matches": "setup-fn"
1196
+ }
1197
+ }
1198
+ }
1199
+ ]
1200
+ }
1201
+ ]
1202
+ },
1203
+ {
1204
+ "not": {
1205
+ "inside": {
1206
+ "stopBy": "end",
1207
+ "pattern": "$F"
1208
+ }
1209
+ }
1210
+ }
1211
+ ]
1212
+ }
1213
+ }
1214
+ }
1215
+ }
1216
+ ]
1217
+ },
1218
+ "base-comp": {
1219
+ "any": [
1220
+ {
1221
+ "matches": "root-comp"
1222
+ },
1223
+ {
1224
+ "kind": "parenthesized_expression",
1225
+ "has": {
1226
+ "stopBy": "neighbor",
1227
+ "matches": "base-comp"
1228
+ }
1229
+ },
1230
+ {
1231
+ "all": [
1232
+ {
1233
+ "any": [
1234
+ {
1235
+ "kind": "member_expression"
1236
+ },
1237
+ {
1238
+ "kind": "subscript_expression"
1239
+ }
1240
+ ]
1241
+ },
1242
+ {
1243
+ "has": {
1244
+ "field": "object",
1245
+ "matches": "base-comp"
1246
+ }
1247
+ }
1248
+ ]
1249
+ }
1250
+ ]
1251
+ },
1252
+ "chain-comp": {
1253
+ "any": [
1254
+ {
1255
+ "kind": "parenthesized_expression",
1256
+ "has": {
1257
+ "stopBy": "neighbor",
1258
+ "matches": "chain-comp"
1259
+ }
1260
+ },
1261
+ {
1262
+ "all": [
1263
+ {
1264
+ "any": [
1265
+ {
1266
+ "kind": "member_expression"
1267
+ },
1268
+ {
1269
+ "kind": "subscript_expression"
1270
+ }
1271
+ ]
1272
+ },
1273
+ {
1274
+ "has": {
1275
+ "field": "object",
1276
+ "matches": "base-comp"
1277
+ }
1278
+ }
1279
+ ]
1280
+ }
1281
+ ]
1282
+ },
1283
+ "callee-mut-comp": {
1284
+ "any": [
1285
+ {
1286
+ "kind": "parenthesized_expression",
1287
+ "has": {
1288
+ "stopBy": "neighbor",
1289
+ "matches": "callee-mut-comp"
1290
+ }
1291
+ },
1292
+ {
1293
+ "any": [
1294
+ {
1295
+ "kind": "member_expression",
1296
+ "all": [
1297
+ {
1298
+ "has": {
1299
+ "field": "object",
1300
+ "matches": "base-comp"
1301
+ }
1302
+ },
1303
+ {
1304
+ "has": {
1305
+ "field": "property",
1306
+ "regex": "^(?:push|pop|shift|unshift|reverse|splice|sort|copyWithin|fill)$"
1307
+ }
1308
+ }
1309
+ ]
1310
+ },
1311
+ {
1312
+ "kind": "subscript_expression",
1313
+ "all": [
1314
+ {
1315
+ "has": {
1316
+ "field": "object",
1317
+ "matches": "base-comp"
1318
+ }
1319
+ },
1320
+ {
1321
+ "has": {
1322
+ "field": "index",
1323
+ "kind": "string",
1324
+ "has": {
1325
+ "stopBy": "neighbor",
1326
+ "kind": "string_fragment",
1327
+ "regex": "^(?:push|pop|shift|unshift|reverse|splice|sort|copyWithin|fill)$"
1328
+ }
1329
+ }
1330
+ }
1331
+ ]
1332
+ }
1333
+ ]
1334
+ }
1335
+ ]
1336
+ },
1337
+ "mutation-comp": {
1338
+ "any": [
1339
+ {
1340
+ "kind": "assignment_expression",
1341
+ "has": {
1342
+ "field": "left",
1343
+ "matches": "chain-comp"
1344
+ }
1345
+ },
1346
+ {
1347
+ "kind": "augmented_assignment_expression",
1348
+ "has": {
1349
+ "field": "left",
1350
+ "matches": "chain-comp"
1351
+ }
1352
+ },
1353
+ {
1354
+ "kind": "update_expression",
1355
+ "has": {
1356
+ "field": "argument",
1357
+ "matches": "chain-comp"
1358
+ }
1359
+ },
1360
+ {
1361
+ "kind": "unary_expression",
1362
+ "all": [
1363
+ {
1364
+ "has": {
1365
+ "field": "operator",
1366
+ "regex": "^delete$"
1367
+ }
1368
+ },
1369
+ {
1370
+ "has": {
1371
+ "field": "argument",
1372
+ "matches": "chain-comp"
1373
+ }
1374
+ }
1375
+ ]
1376
+ },
1377
+ {
1378
+ "kind": "call_expression",
1379
+ "any": [
1380
+ {
1381
+ "has": {
1382
+ "field": "function",
1383
+ "matches": "callee-mut-comp"
1384
+ }
1385
+ },
1386
+ {
1387
+ "all": [
1388
+ {
1389
+ "has": {
1390
+ "field": "function",
1391
+ "kind": "member_expression",
1392
+ "all": [
1393
+ {
1394
+ "has": {
1395
+ "field": "object",
1396
+ "kind": "identifier",
1397
+ "regex": "^Object$"
1398
+ }
1399
+ },
1400
+ {
1401
+ "has": {
1402
+ "field": "property",
1403
+ "regex": "^assign$"
1404
+ }
1405
+ }
1406
+ ]
1407
+ }
1408
+ },
1409
+ {
1410
+ "arguments": {
1411
+ "signature": [
1412
+ "target"
1413
+ ],
1414
+ "bind": {
1415
+ "T": "target"
1416
+ },
1417
+ "mode": "estree"
1418
+ }
1419
+ }
1420
+ ]
1421
+ }
1422
+ ]
1423
+ }
1424
+ ]
1425
+ }
1426
+ }
1427
+ }
1428
+ },
1429
+ {
1430
+ "id": "set-in-options-getter",
1431
+ "forbid": {
1432
+ "ast": {
1433
+ "language": "vue",
1434
+ "embedded": "script-block",
1435
+ "rule": {
1436
+ "all": [
1437
+ {
1438
+ "kind": "property_identifier",
1439
+ "regex": "^(?:\\$set|set)$"
1440
+ },
1441
+ {
1442
+ "inside": {
1443
+ "field": "property",
1444
+ "stopBy": "neighbor",
1445
+ "kind": "member_expression",
1446
+ "all": [
1447
+ {
1448
+ "inside": {
1449
+ "stopBy": "neighbor",
1450
+ "any": [
1451
+ {
1452
+ "kind": "call_expression"
1453
+ },
1454
+ {
1455
+ "kind": "arguments",
1456
+ "inside": {
1457
+ "stopBy": "neighbor",
1458
+ "kind": "call_expression"
1459
+ }
1460
+ }
1461
+ ]
1462
+ }
1463
+ },
1464
+ {
1465
+ "any": [
1466
+ {
1467
+ "all": [
1468
+ {
1469
+ "has": {
1470
+ "field": "property",
1471
+ "regex": "^\\$set$"
1472
+ }
1473
+ },
1474
+ {
1475
+ "has": {
1476
+ "field": "object",
1477
+ "matches": "root-opt"
1478
+ }
1479
+ }
1480
+ ]
1481
+ },
1482
+ {
1483
+ "all": [
1484
+ {
1485
+ "has": {
1486
+ "field": "property",
1487
+ "regex": "^set$"
1488
+ }
1489
+ },
1490
+ {
1491
+ "has": {
1492
+ "field": "object",
1493
+ "all": [
1494
+ {
1495
+ "kind": "identifier",
1496
+ "regex": "^Vue$"
1497
+ },
1498
+ {
1499
+ "matches": "file-plain"
1500
+ },
1501
+ {
1502
+ "inside": {
1503
+ "stopBy": {
1504
+ "matches": "fn-like"
1505
+ },
1506
+ "matches": "opt-getter"
1507
+ }
1508
+ }
1509
+ ]
1510
+ }
1511
+ }
1512
+ ]
1513
+ }
1514
+ ]
1515
+ }
1516
+ ]
1517
+ }
1518
+ }
1519
+ ]
1520
+ },
1521
+ "transform": {
1522
+ "N1": {
1523
+ "replace": {
1524
+ "source": "$K",
1525
+ "replace": "^(?:\\[\\s*(?:'([^']*)'|\"([^\"]*)\")\\s*\\]|'([^']*)'|\"([^\"]*)\")$",
1526
+ "by": "${1}${2}${3}${4}"
1527
+ }
1528
+ },
1529
+ "NAME": {
1530
+ "replace": {
1531
+ "source": "$N1",
1532
+ "replace": "^\\[.*\\]$",
1533
+ "by": "Unknown"
1534
+ }
1535
+ }
1536
+ }
1537
+ }
1538
+ },
1539
+ "violation": {
1540
+ "anchor": "witness.span",
1541
+ "code": "vue/no-side-effects-in-computed-properties",
1542
+ "message": "Remove this assignment from the \"$NAME\" computed and make the change in a method or watcher instead.",
1543
+ "suppress": {
1544
+ "eslint": {
1545
+ "rules": [
1546
+ "vue/no-side-effects-in-computed-properties"
1547
+ ]
1548
+ }
1549
+ }
1550
+ }
1551
+ },
1552
+ {
1553
+ "id": "mutation-in-options-getter",
1554
+ "forbid": {
1555
+ "ast": {
1556
+ "language": "vue",
1557
+ "embedded": "script-block",
1558
+ "rule": {
1559
+ "matches": "mutation-opt"
1560
+ },
1561
+ "constraints": {
1562
+ "T": {
1563
+ "matches": "chain-opt"
1564
+ }
1565
+ },
1566
+ "transform": {
1567
+ "N1": {
1568
+ "replace": {
1569
+ "source": "$K",
1570
+ "replace": "^(?:\\[\\s*(?:'([^']*)'|\"([^\"]*)\")\\s*\\]|'([^']*)'|\"([^\"]*)\")$",
1571
+ "by": "${1}${2}${3}${4}"
1572
+ }
1573
+ },
1574
+ "NAME": {
1575
+ "replace": {
1576
+ "source": "$N1",
1577
+ "replace": "^\\[.*\\]$",
1578
+ "by": "Unknown"
1579
+ }
1580
+ }
1581
+ }
1582
+ }
1583
+ },
1584
+ "violation": {
1585
+ "anchor": "witness.span",
1586
+ "code": "vue/no-side-effects-in-computed-properties",
1587
+ "message": "Remove this mutation from the \"$NAME\" computed and make the change in a method or watcher instead.",
1588
+ "suppress": {
1589
+ "eslint": {
1590
+ "rules": [
1591
+ "vue/no-side-effects-in-computed-properties"
1592
+ ]
1593
+ }
1594
+ }
1595
+ }
1596
+ },
1597
+ {
1598
+ "id": "mutation-in-composition-getter",
1599
+ "forbid": {
1600
+ "ast": {
1601
+ "language": "vue",
1602
+ "embedded": "script-block",
1603
+ "rule": {
1604
+ "matches": "mutation-comp"
1605
+ },
1606
+ "constraints": {
1607
+ "T": {
1608
+ "matches": "chain-comp"
1609
+ }
1610
+ }
1611
+ }
1612
+ },
1613
+ "violation": {
1614
+ "anchor": "witness.span",
1615
+ "code": "vue/no-side-effects-in-computed-properties",
1616
+ "message": "Remove this mutation from the computed getter and make the change in a function or watcher instead.",
1617
+ "suppress": {
1618
+ "eslint": {
1619
+ "rules": [
1620
+ "vue/no-side-effects-in-computed-properties"
1621
+ ]
1622
+ }
1623
+ }
1624
+ }
1625
+ }
1626
+ ]
1627
+ }