eslint-plugin-react-x 1.20.0-next.6 → 1.20.0-next.7
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.
- package/dist/index.js +253 -50
- package/dist/index.mjs +253 -50
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -14,16 +14,20 @@ import { getTypeImmutability, isUnknown, isImmutable, isReadonlyShallow, isReado
|
|
|
14
14
|
|
|
15
15
|
// package.json
|
|
16
16
|
var name = "eslint-plugin-react-x";
|
|
17
|
-
var version = "1.20.0-next.
|
|
17
|
+
var version = "1.20.0-next.7";
|
|
18
18
|
var createRule = createRuleForPlugin("x");
|
|
19
19
|
|
|
20
20
|
// src/rules/avoid-shorthand-boolean.ts
|
|
21
21
|
var RULE_NAME = "avoid-shorthand-boolean";
|
|
22
|
+
var RULE_FEATURES = [
|
|
23
|
+
"LNT"
|
|
24
|
+
];
|
|
22
25
|
var avoid_shorthand_boolean_default = createRule({
|
|
23
26
|
meta: {
|
|
24
27
|
type: "problem",
|
|
25
28
|
docs: {
|
|
26
|
-
description: "disallow using shorthand boolean attributes"
|
|
29
|
+
description: "disallow using shorthand boolean attributes",
|
|
30
|
+
[Symbol.for("rule_features")]: RULE_FEATURES
|
|
27
31
|
},
|
|
28
32
|
fixable: "code",
|
|
29
33
|
messages: {
|
|
@@ -52,11 +56,15 @@ var avoid_shorthand_boolean_default = createRule({
|
|
|
52
56
|
|
|
53
57
|
// src/rules/avoid-shorthand-fragment.ts
|
|
54
58
|
var RULE_NAME2 = "avoid-shorthand-fragment";
|
|
59
|
+
var RULE_FEATURES2 = [
|
|
60
|
+
"LNT"
|
|
61
|
+
];
|
|
55
62
|
var avoid_shorthand_fragment_default = createRule({
|
|
56
63
|
meta: {
|
|
57
64
|
type: "problem",
|
|
58
65
|
docs: {
|
|
59
|
-
description: "disallow using shorthand fragment syntax"
|
|
66
|
+
description: "disallow using shorthand fragment syntax",
|
|
67
|
+
[Symbol.for("rule_features")]: RULE_FEATURES2
|
|
60
68
|
},
|
|
61
69
|
messages: {
|
|
62
70
|
avoidShorthandFragment: "Avoid using shorthand fragment syntax. Use 'Fragment' component instead."
|
|
@@ -77,11 +85,15 @@ var avoid_shorthand_fragment_default = createRule({
|
|
|
77
85
|
defaultOptions: []
|
|
78
86
|
});
|
|
79
87
|
var RULE_NAME3 = "ensure-forward-ref-using-ref";
|
|
88
|
+
var RULE_FEATURES3 = [
|
|
89
|
+
"LNT"
|
|
90
|
+
];
|
|
80
91
|
var ensure_forward_ref_using_ref_default = createRule({
|
|
81
92
|
meta: {
|
|
82
93
|
type: "problem",
|
|
83
94
|
docs: {
|
|
84
|
-
description: "require a 'ref' parameter to be set when using 'forwardRef'"
|
|
95
|
+
description: "require a 'ref' parameter to be set when using 'forwardRef'",
|
|
96
|
+
[Symbol.for("rule_features")]: RULE_FEATURES3
|
|
85
97
|
},
|
|
86
98
|
messages: {
|
|
87
99
|
ensureForwardRefUsingRef: "A 'forwardRef' is used with this component but no 'ref' parameter is set."
|
|
@@ -107,11 +119,15 @@ var ensure_forward_ref_using_ref_default = createRule({
|
|
|
107
119
|
defaultOptions: []
|
|
108
120
|
});
|
|
109
121
|
var RULE_NAME4 = "jsx-no-duplicate-props";
|
|
122
|
+
var RULE_FEATURES4 = [
|
|
123
|
+
"LNT"
|
|
124
|
+
];
|
|
110
125
|
var jsx_no_duplicate_props_default = createRule({
|
|
111
126
|
meta: {
|
|
112
127
|
type: "problem",
|
|
113
128
|
docs: {
|
|
114
|
-
description: "disallow duplicate props"
|
|
129
|
+
description: "disallow duplicate props",
|
|
130
|
+
[Symbol.for("rule_features")]: RULE_FEATURES4
|
|
115
131
|
},
|
|
116
132
|
messages: {
|
|
117
133
|
jsxNoDuplicateProps: "Duplicate prop '{{name}}'"
|
|
@@ -143,12 +159,16 @@ var jsx_no_duplicate_props_default = createRule({
|
|
|
143
159
|
defaultOptions: []
|
|
144
160
|
});
|
|
145
161
|
var RULE_NAME5 = "jsx-uses-vars";
|
|
162
|
+
var RULE_FEATURES5 = [
|
|
163
|
+
"LNT"
|
|
164
|
+
];
|
|
146
165
|
var jsx_uses_vars_default = createRule({
|
|
147
166
|
meta: {
|
|
148
167
|
type: "problem",
|
|
149
168
|
docs: {
|
|
150
169
|
// eslint-disable-next-line eslint-plugin/require-meta-docs-description
|
|
151
|
-
description: "a helper rule to mark variables as used"
|
|
170
|
+
description: "a helper rule to mark variables as used",
|
|
171
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
152
172
|
},
|
|
153
173
|
messages: {
|
|
154
174
|
jsxUsesVars: ""
|
|
@@ -179,6 +199,9 @@ var jsx_uses_vars_default = createRule({
|
|
|
179
199
|
defaultOptions: []
|
|
180
200
|
});
|
|
181
201
|
var RULE_NAME6 = "no-access-state-in-setstate";
|
|
202
|
+
var RULE_FEATURES6 = [
|
|
203
|
+
"LNT"
|
|
204
|
+
];
|
|
182
205
|
function getName(node) {
|
|
183
206
|
if (node.type === AST_NODE_TYPES.TSAsExpression) {
|
|
184
207
|
return getName(node.expression);
|
|
@@ -198,7 +221,8 @@ var no_access_state_in_setstate_default = createRule({
|
|
|
198
221
|
meta: {
|
|
199
222
|
type: "problem",
|
|
200
223
|
docs: {
|
|
201
|
-
description: "disallow accessing 'this.state' within 'setState'"
|
|
224
|
+
description: "disallow accessing 'this.state' within 'setState'",
|
|
225
|
+
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
202
226
|
},
|
|
203
227
|
messages: {
|
|
204
228
|
noAccessStateInSetstate: "Do not access 'this.state' within 'setState'. Use the update function instead."
|
|
@@ -277,6 +301,9 @@ var no_access_state_in_setstate_default = createRule({
|
|
|
277
301
|
defaultOptions: []
|
|
278
302
|
});
|
|
279
303
|
var RULE_NAME7 = "no-array-index-key";
|
|
304
|
+
var RULE_FEATURES7 = [
|
|
305
|
+
"LNT"
|
|
306
|
+
];
|
|
280
307
|
var reactChildrenMethod = ["forEach", "map"];
|
|
281
308
|
var iteratorFunctionIndexParamPosition = /* @__PURE__ */ new Map([
|
|
282
309
|
["every", 1],
|
|
@@ -341,7 +368,8 @@ var no_array_index_key_default = createRule({
|
|
|
341
368
|
meta: {
|
|
342
369
|
type: "problem",
|
|
343
370
|
docs: {
|
|
344
|
-
description: "disallow using Array index as 'key'"
|
|
371
|
+
description: "disallow using Array index as 'key'",
|
|
372
|
+
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
345
373
|
},
|
|
346
374
|
messages: {
|
|
347
375
|
noArrayIndexKey: "Do not use Array index as 'key'."
|
|
@@ -417,11 +445,15 @@ var no_array_index_key_default = createRule({
|
|
|
417
445
|
defaultOptions: []
|
|
418
446
|
});
|
|
419
447
|
var RULE_NAME8 = "no-children-count";
|
|
448
|
+
var RULE_FEATURES8 = [
|
|
449
|
+
"LNT"
|
|
450
|
+
];
|
|
420
451
|
var no_children_count_default = createRule({
|
|
421
452
|
meta: {
|
|
422
453
|
type: "problem",
|
|
423
454
|
docs: {
|
|
424
|
-
description: "disallow using 'Children.count'"
|
|
455
|
+
description: "disallow using 'Children.count'",
|
|
456
|
+
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
425
457
|
},
|
|
426
458
|
messages: {
|
|
427
459
|
noChildrenCount: "Using 'Children.count' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -444,11 +476,15 @@ var no_children_count_default = createRule({
|
|
|
444
476
|
defaultOptions: []
|
|
445
477
|
});
|
|
446
478
|
var RULE_NAME9 = "no-children-for-each";
|
|
479
|
+
var RULE_FEATURES9 = [
|
|
480
|
+
"LNT"
|
|
481
|
+
];
|
|
447
482
|
var no_children_for_each_default = createRule({
|
|
448
483
|
meta: {
|
|
449
484
|
type: "problem",
|
|
450
485
|
docs: {
|
|
451
|
-
description: "disallow using 'Children.forEach'"
|
|
486
|
+
description: "disallow using 'Children.forEach'",
|
|
487
|
+
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
452
488
|
},
|
|
453
489
|
messages: {
|
|
454
490
|
noChildrenForEach: "Using 'Children.forEach' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -471,11 +507,15 @@ var no_children_for_each_default = createRule({
|
|
|
471
507
|
defaultOptions: []
|
|
472
508
|
});
|
|
473
509
|
var RULE_NAME10 = "no-children-map";
|
|
510
|
+
var RULE_FEATURES10 = [
|
|
511
|
+
"LNT"
|
|
512
|
+
];
|
|
474
513
|
var no_children_map_default = createRule({
|
|
475
514
|
meta: {
|
|
476
515
|
type: "problem",
|
|
477
516
|
docs: {
|
|
478
|
-
description: "disallow using 'Children.map'"
|
|
517
|
+
description: "disallow using 'Children.map'",
|
|
518
|
+
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
479
519
|
},
|
|
480
520
|
messages: {
|
|
481
521
|
noChildrenMap: "Using 'Children.map' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -498,11 +538,15 @@ var no_children_map_default = createRule({
|
|
|
498
538
|
defaultOptions: []
|
|
499
539
|
});
|
|
500
540
|
var RULE_NAME11 = "no-children-only";
|
|
541
|
+
var RULE_FEATURES11 = [
|
|
542
|
+
"LNT"
|
|
543
|
+
];
|
|
501
544
|
var no_children_only_default = createRule({
|
|
502
545
|
meta: {
|
|
503
546
|
type: "problem",
|
|
504
547
|
docs: {
|
|
505
|
-
description: "disallow using 'Children.only'"
|
|
548
|
+
description: "disallow using 'Children.only'",
|
|
549
|
+
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
506
550
|
},
|
|
507
551
|
messages: {
|
|
508
552
|
noChildrenOnly: "Using 'Children.only' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -525,11 +569,15 @@ var no_children_only_default = createRule({
|
|
|
525
569
|
defaultOptions: []
|
|
526
570
|
});
|
|
527
571
|
var RULE_NAME12 = "no-children-prop";
|
|
572
|
+
var RULE_FEATURES12 = [
|
|
573
|
+
"LNT"
|
|
574
|
+
];
|
|
528
575
|
var no_children_prop_default = createRule({
|
|
529
576
|
meta: {
|
|
530
577
|
type: "problem",
|
|
531
578
|
docs: {
|
|
532
|
-
description: "disallow passing 'children' as props"
|
|
579
|
+
description: "disallow passing 'children' as props",
|
|
580
|
+
[Symbol.for("rule_features")]: RULE_FEATURES12
|
|
533
581
|
},
|
|
534
582
|
messages: {
|
|
535
583
|
noChildrenProp: "Do not pass 'children' as props."
|
|
@@ -550,11 +598,15 @@ var no_children_prop_default = createRule({
|
|
|
550
598
|
defaultOptions: []
|
|
551
599
|
});
|
|
552
600
|
var RULE_NAME13 = "no-children-to-array";
|
|
601
|
+
var RULE_FEATURES13 = [
|
|
602
|
+
"LNT"
|
|
603
|
+
];
|
|
553
604
|
var no_children_to_array_default = createRule({
|
|
554
605
|
meta: {
|
|
555
606
|
type: "problem",
|
|
556
607
|
docs: {
|
|
557
|
-
description: "disallow using 'Children.toArray'"
|
|
608
|
+
description: "disallow using 'Children.toArray'",
|
|
609
|
+
[Symbol.for("rule_features")]: RULE_FEATURES13
|
|
558
610
|
},
|
|
559
611
|
messages: {
|
|
560
612
|
noChildrenToArray: "Using 'Children.toArray' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -577,6 +629,9 @@ var no_children_to_array_default = createRule({
|
|
|
577
629
|
defaultOptions: []
|
|
578
630
|
});
|
|
579
631
|
var RULE_NAME14 = "no-class-component";
|
|
632
|
+
var RULE_FEATURES14 = [
|
|
633
|
+
"LNT"
|
|
634
|
+
];
|
|
580
635
|
var isComponentDidCatch = isMatching({
|
|
581
636
|
key: {
|
|
582
637
|
type: AST_NODE_TYPES.Identifier,
|
|
@@ -597,7 +652,8 @@ var no_class_component_default = createRule({
|
|
|
597
652
|
meta: {
|
|
598
653
|
type: "problem",
|
|
599
654
|
docs: {
|
|
600
|
-
description: "disallow using class components"
|
|
655
|
+
description: "disallow using class components",
|
|
656
|
+
[Symbol.for("rule_features")]: RULE_FEATURES14
|
|
601
657
|
},
|
|
602
658
|
messages: {
|
|
603
659
|
noClassComponent: "Do not use class components. Use function components instead."
|
|
@@ -629,11 +685,15 @@ var no_class_component_default = createRule({
|
|
|
629
685
|
defaultOptions: []
|
|
630
686
|
});
|
|
631
687
|
var RULE_NAME15 = "no-clone-element";
|
|
688
|
+
var RULE_FEATURES15 = [
|
|
689
|
+
"LNT"
|
|
690
|
+
];
|
|
632
691
|
var no_clone_element_default = createRule({
|
|
633
692
|
meta: {
|
|
634
693
|
type: "problem",
|
|
635
694
|
docs: {
|
|
636
|
-
description: "disallow using 'cloneElement'"
|
|
695
|
+
description: "disallow using 'cloneElement'",
|
|
696
|
+
[Symbol.for("rule_features")]: RULE_FEATURES15
|
|
637
697
|
},
|
|
638
698
|
messages: {
|
|
639
699
|
noCloneElement: "Using 'cloneElement' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -655,11 +715,15 @@ var no_clone_element_default = createRule({
|
|
|
655
715
|
defaultOptions: []
|
|
656
716
|
});
|
|
657
717
|
var RULE_NAME16 = "no-comment-textnodes";
|
|
718
|
+
var RULE_FEATURES16 = [
|
|
719
|
+
"LNT"
|
|
720
|
+
];
|
|
658
721
|
var no_comment_textnodes_default = createRule({
|
|
659
722
|
meta: {
|
|
660
723
|
type: "problem",
|
|
661
724
|
docs: {
|
|
662
|
-
description: "disallow comments from being inserted as text nodes"
|
|
725
|
+
description: "disallow comments from being inserted as text nodes",
|
|
726
|
+
[Symbol.for("rule_features")]: RULE_FEATURES16
|
|
663
727
|
},
|
|
664
728
|
messages: {
|
|
665
729
|
noCommentTextnodes: "Possible misused comment in text node. Comments inside children section of tag should be placed inside braces."
|
|
@@ -691,11 +755,15 @@ var no_comment_textnodes_default = createRule({
|
|
|
691
755
|
defaultOptions: []
|
|
692
756
|
});
|
|
693
757
|
var RULE_NAME17 = "no-complex-conditional-rendering";
|
|
758
|
+
var RULE_FEATURES17 = [
|
|
759
|
+
"LNT"
|
|
760
|
+
];
|
|
694
761
|
var no_complex_conditional_rendering_default = createRule({
|
|
695
762
|
meta: {
|
|
696
763
|
type: "problem",
|
|
697
764
|
docs: {
|
|
698
|
-
description: "disallow complex conditional rendering"
|
|
765
|
+
description: "disallow complex conditional rendering",
|
|
766
|
+
[Symbol.for("rule_features")]: RULE_FEATURES17
|
|
699
767
|
},
|
|
700
768
|
messages: {
|
|
701
769
|
noComplexConditionalRendering: "Avoid complex conditional rendering. Extract the logic into separate elements or components."
|
|
@@ -725,6 +793,9 @@ var no_complex_conditional_rendering_default = createRule({
|
|
|
725
793
|
defaultOptions: []
|
|
726
794
|
});
|
|
727
795
|
var RULE_NAME18 = "no-component-will-mount";
|
|
796
|
+
var RULE_FEATURES18 = [
|
|
797
|
+
"LNT"
|
|
798
|
+
];
|
|
728
799
|
function isComponentWillMount(node) {
|
|
729
800
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillMount";
|
|
730
801
|
}
|
|
@@ -732,7 +803,8 @@ var no_component_will_mount_default = createRule({
|
|
|
732
803
|
meta: {
|
|
733
804
|
type: "problem",
|
|
734
805
|
docs: {
|
|
735
|
-
description: "disallow using 'componentWillMount'"
|
|
806
|
+
description: "disallow using 'componentWillMount'",
|
|
807
|
+
[Symbol.for("rule_features")]: RULE_FEATURES18
|
|
736
808
|
},
|
|
737
809
|
messages: {
|
|
738
810
|
noComponentWillMount: "[Deprecated] Use 'UNSAFE_componentWillMount' instead."
|
|
@@ -764,6 +836,9 @@ var no_component_will_mount_default = createRule({
|
|
|
764
836
|
defaultOptions: []
|
|
765
837
|
});
|
|
766
838
|
var RULE_NAME19 = "no-component-will-receive-props";
|
|
839
|
+
var RULE_FEATURES19 = [
|
|
840
|
+
"LNT"
|
|
841
|
+
];
|
|
767
842
|
function isComponentWillUpdate(node) {
|
|
768
843
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillReceiveProps";
|
|
769
844
|
}
|
|
@@ -771,7 +846,8 @@ var no_component_will_receive_props_default = createRule({
|
|
|
771
846
|
meta: {
|
|
772
847
|
type: "problem",
|
|
773
848
|
docs: {
|
|
774
|
-
description: "disallow using 'componentWillReceiveProps'"
|
|
849
|
+
description: "disallow using 'componentWillReceiveProps'",
|
|
850
|
+
[Symbol.for("rule_features")]: RULE_FEATURES19
|
|
775
851
|
},
|
|
776
852
|
messages: {
|
|
777
853
|
noComponentWillReceiveProps: "[Deprecated] Use 'UNSAFE_componentWillReceiveProps' instead."
|
|
@@ -803,6 +879,9 @@ var no_component_will_receive_props_default = createRule({
|
|
|
803
879
|
defaultOptions: []
|
|
804
880
|
});
|
|
805
881
|
var RULE_NAME20 = "no-component-will-update";
|
|
882
|
+
var RULE_FEATURES20 = [
|
|
883
|
+
"LNT"
|
|
884
|
+
];
|
|
806
885
|
function isComponentWillUpdate2(node) {
|
|
807
886
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
|
|
808
887
|
}
|
|
@@ -810,7 +889,8 @@ var no_component_will_update_default = createRule({
|
|
|
810
889
|
meta: {
|
|
811
890
|
type: "problem",
|
|
812
891
|
docs: {
|
|
813
|
-
description: "disallow using 'componentWillReceiveProps'"
|
|
892
|
+
description: "disallow using 'componentWillReceiveProps'",
|
|
893
|
+
[Symbol.for("rule_features")]: RULE_FEATURES20
|
|
814
894
|
},
|
|
815
895
|
messages: {
|
|
816
896
|
noComponentWillUpdate: "[Deprecated] Use 'UNSAFE_componentWillUpdate' instead."
|
|
@@ -842,11 +922,16 @@ var no_component_will_update_default = createRule({
|
|
|
842
922
|
defaultOptions: []
|
|
843
923
|
});
|
|
844
924
|
var RULE_NAME21 = "no-context-provider";
|
|
925
|
+
var RULE_FEATURES21 = [
|
|
926
|
+
"LNT",
|
|
927
|
+
"FIX"
|
|
928
|
+
];
|
|
845
929
|
var no_context_provider_default = createRule({
|
|
846
930
|
meta: {
|
|
847
931
|
type: "problem",
|
|
848
932
|
docs: {
|
|
849
|
-
description: "disallow the use of '<Context.Provider>'"
|
|
933
|
+
description: "disallow the use of '<Context.Provider>'",
|
|
934
|
+
[Symbol.for("rule_features")]: RULE_FEATURES21
|
|
850
935
|
},
|
|
851
936
|
fixable: "code",
|
|
852
937
|
messages: {
|
|
@@ -883,11 +968,15 @@ var no_context_provider_default = createRule({
|
|
|
883
968
|
defaultOptions: []
|
|
884
969
|
});
|
|
885
970
|
var RULE_NAME22 = "no-create-ref";
|
|
971
|
+
var RULE_FEATURES22 = [
|
|
972
|
+
"LNT"
|
|
973
|
+
];
|
|
886
974
|
var no_create_ref_default = createRule({
|
|
887
975
|
meta: {
|
|
888
976
|
type: "problem",
|
|
889
977
|
docs: {
|
|
890
|
-
description: "disallow using 'createRef' in function components"
|
|
978
|
+
description: "disallow using 'createRef' in function components",
|
|
979
|
+
[Symbol.for("rule_features")]: RULE_FEATURES22
|
|
891
980
|
},
|
|
892
981
|
messages: {
|
|
893
982
|
noCreateRef: "[Deprecated] Use 'useRef' instead."
|
|
@@ -907,11 +996,15 @@ var no_create_ref_default = createRule({
|
|
|
907
996
|
defaultOptions: []
|
|
908
997
|
});
|
|
909
998
|
var RULE_NAME23 = "no-default-props";
|
|
999
|
+
var RULE_FEATURES23 = [
|
|
1000
|
+
"LNT"
|
|
1001
|
+
];
|
|
910
1002
|
var no_default_props_default = createRule({
|
|
911
1003
|
meta: {
|
|
912
1004
|
type: "problem",
|
|
913
1005
|
docs: {
|
|
914
|
-
description: "disallow using 'defaultProps' property in components"
|
|
1006
|
+
description: "disallow using 'defaultProps' property in components",
|
|
1007
|
+
[Symbol.for("rule_features")]: RULE_FEATURES23
|
|
915
1008
|
},
|
|
916
1009
|
messages: {
|
|
917
1010
|
noDefaultProps: "[Deprecated] Use ES6 default parameters instead."
|
|
@@ -946,6 +1039,9 @@ var no_default_props_default = createRule({
|
|
|
946
1039
|
defaultOptions: []
|
|
947
1040
|
});
|
|
948
1041
|
var RULE_NAME24 = "no-direct-mutation-state";
|
|
1042
|
+
var RULE_FEATURES24 = [
|
|
1043
|
+
"LNT"
|
|
1044
|
+
];
|
|
949
1045
|
function getName2(node) {
|
|
950
1046
|
if (node.type === AST_NODE_TYPES.TSAsExpression) {
|
|
951
1047
|
return getName2(node.expression);
|
|
@@ -972,7 +1068,8 @@ var no_direct_mutation_state_default = createRule({
|
|
|
972
1068
|
meta: {
|
|
973
1069
|
type: "problem",
|
|
974
1070
|
docs: {
|
|
975
|
-
description: "disallow direct mutation of state"
|
|
1071
|
+
description: "disallow direct mutation of state",
|
|
1072
|
+
[Symbol.for("rule_features")]: RULE_FEATURES24
|
|
976
1073
|
},
|
|
977
1074
|
messages: {
|
|
978
1075
|
noDirectMutationState: "Do not mutate state directly. Use 'setState()' instead."
|
|
@@ -1004,11 +1101,15 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1004
1101
|
defaultOptions: []
|
|
1005
1102
|
});
|
|
1006
1103
|
var RULE_NAME25 = "no-duplicate-key";
|
|
1104
|
+
var RULE_FEATURES25 = [
|
|
1105
|
+
"LNT"
|
|
1106
|
+
];
|
|
1007
1107
|
var no_duplicate_key_default = createRule({
|
|
1008
1108
|
meta: {
|
|
1009
1109
|
type: "problem",
|
|
1010
1110
|
docs: {
|
|
1011
|
-
description: "disallow duplicate keys when rendering list"
|
|
1111
|
+
description: "disallow duplicate keys when rendering list",
|
|
1112
|
+
[Symbol.for("rule_features")]: RULE_FEATURES25
|
|
1012
1113
|
},
|
|
1013
1114
|
messages: {
|
|
1014
1115
|
noDuplicateKey: "A key must be unique. '{{value}}' is duplicated."
|
|
@@ -1133,11 +1234,16 @@ var no_duplicate_key_default = createRule({
|
|
|
1133
1234
|
defaultOptions: []
|
|
1134
1235
|
});
|
|
1135
1236
|
var RULE_NAME26 = "no-forward-ref";
|
|
1237
|
+
var RULE_FEATURES26 = [
|
|
1238
|
+
"LNT",
|
|
1239
|
+
"FIX"
|
|
1240
|
+
];
|
|
1136
1241
|
var no_forward_ref_default = createRule({
|
|
1137
1242
|
meta: {
|
|
1138
1243
|
type: "problem",
|
|
1139
1244
|
docs: {
|
|
1140
|
-
description: "disallow the use of 'forwardRef'"
|
|
1245
|
+
description: "disallow the use of 'forwardRef'",
|
|
1246
|
+
[Symbol.for("rule_features")]: RULE_FEATURES26
|
|
1141
1247
|
},
|
|
1142
1248
|
fixable: "code",
|
|
1143
1249
|
messages: {
|
|
@@ -1225,11 +1331,15 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1225
1331
|
];
|
|
1226
1332
|
}
|
|
1227
1333
|
var RULE_NAME27 = "no-implicit-key";
|
|
1334
|
+
var RULE_FEATURES27 = [
|
|
1335
|
+
"LNT"
|
|
1336
|
+
];
|
|
1228
1337
|
var no_implicit_key_default = createRule({
|
|
1229
1338
|
meta: {
|
|
1230
1339
|
type: "problem",
|
|
1231
1340
|
docs: {
|
|
1232
|
-
description: "disallow implicit 'key' props"
|
|
1341
|
+
description: "disallow implicit 'key' props",
|
|
1342
|
+
[Symbol.for("rule_features")]: RULE_FEATURES27
|
|
1233
1343
|
},
|
|
1234
1344
|
messages: {
|
|
1235
1345
|
noImplicitKey: "Do not use implicit 'key' props."
|
|
@@ -1280,6 +1390,10 @@ function unionTypeParts(type) {
|
|
|
1280
1390
|
return isUnionType(type) ? type.types : [type];
|
|
1281
1391
|
}
|
|
1282
1392
|
var RULE_NAME28 = "no-leaked-conditional-rendering";
|
|
1393
|
+
var RULE_FEATURES28 = [
|
|
1394
|
+
"LNT",
|
|
1395
|
+
"TSC"
|
|
1396
|
+
];
|
|
1283
1397
|
var tsHelpers = {
|
|
1284
1398
|
isAnyType: (type) => isTypeFlagSet(type, ts.TypeFlags.TypeParameter | ts.TypeFlags.Any),
|
|
1285
1399
|
isBigIntType: (type) => isTypeFlagSet(type, ts.TypeFlags.BigIntLike),
|
|
@@ -1376,7 +1490,8 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1376
1490
|
meta: {
|
|
1377
1491
|
type: "problem",
|
|
1378
1492
|
docs: {
|
|
1379
|
-
description: "disallow problematic leaked values from being rendered"
|
|
1493
|
+
description: "disallow problematic leaked values from being rendered",
|
|
1494
|
+
[Symbol.for("rule_features")]: RULE_FEATURES28
|
|
1380
1495
|
},
|
|
1381
1496
|
messages: {
|
|
1382
1497
|
noLeakedConditionalRendering: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes."
|
|
@@ -1441,11 +1556,15 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1441
1556
|
defaultOptions: []
|
|
1442
1557
|
});
|
|
1443
1558
|
var RULE_NAME29 = "no-missing-component-display-name";
|
|
1559
|
+
var RULE_FEATURES29 = [
|
|
1560
|
+
"LNT"
|
|
1561
|
+
];
|
|
1444
1562
|
var no_missing_component_display_name_default = createRule({
|
|
1445
1563
|
meta: {
|
|
1446
1564
|
type: "problem",
|
|
1447
1565
|
docs: {
|
|
1448
|
-
description: "require 'displayName' for 'memo' and 'forwardRef' components"
|
|
1566
|
+
description: "require 'displayName' for 'memo' and 'forwardRef' components",
|
|
1567
|
+
[Symbol.for("rule_features")]: RULE_FEATURES29
|
|
1449
1568
|
},
|
|
1450
1569
|
messages: {
|
|
1451
1570
|
noMissingComponentDisplayName: "Add missing 'displayName' for component."
|
|
@@ -1477,11 +1596,15 @@ var no_missing_component_display_name_default = createRule({
|
|
|
1477
1596
|
defaultOptions: []
|
|
1478
1597
|
});
|
|
1479
1598
|
var RULE_NAME30 = "no-missing-key";
|
|
1599
|
+
var RULE_FEATURES30 = [
|
|
1600
|
+
"LNT"
|
|
1601
|
+
];
|
|
1480
1602
|
var no_missing_key_default = createRule({
|
|
1481
1603
|
meta: {
|
|
1482
1604
|
type: "problem",
|
|
1483
1605
|
docs: {
|
|
1484
|
-
description: "require 'key' when rendering list"
|
|
1606
|
+
description: "require 'key' when rendering list",
|
|
1607
|
+
[Symbol.for("rule_features")]: RULE_FEATURES30
|
|
1485
1608
|
},
|
|
1486
1609
|
messages: {
|
|
1487
1610
|
noMissingKey: "Missing 'key' for element when rendering list.",
|
|
@@ -1594,11 +1717,15 @@ var no_missing_key_default = createRule({
|
|
|
1594
1717
|
defaultOptions: []
|
|
1595
1718
|
});
|
|
1596
1719
|
var RULE_NAME31 = "no-nested-components";
|
|
1720
|
+
var RULE_FEATURES31 = [
|
|
1721
|
+
"LNT"
|
|
1722
|
+
];
|
|
1597
1723
|
var no_nested_components_default = createRule({
|
|
1598
1724
|
meta: {
|
|
1599
1725
|
type: "problem",
|
|
1600
1726
|
docs: {
|
|
1601
|
-
description: "disallow using unstable nested components"
|
|
1727
|
+
description: "disallow using unstable nested components",
|
|
1728
|
+
[Symbol.for("rule_features")]: RULE_FEATURES31
|
|
1602
1729
|
},
|
|
1603
1730
|
messages: {
|
|
1604
1731
|
nestedComponent: "Do not nest components inside other components. Move it to the top level.",
|
|
@@ -1691,11 +1818,15 @@ var no_nested_components_default = createRule({
|
|
|
1691
1818
|
defaultOptions: []
|
|
1692
1819
|
});
|
|
1693
1820
|
var RULE_NAME32 = "no-prop-types";
|
|
1821
|
+
var RULE_FEATURES32 = [
|
|
1822
|
+
"LNT"
|
|
1823
|
+
];
|
|
1694
1824
|
var no_prop_types_default = createRule({
|
|
1695
1825
|
meta: {
|
|
1696
1826
|
type: "problem",
|
|
1697
1827
|
docs: {
|
|
1698
|
-
description: "disallow using 'propTypes' property in components"
|
|
1828
|
+
description: "disallow using 'propTypes' property in components",
|
|
1829
|
+
[Symbol.for("rule_features")]: RULE_FEATURES32
|
|
1699
1830
|
},
|
|
1700
1831
|
messages: {
|
|
1701
1832
|
noPropTypes: "[Deprecated] Use TypeScript or another type-checking solution instead."
|
|
@@ -1730,6 +1861,9 @@ var no_prop_types_default = createRule({
|
|
|
1730
1861
|
defaultOptions: []
|
|
1731
1862
|
});
|
|
1732
1863
|
var RULE_NAME33 = "no-redundant-should-component-update";
|
|
1864
|
+
var RULE_FEATURES33 = [
|
|
1865
|
+
"LNT"
|
|
1866
|
+
];
|
|
1733
1867
|
function isShouldComponentUpdate(node) {
|
|
1734
1868
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
|
|
1735
1869
|
}
|
|
@@ -1737,7 +1871,8 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1737
1871
|
meta: {
|
|
1738
1872
|
type: "problem",
|
|
1739
1873
|
docs: {
|
|
1740
|
-
description: "disallow using 'shouldComponentUpdate' in class component extends 'React.PureComponent'"
|
|
1874
|
+
description: "disallow using 'shouldComponentUpdate' in class component extends 'React.PureComponent'",
|
|
1875
|
+
[Symbol.for("rule_features")]: RULE_FEATURES33
|
|
1741
1876
|
},
|
|
1742
1877
|
messages: {
|
|
1743
1878
|
noRedundantShouldComponentUpdate: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'."
|
|
@@ -1773,6 +1908,9 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1773
1908
|
defaultOptions: []
|
|
1774
1909
|
});
|
|
1775
1910
|
var RULE_NAME34 = "no-set-state-in-component-did-mount";
|
|
1911
|
+
var RULE_FEATURES34 = [
|
|
1912
|
+
"LNT"
|
|
1913
|
+
];
|
|
1776
1914
|
function isComponentDidMount(node) {
|
|
1777
1915
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
|
|
1778
1916
|
}
|
|
@@ -1780,7 +1918,8 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
1780
1918
|
meta: {
|
|
1781
1919
|
type: "problem",
|
|
1782
1920
|
docs: {
|
|
1783
|
-
description: "disallow using 'setState' in 'componentDidMount'"
|
|
1921
|
+
description: "disallow using 'setState' in 'componentDidMount'",
|
|
1922
|
+
[Symbol.for("rule_features")]: RULE_FEATURES34
|
|
1784
1923
|
},
|
|
1785
1924
|
messages: {
|
|
1786
1925
|
noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions, such as callbacks."
|
|
@@ -1816,6 +1955,9 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
1816
1955
|
defaultOptions: []
|
|
1817
1956
|
});
|
|
1818
1957
|
var RULE_NAME35 = "no-set-state-in-component-did-update";
|
|
1958
|
+
var RULE_FEATURES35 = [
|
|
1959
|
+
"LNT"
|
|
1960
|
+
];
|
|
1819
1961
|
function isComponentDidUpdate(node) {
|
|
1820
1962
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidUpdate";
|
|
1821
1963
|
}
|
|
@@ -1823,7 +1965,8 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
1823
1965
|
meta: {
|
|
1824
1966
|
type: "problem",
|
|
1825
1967
|
docs: {
|
|
1826
|
-
description: "disallow using 'setState' in 'componentDidUpdate'"
|
|
1968
|
+
description: "disallow using 'setState' in 'componentDidUpdate'",
|
|
1969
|
+
[Symbol.for("rule_features")]: RULE_FEATURES35
|
|
1827
1970
|
},
|
|
1828
1971
|
messages: {
|
|
1829
1972
|
noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions, such as callbacks."
|
|
@@ -1859,6 +2002,9 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
1859
2002
|
defaultOptions: []
|
|
1860
2003
|
});
|
|
1861
2004
|
var RULE_NAME36 = "no-set-state-in-component-will-update";
|
|
2005
|
+
var RULE_FEATURES36 = [
|
|
2006
|
+
"LNT"
|
|
2007
|
+
];
|
|
1862
2008
|
function isComponentWillUpdate3(node) {
|
|
1863
2009
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
|
|
1864
2010
|
}
|
|
@@ -1866,7 +2012,8 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
1866
2012
|
meta: {
|
|
1867
2013
|
type: "problem",
|
|
1868
2014
|
docs: {
|
|
1869
|
-
description: "disallow using 'setState' in 'componentWillUpdate'"
|
|
2015
|
+
description: "disallow using 'setState' in 'componentWillUpdate'",
|
|
2016
|
+
[Symbol.for("rule_features")]: RULE_FEATURES36
|
|
1870
2017
|
},
|
|
1871
2018
|
messages: {
|
|
1872
2019
|
noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions, such as callbacks."
|
|
@@ -1902,6 +2049,9 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
1902
2049
|
defaultOptions: []
|
|
1903
2050
|
});
|
|
1904
2051
|
var RULE_NAME37 = "no-string-refs";
|
|
2052
|
+
var RULE_FEATURES37 = [
|
|
2053
|
+
"LNT"
|
|
2054
|
+
];
|
|
1905
2055
|
function containsStringLiteral({ value }) {
|
|
1906
2056
|
return value?.type === AST_NODE_TYPES.Literal && isString(value.value);
|
|
1907
2057
|
}
|
|
@@ -1914,7 +2064,8 @@ var no_string_refs_default = createRule({
|
|
|
1914
2064
|
meta: {
|
|
1915
2065
|
type: "problem",
|
|
1916
2066
|
docs: {
|
|
1917
|
-
description: "disallow using deprecated string refs"
|
|
2067
|
+
description: "disallow using deprecated string refs",
|
|
2068
|
+
[Symbol.for("rule_features")]: RULE_FEATURES37
|
|
1918
2069
|
},
|
|
1919
2070
|
messages: {
|
|
1920
2071
|
noStringRefs: "[Deprecated] Use callback refs instead."
|
|
@@ -1938,6 +2089,9 @@ var no_string_refs_default = createRule({
|
|
|
1938
2089
|
defaultOptions: []
|
|
1939
2090
|
});
|
|
1940
2091
|
var RULE_NAME38 = "no-unsafe-component-will-mount";
|
|
2092
|
+
var RULE_FEATURES38 = [
|
|
2093
|
+
"LNT"
|
|
2094
|
+
];
|
|
1941
2095
|
function isUnsafeComponentWillMount(node) {
|
|
1942
2096
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillMount";
|
|
1943
2097
|
}
|
|
@@ -1945,7 +2099,8 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
1945
2099
|
meta: {
|
|
1946
2100
|
type: "problem",
|
|
1947
2101
|
docs: {
|
|
1948
|
-
description: "disallow using 'UNSAFE_componentWillMount'"
|
|
2102
|
+
description: "disallow using 'UNSAFE_componentWillMount'",
|
|
2103
|
+
[Symbol.for("rule_features")]: RULE_FEATURES38
|
|
1949
2104
|
},
|
|
1950
2105
|
messages: {
|
|
1951
2106
|
noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'."
|
|
@@ -1977,6 +2132,9 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
1977
2132
|
defaultOptions: []
|
|
1978
2133
|
});
|
|
1979
2134
|
var RULE_NAME39 = "no-unsafe-component-will-receive-props";
|
|
2135
|
+
var RULE_FEATURES39 = [
|
|
2136
|
+
"LNT"
|
|
2137
|
+
];
|
|
1980
2138
|
function isUnsafeComponentWillReceiveProps(node) {
|
|
1981
2139
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillReceiveProps";
|
|
1982
2140
|
}
|
|
@@ -1984,7 +2142,8 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
1984
2142
|
meta: {
|
|
1985
2143
|
type: "problem",
|
|
1986
2144
|
docs: {
|
|
1987
|
-
description: "disallow using 'UNSAFE_componentWillReceiveProps'"
|
|
2145
|
+
description: "disallow using 'UNSAFE_componentWillReceiveProps'",
|
|
2146
|
+
[Symbol.for("rule_features")]: RULE_FEATURES39
|
|
1988
2147
|
},
|
|
1989
2148
|
messages: {
|
|
1990
2149
|
noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'."
|
|
@@ -2016,6 +2175,9 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
2016
2175
|
defaultOptions: []
|
|
2017
2176
|
});
|
|
2018
2177
|
var RULE_NAME40 = "no-unsafe-component-will-update";
|
|
2178
|
+
var RULE_FEATURES40 = [
|
|
2179
|
+
"LNT"
|
|
2180
|
+
];
|
|
2019
2181
|
function isUnsafeComponentWillUpdate(node) {
|
|
2020
2182
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillUpdate";
|
|
2021
2183
|
}
|
|
@@ -2023,7 +2185,8 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2023
2185
|
meta: {
|
|
2024
2186
|
type: "problem",
|
|
2025
2187
|
docs: {
|
|
2026
|
-
description: "disallow using 'UNSAFE_componentWillUpdate'"
|
|
2188
|
+
description: "disallow using 'UNSAFE_componentWillUpdate'",
|
|
2189
|
+
[Symbol.for("rule_features")]: RULE_FEATURES40
|
|
2027
2190
|
},
|
|
2028
2191
|
messages: {
|
|
2029
2192
|
noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'."
|
|
@@ -2055,11 +2218,15 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2055
2218
|
defaultOptions: []
|
|
2056
2219
|
});
|
|
2057
2220
|
var RULE_NAME41 = "no-unstable-context-value";
|
|
2221
|
+
var RULE_FEATURES41 = [
|
|
2222
|
+
"LNT"
|
|
2223
|
+
];
|
|
2058
2224
|
var no_unstable_context_value_default = createRule({
|
|
2059
2225
|
meta: {
|
|
2060
2226
|
type: "problem",
|
|
2061
2227
|
docs: {
|
|
2062
|
-
description: "disallow passing constructed values to context providers"
|
|
2228
|
+
description: "disallow passing constructed values to context providers",
|
|
2229
|
+
[Symbol.for("rule_features")]: RULE_FEATURES41
|
|
2063
2230
|
},
|
|
2064
2231
|
messages: {
|
|
2065
2232
|
noUnstableContextValue: "A/an '{{type}}' passed as the value prop to the context provider should not be constructed. It will change on every render.",
|
|
@@ -2122,11 +2289,15 @@ var no_unstable_context_value_default = createRule({
|
|
|
2122
2289
|
defaultOptions: []
|
|
2123
2290
|
});
|
|
2124
2291
|
var RULE_NAME42 = "no-unstable-default-props";
|
|
2292
|
+
var RULE_FEATURES42 = [
|
|
2293
|
+
"LNT"
|
|
2294
|
+
];
|
|
2125
2295
|
var no_unstable_default_props_default = createRule({
|
|
2126
2296
|
meta: {
|
|
2127
2297
|
type: "problem",
|
|
2128
2298
|
docs: {
|
|
2129
|
-
description: "disallow using unstable value as default param in function component"
|
|
2299
|
+
description: "disallow using unstable value as default param in function component",
|
|
2300
|
+
[Symbol.for("rule_features")]: RULE_FEATURES42
|
|
2130
2301
|
},
|
|
2131
2302
|
messages: {
|
|
2132
2303
|
noUnstableDefaultProps: "A/an '{{forbiddenType}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{forbiddenType}}'."
|
|
@@ -2187,6 +2358,9 @@ var no_unstable_default_props_default = createRule({
|
|
|
2187
2358
|
defaultOptions: []
|
|
2188
2359
|
});
|
|
2189
2360
|
var RULE_NAME43 = "no-unused-class-component-members";
|
|
2361
|
+
var RULE_FEATURES43 = [
|
|
2362
|
+
"LNT"
|
|
2363
|
+
];
|
|
2190
2364
|
var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
|
|
2191
2365
|
"componentDidCatch",
|
|
2192
2366
|
"componentDidMount",
|
|
@@ -2223,7 +2397,8 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2223
2397
|
meta: {
|
|
2224
2398
|
type: "problem",
|
|
2225
2399
|
docs: {
|
|
2226
|
-
description: "disallow unused class component members"
|
|
2400
|
+
description: "disallow unused class component members",
|
|
2401
|
+
[Symbol.for("rule_features")]: RULE_FEATURES43
|
|
2227
2402
|
},
|
|
2228
2403
|
messages: {
|
|
2229
2404
|
noUnusedClassComponentMembers: "Unused method or property '{{methodName}}'' of class '{{className}}'."
|
|
@@ -2314,6 +2489,9 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2314
2489
|
defaultOptions: []
|
|
2315
2490
|
});
|
|
2316
2491
|
var RULE_NAME44 = "no-unused-state";
|
|
2492
|
+
var RULE_FEATURES44 = [
|
|
2493
|
+
"LNT"
|
|
2494
|
+
];
|
|
2317
2495
|
function getName4(node) {
|
|
2318
2496
|
if (node.type === AST_NODE_TYPES.TSAsExpression) {
|
|
2319
2497
|
return getName4(node.expression);
|
|
@@ -2346,7 +2524,8 @@ var no_unused_state_default = createRule({
|
|
|
2346
2524
|
meta: {
|
|
2347
2525
|
type: "problem",
|
|
2348
2526
|
docs: {
|
|
2349
|
-
description: "disallow unused state of class component"
|
|
2527
|
+
description: "disallow unused state of class component",
|
|
2528
|
+
[Symbol.for("rule_features")]: RULE_FEATURES44
|
|
2350
2529
|
},
|
|
2351
2530
|
messages: {
|
|
2352
2531
|
noUnusedState: "Unused class component state in '{{className}}'"
|
|
@@ -2514,6 +2693,9 @@ var no_useless_fragment_default = createRule({
|
|
|
2514
2693
|
}]
|
|
2515
2694
|
});
|
|
2516
2695
|
var RULE_NAME46 = "prefer-destructuring-assignment";
|
|
2696
|
+
var RULE_FEATURES45 = [
|
|
2697
|
+
"LNT"
|
|
2698
|
+
];
|
|
2517
2699
|
function isMemberExpressionWithObjectName(node) {
|
|
2518
2700
|
return node.object.type === AST_NODE_TYPES.Identifier && "name" in node.object;
|
|
2519
2701
|
}
|
|
@@ -2521,7 +2703,8 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2521
2703
|
meta: {
|
|
2522
2704
|
type: "problem",
|
|
2523
2705
|
docs: {
|
|
2524
|
-
description: "enforce using destructuring assignment in component props and context"
|
|
2706
|
+
description: "enforce using destructuring assignment in component props and context",
|
|
2707
|
+
[Symbol.for("rule_features")]: RULE_FEATURES45
|
|
2525
2708
|
},
|
|
2526
2709
|
messages: {
|
|
2527
2710
|
preferDestructuringAssignment: "Use destructuring assignment for {{name}}."
|
|
@@ -2584,11 +2767,16 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2584
2767
|
defaultOptions: []
|
|
2585
2768
|
});
|
|
2586
2769
|
var RULE_NAME47 = "prefer-react-namespace-import";
|
|
2770
|
+
var RULE_FEATURES46 = [
|
|
2771
|
+
"LNT",
|
|
2772
|
+
"FIX"
|
|
2773
|
+
];
|
|
2587
2774
|
var prefer_react_namespace_import_default = createRule({
|
|
2588
2775
|
meta: {
|
|
2589
2776
|
type: "problem",
|
|
2590
2777
|
docs: {
|
|
2591
|
-
description: "enforce React is imported via a namespace import"
|
|
2778
|
+
description: "enforce React is imported via a namespace import",
|
|
2779
|
+
[Symbol.for("rule_features")]: RULE_FEATURES46
|
|
2592
2780
|
},
|
|
2593
2781
|
fixable: "code",
|
|
2594
2782
|
messages: {
|
|
@@ -2633,6 +2821,10 @@ ${importStringPrefix} ${specifiers} from ${importSourceQuoted}${semiColon}`
|
|
|
2633
2821
|
defaultOptions: []
|
|
2634
2822
|
});
|
|
2635
2823
|
var RULE_NAME48 = "prefer-read-only-props";
|
|
2824
|
+
var RULE_FEATURES47 = [
|
|
2825
|
+
"LNT",
|
|
2826
|
+
"TSC"
|
|
2827
|
+
];
|
|
2636
2828
|
function isReadonlyType(type, services) {
|
|
2637
2829
|
try {
|
|
2638
2830
|
const im = getTypeImmutability(services.program, type);
|
|
@@ -2645,7 +2837,8 @@ var prefer_read_only_props_default = createRule({
|
|
|
2645
2837
|
meta: {
|
|
2646
2838
|
type: "problem",
|
|
2647
2839
|
docs: {
|
|
2648
|
-
description: "enforce read-only props in components"
|
|
2840
|
+
description: "enforce read-only props in components",
|
|
2841
|
+
[Symbol.for("rule_features")]: RULE_FEATURES47
|
|
2649
2842
|
},
|
|
2650
2843
|
messages: {
|
|
2651
2844
|
preferReadOnlyProps: "A function component's props should be read-only."
|
|
@@ -2673,11 +2866,16 @@ var prefer_read_only_props_default = createRule({
|
|
|
2673
2866
|
defaultOptions: []
|
|
2674
2867
|
});
|
|
2675
2868
|
var RULE_NAME49 = "prefer-shorthand-boolean";
|
|
2869
|
+
var RULE_FEATURES48 = [
|
|
2870
|
+
"LNT",
|
|
2871
|
+
"FIX"
|
|
2872
|
+
];
|
|
2676
2873
|
var prefer_shorthand_boolean_default = createRule({
|
|
2677
2874
|
meta: {
|
|
2678
2875
|
type: "problem",
|
|
2679
2876
|
docs: {
|
|
2680
|
-
description: "enforce using shorthand boolean attributes"
|
|
2877
|
+
description: "enforce using shorthand boolean attributes",
|
|
2878
|
+
[Symbol.for("rule_features")]: RULE_FEATURES48
|
|
2681
2879
|
},
|
|
2682
2880
|
fixable: "code",
|
|
2683
2881
|
messages: {
|
|
@@ -2708,11 +2906,16 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
2708
2906
|
defaultOptions: []
|
|
2709
2907
|
});
|
|
2710
2908
|
var RULE_NAME50 = "prefer-shorthand-fragment";
|
|
2909
|
+
var RULE_FEATURES49 = [
|
|
2910
|
+
"LNT"
|
|
2911
|
+
// "FIX",
|
|
2912
|
+
];
|
|
2711
2913
|
var prefer_shorthand_fragment_default = createRule({
|
|
2712
2914
|
meta: {
|
|
2713
2915
|
type: "problem",
|
|
2714
2916
|
docs: {
|
|
2715
|
-
description: "enforce using fragment syntax instead of 'Fragment' component"
|
|
2917
|
+
description: "enforce using fragment syntax instead of 'Fragment' component",
|
|
2918
|
+
[Symbol.for("rule_features")]: RULE_FEATURES49
|
|
2716
2919
|
},
|
|
2717
2920
|
messages: {
|
|
2718
2921
|
preferShorthandFragment: "Use fragment shorthand syntax instead of 'Fragment' component."
|