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.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.
|
|
17
|
+
var version = "1.20.0-beta.13";
|
|
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
|
+
"CHK"
|
|
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
|
+
"CHK"
|
|
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
|
+
"CHK"
|
|
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
|
+
"CHK"
|
|
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,14 @@ var jsx_no_duplicate_props_default = createRule({
|
|
|
143
159
|
defaultOptions: []
|
|
144
160
|
});
|
|
145
161
|
var RULE_NAME5 = "jsx-uses-vars";
|
|
162
|
+
var RULE_FEATURES5 = [];
|
|
146
163
|
var jsx_uses_vars_default = createRule({
|
|
147
164
|
meta: {
|
|
148
165
|
type: "problem",
|
|
149
166
|
docs: {
|
|
150
167
|
// eslint-disable-next-line eslint-plugin/require-meta-docs-description
|
|
151
|
-
description: "a helper rule to mark variables as used"
|
|
168
|
+
description: "a helper rule to mark variables as used",
|
|
169
|
+
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
152
170
|
},
|
|
153
171
|
messages: {
|
|
154
172
|
jsxUsesVars: ""
|
|
@@ -179,6 +197,9 @@ var jsx_uses_vars_default = createRule({
|
|
|
179
197
|
defaultOptions: []
|
|
180
198
|
});
|
|
181
199
|
var RULE_NAME6 = "no-access-state-in-setstate";
|
|
200
|
+
var RULE_FEATURES6 = [
|
|
201
|
+
"CHK"
|
|
202
|
+
];
|
|
182
203
|
function getName(node) {
|
|
183
204
|
if (node.type === AST_NODE_TYPES.TSAsExpression) {
|
|
184
205
|
return getName(node.expression);
|
|
@@ -198,7 +219,8 @@ var no_access_state_in_setstate_default = createRule({
|
|
|
198
219
|
meta: {
|
|
199
220
|
type: "problem",
|
|
200
221
|
docs: {
|
|
201
|
-
description: "disallow accessing 'this.state' within 'setState'"
|
|
222
|
+
description: "disallow accessing 'this.state' within 'setState'",
|
|
223
|
+
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
202
224
|
},
|
|
203
225
|
messages: {
|
|
204
226
|
noAccessStateInSetstate: "Do not access 'this.state' within 'setState'. Use the update function instead."
|
|
@@ -277,6 +299,9 @@ var no_access_state_in_setstate_default = createRule({
|
|
|
277
299
|
defaultOptions: []
|
|
278
300
|
});
|
|
279
301
|
var RULE_NAME7 = "no-array-index-key";
|
|
302
|
+
var RULE_FEATURES7 = [
|
|
303
|
+
"CHK"
|
|
304
|
+
];
|
|
280
305
|
var reactChildrenMethod = ["forEach", "map"];
|
|
281
306
|
var iteratorFunctionIndexParamPosition = /* @__PURE__ */ new Map([
|
|
282
307
|
["every", 1],
|
|
@@ -341,7 +366,8 @@ var no_array_index_key_default = createRule({
|
|
|
341
366
|
meta: {
|
|
342
367
|
type: "problem",
|
|
343
368
|
docs: {
|
|
344
|
-
description: "disallow using Array index as 'key'"
|
|
369
|
+
description: "disallow using Array index as 'key'",
|
|
370
|
+
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
345
371
|
},
|
|
346
372
|
messages: {
|
|
347
373
|
noArrayIndexKey: "Do not use Array index as 'key'."
|
|
@@ -391,7 +417,7 @@ var no_array_index_key_default = createRule({
|
|
|
391
417
|
const [_, props] = node.arguments;
|
|
392
418
|
if (props?.type !== AST_NODE_TYPES.ObjectExpression) return;
|
|
393
419
|
for (const prop of props.properties) {
|
|
394
|
-
if (!isMatching({ key: { name: "key" } }
|
|
420
|
+
if (!isMatching({ key: { name: "key" } })(prop)) continue;
|
|
395
421
|
if (!("value" in prop)) continue;
|
|
396
422
|
const descriptors = getReportDescriptor(prop.value);
|
|
397
423
|
for (const descriptor of descriptors) {
|
|
@@ -417,11 +443,15 @@ var no_array_index_key_default = createRule({
|
|
|
417
443
|
defaultOptions: []
|
|
418
444
|
});
|
|
419
445
|
var RULE_NAME8 = "no-children-count";
|
|
446
|
+
var RULE_FEATURES8 = [
|
|
447
|
+
"CHK"
|
|
448
|
+
];
|
|
420
449
|
var no_children_count_default = createRule({
|
|
421
450
|
meta: {
|
|
422
451
|
type: "problem",
|
|
423
452
|
docs: {
|
|
424
|
-
description: "disallow using 'Children.count'"
|
|
453
|
+
description: "disallow using 'Children.count'",
|
|
454
|
+
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
425
455
|
},
|
|
426
456
|
messages: {
|
|
427
457
|
noChildrenCount: "Using 'Children.count' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -444,11 +474,15 @@ var no_children_count_default = createRule({
|
|
|
444
474
|
defaultOptions: []
|
|
445
475
|
});
|
|
446
476
|
var RULE_NAME9 = "no-children-for-each";
|
|
477
|
+
var RULE_FEATURES9 = [
|
|
478
|
+
"CHK"
|
|
479
|
+
];
|
|
447
480
|
var no_children_for_each_default = createRule({
|
|
448
481
|
meta: {
|
|
449
482
|
type: "problem",
|
|
450
483
|
docs: {
|
|
451
|
-
description: "disallow using 'Children.forEach'"
|
|
484
|
+
description: "disallow using 'Children.forEach'",
|
|
485
|
+
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
452
486
|
},
|
|
453
487
|
messages: {
|
|
454
488
|
noChildrenForEach: "Using 'Children.forEach' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -471,11 +505,15 @@ var no_children_for_each_default = createRule({
|
|
|
471
505
|
defaultOptions: []
|
|
472
506
|
});
|
|
473
507
|
var RULE_NAME10 = "no-children-map";
|
|
508
|
+
var RULE_FEATURES10 = [
|
|
509
|
+
"CHK"
|
|
510
|
+
];
|
|
474
511
|
var no_children_map_default = createRule({
|
|
475
512
|
meta: {
|
|
476
513
|
type: "problem",
|
|
477
514
|
docs: {
|
|
478
|
-
description: "disallow using 'Children.map'"
|
|
515
|
+
description: "disallow using 'Children.map'",
|
|
516
|
+
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
479
517
|
},
|
|
480
518
|
messages: {
|
|
481
519
|
noChildrenMap: "Using 'Children.map' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -498,11 +536,15 @@ var no_children_map_default = createRule({
|
|
|
498
536
|
defaultOptions: []
|
|
499
537
|
});
|
|
500
538
|
var RULE_NAME11 = "no-children-only";
|
|
539
|
+
var RULE_FEATURES11 = [
|
|
540
|
+
"CHK"
|
|
541
|
+
];
|
|
501
542
|
var no_children_only_default = createRule({
|
|
502
543
|
meta: {
|
|
503
544
|
type: "problem",
|
|
504
545
|
docs: {
|
|
505
|
-
description: "disallow using 'Children.only'"
|
|
546
|
+
description: "disallow using 'Children.only'",
|
|
547
|
+
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
506
548
|
},
|
|
507
549
|
messages: {
|
|
508
550
|
noChildrenOnly: "Using 'Children.only' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -525,11 +567,15 @@ var no_children_only_default = createRule({
|
|
|
525
567
|
defaultOptions: []
|
|
526
568
|
});
|
|
527
569
|
var RULE_NAME12 = "no-children-prop";
|
|
570
|
+
var RULE_FEATURES12 = [
|
|
571
|
+
"CHK"
|
|
572
|
+
];
|
|
528
573
|
var no_children_prop_default = createRule({
|
|
529
574
|
meta: {
|
|
530
575
|
type: "problem",
|
|
531
576
|
docs: {
|
|
532
|
-
description: "disallow passing 'children' as props"
|
|
577
|
+
description: "disallow passing 'children' as props",
|
|
578
|
+
[Symbol.for("rule_features")]: RULE_FEATURES12
|
|
533
579
|
},
|
|
534
580
|
messages: {
|
|
535
581
|
noChildrenProp: "Do not pass 'children' as props."
|
|
@@ -550,11 +596,15 @@ var no_children_prop_default = createRule({
|
|
|
550
596
|
defaultOptions: []
|
|
551
597
|
});
|
|
552
598
|
var RULE_NAME13 = "no-children-to-array";
|
|
599
|
+
var RULE_FEATURES13 = [
|
|
600
|
+
"CHK"
|
|
601
|
+
];
|
|
553
602
|
var no_children_to_array_default = createRule({
|
|
554
603
|
meta: {
|
|
555
604
|
type: "problem",
|
|
556
605
|
docs: {
|
|
557
|
-
description: "disallow using 'Children.toArray'"
|
|
606
|
+
description: "disallow using 'Children.toArray'",
|
|
607
|
+
[Symbol.for("rule_features")]: RULE_FEATURES13
|
|
558
608
|
},
|
|
559
609
|
messages: {
|
|
560
610
|
noChildrenToArray: "Using 'Children.toArray' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -577,6 +627,9 @@ var no_children_to_array_default = createRule({
|
|
|
577
627
|
defaultOptions: []
|
|
578
628
|
});
|
|
579
629
|
var RULE_NAME14 = "no-class-component";
|
|
630
|
+
var RULE_FEATURES14 = [
|
|
631
|
+
"CHK"
|
|
632
|
+
];
|
|
580
633
|
var isComponentDidCatch = isMatching({
|
|
581
634
|
key: {
|
|
582
635
|
type: AST_NODE_TYPES.Identifier,
|
|
@@ -597,7 +650,8 @@ var no_class_component_default = createRule({
|
|
|
597
650
|
meta: {
|
|
598
651
|
type: "problem",
|
|
599
652
|
docs: {
|
|
600
|
-
description: "disallow using class components"
|
|
653
|
+
description: "disallow using class components",
|
|
654
|
+
[Symbol.for("rule_features")]: RULE_FEATURES14
|
|
601
655
|
},
|
|
602
656
|
messages: {
|
|
603
657
|
noClassComponent: "Do not use class components. Use function components instead."
|
|
@@ -629,11 +683,15 @@ var no_class_component_default = createRule({
|
|
|
629
683
|
defaultOptions: []
|
|
630
684
|
});
|
|
631
685
|
var RULE_NAME15 = "no-clone-element";
|
|
686
|
+
var RULE_FEATURES15 = [
|
|
687
|
+
"CHK"
|
|
688
|
+
];
|
|
632
689
|
var no_clone_element_default = createRule({
|
|
633
690
|
meta: {
|
|
634
691
|
type: "problem",
|
|
635
692
|
docs: {
|
|
636
|
-
description: "disallow using 'cloneElement'"
|
|
693
|
+
description: "disallow using 'cloneElement'",
|
|
694
|
+
[Symbol.for("rule_features")]: RULE_FEATURES15
|
|
637
695
|
},
|
|
638
696
|
messages: {
|
|
639
697
|
noCloneElement: "Using 'cloneElement' is uncommon and can lead to fragile code. Use alternatives instead."
|
|
@@ -655,11 +713,15 @@ var no_clone_element_default = createRule({
|
|
|
655
713
|
defaultOptions: []
|
|
656
714
|
});
|
|
657
715
|
var RULE_NAME16 = "no-comment-textnodes";
|
|
716
|
+
var RULE_FEATURES16 = [
|
|
717
|
+
"CHK"
|
|
718
|
+
];
|
|
658
719
|
var no_comment_textnodes_default = createRule({
|
|
659
720
|
meta: {
|
|
660
721
|
type: "problem",
|
|
661
722
|
docs: {
|
|
662
|
-
description: "disallow comments from being inserted as text nodes"
|
|
723
|
+
description: "disallow comments from being inserted as text nodes",
|
|
724
|
+
[Symbol.for("rule_features")]: RULE_FEATURES16
|
|
663
725
|
},
|
|
664
726
|
messages: {
|
|
665
727
|
noCommentTextnodes: "Possible misused comment in text node. Comments inside children section of tag should be placed inside braces."
|
|
@@ -691,11 +753,15 @@ var no_comment_textnodes_default = createRule({
|
|
|
691
753
|
defaultOptions: []
|
|
692
754
|
});
|
|
693
755
|
var RULE_NAME17 = "no-complex-conditional-rendering";
|
|
756
|
+
var RULE_FEATURES17 = [
|
|
757
|
+
"CHK"
|
|
758
|
+
];
|
|
694
759
|
var no_complex_conditional_rendering_default = createRule({
|
|
695
760
|
meta: {
|
|
696
761
|
type: "problem",
|
|
697
762
|
docs: {
|
|
698
|
-
description: "disallow complex conditional rendering"
|
|
763
|
+
description: "disallow complex conditional rendering",
|
|
764
|
+
[Symbol.for("rule_features")]: RULE_FEATURES17
|
|
699
765
|
},
|
|
700
766
|
messages: {
|
|
701
767
|
noComplexConditionalRendering: "Avoid complex conditional rendering. Extract the logic into separate elements or components."
|
|
@@ -725,6 +791,10 @@ var no_complex_conditional_rendering_default = createRule({
|
|
|
725
791
|
defaultOptions: []
|
|
726
792
|
});
|
|
727
793
|
var RULE_NAME18 = "no-component-will-mount";
|
|
794
|
+
var RULE_FEATURES18 = [
|
|
795
|
+
"CHK",
|
|
796
|
+
"MOD"
|
|
797
|
+
];
|
|
728
798
|
function isComponentWillMount(node) {
|
|
729
799
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillMount";
|
|
730
800
|
}
|
|
@@ -732,8 +802,10 @@ var no_component_will_mount_default = createRule({
|
|
|
732
802
|
meta: {
|
|
733
803
|
type: "problem",
|
|
734
804
|
docs: {
|
|
735
|
-
description: "disallow using 'componentWillMount'"
|
|
805
|
+
description: "disallow using 'componentWillMount'",
|
|
806
|
+
[Symbol.for("rule_features")]: RULE_FEATURES18
|
|
736
807
|
},
|
|
808
|
+
fixable: "code",
|
|
737
809
|
messages: {
|
|
738
810
|
noComponentWillMount: "[Deprecated] Use 'UNSAFE_componentWillMount' instead."
|
|
739
811
|
},
|
|
@@ -753,7 +825,11 @@ var no_component_will_mount_default = createRule({
|
|
|
753
825
|
if (isComponentWillMount(member)) {
|
|
754
826
|
context.report({
|
|
755
827
|
messageId: "noComponentWillMount",
|
|
756
|
-
node: member
|
|
828
|
+
node: member,
|
|
829
|
+
fix(fixer) {
|
|
830
|
+
if (!("key" in member)) return null;
|
|
831
|
+
return fixer.replaceText(member.key, "UNSAFE_componentWillMount");
|
|
832
|
+
}
|
|
757
833
|
});
|
|
758
834
|
}
|
|
759
835
|
}
|
|
@@ -764,6 +840,10 @@ var no_component_will_mount_default = createRule({
|
|
|
764
840
|
defaultOptions: []
|
|
765
841
|
});
|
|
766
842
|
var RULE_NAME19 = "no-component-will-receive-props";
|
|
843
|
+
var RULE_FEATURES19 = [
|
|
844
|
+
"CHK",
|
|
845
|
+
"MOD"
|
|
846
|
+
];
|
|
767
847
|
function isComponentWillUpdate(node) {
|
|
768
848
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillReceiveProps";
|
|
769
849
|
}
|
|
@@ -771,8 +851,10 @@ var no_component_will_receive_props_default = createRule({
|
|
|
771
851
|
meta: {
|
|
772
852
|
type: "problem",
|
|
773
853
|
docs: {
|
|
774
|
-
description: "disallow using 'componentWillReceiveProps'"
|
|
854
|
+
description: "disallow using 'componentWillReceiveProps'",
|
|
855
|
+
[Symbol.for("rule_features")]: RULE_FEATURES19
|
|
775
856
|
},
|
|
857
|
+
fixable: "code",
|
|
776
858
|
messages: {
|
|
777
859
|
noComponentWillReceiveProps: "[Deprecated] Use 'UNSAFE_componentWillReceiveProps' instead."
|
|
778
860
|
},
|
|
@@ -792,7 +874,11 @@ var no_component_will_receive_props_default = createRule({
|
|
|
792
874
|
if (isComponentWillUpdate(member)) {
|
|
793
875
|
context.report({
|
|
794
876
|
messageId: "noComponentWillReceiveProps",
|
|
795
|
-
node: member
|
|
877
|
+
node: member,
|
|
878
|
+
fix(fixer) {
|
|
879
|
+
if (!("key" in member)) return null;
|
|
880
|
+
return fixer.replaceText(member.key, "UNSAFE_componentWillReceiveProps");
|
|
881
|
+
}
|
|
796
882
|
});
|
|
797
883
|
}
|
|
798
884
|
}
|
|
@@ -803,6 +889,10 @@ var no_component_will_receive_props_default = createRule({
|
|
|
803
889
|
defaultOptions: []
|
|
804
890
|
});
|
|
805
891
|
var RULE_NAME20 = "no-component-will-update";
|
|
892
|
+
var RULE_FEATURES20 = [
|
|
893
|
+
"CHK",
|
|
894
|
+
"MOD"
|
|
895
|
+
];
|
|
806
896
|
function isComponentWillUpdate2(node) {
|
|
807
897
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
|
|
808
898
|
}
|
|
@@ -810,8 +900,10 @@ var no_component_will_update_default = createRule({
|
|
|
810
900
|
meta: {
|
|
811
901
|
type: "problem",
|
|
812
902
|
docs: {
|
|
813
|
-
description: "disallow using 'componentWillReceiveProps'"
|
|
903
|
+
description: "disallow using 'componentWillReceiveProps'",
|
|
904
|
+
[Symbol.for("rule_features")]: RULE_FEATURES20
|
|
814
905
|
},
|
|
906
|
+
fixable: "code",
|
|
815
907
|
messages: {
|
|
816
908
|
noComponentWillUpdate: "[Deprecated] Use 'UNSAFE_componentWillUpdate' instead."
|
|
817
909
|
},
|
|
@@ -831,7 +923,11 @@ var no_component_will_update_default = createRule({
|
|
|
831
923
|
if (isComponentWillUpdate2(member)) {
|
|
832
924
|
context.report({
|
|
833
925
|
messageId: "noComponentWillUpdate",
|
|
834
|
-
node: member
|
|
926
|
+
node: member,
|
|
927
|
+
fix(fixer) {
|
|
928
|
+
if (!("key" in member)) return null;
|
|
929
|
+
return fixer.replaceText(member.key, "UNSAFE_componentWillUpdate");
|
|
930
|
+
}
|
|
835
931
|
});
|
|
836
932
|
}
|
|
837
933
|
}
|
|
@@ -842,11 +938,16 @@ var no_component_will_update_default = createRule({
|
|
|
842
938
|
defaultOptions: []
|
|
843
939
|
});
|
|
844
940
|
var RULE_NAME21 = "no-context-provider";
|
|
941
|
+
var RULE_FEATURES21 = [
|
|
942
|
+
"CHK",
|
|
943
|
+
"MOD"
|
|
944
|
+
];
|
|
845
945
|
var no_context_provider_default = createRule({
|
|
846
946
|
meta: {
|
|
847
947
|
type: "problem",
|
|
848
948
|
docs: {
|
|
849
|
-
description: "disallow the use of '<Context.Provider>'"
|
|
949
|
+
description: "disallow the use of '<Context.Provider>'",
|
|
950
|
+
[Symbol.for("rule_features")]: RULE_FEATURES21
|
|
850
951
|
},
|
|
851
952
|
fixable: "code",
|
|
852
953
|
messages: {
|
|
@@ -883,11 +984,15 @@ var no_context_provider_default = createRule({
|
|
|
883
984
|
defaultOptions: []
|
|
884
985
|
});
|
|
885
986
|
var RULE_NAME22 = "no-create-ref";
|
|
987
|
+
var RULE_FEATURES22 = [
|
|
988
|
+
"CHK"
|
|
989
|
+
];
|
|
886
990
|
var no_create_ref_default = createRule({
|
|
887
991
|
meta: {
|
|
888
992
|
type: "problem",
|
|
889
993
|
docs: {
|
|
890
|
-
description: "disallow using 'createRef' in function components"
|
|
994
|
+
description: "disallow using 'createRef' in function components",
|
|
995
|
+
[Symbol.for("rule_features")]: RULE_FEATURES22
|
|
891
996
|
},
|
|
892
997
|
messages: {
|
|
893
998
|
noCreateRef: "[Deprecated] Use 'useRef' instead."
|
|
@@ -907,11 +1012,15 @@ var no_create_ref_default = createRule({
|
|
|
907
1012
|
defaultOptions: []
|
|
908
1013
|
});
|
|
909
1014
|
var RULE_NAME23 = "no-default-props";
|
|
1015
|
+
var RULE_FEATURES23 = [
|
|
1016
|
+
"CHK"
|
|
1017
|
+
];
|
|
910
1018
|
var no_default_props_default = createRule({
|
|
911
1019
|
meta: {
|
|
912
1020
|
type: "problem",
|
|
913
1021
|
docs: {
|
|
914
|
-
description: "disallow using 'defaultProps' property in components"
|
|
1022
|
+
description: "disallow using 'defaultProps' property in components",
|
|
1023
|
+
[Symbol.for("rule_features")]: RULE_FEATURES23
|
|
915
1024
|
},
|
|
916
1025
|
messages: {
|
|
917
1026
|
noDefaultProps: "[Deprecated] Use ES6 default parameters instead."
|
|
@@ -946,6 +1055,9 @@ var no_default_props_default = createRule({
|
|
|
946
1055
|
defaultOptions: []
|
|
947
1056
|
});
|
|
948
1057
|
var RULE_NAME24 = "no-direct-mutation-state";
|
|
1058
|
+
var RULE_FEATURES24 = [
|
|
1059
|
+
"CHK"
|
|
1060
|
+
];
|
|
949
1061
|
function getName2(node) {
|
|
950
1062
|
if (node.type === AST_NODE_TYPES.TSAsExpression) {
|
|
951
1063
|
return getName2(node.expression);
|
|
@@ -972,7 +1084,8 @@ var no_direct_mutation_state_default = createRule({
|
|
|
972
1084
|
meta: {
|
|
973
1085
|
type: "problem",
|
|
974
1086
|
docs: {
|
|
975
|
-
description: "disallow direct mutation of state"
|
|
1087
|
+
description: "disallow direct mutation of state",
|
|
1088
|
+
[Symbol.for("rule_features")]: RULE_FEATURES24
|
|
976
1089
|
},
|
|
977
1090
|
messages: {
|
|
978
1091
|
noDirectMutationState: "Do not mutate state directly. Use 'setState()' instead."
|
|
@@ -1004,11 +1117,15 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1004
1117
|
defaultOptions: []
|
|
1005
1118
|
});
|
|
1006
1119
|
var RULE_NAME25 = "no-duplicate-key";
|
|
1120
|
+
var RULE_FEATURES25 = [
|
|
1121
|
+
"CHK"
|
|
1122
|
+
];
|
|
1007
1123
|
var no_duplicate_key_default = createRule({
|
|
1008
1124
|
meta: {
|
|
1009
1125
|
type: "problem",
|
|
1010
1126
|
docs: {
|
|
1011
|
-
description: "disallow duplicate keys when rendering list"
|
|
1127
|
+
description: "disallow duplicate keys when rendering list",
|
|
1128
|
+
[Symbol.for("rule_features")]: RULE_FEATURES25
|
|
1012
1129
|
},
|
|
1013
1130
|
messages: {
|
|
1014
1131
|
noDuplicateKey: "A key must be unique. '{{value}}' is duplicated."
|
|
@@ -1133,11 +1250,16 @@ var no_duplicate_key_default = createRule({
|
|
|
1133
1250
|
defaultOptions: []
|
|
1134
1251
|
});
|
|
1135
1252
|
var RULE_NAME26 = "no-forward-ref";
|
|
1253
|
+
var RULE_FEATURES26 = [
|
|
1254
|
+
"CHK",
|
|
1255
|
+
"MOD"
|
|
1256
|
+
];
|
|
1136
1257
|
var no_forward_ref_default = createRule({
|
|
1137
1258
|
meta: {
|
|
1138
1259
|
type: "problem",
|
|
1139
1260
|
docs: {
|
|
1140
|
-
description: "disallow the use of 'forwardRef'"
|
|
1261
|
+
description: "disallow the use of 'forwardRef'",
|
|
1262
|
+
[Symbol.for("rule_features")]: RULE_FEATURES26
|
|
1141
1263
|
},
|
|
1142
1264
|
fixable: "code",
|
|
1143
1265
|
messages: {
|
|
@@ -1225,11 +1347,15 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1225
1347
|
];
|
|
1226
1348
|
}
|
|
1227
1349
|
var RULE_NAME27 = "no-implicit-key";
|
|
1350
|
+
var RULE_FEATURES27 = [
|
|
1351
|
+
"CHK"
|
|
1352
|
+
];
|
|
1228
1353
|
var no_implicit_key_default = createRule({
|
|
1229
1354
|
meta: {
|
|
1230
1355
|
type: "problem",
|
|
1231
1356
|
docs: {
|
|
1232
|
-
description: "disallow implicit 'key' props"
|
|
1357
|
+
description: "disallow implicit 'key' props",
|
|
1358
|
+
[Symbol.for("rule_features")]: RULE_FEATURES27
|
|
1233
1359
|
},
|
|
1234
1360
|
messages: {
|
|
1235
1361
|
noImplicitKey: "Do not use implicit 'key' props."
|
|
@@ -1280,6 +1406,10 @@ function unionTypeParts(type) {
|
|
|
1280
1406
|
return isUnionType(type) ? type.types : [type];
|
|
1281
1407
|
}
|
|
1282
1408
|
var RULE_NAME28 = "no-leaked-conditional-rendering";
|
|
1409
|
+
var RULE_FEATURES28 = [
|
|
1410
|
+
"CHK",
|
|
1411
|
+
"TSC"
|
|
1412
|
+
];
|
|
1283
1413
|
var tsHelpers = {
|
|
1284
1414
|
isAnyType: (type) => isTypeFlagSet(type, ts.TypeFlags.TypeParameter | ts.TypeFlags.Any),
|
|
1285
1415
|
isBigIntType: (type) => isTypeFlagSet(type, ts.TypeFlags.BigIntLike),
|
|
@@ -1376,7 +1506,8 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1376
1506
|
meta: {
|
|
1377
1507
|
type: "problem",
|
|
1378
1508
|
docs: {
|
|
1379
|
-
description: "disallow problematic leaked values from being rendered"
|
|
1509
|
+
description: "disallow problematic leaked values from being rendered",
|
|
1510
|
+
[Symbol.for("rule_features")]: RULE_FEATURES28
|
|
1380
1511
|
},
|
|
1381
1512
|
messages: {
|
|
1382
1513
|
noLeakedConditionalRendering: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes."
|
|
@@ -1441,11 +1572,15 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1441
1572
|
defaultOptions: []
|
|
1442
1573
|
});
|
|
1443
1574
|
var RULE_NAME29 = "no-missing-component-display-name";
|
|
1575
|
+
var RULE_FEATURES29 = [
|
|
1576
|
+
"CHK"
|
|
1577
|
+
];
|
|
1444
1578
|
var no_missing_component_display_name_default = createRule({
|
|
1445
1579
|
meta: {
|
|
1446
1580
|
type: "problem",
|
|
1447
1581
|
docs: {
|
|
1448
|
-
description: "require 'displayName' for 'memo' and 'forwardRef' components"
|
|
1582
|
+
description: "require 'displayName' for 'memo' and 'forwardRef' components",
|
|
1583
|
+
[Symbol.for("rule_features")]: RULE_FEATURES29
|
|
1449
1584
|
},
|
|
1450
1585
|
messages: {
|
|
1451
1586
|
noMissingComponentDisplayName: "Add missing 'displayName' for component."
|
|
@@ -1477,11 +1612,15 @@ var no_missing_component_display_name_default = createRule({
|
|
|
1477
1612
|
defaultOptions: []
|
|
1478
1613
|
});
|
|
1479
1614
|
var RULE_NAME30 = "no-missing-key";
|
|
1615
|
+
var RULE_FEATURES30 = [
|
|
1616
|
+
"CHK"
|
|
1617
|
+
];
|
|
1480
1618
|
var no_missing_key_default = createRule({
|
|
1481
1619
|
meta: {
|
|
1482
1620
|
type: "problem",
|
|
1483
1621
|
docs: {
|
|
1484
|
-
description: "require 'key' when rendering list"
|
|
1622
|
+
description: "require 'key' when rendering list",
|
|
1623
|
+
[Symbol.for("rule_features")]: RULE_FEATURES30
|
|
1485
1624
|
},
|
|
1486
1625
|
messages: {
|
|
1487
1626
|
noMissingKey: "Missing 'key' for element when rendering list.",
|
|
@@ -1594,11 +1733,15 @@ var no_missing_key_default = createRule({
|
|
|
1594
1733
|
defaultOptions: []
|
|
1595
1734
|
});
|
|
1596
1735
|
var RULE_NAME31 = "no-nested-components";
|
|
1736
|
+
var RULE_FEATURES31 = [
|
|
1737
|
+
"CHK"
|
|
1738
|
+
];
|
|
1597
1739
|
var no_nested_components_default = createRule({
|
|
1598
1740
|
meta: {
|
|
1599
1741
|
type: "problem",
|
|
1600
1742
|
docs: {
|
|
1601
|
-
description: "disallow using unstable nested components"
|
|
1743
|
+
description: "disallow using unstable nested components",
|
|
1744
|
+
[Symbol.for("rule_features")]: RULE_FEATURES31
|
|
1602
1745
|
},
|
|
1603
1746
|
messages: {
|
|
1604
1747
|
nestedComponent: "Do not nest components inside other components. Move it to the top level.",
|
|
@@ -1691,11 +1834,15 @@ var no_nested_components_default = createRule({
|
|
|
1691
1834
|
defaultOptions: []
|
|
1692
1835
|
});
|
|
1693
1836
|
var RULE_NAME32 = "no-prop-types";
|
|
1837
|
+
var RULE_FEATURES32 = [
|
|
1838
|
+
"CHK"
|
|
1839
|
+
];
|
|
1694
1840
|
var no_prop_types_default = createRule({
|
|
1695
1841
|
meta: {
|
|
1696
1842
|
type: "problem",
|
|
1697
1843
|
docs: {
|
|
1698
|
-
description: "disallow using 'propTypes' property in components"
|
|
1844
|
+
description: "disallow using 'propTypes' property in components",
|
|
1845
|
+
[Symbol.for("rule_features")]: RULE_FEATURES32
|
|
1699
1846
|
},
|
|
1700
1847
|
messages: {
|
|
1701
1848
|
noPropTypes: "[Deprecated] Use TypeScript or another type-checking solution instead."
|
|
@@ -1730,6 +1877,9 @@ var no_prop_types_default = createRule({
|
|
|
1730
1877
|
defaultOptions: []
|
|
1731
1878
|
});
|
|
1732
1879
|
var RULE_NAME33 = "no-redundant-should-component-update";
|
|
1880
|
+
var RULE_FEATURES33 = [
|
|
1881
|
+
"CHK"
|
|
1882
|
+
];
|
|
1733
1883
|
function isShouldComponentUpdate(node) {
|
|
1734
1884
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
|
|
1735
1885
|
}
|
|
@@ -1737,7 +1887,8 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1737
1887
|
meta: {
|
|
1738
1888
|
type: "problem",
|
|
1739
1889
|
docs: {
|
|
1740
|
-
description: "disallow using 'shouldComponentUpdate' in class component extends 'React.PureComponent'"
|
|
1890
|
+
description: "disallow using 'shouldComponentUpdate' in class component extends 'React.PureComponent'",
|
|
1891
|
+
[Symbol.for("rule_features")]: RULE_FEATURES33
|
|
1741
1892
|
},
|
|
1742
1893
|
messages: {
|
|
1743
1894
|
noRedundantShouldComponentUpdate: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'."
|
|
@@ -1773,6 +1924,9 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1773
1924
|
defaultOptions: []
|
|
1774
1925
|
});
|
|
1775
1926
|
var RULE_NAME34 = "no-set-state-in-component-did-mount";
|
|
1927
|
+
var RULE_FEATURES34 = [
|
|
1928
|
+
"CHK"
|
|
1929
|
+
];
|
|
1776
1930
|
function isComponentDidMount(node) {
|
|
1777
1931
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
|
|
1778
1932
|
}
|
|
@@ -1780,7 +1934,8 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
1780
1934
|
meta: {
|
|
1781
1935
|
type: "problem",
|
|
1782
1936
|
docs: {
|
|
1783
|
-
description: "disallow using 'setState' in 'componentDidMount'"
|
|
1937
|
+
description: "disallow using 'setState' in 'componentDidMount'",
|
|
1938
|
+
[Symbol.for("rule_features")]: RULE_FEATURES34
|
|
1784
1939
|
},
|
|
1785
1940
|
messages: {
|
|
1786
1941
|
noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions, such as callbacks."
|
|
@@ -1816,6 +1971,9 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
1816
1971
|
defaultOptions: []
|
|
1817
1972
|
});
|
|
1818
1973
|
var RULE_NAME35 = "no-set-state-in-component-did-update";
|
|
1974
|
+
var RULE_FEATURES35 = [
|
|
1975
|
+
"CHK"
|
|
1976
|
+
];
|
|
1819
1977
|
function isComponentDidUpdate(node) {
|
|
1820
1978
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidUpdate";
|
|
1821
1979
|
}
|
|
@@ -1823,7 +1981,8 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
1823
1981
|
meta: {
|
|
1824
1982
|
type: "problem",
|
|
1825
1983
|
docs: {
|
|
1826
|
-
description: "disallow using 'setState' in 'componentDidUpdate'"
|
|
1984
|
+
description: "disallow using 'setState' in 'componentDidUpdate'",
|
|
1985
|
+
[Symbol.for("rule_features")]: RULE_FEATURES35
|
|
1827
1986
|
},
|
|
1828
1987
|
messages: {
|
|
1829
1988
|
noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions, such as callbacks."
|
|
@@ -1859,6 +2018,9 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
1859
2018
|
defaultOptions: []
|
|
1860
2019
|
});
|
|
1861
2020
|
var RULE_NAME36 = "no-set-state-in-component-will-update";
|
|
2021
|
+
var RULE_FEATURES36 = [
|
|
2022
|
+
"CHK"
|
|
2023
|
+
];
|
|
1862
2024
|
function isComponentWillUpdate3(node) {
|
|
1863
2025
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
|
|
1864
2026
|
}
|
|
@@ -1866,7 +2028,8 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
1866
2028
|
meta: {
|
|
1867
2029
|
type: "problem",
|
|
1868
2030
|
docs: {
|
|
1869
|
-
description: "disallow using 'setState' in 'componentWillUpdate'"
|
|
2031
|
+
description: "disallow using 'setState' in 'componentWillUpdate'",
|
|
2032
|
+
[Symbol.for("rule_features")]: RULE_FEATURES36
|
|
1870
2033
|
},
|
|
1871
2034
|
messages: {
|
|
1872
2035
|
noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions, such as callbacks."
|
|
@@ -1902,6 +2065,9 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
1902
2065
|
defaultOptions: []
|
|
1903
2066
|
});
|
|
1904
2067
|
var RULE_NAME37 = "no-string-refs";
|
|
2068
|
+
var RULE_FEATURES37 = [
|
|
2069
|
+
"CHK"
|
|
2070
|
+
];
|
|
1905
2071
|
function containsStringLiteral({ value }) {
|
|
1906
2072
|
return value?.type === AST_NODE_TYPES.Literal && isString(value.value);
|
|
1907
2073
|
}
|
|
@@ -1914,7 +2080,8 @@ var no_string_refs_default = createRule({
|
|
|
1914
2080
|
meta: {
|
|
1915
2081
|
type: "problem",
|
|
1916
2082
|
docs: {
|
|
1917
|
-
description: "disallow using deprecated string refs"
|
|
2083
|
+
description: "disallow using deprecated string refs",
|
|
2084
|
+
[Symbol.for("rule_features")]: RULE_FEATURES37
|
|
1918
2085
|
},
|
|
1919
2086
|
messages: {
|
|
1920
2087
|
noStringRefs: "[Deprecated] Use callback refs instead."
|
|
@@ -1938,6 +2105,9 @@ var no_string_refs_default = createRule({
|
|
|
1938
2105
|
defaultOptions: []
|
|
1939
2106
|
});
|
|
1940
2107
|
var RULE_NAME38 = "no-unsafe-component-will-mount";
|
|
2108
|
+
var RULE_FEATURES38 = [
|
|
2109
|
+
"CHK"
|
|
2110
|
+
];
|
|
1941
2111
|
function isUnsafeComponentWillMount(node) {
|
|
1942
2112
|
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
2113
|
}
|
|
@@ -1945,7 +2115,8 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
1945
2115
|
meta: {
|
|
1946
2116
|
type: "problem",
|
|
1947
2117
|
docs: {
|
|
1948
|
-
description: "disallow using 'UNSAFE_componentWillMount'"
|
|
2118
|
+
description: "disallow using 'UNSAFE_componentWillMount'",
|
|
2119
|
+
[Symbol.for("rule_features")]: RULE_FEATURES38
|
|
1949
2120
|
},
|
|
1950
2121
|
messages: {
|
|
1951
2122
|
noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'."
|
|
@@ -1977,6 +2148,9 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
1977
2148
|
defaultOptions: []
|
|
1978
2149
|
});
|
|
1979
2150
|
var RULE_NAME39 = "no-unsafe-component-will-receive-props";
|
|
2151
|
+
var RULE_FEATURES39 = [
|
|
2152
|
+
"CHK"
|
|
2153
|
+
];
|
|
1980
2154
|
function isUnsafeComponentWillReceiveProps(node) {
|
|
1981
2155
|
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
2156
|
}
|
|
@@ -1984,7 +2158,8 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
1984
2158
|
meta: {
|
|
1985
2159
|
type: "problem",
|
|
1986
2160
|
docs: {
|
|
1987
|
-
description: "disallow using 'UNSAFE_componentWillReceiveProps'"
|
|
2161
|
+
description: "disallow using 'UNSAFE_componentWillReceiveProps'",
|
|
2162
|
+
[Symbol.for("rule_features")]: RULE_FEATURES39
|
|
1988
2163
|
},
|
|
1989
2164
|
messages: {
|
|
1990
2165
|
noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'."
|
|
@@ -2016,6 +2191,9 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
2016
2191
|
defaultOptions: []
|
|
2017
2192
|
});
|
|
2018
2193
|
var RULE_NAME40 = "no-unsafe-component-will-update";
|
|
2194
|
+
var RULE_FEATURES40 = [
|
|
2195
|
+
"CHK"
|
|
2196
|
+
];
|
|
2019
2197
|
function isUnsafeComponentWillUpdate(node) {
|
|
2020
2198
|
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
2199
|
}
|
|
@@ -2023,7 +2201,8 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2023
2201
|
meta: {
|
|
2024
2202
|
type: "problem",
|
|
2025
2203
|
docs: {
|
|
2026
|
-
description: "disallow using 'UNSAFE_componentWillUpdate'"
|
|
2204
|
+
description: "disallow using 'UNSAFE_componentWillUpdate'",
|
|
2205
|
+
[Symbol.for("rule_features")]: RULE_FEATURES40
|
|
2027
2206
|
},
|
|
2028
2207
|
messages: {
|
|
2029
2208
|
noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'."
|
|
@@ -2055,11 +2234,15 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2055
2234
|
defaultOptions: []
|
|
2056
2235
|
});
|
|
2057
2236
|
var RULE_NAME41 = "no-unstable-context-value";
|
|
2237
|
+
var RULE_FEATURES41 = [
|
|
2238
|
+
"CHK"
|
|
2239
|
+
];
|
|
2058
2240
|
var no_unstable_context_value_default = createRule({
|
|
2059
2241
|
meta: {
|
|
2060
2242
|
type: "problem",
|
|
2061
2243
|
docs: {
|
|
2062
|
-
description: "disallow passing constructed values to context providers"
|
|
2244
|
+
description: "disallow passing constructed values to context providers",
|
|
2245
|
+
[Symbol.for("rule_features")]: RULE_FEATURES41
|
|
2063
2246
|
},
|
|
2064
2247
|
messages: {
|
|
2065
2248
|
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 +2305,15 @@ var no_unstable_context_value_default = createRule({
|
|
|
2122
2305
|
defaultOptions: []
|
|
2123
2306
|
});
|
|
2124
2307
|
var RULE_NAME42 = "no-unstable-default-props";
|
|
2308
|
+
var RULE_FEATURES42 = [
|
|
2309
|
+
"CHK"
|
|
2310
|
+
];
|
|
2125
2311
|
var no_unstable_default_props_default = createRule({
|
|
2126
2312
|
meta: {
|
|
2127
2313
|
type: "problem",
|
|
2128
2314
|
docs: {
|
|
2129
|
-
description: "disallow using unstable value as default param in function component"
|
|
2315
|
+
description: "disallow using unstable value as default param in function component",
|
|
2316
|
+
[Symbol.for("rule_features")]: RULE_FEATURES42
|
|
2130
2317
|
},
|
|
2131
2318
|
messages: {
|
|
2132
2319
|
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 +2374,9 @@ var no_unstable_default_props_default = createRule({
|
|
|
2187
2374
|
defaultOptions: []
|
|
2188
2375
|
});
|
|
2189
2376
|
var RULE_NAME43 = "no-unused-class-component-members";
|
|
2377
|
+
var RULE_FEATURES43 = [
|
|
2378
|
+
"CHK"
|
|
2379
|
+
];
|
|
2190
2380
|
var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
|
|
2191
2381
|
"componentDidCatch",
|
|
2192
2382
|
"componentDidMount",
|
|
@@ -2223,7 +2413,8 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2223
2413
|
meta: {
|
|
2224
2414
|
type: "problem",
|
|
2225
2415
|
docs: {
|
|
2226
|
-
description: "disallow unused class component members"
|
|
2416
|
+
description: "disallow unused class component members",
|
|
2417
|
+
[Symbol.for("rule_features")]: RULE_FEATURES43
|
|
2227
2418
|
},
|
|
2228
2419
|
messages: {
|
|
2229
2420
|
noUnusedClassComponentMembers: "Unused method or property '{{methodName}}'' of class '{{className}}'."
|
|
@@ -2314,6 +2505,9 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2314
2505
|
defaultOptions: []
|
|
2315
2506
|
});
|
|
2316
2507
|
var RULE_NAME44 = "no-unused-state";
|
|
2508
|
+
var RULE_FEATURES44 = [
|
|
2509
|
+
"CHK"
|
|
2510
|
+
];
|
|
2317
2511
|
function getName4(node) {
|
|
2318
2512
|
if (node.type === AST_NODE_TYPES.TSAsExpression) {
|
|
2319
2513
|
return getName4(node.expression);
|
|
@@ -2346,7 +2540,8 @@ var no_unused_state_default = createRule({
|
|
|
2346
2540
|
meta: {
|
|
2347
2541
|
type: "problem",
|
|
2348
2542
|
docs: {
|
|
2349
|
-
description: "disallow unused state of class component"
|
|
2543
|
+
description: "disallow unused state of class component",
|
|
2544
|
+
[Symbol.for("rule_features")]: RULE_FEATURES44
|
|
2350
2545
|
},
|
|
2351
2546
|
messages: {
|
|
2352
2547
|
noUnusedState: "Unused class component state in '{{className}}'"
|
|
@@ -2514,6 +2709,9 @@ var no_useless_fragment_default = createRule({
|
|
|
2514
2709
|
}]
|
|
2515
2710
|
});
|
|
2516
2711
|
var RULE_NAME46 = "prefer-destructuring-assignment";
|
|
2712
|
+
var RULE_FEATURES45 = [
|
|
2713
|
+
"CHK"
|
|
2714
|
+
];
|
|
2517
2715
|
function isMemberExpressionWithObjectName(node) {
|
|
2518
2716
|
return node.object.type === AST_NODE_TYPES.Identifier && "name" in node.object;
|
|
2519
2717
|
}
|
|
@@ -2521,7 +2719,8 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2521
2719
|
meta: {
|
|
2522
2720
|
type: "problem",
|
|
2523
2721
|
docs: {
|
|
2524
|
-
description: "enforce using destructuring assignment in component props and context"
|
|
2722
|
+
description: "enforce using destructuring assignment in component props and context",
|
|
2723
|
+
[Symbol.for("rule_features")]: RULE_FEATURES45
|
|
2525
2724
|
},
|
|
2526
2725
|
messages: {
|
|
2527
2726
|
preferDestructuringAssignment: "Use destructuring assignment for {{name}}."
|
|
@@ -2584,11 +2783,16 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2584
2783
|
defaultOptions: []
|
|
2585
2784
|
});
|
|
2586
2785
|
var RULE_NAME47 = "prefer-react-namespace-import";
|
|
2786
|
+
var RULE_FEATURES46 = [
|
|
2787
|
+
"CHK",
|
|
2788
|
+
"FIX"
|
|
2789
|
+
];
|
|
2587
2790
|
var prefer_react_namespace_import_default = createRule({
|
|
2588
2791
|
meta: {
|
|
2589
2792
|
type: "problem",
|
|
2590
2793
|
docs: {
|
|
2591
|
-
description: "enforce React is imported via a namespace import"
|
|
2794
|
+
description: "enforce React is imported via a namespace import",
|
|
2795
|
+
[Symbol.for("rule_features")]: RULE_FEATURES46
|
|
2592
2796
|
},
|
|
2593
2797
|
fixable: "code",
|
|
2594
2798
|
messages: {
|
|
@@ -2633,6 +2837,10 @@ ${importStringPrefix} ${specifiers} from ${importSourceQuoted}${semiColon}`
|
|
|
2633
2837
|
defaultOptions: []
|
|
2634
2838
|
});
|
|
2635
2839
|
var RULE_NAME48 = "prefer-read-only-props";
|
|
2840
|
+
var RULE_FEATURES47 = [
|
|
2841
|
+
"CHK",
|
|
2842
|
+
"TSC"
|
|
2843
|
+
];
|
|
2636
2844
|
function isReadonlyType(type, services) {
|
|
2637
2845
|
try {
|
|
2638
2846
|
const im = getTypeImmutability(services.program, type);
|
|
@@ -2645,7 +2853,8 @@ var prefer_read_only_props_default = createRule({
|
|
|
2645
2853
|
meta: {
|
|
2646
2854
|
type: "problem",
|
|
2647
2855
|
docs: {
|
|
2648
|
-
description: "enforce read-only props in components"
|
|
2856
|
+
description: "enforce read-only props in components",
|
|
2857
|
+
[Symbol.for("rule_features")]: RULE_FEATURES47
|
|
2649
2858
|
},
|
|
2650
2859
|
messages: {
|
|
2651
2860
|
preferReadOnlyProps: "A function component's props should be read-only."
|
|
@@ -2673,11 +2882,16 @@ var prefer_read_only_props_default = createRule({
|
|
|
2673
2882
|
defaultOptions: []
|
|
2674
2883
|
});
|
|
2675
2884
|
var RULE_NAME49 = "prefer-shorthand-boolean";
|
|
2885
|
+
var RULE_FEATURES48 = [
|
|
2886
|
+
"CHK",
|
|
2887
|
+
"FIX"
|
|
2888
|
+
];
|
|
2676
2889
|
var prefer_shorthand_boolean_default = createRule({
|
|
2677
2890
|
meta: {
|
|
2678
2891
|
type: "problem",
|
|
2679
2892
|
docs: {
|
|
2680
|
-
description: "enforce using shorthand boolean attributes"
|
|
2893
|
+
description: "enforce using shorthand boolean attributes",
|
|
2894
|
+
[Symbol.for("rule_features")]: RULE_FEATURES48
|
|
2681
2895
|
},
|
|
2682
2896
|
fixable: "code",
|
|
2683
2897
|
messages: {
|
|
@@ -2708,11 +2922,15 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
2708
2922
|
defaultOptions: []
|
|
2709
2923
|
});
|
|
2710
2924
|
var RULE_NAME50 = "prefer-shorthand-fragment";
|
|
2925
|
+
var RULE_FEATURES49 = [
|
|
2926
|
+
"CHK"
|
|
2927
|
+
];
|
|
2711
2928
|
var prefer_shorthand_fragment_default = createRule({
|
|
2712
2929
|
meta: {
|
|
2713
2930
|
type: "problem",
|
|
2714
2931
|
docs: {
|
|
2715
|
-
description: "enforce using fragment syntax instead of 'Fragment' component"
|
|
2932
|
+
description: "enforce using fragment syntax instead of 'Fragment' component",
|
|
2933
|
+
[Symbol.for("rule_features")]: RULE_FEATURES49
|
|
2716
2934
|
},
|
|
2717
2935
|
messages: {
|
|
2718
2936
|
preferShorthandFragment: "Use fragment shorthand syntax instead of 'Fragment' component."
|
|
@@ -2738,14 +2956,6 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
2738
2956
|
});
|
|
2739
2957
|
|
|
2740
2958
|
// src/index.ts
|
|
2741
|
-
var DEFAULT_ESLINT_REACT_SETTINGS = {
|
|
2742
|
-
additionalHooks: {
|
|
2743
|
-
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
2744
|
-
},
|
|
2745
|
-
polymorphicPropName: "as",
|
|
2746
|
-
strictImportCheck: true,
|
|
2747
|
-
version: "detect"
|
|
2748
|
-
};
|
|
2749
2959
|
var src_default = {
|
|
2750
2960
|
meta: {
|
|
2751
2961
|
name,
|
|
@@ -2805,8 +3015,7 @@ var src_default = {
|
|
|
2805
3015
|
// Deprecated Rules
|
|
2806
3016
|
/** @deprecated Use `no-complex-conditional-rendering` instead. */
|
|
2807
3017
|
"no-complicated-conditional-rendering": no_complex_conditional_rendering_default
|
|
2808
|
-
}
|
|
2809
|
-
DEFAULT_ESLINT_REACT_SETTINGS
|
|
3018
|
+
}
|
|
2810
3019
|
};
|
|
2811
3020
|
|
|
2812
3021
|
export { src_default as default };
|