eslint-plugin-react-x 1.19.0 → 1.20.0-beta.13
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/README.md +4 -53
- package/dist/index.d.mts +0 -8
- package/dist/index.d.ts +0 -8
- package/dist/index.js +273 -64
- package/dist/index.mjs +273 -64
- package/package.json +14 -13
package/dist/index.js
CHANGED
|
@@ -41,16 +41,20 @@ var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
|
41
41
|
|
|
42
42
|
// package.json
|
|
43
43
|
var name = "eslint-plugin-react-x";
|
|
44
|
-
var version = "1.
|
|
44
|
+
var version = "1.20.0-beta.13";
|
|
45
45
|
var createRule = shared.createRuleForPlugin("x");
|
|
46
46
|
|
|
47
47
|
// src/rules/avoid-shorthand-boolean.ts
|
|
48
48
|
var RULE_NAME = "avoid-shorthand-boolean";
|
|
49
|
+
var RULE_FEATURES = [
|
|
50
|
+
"CHK"
|
|
51
|
+
];
|
|
49
52
|
var avoid_shorthand_boolean_default = createRule({
|
|
50
53
|
meta: {
|
|
51
54
|
type: "problem",
|
|
52
55
|
docs: {
|
|
53
|
-
description: "disallow using shorthand boolean attributes"
|
|
56
|
+
description: "disallow using shorthand boolean attributes",
|
|
57
|
+
[Symbol.for("rule_features")]: RULE_FEATURES
|
|
54
58
|
},
|
|
55
59
|
fixable: "code",
|
|
56
60
|
messages: {
|
|
@@ -79,11 +83,15 @@ var avoid_shorthand_boolean_default = createRule({
|
|
|
79
83
|
|
|
80
84
|
// src/rules/avoid-shorthand-fragment.ts
|
|
81
85
|
var RULE_NAME2 = "avoid-shorthand-fragment";
|
|
86
|
+
var RULE_FEATURES2 = [
|
|
87
|
+
"CHK"
|
|
88
|
+
];
|
|
82
89
|
var avoid_shorthand_fragment_default = createRule({
|
|
83
90
|
meta: {
|
|
84
91
|
type: "problem",
|
|
85
92
|
docs: {
|
|
86
|
-
description: "disallow using shorthand fragment syntax"
|
|
93
|
+
description: "disallow using shorthand fragment syntax",
|
|
94
|
+
[Symbol.for("rule_features")]: RULE_FEATURES2
|
|
87
95
|
},
|
|
88
96
|
messages: {
|
|
89
97
|
avoidShorthandFragment: "Avoid using shorthand fragment syntax. Use 'Fragment' component instead."
|
|
@@ -104,11 +112,15 @@ var avoid_shorthand_fragment_default = createRule({
|
|
|
104
112
|
defaultOptions: []
|
|
105
113
|
});
|
|
106
114
|
var RULE_NAME3 = "ensure-forward-ref-using-ref";
|
|
115
|
+
var RULE_FEATURES3 = [
|
|
116
|
+
"CHK"
|
|
117
|
+
];
|
|
107
118
|
var ensure_forward_ref_using_ref_default = createRule({
|
|
108
119
|
meta: {
|
|
109
120
|
type: "problem",
|
|
110
121
|
docs: {
|
|
111
|
-
description: "require a 'ref' parameter to be set when using 'forwardRef'"
|
|
122
|
+
description: "require a 'ref' parameter to be set when using 'forwardRef'",
|
|
123
|
+
[Symbol.for("rule_features")]: RULE_FEATURES3
|
|
112
124
|
},
|
|
113
125
|
messages: {
|
|
114
126
|
ensureForwardRefUsingRef: "A 'forwardRef' is used with this component but no 'ref' parameter is set."
|
|
@@ -134,11 +146,15 @@ var ensure_forward_ref_using_ref_default = createRule({
|
|
|
134
146
|
defaultOptions: []
|
|
135
147
|
});
|
|
136
148
|
var RULE_NAME4 = "jsx-no-duplicate-props";
|
|
149
|
+
var RULE_FEATURES4 = [
|
|
150
|
+
"CHK"
|
|
151
|
+
];
|
|
137
152
|
var jsx_no_duplicate_props_default = createRule({
|
|
138
153
|
meta: {
|
|
139
154
|
type: "problem",
|
|
140
155
|
docs: {
|
|
141
|
-
description: "disallow duplicate props"
|
|
156
|
+
description: "disallow duplicate props",
|
|
157
|
+
[Symbol.for("rule_features")]: RULE_FEATURES4
|
|
142
158
|
},
|
|
143
159
|
messages: {
|
|
144
160
|
jsxNoDuplicateProps: "Duplicate prop '{{name}}'"
|
|
@@ -170,12 +186,14 @@ var jsx_no_duplicate_props_default = createRule({
|
|
|
170
186
|
defaultOptions: []
|
|
171
187
|
});
|
|
172
188
|
var RULE_NAME5 = "jsx-uses-vars";
|
|
189
|
+
var RULE_FEATURES5 = [];
|
|
173
190
|
var jsx_uses_vars_default = createRule({
|
|
174
191
|
meta: {
|
|
175
192
|
type: "problem",
|
|
176
193
|
docs: {
|
|
177
194
|
// eslint-disable-next-line eslint-plugin/require-meta-docs-description
|
|
178
|
-
description: "a helper rule to mark variables as used"
|
|
195
|
+
description: "a helper rule to mark variables as used",
|
|
196
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
179
197
|
},
|
|
180
198
|
messages: {
|
|
181
199
|
jsxUsesVars: ""
|
|
@@ -206,6 +224,9 @@ var jsx_uses_vars_default = createRule({
|
|
|
206
224
|
defaultOptions: []
|
|
207
225
|
});
|
|
208
226
|
var RULE_NAME6 = "no-access-state-in-setstate";
|
|
227
|
+
var RULE_FEATURES6 = [
|
|
228
|
+
"CHK"
|
|
229
|
+
];
|
|
209
230
|
function getName(node) {
|
|
210
231
|
if (node.type === types.AST_NODE_TYPES.TSAsExpression) {
|
|
211
232
|
return getName(node.expression);
|
|
@@ -225,7 +246,8 @@ var no_access_state_in_setstate_default = createRule({
|
|
|
225
246
|
meta: {
|
|
226
247
|
type: "problem",
|
|
227
248
|
docs: {
|
|
228
|
-
description: "disallow accessing 'this.state' within 'setState'"
|
|
249
|
+
description: "disallow accessing 'this.state' within 'setState'",
|
|
250
|
+
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
229
251
|
},
|
|
230
252
|
messages: {
|
|
231
253
|
noAccessStateInSetstate: "Do not access 'this.state' within 'setState'. Use the update function instead."
|
|
@@ -304,6 +326,9 @@ var no_access_state_in_setstate_default = createRule({
|
|
|
304
326
|
defaultOptions: []
|
|
305
327
|
});
|
|
306
328
|
var RULE_NAME7 = "no-array-index-key";
|
|
329
|
+
var RULE_FEATURES7 = [
|
|
330
|
+
"CHK"
|
|
331
|
+
];
|
|
307
332
|
var reactChildrenMethod = ["forEach", "map"];
|
|
308
333
|
var iteratorFunctionIndexParamPosition = /* @__PURE__ */ new Map([
|
|
309
334
|
["every", 1],
|
|
@@ -368,7 +393,8 @@ var no_array_index_key_default = createRule({
|
|
|
368
393
|
meta: {
|
|
369
394
|
type: "problem",
|
|
370
395
|
docs: {
|
|
371
|
-
description: "disallow using Array index as 'key'"
|
|
396
|
+
description: "disallow using Array index as 'key'",
|
|
397
|
+
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
372
398
|
},
|
|
373
399
|
messages: {
|
|
374
400
|
noArrayIndexKey: "Do not use Array index as 'key'."
|
|
@@ -418,7 +444,7 @@ var no_array_index_key_default = createRule({
|
|
|
418
444
|
const [_, props] = node.arguments;
|
|
419
445
|
if (props?.type !== types.AST_NODE_TYPES.ObjectExpression) return;
|
|
420
446
|
for (const prop of props.properties) {
|
|
421
|
-
if (!tsPattern.isMatching({ key: { name: "key" } }
|
|
447
|
+
if (!tsPattern.isMatching({ key: { name: "key" } })(prop)) continue;
|
|
422
448
|
if (!("value" in prop)) continue;
|
|
423
449
|
const descriptors = getReportDescriptor(prop.value);
|
|
424
450
|
for (const descriptor of descriptors) {
|
|
@@ -444,11 +470,15 @@ var no_array_index_key_default = createRule({
|
|
|
444
470
|
defaultOptions: []
|
|
445
471
|
});
|
|
446
472
|
var RULE_NAME8 = "no-children-count";
|
|
473
|
+
var RULE_FEATURES8 = [
|
|
474
|
+
"CHK"
|
|
475
|
+
];
|
|
447
476
|
var no_children_count_default = createRule({
|
|
448
477
|
meta: {
|
|
449
478
|
type: "problem",
|
|
450
479
|
docs: {
|
|
451
|
-
description: "disallow using 'Children.count'"
|
|
480
|
+
description: "disallow using 'Children.count'",
|
|
481
|
+
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
452
482
|
},
|
|
453
483
|
messages: {
|
|
454
484
|
noChildrenCount: "Using 'Children.count' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -471,11 +501,15 @@ var no_children_count_default = createRule({
|
|
|
471
501
|
defaultOptions: []
|
|
472
502
|
});
|
|
473
503
|
var RULE_NAME9 = "no-children-for-each";
|
|
504
|
+
var RULE_FEATURES9 = [
|
|
505
|
+
"CHK"
|
|
506
|
+
];
|
|
474
507
|
var no_children_for_each_default = createRule({
|
|
475
508
|
meta: {
|
|
476
509
|
type: "problem",
|
|
477
510
|
docs: {
|
|
478
|
-
description: "disallow using 'Children.forEach'"
|
|
511
|
+
description: "disallow using 'Children.forEach'",
|
|
512
|
+
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
479
513
|
},
|
|
480
514
|
messages: {
|
|
481
515
|
noChildrenForEach: "Using 'Children.forEach' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -498,11 +532,15 @@ var no_children_for_each_default = createRule({
|
|
|
498
532
|
defaultOptions: []
|
|
499
533
|
});
|
|
500
534
|
var RULE_NAME10 = "no-children-map";
|
|
535
|
+
var RULE_FEATURES10 = [
|
|
536
|
+
"CHK"
|
|
537
|
+
];
|
|
501
538
|
var no_children_map_default = createRule({
|
|
502
539
|
meta: {
|
|
503
540
|
type: "problem",
|
|
504
541
|
docs: {
|
|
505
|
-
description: "disallow using 'Children.map'"
|
|
542
|
+
description: "disallow using 'Children.map'",
|
|
543
|
+
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
506
544
|
},
|
|
507
545
|
messages: {
|
|
508
546
|
noChildrenMap: "Using 'Children.map' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -525,11 +563,15 @@ var no_children_map_default = createRule({
|
|
|
525
563
|
defaultOptions: []
|
|
526
564
|
});
|
|
527
565
|
var RULE_NAME11 = "no-children-only";
|
|
566
|
+
var RULE_FEATURES11 = [
|
|
567
|
+
"CHK"
|
|
568
|
+
];
|
|
528
569
|
var no_children_only_default = createRule({
|
|
529
570
|
meta: {
|
|
530
571
|
type: "problem",
|
|
531
572
|
docs: {
|
|
532
|
-
description: "disallow using 'Children.only'"
|
|
573
|
+
description: "disallow using 'Children.only'",
|
|
574
|
+
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
533
575
|
},
|
|
534
576
|
messages: {
|
|
535
577
|
noChildrenOnly: "Using 'Children.only' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -552,11 +594,15 @@ var no_children_only_default = createRule({
|
|
|
552
594
|
defaultOptions: []
|
|
553
595
|
});
|
|
554
596
|
var RULE_NAME12 = "no-children-prop";
|
|
597
|
+
var RULE_FEATURES12 = [
|
|
598
|
+
"CHK"
|
|
599
|
+
];
|
|
555
600
|
var no_children_prop_default = createRule({
|
|
556
601
|
meta: {
|
|
557
602
|
type: "problem",
|
|
558
603
|
docs: {
|
|
559
|
-
description: "disallow passing 'children' as props"
|
|
604
|
+
description: "disallow passing 'children' as props",
|
|
605
|
+
[Symbol.for("rule_features")]: RULE_FEATURES12
|
|
560
606
|
},
|
|
561
607
|
messages: {
|
|
562
608
|
noChildrenProp: "Do not pass 'children' as props."
|
|
@@ -577,11 +623,15 @@ var no_children_prop_default = createRule({
|
|
|
577
623
|
defaultOptions: []
|
|
578
624
|
});
|
|
579
625
|
var RULE_NAME13 = "no-children-to-array";
|
|
626
|
+
var RULE_FEATURES13 = [
|
|
627
|
+
"CHK"
|
|
628
|
+
];
|
|
580
629
|
var no_children_to_array_default = createRule({
|
|
581
630
|
meta: {
|
|
582
631
|
type: "problem",
|
|
583
632
|
docs: {
|
|
584
|
-
description: "disallow using 'Children.toArray'"
|
|
633
|
+
description: "disallow using 'Children.toArray'",
|
|
634
|
+
[Symbol.for("rule_features")]: RULE_FEATURES13
|
|
585
635
|
},
|
|
586
636
|
messages: {
|
|
587
637
|
noChildrenToArray: "Using 'Children.toArray' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -604,6 +654,9 @@ var no_children_to_array_default = createRule({
|
|
|
604
654
|
defaultOptions: []
|
|
605
655
|
});
|
|
606
656
|
var RULE_NAME14 = "no-class-component";
|
|
657
|
+
var RULE_FEATURES14 = [
|
|
658
|
+
"CHK"
|
|
659
|
+
];
|
|
607
660
|
var isComponentDidCatch = tsPattern.isMatching({
|
|
608
661
|
key: {
|
|
609
662
|
type: types.AST_NODE_TYPES.Identifier,
|
|
@@ -624,7 +677,8 @@ var no_class_component_default = createRule({
|
|
|
624
677
|
meta: {
|
|
625
678
|
type: "problem",
|
|
626
679
|
docs: {
|
|
627
|
-
description: "disallow using class components"
|
|
680
|
+
description: "disallow using class components",
|
|
681
|
+
[Symbol.for("rule_features")]: RULE_FEATURES14
|
|
628
682
|
},
|
|
629
683
|
messages: {
|
|
630
684
|
noClassComponent: "Do not use class components. Use function components instead."
|
|
@@ -656,11 +710,15 @@ var no_class_component_default = createRule({
|
|
|
656
710
|
defaultOptions: []
|
|
657
711
|
});
|
|
658
712
|
var RULE_NAME15 = "no-clone-element";
|
|
713
|
+
var RULE_FEATURES15 = [
|
|
714
|
+
"CHK"
|
|
715
|
+
];
|
|
659
716
|
var no_clone_element_default = createRule({
|
|
660
717
|
meta: {
|
|
661
718
|
type: "problem",
|
|
662
719
|
docs: {
|
|
663
|
-
description: "disallow using 'cloneElement'"
|
|
720
|
+
description: "disallow using 'cloneElement'",
|
|
721
|
+
[Symbol.for("rule_features")]: RULE_FEATURES15
|
|
664
722
|
},
|
|
665
723
|
messages: {
|
|
666
724
|
noCloneElement: "Using 'cloneElement' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -682,11 +740,15 @@ var no_clone_element_default = createRule({
|
|
|
682
740
|
defaultOptions: []
|
|
683
741
|
});
|
|
684
742
|
var RULE_NAME16 = "no-comment-textnodes";
|
|
743
|
+
var RULE_FEATURES16 = [
|
|
744
|
+
"CHK"
|
|
745
|
+
];
|
|
685
746
|
var no_comment_textnodes_default = createRule({
|
|
686
747
|
meta: {
|
|
687
748
|
type: "problem",
|
|
688
749
|
docs: {
|
|
689
|
-
description: "disallow comments from being inserted as text nodes"
|
|
750
|
+
description: "disallow comments from being inserted as text nodes",
|
|
751
|
+
[Symbol.for("rule_features")]: RULE_FEATURES16
|
|
690
752
|
},
|
|
691
753
|
messages: {
|
|
692
754
|
noCommentTextnodes: "Possible misused comment in text node. Comments inside children section of tag should be placed inside braces."
|
|
@@ -718,11 +780,15 @@ var no_comment_textnodes_default = createRule({
|
|
|
718
780
|
defaultOptions: []
|
|
719
781
|
});
|
|
720
782
|
var RULE_NAME17 = "no-complex-conditional-rendering";
|
|
783
|
+
var RULE_FEATURES17 = [
|
|
784
|
+
"CHK"
|
|
785
|
+
];
|
|
721
786
|
var no_complex_conditional_rendering_default = createRule({
|
|
722
787
|
meta: {
|
|
723
788
|
type: "problem",
|
|
724
789
|
docs: {
|
|
725
|
-
description: "disallow complex conditional rendering"
|
|
790
|
+
description: "disallow complex conditional rendering",
|
|
791
|
+
[Symbol.for("rule_features")]: RULE_FEATURES17
|
|
726
792
|
},
|
|
727
793
|
messages: {
|
|
728
794
|
noComplexConditionalRendering: "Avoid complex conditional rendering. Extract the logic into separate elements or components."
|
|
@@ -752,6 +818,10 @@ var no_complex_conditional_rendering_default = createRule({
|
|
|
752
818
|
defaultOptions: []
|
|
753
819
|
});
|
|
754
820
|
var RULE_NAME18 = "no-component-will-mount";
|
|
821
|
+
var RULE_FEATURES18 = [
|
|
822
|
+
"CHK",
|
|
823
|
+
"MOD"
|
|
824
|
+
];
|
|
755
825
|
function isComponentWillMount(node) {
|
|
756
826
|
return AST11__namespace.isOneOf([types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentWillMount";
|
|
757
827
|
}
|
|
@@ -759,8 +829,10 @@ var no_component_will_mount_default = createRule({
|
|
|
759
829
|
meta: {
|
|
760
830
|
type: "problem",
|
|
761
831
|
docs: {
|
|
762
|
-
description: "disallow using 'componentWillMount'"
|
|
832
|
+
description: "disallow using 'componentWillMount'",
|
|
833
|
+
[Symbol.for("rule_features")]: RULE_FEATURES18
|
|
763
834
|
},
|
|
835
|
+
fixable: "code",
|
|
764
836
|
messages: {
|
|
765
837
|
noComponentWillMount: "[Deprecated] Use 'UNSAFE_componentWillMount' instead."
|
|
766
838
|
},
|
|
@@ -780,7 +852,11 @@ var no_component_will_mount_default = createRule({
|
|
|
780
852
|
if (isComponentWillMount(member)) {
|
|
781
853
|
context.report({
|
|
782
854
|
messageId: "noComponentWillMount",
|
|
783
|
-
node: member
|
|
855
|
+
node: member,
|
|
856
|
+
fix(fixer) {
|
|
857
|
+
if (!("key" in member)) return null;
|
|
858
|
+
return fixer.replaceText(member.key, "UNSAFE_componentWillMount");
|
|
859
|
+
}
|
|
784
860
|
});
|
|
785
861
|
}
|
|
786
862
|
}
|
|
@@ -791,6 +867,10 @@ var no_component_will_mount_default = createRule({
|
|
|
791
867
|
defaultOptions: []
|
|
792
868
|
});
|
|
793
869
|
var RULE_NAME19 = "no-component-will-receive-props";
|
|
870
|
+
var RULE_FEATURES19 = [
|
|
871
|
+
"CHK",
|
|
872
|
+
"MOD"
|
|
873
|
+
];
|
|
794
874
|
function isComponentWillUpdate(node) {
|
|
795
875
|
return AST11__namespace.isOneOf([types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentWillReceiveProps";
|
|
796
876
|
}
|
|
@@ -798,8 +878,10 @@ var no_component_will_receive_props_default = createRule({
|
|
|
798
878
|
meta: {
|
|
799
879
|
type: "problem",
|
|
800
880
|
docs: {
|
|
801
|
-
description: "disallow using 'componentWillReceiveProps'"
|
|
881
|
+
description: "disallow using 'componentWillReceiveProps'",
|
|
882
|
+
[Symbol.for("rule_features")]: RULE_FEATURES19
|
|
802
883
|
},
|
|
884
|
+
fixable: "code",
|
|
803
885
|
messages: {
|
|
804
886
|
noComponentWillReceiveProps: "[Deprecated] Use 'UNSAFE_componentWillReceiveProps' instead."
|
|
805
887
|
},
|
|
@@ -819,7 +901,11 @@ var no_component_will_receive_props_default = createRule({
|
|
|
819
901
|
if (isComponentWillUpdate(member)) {
|
|
820
902
|
context.report({
|
|
821
903
|
messageId: "noComponentWillReceiveProps",
|
|
822
|
-
node: member
|
|
904
|
+
node: member,
|
|
905
|
+
fix(fixer) {
|
|
906
|
+
if (!("key" in member)) return null;
|
|
907
|
+
return fixer.replaceText(member.key, "UNSAFE_componentWillReceiveProps");
|
|
908
|
+
}
|
|
823
909
|
});
|
|
824
910
|
}
|
|
825
911
|
}
|
|
@@ -830,6 +916,10 @@ var no_component_will_receive_props_default = createRule({
|
|
|
830
916
|
defaultOptions: []
|
|
831
917
|
});
|
|
832
918
|
var RULE_NAME20 = "no-component-will-update";
|
|
919
|
+
var RULE_FEATURES20 = [
|
|
920
|
+
"CHK",
|
|
921
|
+
"MOD"
|
|
922
|
+
];
|
|
833
923
|
function isComponentWillUpdate2(node) {
|
|
834
924
|
return AST11__namespace.isOneOf([types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
|
|
835
925
|
}
|
|
@@ -837,8 +927,10 @@ var no_component_will_update_default = createRule({
|
|
|
837
927
|
meta: {
|
|
838
928
|
type: "problem",
|
|
839
929
|
docs: {
|
|
840
|
-
description: "disallow using 'componentWillReceiveProps'"
|
|
930
|
+
description: "disallow using 'componentWillReceiveProps'",
|
|
931
|
+
[Symbol.for("rule_features")]: RULE_FEATURES20
|
|
841
932
|
},
|
|
933
|
+
fixable: "code",
|
|
842
934
|
messages: {
|
|
843
935
|
noComponentWillUpdate: "[Deprecated] Use 'UNSAFE_componentWillUpdate' instead."
|
|
844
936
|
},
|
|
@@ -858,7 +950,11 @@ var no_component_will_update_default = createRule({
|
|
|
858
950
|
if (isComponentWillUpdate2(member)) {
|
|
859
951
|
context.report({
|
|
860
952
|
messageId: "noComponentWillUpdate",
|
|
861
|
-
node: member
|
|
953
|
+
node: member,
|
|
954
|
+
fix(fixer) {
|
|
955
|
+
if (!("key" in member)) return null;
|
|
956
|
+
return fixer.replaceText(member.key, "UNSAFE_componentWillUpdate");
|
|
957
|
+
}
|
|
862
958
|
});
|
|
863
959
|
}
|
|
864
960
|
}
|
|
@@ -869,11 +965,16 @@ var no_component_will_update_default = createRule({
|
|
|
869
965
|
defaultOptions: []
|
|
870
966
|
});
|
|
871
967
|
var RULE_NAME21 = "no-context-provider";
|
|
968
|
+
var RULE_FEATURES21 = [
|
|
969
|
+
"CHK",
|
|
970
|
+
"MOD"
|
|
971
|
+
];
|
|
872
972
|
var no_context_provider_default = createRule({
|
|
873
973
|
meta: {
|
|
874
974
|
type: "problem",
|
|
875
975
|
docs: {
|
|
876
|
-
description: "disallow the use of '<Context.Provider>'"
|
|
976
|
+
description: "disallow the use of '<Context.Provider>'",
|
|
977
|
+
[Symbol.for("rule_features")]: RULE_FEATURES21
|
|
877
978
|
},
|
|
878
979
|
fixable: "code",
|
|
879
980
|
messages: {
|
|
@@ -910,11 +1011,15 @@ var no_context_provider_default = createRule({
|
|
|
910
1011
|
defaultOptions: []
|
|
911
1012
|
});
|
|
912
1013
|
var RULE_NAME22 = "no-create-ref";
|
|
1014
|
+
var RULE_FEATURES22 = [
|
|
1015
|
+
"CHK"
|
|
1016
|
+
];
|
|
913
1017
|
var no_create_ref_default = createRule({
|
|
914
1018
|
meta: {
|
|
915
1019
|
type: "problem",
|
|
916
1020
|
docs: {
|
|
917
|
-
description: "disallow using 'createRef' in function components"
|
|
1021
|
+
description: "disallow using 'createRef' in function components",
|
|
1022
|
+
[Symbol.for("rule_features")]: RULE_FEATURES22
|
|
918
1023
|
},
|
|
919
1024
|
messages: {
|
|
920
1025
|
noCreateRef: "[Deprecated] Use 'useRef' instead."
|
|
@@ -934,11 +1039,15 @@ var no_create_ref_default = createRule({
|
|
|
934
1039
|
defaultOptions: []
|
|
935
1040
|
});
|
|
936
1041
|
var RULE_NAME23 = "no-default-props";
|
|
1042
|
+
var RULE_FEATURES23 = [
|
|
1043
|
+
"CHK"
|
|
1044
|
+
];
|
|
937
1045
|
var no_default_props_default = createRule({
|
|
938
1046
|
meta: {
|
|
939
1047
|
type: "problem",
|
|
940
1048
|
docs: {
|
|
941
|
-
description: "disallow using 'defaultProps' property in components"
|
|
1049
|
+
description: "disallow using 'defaultProps' property in components",
|
|
1050
|
+
[Symbol.for("rule_features")]: RULE_FEATURES23
|
|
942
1051
|
},
|
|
943
1052
|
messages: {
|
|
944
1053
|
noDefaultProps: "[Deprecated] Use ES6 default parameters instead."
|
|
@@ -973,6 +1082,9 @@ var no_default_props_default = createRule({
|
|
|
973
1082
|
defaultOptions: []
|
|
974
1083
|
});
|
|
975
1084
|
var RULE_NAME24 = "no-direct-mutation-state";
|
|
1085
|
+
var RULE_FEATURES24 = [
|
|
1086
|
+
"CHK"
|
|
1087
|
+
];
|
|
976
1088
|
function getName2(node) {
|
|
977
1089
|
if (node.type === types.AST_NODE_TYPES.TSAsExpression) {
|
|
978
1090
|
return getName2(node.expression);
|
|
@@ -999,7 +1111,8 @@ var no_direct_mutation_state_default = createRule({
|
|
|
999
1111
|
meta: {
|
|
1000
1112
|
type: "problem",
|
|
1001
1113
|
docs: {
|
|
1002
|
-
description: "disallow direct mutation of state"
|
|
1114
|
+
description: "disallow direct mutation of state",
|
|
1115
|
+
[Symbol.for("rule_features")]: RULE_FEATURES24
|
|
1003
1116
|
},
|
|
1004
1117
|
messages: {
|
|
1005
1118
|
noDirectMutationState: "Do not mutate state directly. Use 'setState()' instead."
|
|
@@ -1031,11 +1144,15 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1031
1144
|
defaultOptions: []
|
|
1032
1145
|
});
|
|
1033
1146
|
var RULE_NAME25 = "no-duplicate-key";
|
|
1147
|
+
var RULE_FEATURES25 = [
|
|
1148
|
+
"CHK"
|
|
1149
|
+
];
|
|
1034
1150
|
var no_duplicate_key_default = createRule({
|
|
1035
1151
|
meta: {
|
|
1036
1152
|
type: "problem",
|
|
1037
1153
|
docs: {
|
|
1038
|
-
description: "disallow duplicate keys when rendering list"
|
|
1154
|
+
description: "disallow duplicate keys when rendering list",
|
|
1155
|
+
[Symbol.for("rule_features")]: RULE_FEATURES25
|
|
1039
1156
|
},
|
|
1040
1157
|
messages: {
|
|
1041
1158
|
noDuplicateKey: "A key must be unique. '{{value}}' is duplicated."
|
|
@@ -1160,11 +1277,16 @@ var no_duplicate_key_default = createRule({
|
|
|
1160
1277
|
defaultOptions: []
|
|
1161
1278
|
});
|
|
1162
1279
|
var RULE_NAME26 = "no-forward-ref";
|
|
1280
|
+
var RULE_FEATURES26 = [
|
|
1281
|
+
"CHK",
|
|
1282
|
+
"MOD"
|
|
1283
|
+
];
|
|
1163
1284
|
var no_forward_ref_default = createRule({
|
|
1164
1285
|
meta: {
|
|
1165
1286
|
type: "problem",
|
|
1166
1287
|
docs: {
|
|
1167
|
-
description: "disallow the use of 'forwardRef'"
|
|
1288
|
+
description: "disallow the use of 'forwardRef'",
|
|
1289
|
+
[Symbol.for("rule_features")]: RULE_FEATURES26
|
|
1168
1290
|
},
|
|
1169
1291
|
fixable: "code",
|
|
1170
1292
|
messages: {
|
|
@@ -1252,11 +1374,15 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1252
1374
|
];
|
|
1253
1375
|
}
|
|
1254
1376
|
var RULE_NAME27 = "no-implicit-key";
|
|
1377
|
+
var RULE_FEATURES27 = [
|
|
1378
|
+
"CHK"
|
|
1379
|
+
];
|
|
1255
1380
|
var no_implicit_key_default = createRule({
|
|
1256
1381
|
meta: {
|
|
1257
1382
|
type: "problem",
|
|
1258
1383
|
docs: {
|
|
1259
|
-
description: "disallow implicit 'key' props"
|
|
1384
|
+
description: "disallow implicit 'key' props",
|
|
1385
|
+
[Symbol.for("rule_features")]: RULE_FEATURES27
|
|
1260
1386
|
},
|
|
1261
1387
|
messages: {
|
|
1262
1388
|
noImplicitKey: "Do not use implicit 'key' props."
|
|
@@ -1307,6 +1433,10 @@ function unionTypeParts(type) {
|
|
|
1307
1433
|
return isUnionType(type) ? type.types : [type];
|
|
1308
1434
|
}
|
|
1309
1435
|
var RULE_NAME28 = "no-leaked-conditional-rendering";
|
|
1436
|
+
var RULE_FEATURES28 = [
|
|
1437
|
+
"CHK",
|
|
1438
|
+
"TSC"
|
|
1439
|
+
];
|
|
1310
1440
|
var tsHelpers = {
|
|
1311
1441
|
isAnyType: (type) => isTypeFlagSet(type, ts__default.default.TypeFlags.TypeParameter | ts__default.default.TypeFlags.Any),
|
|
1312
1442
|
isBigIntType: (type) => isTypeFlagSet(type, ts__default.default.TypeFlags.BigIntLike),
|
|
@@ -1403,7 +1533,8 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1403
1533
|
meta: {
|
|
1404
1534
|
type: "problem",
|
|
1405
1535
|
docs: {
|
|
1406
|
-
description: "disallow problematic leaked values from being rendered"
|
|
1536
|
+
description: "disallow problematic leaked values from being rendered",
|
|
1537
|
+
[Symbol.for("rule_features")]: RULE_FEATURES28
|
|
1407
1538
|
},
|
|
1408
1539
|
messages: {
|
|
1409
1540
|
noLeakedConditionalRendering: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes."
|
|
@@ -1468,11 +1599,15 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1468
1599
|
defaultOptions: []
|
|
1469
1600
|
});
|
|
1470
1601
|
var RULE_NAME29 = "no-missing-component-display-name";
|
|
1602
|
+
var RULE_FEATURES29 = [
|
|
1603
|
+
"CHK"
|
|
1604
|
+
];
|
|
1471
1605
|
var no_missing_component_display_name_default = createRule({
|
|
1472
1606
|
meta: {
|
|
1473
1607
|
type: "problem",
|
|
1474
1608
|
docs: {
|
|
1475
|
-
description: "require 'displayName' for 'memo' and 'forwardRef' components"
|
|
1609
|
+
description: "require 'displayName' for 'memo' and 'forwardRef' components",
|
|
1610
|
+
[Symbol.for("rule_features")]: RULE_FEATURES29
|
|
1476
1611
|
},
|
|
1477
1612
|
messages: {
|
|
1478
1613
|
noMissingComponentDisplayName: "Add missing 'displayName' for component."
|
|
@@ -1504,11 +1639,15 @@ var no_missing_component_display_name_default = createRule({
|
|
|
1504
1639
|
defaultOptions: []
|
|
1505
1640
|
});
|
|
1506
1641
|
var RULE_NAME30 = "no-missing-key";
|
|
1642
|
+
var RULE_FEATURES30 = [
|
|
1643
|
+
"CHK"
|
|
1644
|
+
];
|
|
1507
1645
|
var no_missing_key_default = createRule({
|
|
1508
1646
|
meta: {
|
|
1509
1647
|
type: "problem",
|
|
1510
1648
|
docs: {
|
|
1511
|
-
description: "require 'key' when rendering list"
|
|
1649
|
+
description: "require 'key' when rendering list",
|
|
1650
|
+
[Symbol.for("rule_features")]: RULE_FEATURES30
|
|
1512
1651
|
},
|
|
1513
1652
|
messages: {
|
|
1514
1653
|
noMissingKey: "Missing 'key' for element when rendering list.",
|
|
@@ -1621,11 +1760,15 @@ var no_missing_key_default = createRule({
|
|
|
1621
1760
|
defaultOptions: []
|
|
1622
1761
|
});
|
|
1623
1762
|
var RULE_NAME31 = "no-nested-components";
|
|
1763
|
+
var RULE_FEATURES31 = [
|
|
1764
|
+
"CHK"
|
|
1765
|
+
];
|
|
1624
1766
|
var no_nested_components_default = createRule({
|
|
1625
1767
|
meta: {
|
|
1626
1768
|
type: "problem",
|
|
1627
1769
|
docs: {
|
|
1628
|
-
description: "disallow using unstable nested components"
|
|
1770
|
+
description: "disallow using unstable nested components",
|
|
1771
|
+
[Symbol.for("rule_features")]: RULE_FEATURES31
|
|
1629
1772
|
},
|
|
1630
1773
|
messages: {
|
|
1631
1774
|
nestedComponent: "Do not nest components inside other components. Move it to the top level.",
|
|
@@ -1718,11 +1861,15 @@ var no_nested_components_default = createRule({
|
|
|
1718
1861
|
defaultOptions: []
|
|
1719
1862
|
});
|
|
1720
1863
|
var RULE_NAME32 = "no-prop-types";
|
|
1864
|
+
var RULE_FEATURES32 = [
|
|
1865
|
+
"CHK"
|
|
1866
|
+
];
|
|
1721
1867
|
var no_prop_types_default = createRule({
|
|
1722
1868
|
meta: {
|
|
1723
1869
|
type: "problem",
|
|
1724
1870
|
docs: {
|
|
1725
|
-
description: "disallow using 'propTypes' property in components"
|
|
1871
|
+
description: "disallow using 'propTypes' property in components",
|
|
1872
|
+
[Symbol.for("rule_features")]: RULE_FEATURES32
|
|
1726
1873
|
},
|
|
1727
1874
|
messages: {
|
|
1728
1875
|
noPropTypes: "[Deprecated] Use TypeScript or another type-checking solution instead."
|
|
@@ -1757,6 +1904,9 @@ var no_prop_types_default = createRule({
|
|
|
1757
1904
|
defaultOptions: []
|
|
1758
1905
|
});
|
|
1759
1906
|
var RULE_NAME33 = "no-redundant-should-component-update";
|
|
1907
|
+
var RULE_FEATURES33 = [
|
|
1908
|
+
"CHK"
|
|
1909
|
+
];
|
|
1760
1910
|
function isShouldComponentUpdate(node) {
|
|
1761
1911
|
return AST11__namespace.isOneOf([types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
|
|
1762
1912
|
}
|
|
@@ -1764,7 +1914,8 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1764
1914
|
meta: {
|
|
1765
1915
|
type: "problem",
|
|
1766
1916
|
docs: {
|
|
1767
|
-
description: "disallow using 'shouldComponentUpdate' in class component extends 'React.PureComponent'"
|
|
1917
|
+
description: "disallow using 'shouldComponentUpdate' in class component extends 'React.PureComponent'",
|
|
1918
|
+
[Symbol.for("rule_features")]: RULE_FEATURES33
|
|
1768
1919
|
},
|
|
1769
1920
|
messages: {
|
|
1770
1921
|
noRedundantShouldComponentUpdate: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'."
|
|
@@ -1800,6 +1951,9 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1800
1951
|
defaultOptions: []
|
|
1801
1952
|
});
|
|
1802
1953
|
var RULE_NAME34 = "no-set-state-in-component-did-mount";
|
|
1954
|
+
var RULE_FEATURES34 = [
|
|
1955
|
+
"CHK"
|
|
1956
|
+
];
|
|
1803
1957
|
function isComponentDidMount(node) {
|
|
1804
1958
|
return AST11__namespace.isOneOf([types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
|
|
1805
1959
|
}
|
|
@@ -1807,7 +1961,8 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
1807
1961
|
meta: {
|
|
1808
1962
|
type: "problem",
|
|
1809
1963
|
docs: {
|
|
1810
|
-
description: "disallow using 'setState' in 'componentDidMount'"
|
|
1964
|
+
description: "disallow using 'setState' in 'componentDidMount'",
|
|
1965
|
+
[Symbol.for("rule_features")]: RULE_FEATURES34
|
|
1811
1966
|
},
|
|
1812
1967
|
messages: {
|
|
1813
1968
|
noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions, such as callbacks."
|
|
@@ -1843,6 +1998,9 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
1843
1998
|
defaultOptions: []
|
|
1844
1999
|
});
|
|
1845
2000
|
var RULE_NAME35 = "no-set-state-in-component-did-update";
|
|
2001
|
+
var RULE_FEATURES35 = [
|
|
2002
|
+
"CHK"
|
|
2003
|
+
];
|
|
1846
2004
|
function isComponentDidUpdate(node) {
|
|
1847
2005
|
return AST11__namespace.isOneOf([types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentDidUpdate";
|
|
1848
2006
|
}
|
|
@@ -1850,7 +2008,8 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
1850
2008
|
meta: {
|
|
1851
2009
|
type: "problem",
|
|
1852
2010
|
docs: {
|
|
1853
|
-
description: "disallow using 'setState' in 'componentDidUpdate'"
|
|
2011
|
+
description: "disallow using 'setState' in 'componentDidUpdate'",
|
|
2012
|
+
[Symbol.for("rule_features")]: RULE_FEATURES35
|
|
1854
2013
|
},
|
|
1855
2014
|
messages: {
|
|
1856
2015
|
noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions, such as callbacks."
|
|
@@ -1886,6 +2045,9 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
1886
2045
|
defaultOptions: []
|
|
1887
2046
|
});
|
|
1888
2047
|
var RULE_NAME36 = "no-set-state-in-component-will-update";
|
|
2048
|
+
var RULE_FEATURES36 = [
|
|
2049
|
+
"CHK"
|
|
2050
|
+
];
|
|
1889
2051
|
function isComponentWillUpdate3(node) {
|
|
1890
2052
|
return AST11__namespace.isOneOf([types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
|
|
1891
2053
|
}
|
|
@@ -1893,7 +2055,8 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
1893
2055
|
meta: {
|
|
1894
2056
|
type: "problem",
|
|
1895
2057
|
docs: {
|
|
1896
|
-
description: "disallow using 'setState' in 'componentWillUpdate'"
|
|
2058
|
+
description: "disallow using 'setState' in 'componentWillUpdate'",
|
|
2059
|
+
[Symbol.for("rule_features")]: RULE_FEATURES36
|
|
1897
2060
|
},
|
|
1898
2061
|
messages: {
|
|
1899
2062
|
noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions, such as callbacks."
|
|
@@ -1929,6 +2092,9 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
1929
2092
|
defaultOptions: []
|
|
1930
2093
|
});
|
|
1931
2094
|
var RULE_NAME37 = "no-string-refs";
|
|
2095
|
+
var RULE_FEATURES37 = [
|
|
2096
|
+
"CHK"
|
|
2097
|
+
];
|
|
1932
2098
|
function containsStringLiteral({ value }) {
|
|
1933
2099
|
return value?.type === types.AST_NODE_TYPES.Literal && tools.isString(value.value);
|
|
1934
2100
|
}
|
|
@@ -1941,7 +2107,8 @@ var no_string_refs_default = createRule({
|
|
|
1941
2107
|
meta: {
|
|
1942
2108
|
type: "problem",
|
|
1943
2109
|
docs: {
|
|
1944
|
-
description: "disallow using deprecated string refs"
|
|
2110
|
+
description: "disallow using deprecated string refs",
|
|
2111
|
+
[Symbol.for("rule_features")]: RULE_FEATURES37
|
|
1945
2112
|
},
|
|
1946
2113
|
messages: {
|
|
1947
2114
|
noStringRefs: "[Deprecated] Use callback refs instead."
|
|
@@ -1965,6 +2132,9 @@ var no_string_refs_default = createRule({
|
|
|
1965
2132
|
defaultOptions: []
|
|
1966
2133
|
});
|
|
1967
2134
|
var RULE_NAME38 = "no-unsafe-component-will-mount";
|
|
2135
|
+
var RULE_FEATURES38 = [
|
|
2136
|
+
"CHK"
|
|
2137
|
+
];
|
|
1968
2138
|
function isUnsafeComponentWillMount(node) {
|
|
1969
2139
|
return AST11__namespace.isOneOf([types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillMount";
|
|
1970
2140
|
}
|
|
@@ -1972,7 +2142,8 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
1972
2142
|
meta: {
|
|
1973
2143
|
type: "problem",
|
|
1974
2144
|
docs: {
|
|
1975
|
-
description: "disallow using 'UNSAFE_componentWillMount'"
|
|
2145
|
+
description: "disallow using 'UNSAFE_componentWillMount'",
|
|
2146
|
+
[Symbol.for("rule_features")]: RULE_FEATURES38
|
|
1976
2147
|
},
|
|
1977
2148
|
messages: {
|
|
1978
2149
|
noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'."
|
|
@@ -2004,6 +2175,9 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
2004
2175
|
defaultOptions: []
|
|
2005
2176
|
});
|
|
2006
2177
|
var RULE_NAME39 = "no-unsafe-component-will-receive-props";
|
|
2178
|
+
var RULE_FEATURES39 = [
|
|
2179
|
+
"CHK"
|
|
2180
|
+
];
|
|
2007
2181
|
function isUnsafeComponentWillReceiveProps(node) {
|
|
2008
2182
|
return AST11__namespace.isOneOf([types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillReceiveProps";
|
|
2009
2183
|
}
|
|
@@ -2011,7 +2185,8 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
2011
2185
|
meta: {
|
|
2012
2186
|
type: "problem",
|
|
2013
2187
|
docs: {
|
|
2014
|
-
description: "disallow using 'UNSAFE_componentWillReceiveProps'"
|
|
2188
|
+
description: "disallow using 'UNSAFE_componentWillReceiveProps'",
|
|
2189
|
+
[Symbol.for("rule_features")]: RULE_FEATURES39
|
|
2015
2190
|
},
|
|
2016
2191
|
messages: {
|
|
2017
2192
|
noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'."
|
|
@@ -2043,6 +2218,9 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
2043
2218
|
defaultOptions: []
|
|
2044
2219
|
});
|
|
2045
2220
|
var RULE_NAME40 = "no-unsafe-component-will-update";
|
|
2221
|
+
var RULE_FEATURES40 = [
|
|
2222
|
+
"CHK"
|
|
2223
|
+
];
|
|
2046
2224
|
function isUnsafeComponentWillUpdate(node) {
|
|
2047
2225
|
return AST11__namespace.isOneOf([types.AST_NODE_TYPES.MethodDefinition, types.AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillUpdate";
|
|
2048
2226
|
}
|
|
@@ -2050,7 +2228,8 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2050
2228
|
meta: {
|
|
2051
2229
|
type: "problem",
|
|
2052
2230
|
docs: {
|
|
2053
|
-
description: "disallow using 'UNSAFE_componentWillUpdate'"
|
|
2231
|
+
description: "disallow using 'UNSAFE_componentWillUpdate'",
|
|
2232
|
+
[Symbol.for("rule_features")]: RULE_FEATURES40
|
|
2054
2233
|
},
|
|
2055
2234
|
messages: {
|
|
2056
2235
|
noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'."
|
|
@@ -2082,11 +2261,15 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2082
2261
|
defaultOptions: []
|
|
2083
2262
|
});
|
|
2084
2263
|
var RULE_NAME41 = "no-unstable-context-value";
|
|
2264
|
+
var RULE_FEATURES41 = [
|
|
2265
|
+
"CHK"
|
|
2266
|
+
];
|
|
2085
2267
|
var no_unstable_context_value_default = createRule({
|
|
2086
2268
|
meta: {
|
|
2087
2269
|
type: "problem",
|
|
2088
2270
|
docs: {
|
|
2089
|
-
description: "disallow passing constructed values to context providers"
|
|
2271
|
+
description: "disallow passing constructed values to context providers",
|
|
2272
|
+
[Symbol.for("rule_features")]: RULE_FEATURES41
|
|
2090
2273
|
},
|
|
2091
2274
|
messages: {
|
|
2092
2275
|
noUnstableContextValue: "A/an '{{type}}' passed as the value prop to the context provider should not be constructed. It will change on every render.",
|
|
@@ -2149,11 +2332,15 @@ var no_unstable_context_value_default = createRule({
|
|
|
2149
2332
|
defaultOptions: []
|
|
2150
2333
|
});
|
|
2151
2334
|
var RULE_NAME42 = "no-unstable-default-props";
|
|
2335
|
+
var RULE_FEATURES42 = [
|
|
2336
|
+
"CHK"
|
|
2337
|
+
];
|
|
2152
2338
|
var no_unstable_default_props_default = createRule({
|
|
2153
2339
|
meta: {
|
|
2154
2340
|
type: "problem",
|
|
2155
2341
|
docs: {
|
|
2156
|
-
description: "disallow using unstable value as default param in function component"
|
|
2342
|
+
description: "disallow using unstable value as default param in function component",
|
|
2343
|
+
[Symbol.for("rule_features")]: RULE_FEATURES42
|
|
2157
2344
|
},
|
|
2158
2345
|
messages: {
|
|
2159
2346
|
noUnstableDefaultProps: "A/an '{{forbiddenType}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{forbiddenType}}'."
|
|
@@ -2214,6 +2401,9 @@ var no_unstable_default_props_default = createRule({
|
|
|
2214
2401
|
defaultOptions: []
|
|
2215
2402
|
});
|
|
2216
2403
|
var RULE_NAME43 = "no-unused-class-component-members";
|
|
2404
|
+
var RULE_FEATURES43 = [
|
|
2405
|
+
"CHK"
|
|
2406
|
+
];
|
|
2217
2407
|
var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
|
|
2218
2408
|
"componentDidCatch",
|
|
2219
2409
|
"componentDidMount",
|
|
@@ -2250,7 +2440,8 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2250
2440
|
meta: {
|
|
2251
2441
|
type: "problem",
|
|
2252
2442
|
docs: {
|
|
2253
|
-
description: "disallow unused class component members"
|
|
2443
|
+
description: "disallow unused class component members",
|
|
2444
|
+
[Symbol.for("rule_features")]: RULE_FEATURES43
|
|
2254
2445
|
},
|
|
2255
2446
|
messages: {
|
|
2256
2447
|
noUnusedClassComponentMembers: "Unused method or property '{{methodName}}'' of class '{{className}}'."
|
|
@@ -2341,6 +2532,9 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2341
2532
|
defaultOptions: []
|
|
2342
2533
|
});
|
|
2343
2534
|
var RULE_NAME44 = "no-unused-state";
|
|
2535
|
+
var RULE_FEATURES44 = [
|
|
2536
|
+
"CHK"
|
|
2537
|
+
];
|
|
2344
2538
|
function getName4(node) {
|
|
2345
2539
|
if (node.type === types.AST_NODE_TYPES.TSAsExpression) {
|
|
2346
2540
|
return getName4(node.expression);
|
|
@@ -2373,7 +2567,8 @@ var no_unused_state_default = createRule({
|
|
|
2373
2567
|
meta: {
|
|
2374
2568
|
type: "problem",
|
|
2375
2569
|
docs: {
|
|
2376
|
-
description: "disallow unused state of class component"
|
|
2570
|
+
description: "disallow unused state of class component",
|
|
2571
|
+
[Symbol.for("rule_features")]: RULE_FEATURES44
|
|
2377
2572
|
},
|
|
2378
2573
|
messages: {
|
|
2379
2574
|
noUnusedState: "Unused class component state in '{{className}}'"
|
|
@@ -2541,6 +2736,9 @@ var no_useless_fragment_default = createRule({
|
|
|
2541
2736
|
}]
|
|
2542
2737
|
});
|
|
2543
2738
|
var RULE_NAME46 = "prefer-destructuring-assignment";
|
|
2739
|
+
var RULE_FEATURES45 = [
|
|
2740
|
+
"CHK"
|
|
2741
|
+
];
|
|
2544
2742
|
function isMemberExpressionWithObjectName(node) {
|
|
2545
2743
|
return node.object.type === types.AST_NODE_TYPES.Identifier && "name" in node.object;
|
|
2546
2744
|
}
|
|
@@ -2548,7 +2746,8 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2548
2746
|
meta: {
|
|
2549
2747
|
type: "problem",
|
|
2550
2748
|
docs: {
|
|
2551
|
-
description: "enforce using destructuring assignment in component props and context"
|
|
2749
|
+
description: "enforce using destructuring assignment in component props and context",
|
|
2750
|
+
[Symbol.for("rule_features")]: RULE_FEATURES45
|
|
2552
2751
|
},
|
|
2553
2752
|
messages: {
|
|
2554
2753
|
preferDestructuringAssignment: "Use destructuring assignment for {{name}}."
|
|
@@ -2611,11 +2810,16 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2611
2810
|
defaultOptions: []
|
|
2612
2811
|
});
|
|
2613
2812
|
var RULE_NAME47 = "prefer-react-namespace-import";
|
|
2813
|
+
var RULE_FEATURES46 = [
|
|
2814
|
+
"CHK",
|
|
2815
|
+
"FIX"
|
|
2816
|
+
];
|
|
2614
2817
|
var prefer_react_namespace_import_default = createRule({
|
|
2615
2818
|
meta: {
|
|
2616
2819
|
type: "problem",
|
|
2617
2820
|
docs: {
|
|
2618
|
-
description: "enforce React is imported via a namespace import"
|
|
2821
|
+
description: "enforce React is imported via a namespace import",
|
|
2822
|
+
[Symbol.for("rule_features")]: RULE_FEATURES46
|
|
2619
2823
|
},
|
|
2620
2824
|
fixable: "code",
|
|
2621
2825
|
messages: {
|
|
@@ -2660,6 +2864,10 @@ ${importStringPrefix} ${specifiers} from ${importSourceQuoted}${semiColon}`
|
|
|
2660
2864
|
defaultOptions: []
|
|
2661
2865
|
});
|
|
2662
2866
|
var RULE_NAME48 = "prefer-read-only-props";
|
|
2867
|
+
var RULE_FEATURES47 = [
|
|
2868
|
+
"CHK",
|
|
2869
|
+
"TSC"
|
|
2870
|
+
];
|
|
2663
2871
|
function isReadonlyType(type, services) {
|
|
2664
2872
|
try {
|
|
2665
2873
|
const im = isImmutableType.getTypeImmutability(services.program, type);
|
|
@@ -2672,7 +2880,8 @@ var prefer_read_only_props_default = createRule({
|
|
|
2672
2880
|
meta: {
|
|
2673
2881
|
type: "problem",
|
|
2674
2882
|
docs: {
|
|
2675
|
-
description: "enforce read-only props in components"
|
|
2883
|
+
description: "enforce read-only props in components",
|
|
2884
|
+
[Symbol.for("rule_features")]: RULE_FEATURES47
|
|
2676
2885
|
},
|
|
2677
2886
|
messages: {
|
|
2678
2887
|
preferReadOnlyProps: "A function component's props should be read-only."
|
|
@@ -2700,11 +2909,16 @@ var prefer_read_only_props_default = createRule({
|
|
|
2700
2909
|
defaultOptions: []
|
|
2701
2910
|
});
|
|
2702
2911
|
var RULE_NAME49 = "prefer-shorthand-boolean";
|
|
2912
|
+
var RULE_FEATURES48 = [
|
|
2913
|
+
"CHK",
|
|
2914
|
+
"FIX"
|
|
2915
|
+
];
|
|
2703
2916
|
var prefer_shorthand_boolean_default = createRule({
|
|
2704
2917
|
meta: {
|
|
2705
2918
|
type: "problem",
|
|
2706
2919
|
docs: {
|
|
2707
|
-
description: "enforce using shorthand boolean attributes"
|
|
2920
|
+
description: "enforce using shorthand boolean attributes",
|
|
2921
|
+
[Symbol.for("rule_features")]: RULE_FEATURES48
|
|
2708
2922
|
},
|
|
2709
2923
|
fixable: "code",
|
|
2710
2924
|
messages: {
|
|
@@ -2735,11 +2949,15 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
2735
2949
|
defaultOptions: []
|
|
2736
2950
|
});
|
|
2737
2951
|
var RULE_NAME50 = "prefer-shorthand-fragment";
|
|
2952
|
+
var RULE_FEATURES49 = [
|
|
2953
|
+
"CHK"
|
|
2954
|
+
];
|
|
2738
2955
|
var prefer_shorthand_fragment_default = createRule({
|
|
2739
2956
|
meta: {
|
|
2740
2957
|
type: "problem",
|
|
2741
2958
|
docs: {
|
|
2742
|
-
description: "enforce using fragment syntax instead of 'Fragment' component"
|
|
2959
|
+
description: "enforce using fragment syntax instead of 'Fragment' component",
|
|
2960
|
+
[Symbol.for("rule_features")]: RULE_FEATURES49
|
|
2743
2961
|
},
|
|
2744
2962
|
messages: {
|
|
2745
2963
|
preferShorthandFragment: "Use fragment shorthand syntax instead of 'Fragment' component."
|
|
@@ -2765,14 +2983,6 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
2765
2983
|
});
|
|
2766
2984
|
|
|
2767
2985
|
// src/index.ts
|
|
2768
|
-
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
2769
|
-
additionalHooks: {
|
|
2770
|
-
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
2771
|
-
},
|
|
2772
|
-
polymorphicPropName: "as",
|
|
2773
|
-
strictImportCheck: true,
|
|
2774
|
-
version: "detect"
|
|
2775
|
-
};
|
|
2776
2986
|
var src_default = {
|
|
2777
2987
|
meta: {
|
|
2778
2988
|
name,
|
|
@@ -2832,8 +3042,7 @@ var src_default = {
|
|
|
2832
3042
|
// Deprecated Rules
|
|
2833
3043
|
/** @deprecated Use `no-complex-conditional-rendering` instead. */
|
|
2834
3044
|
"no-complicated-conditional-rendering": no_complex_conditional_rendering_default
|
|
2835
|
-
}
|
|
2836
|
-
DEFAULT_ESLINT_REACT_SETTINGS
|
|
3045
|
+
}
|
|
2837
3046
|
};
|
|
2838
3047
|
|
|
2839
3048
|
module.exports = src_default;
|