eslint-plugin-react-x 1.20.0-beta.2 → 1.20.0-beta.9
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 +3 -3
- package/dist/index.d.mts +0 -8
- package/dist/index.d.ts +0 -8
- package/dist/index.js +252 -60
- package/dist/index.mjs +252 -60
- package/package.json +10 -9
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-beta.
|
|
17
|
+
var version = "1.20.0-beta.9";
|
|
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,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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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'."
|
|
@@ -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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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,9 @@ 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
|
+
"LNT"
|
|
796
|
+
];
|
|
728
797
|
function isComponentWillMount(node) {
|
|
729
798
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillMount";
|
|
730
799
|
}
|
|
@@ -732,7 +801,8 @@ var no_component_will_mount_default = createRule({
|
|
|
732
801
|
meta: {
|
|
733
802
|
type: "problem",
|
|
734
803
|
docs: {
|
|
735
|
-
description: "disallow using 'componentWillMount'"
|
|
804
|
+
description: "disallow using 'componentWillMount'",
|
|
805
|
+
[Symbol.for("rule_features")]: RULE_FEATURES18
|
|
736
806
|
},
|
|
737
807
|
messages: {
|
|
738
808
|
noComponentWillMount: "[Deprecated] Use 'UNSAFE_componentWillMount' instead."
|
|
@@ -764,6 +834,9 @@ var no_component_will_mount_default = createRule({
|
|
|
764
834
|
defaultOptions: []
|
|
765
835
|
});
|
|
766
836
|
var RULE_NAME19 = "no-component-will-receive-props";
|
|
837
|
+
var RULE_FEATURES19 = [
|
|
838
|
+
"LNT"
|
|
839
|
+
];
|
|
767
840
|
function isComponentWillUpdate(node) {
|
|
768
841
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillReceiveProps";
|
|
769
842
|
}
|
|
@@ -771,7 +844,8 @@ var no_component_will_receive_props_default = createRule({
|
|
|
771
844
|
meta: {
|
|
772
845
|
type: "problem",
|
|
773
846
|
docs: {
|
|
774
|
-
description: "disallow using 'componentWillReceiveProps'"
|
|
847
|
+
description: "disallow using 'componentWillReceiveProps'",
|
|
848
|
+
[Symbol.for("rule_features")]: RULE_FEATURES19
|
|
775
849
|
},
|
|
776
850
|
messages: {
|
|
777
851
|
noComponentWillReceiveProps: "[Deprecated] Use 'UNSAFE_componentWillReceiveProps' instead."
|
|
@@ -803,6 +877,9 @@ var no_component_will_receive_props_default = createRule({
|
|
|
803
877
|
defaultOptions: []
|
|
804
878
|
});
|
|
805
879
|
var RULE_NAME20 = "no-component-will-update";
|
|
880
|
+
var RULE_FEATURES20 = [
|
|
881
|
+
"LNT"
|
|
882
|
+
];
|
|
806
883
|
function isComponentWillUpdate2(node) {
|
|
807
884
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
|
|
808
885
|
}
|
|
@@ -810,7 +887,8 @@ var no_component_will_update_default = createRule({
|
|
|
810
887
|
meta: {
|
|
811
888
|
type: "problem",
|
|
812
889
|
docs: {
|
|
813
|
-
description: "disallow using 'componentWillReceiveProps'"
|
|
890
|
+
description: "disallow using 'componentWillReceiveProps'",
|
|
891
|
+
[Symbol.for("rule_features")]: RULE_FEATURES20
|
|
814
892
|
},
|
|
815
893
|
messages: {
|
|
816
894
|
noComponentWillUpdate: "[Deprecated] Use 'UNSAFE_componentWillUpdate' instead."
|
|
@@ -842,11 +920,16 @@ var no_component_will_update_default = createRule({
|
|
|
842
920
|
defaultOptions: []
|
|
843
921
|
});
|
|
844
922
|
var RULE_NAME21 = "no-context-provider";
|
|
923
|
+
var RULE_FEATURES21 = [
|
|
924
|
+
"LNT",
|
|
925
|
+
"FIX"
|
|
926
|
+
];
|
|
845
927
|
var no_context_provider_default = createRule({
|
|
846
928
|
meta: {
|
|
847
929
|
type: "problem",
|
|
848
930
|
docs: {
|
|
849
|
-
description: "disallow the use of '<Context.Provider>'"
|
|
931
|
+
description: "disallow the use of '<Context.Provider>'",
|
|
932
|
+
[Symbol.for("rule_features")]: RULE_FEATURES21
|
|
850
933
|
},
|
|
851
934
|
fixable: "code",
|
|
852
935
|
messages: {
|
|
@@ -883,11 +966,15 @@ var no_context_provider_default = createRule({
|
|
|
883
966
|
defaultOptions: []
|
|
884
967
|
});
|
|
885
968
|
var RULE_NAME22 = "no-create-ref";
|
|
969
|
+
var RULE_FEATURES22 = [
|
|
970
|
+
"LNT"
|
|
971
|
+
];
|
|
886
972
|
var no_create_ref_default = createRule({
|
|
887
973
|
meta: {
|
|
888
974
|
type: "problem",
|
|
889
975
|
docs: {
|
|
890
|
-
description: "disallow using 'createRef' in function components"
|
|
976
|
+
description: "disallow using 'createRef' in function components",
|
|
977
|
+
[Symbol.for("rule_features")]: RULE_FEATURES22
|
|
891
978
|
},
|
|
892
979
|
messages: {
|
|
893
980
|
noCreateRef: "[Deprecated] Use 'useRef' instead."
|
|
@@ -907,11 +994,15 @@ var no_create_ref_default = createRule({
|
|
|
907
994
|
defaultOptions: []
|
|
908
995
|
});
|
|
909
996
|
var RULE_NAME23 = "no-default-props";
|
|
997
|
+
var RULE_FEATURES23 = [
|
|
998
|
+
"LNT"
|
|
999
|
+
];
|
|
910
1000
|
var no_default_props_default = createRule({
|
|
911
1001
|
meta: {
|
|
912
1002
|
type: "problem",
|
|
913
1003
|
docs: {
|
|
914
|
-
description: "disallow using 'defaultProps' property in components"
|
|
1004
|
+
description: "disallow using 'defaultProps' property in components",
|
|
1005
|
+
[Symbol.for("rule_features")]: RULE_FEATURES23
|
|
915
1006
|
},
|
|
916
1007
|
messages: {
|
|
917
1008
|
noDefaultProps: "[Deprecated] Use ES6 default parameters instead."
|
|
@@ -946,6 +1037,9 @@ var no_default_props_default = createRule({
|
|
|
946
1037
|
defaultOptions: []
|
|
947
1038
|
});
|
|
948
1039
|
var RULE_NAME24 = "no-direct-mutation-state";
|
|
1040
|
+
var RULE_FEATURES24 = [
|
|
1041
|
+
"LNT"
|
|
1042
|
+
];
|
|
949
1043
|
function getName2(node) {
|
|
950
1044
|
if (node.type === AST_NODE_TYPES.TSAsExpression) {
|
|
951
1045
|
return getName2(node.expression);
|
|
@@ -972,7 +1066,8 @@ var no_direct_mutation_state_default = createRule({
|
|
|
972
1066
|
meta: {
|
|
973
1067
|
type: "problem",
|
|
974
1068
|
docs: {
|
|
975
|
-
description: "disallow direct mutation of state"
|
|
1069
|
+
description: "disallow direct mutation of state",
|
|
1070
|
+
[Symbol.for("rule_features")]: RULE_FEATURES24
|
|
976
1071
|
},
|
|
977
1072
|
messages: {
|
|
978
1073
|
noDirectMutationState: "Do not mutate state directly. Use 'setState()' instead."
|
|
@@ -1004,11 +1099,15 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1004
1099
|
defaultOptions: []
|
|
1005
1100
|
});
|
|
1006
1101
|
var RULE_NAME25 = "no-duplicate-key";
|
|
1102
|
+
var RULE_FEATURES25 = [
|
|
1103
|
+
"LNT"
|
|
1104
|
+
];
|
|
1007
1105
|
var no_duplicate_key_default = createRule({
|
|
1008
1106
|
meta: {
|
|
1009
1107
|
type: "problem",
|
|
1010
1108
|
docs: {
|
|
1011
|
-
description: "disallow duplicate keys when rendering list"
|
|
1109
|
+
description: "disallow duplicate keys when rendering list",
|
|
1110
|
+
[Symbol.for("rule_features")]: RULE_FEATURES25
|
|
1012
1111
|
},
|
|
1013
1112
|
messages: {
|
|
1014
1113
|
noDuplicateKey: "A key must be unique. '{{value}}' is duplicated."
|
|
@@ -1133,11 +1232,16 @@ var no_duplicate_key_default = createRule({
|
|
|
1133
1232
|
defaultOptions: []
|
|
1134
1233
|
});
|
|
1135
1234
|
var RULE_NAME26 = "no-forward-ref";
|
|
1235
|
+
var RULE_FEATURES26 = [
|
|
1236
|
+
"LNT",
|
|
1237
|
+
"FIX"
|
|
1238
|
+
];
|
|
1136
1239
|
var no_forward_ref_default = createRule({
|
|
1137
1240
|
meta: {
|
|
1138
1241
|
type: "problem",
|
|
1139
1242
|
docs: {
|
|
1140
|
-
description: "disallow the use of 'forwardRef'"
|
|
1243
|
+
description: "disallow the use of 'forwardRef'",
|
|
1244
|
+
[Symbol.for("rule_features")]: RULE_FEATURES26
|
|
1141
1245
|
},
|
|
1142
1246
|
fixable: "code",
|
|
1143
1247
|
messages: {
|
|
@@ -1225,11 +1329,15 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1225
1329
|
];
|
|
1226
1330
|
}
|
|
1227
1331
|
var RULE_NAME27 = "no-implicit-key";
|
|
1332
|
+
var RULE_FEATURES27 = [
|
|
1333
|
+
"LNT"
|
|
1334
|
+
];
|
|
1228
1335
|
var no_implicit_key_default = createRule({
|
|
1229
1336
|
meta: {
|
|
1230
1337
|
type: "problem",
|
|
1231
1338
|
docs: {
|
|
1232
|
-
description: "disallow implicit 'key' props"
|
|
1339
|
+
description: "disallow implicit 'key' props",
|
|
1340
|
+
[Symbol.for("rule_features")]: RULE_FEATURES27
|
|
1233
1341
|
},
|
|
1234
1342
|
messages: {
|
|
1235
1343
|
noImplicitKey: "Do not use implicit 'key' props."
|
|
@@ -1280,6 +1388,10 @@ function unionTypeParts(type) {
|
|
|
1280
1388
|
return isUnionType(type) ? type.types : [type];
|
|
1281
1389
|
}
|
|
1282
1390
|
var RULE_NAME28 = "no-leaked-conditional-rendering";
|
|
1391
|
+
var RULE_FEATURES28 = [
|
|
1392
|
+
"LNT",
|
|
1393
|
+
"TSC"
|
|
1394
|
+
];
|
|
1283
1395
|
var tsHelpers = {
|
|
1284
1396
|
isAnyType: (type) => isTypeFlagSet(type, ts.TypeFlags.TypeParameter | ts.TypeFlags.Any),
|
|
1285
1397
|
isBigIntType: (type) => isTypeFlagSet(type, ts.TypeFlags.BigIntLike),
|
|
@@ -1376,7 +1488,8 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1376
1488
|
meta: {
|
|
1377
1489
|
type: "problem",
|
|
1378
1490
|
docs: {
|
|
1379
|
-
description: "disallow problematic leaked values from being rendered"
|
|
1491
|
+
description: "disallow problematic leaked values from being rendered",
|
|
1492
|
+
[Symbol.for("rule_features")]: RULE_FEATURES28
|
|
1380
1493
|
},
|
|
1381
1494
|
messages: {
|
|
1382
1495
|
noLeakedConditionalRendering: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes."
|
|
@@ -1441,11 +1554,15 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1441
1554
|
defaultOptions: []
|
|
1442
1555
|
});
|
|
1443
1556
|
var RULE_NAME29 = "no-missing-component-display-name";
|
|
1557
|
+
var RULE_FEATURES29 = [
|
|
1558
|
+
"LNT"
|
|
1559
|
+
];
|
|
1444
1560
|
var no_missing_component_display_name_default = createRule({
|
|
1445
1561
|
meta: {
|
|
1446
1562
|
type: "problem",
|
|
1447
1563
|
docs: {
|
|
1448
|
-
description: "require 'displayName' for 'memo' and 'forwardRef' components"
|
|
1564
|
+
description: "require 'displayName' for 'memo' and 'forwardRef' components",
|
|
1565
|
+
[Symbol.for("rule_features")]: RULE_FEATURES29
|
|
1449
1566
|
},
|
|
1450
1567
|
messages: {
|
|
1451
1568
|
noMissingComponentDisplayName: "Add missing 'displayName' for component."
|
|
@@ -1477,11 +1594,15 @@ var no_missing_component_display_name_default = createRule({
|
|
|
1477
1594
|
defaultOptions: []
|
|
1478
1595
|
});
|
|
1479
1596
|
var RULE_NAME30 = "no-missing-key";
|
|
1597
|
+
var RULE_FEATURES30 = [
|
|
1598
|
+
"LNT"
|
|
1599
|
+
];
|
|
1480
1600
|
var no_missing_key_default = createRule({
|
|
1481
1601
|
meta: {
|
|
1482
1602
|
type: "problem",
|
|
1483
1603
|
docs: {
|
|
1484
|
-
description: "require 'key' when rendering list"
|
|
1604
|
+
description: "require 'key' when rendering list",
|
|
1605
|
+
[Symbol.for("rule_features")]: RULE_FEATURES30
|
|
1485
1606
|
},
|
|
1486
1607
|
messages: {
|
|
1487
1608
|
noMissingKey: "Missing 'key' for element when rendering list.",
|
|
@@ -1594,11 +1715,15 @@ var no_missing_key_default = createRule({
|
|
|
1594
1715
|
defaultOptions: []
|
|
1595
1716
|
});
|
|
1596
1717
|
var RULE_NAME31 = "no-nested-components";
|
|
1718
|
+
var RULE_FEATURES31 = [
|
|
1719
|
+
"LNT"
|
|
1720
|
+
];
|
|
1597
1721
|
var no_nested_components_default = createRule({
|
|
1598
1722
|
meta: {
|
|
1599
1723
|
type: "problem",
|
|
1600
1724
|
docs: {
|
|
1601
|
-
description: "disallow using unstable nested components"
|
|
1725
|
+
description: "disallow using unstable nested components",
|
|
1726
|
+
[Symbol.for("rule_features")]: RULE_FEATURES31
|
|
1602
1727
|
},
|
|
1603
1728
|
messages: {
|
|
1604
1729
|
nestedComponent: "Do not nest components inside other components. Move it to the top level.",
|
|
@@ -1691,11 +1816,15 @@ var no_nested_components_default = createRule({
|
|
|
1691
1816
|
defaultOptions: []
|
|
1692
1817
|
});
|
|
1693
1818
|
var RULE_NAME32 = "no-prop-types";
|
|
1819
|
+
var RULE_FEATURES32 = [
|
|
1820
|
+
"LNT"
|
|
1821
|
+
];
|
|
1694
1822
|
var no_prop_types_default = createRule({
|
|
1695
1823
|
meta: {
|
|
1696
1824
|
type: "problem",
|
|
1697
1825
|
docs: {
|
|
1698
|
-
description: "disallow using 'propTypes' property in components"
|
|
1826
|
+
description: "disallow using 'propTypes' property in components",
|
|
1827
|
+
[Symbol.for("rule_features")]: RULE_FEATURES32
|
|
1699
1828
|
},
|
|
1700
1829
|
messages: {
|
|
1701
1830
|
noPropTypes: "[Deprecated] Use TypeScript or another type-checking solution instead."
|
|
@@ -1730,6 +1859,9 @@ var no_prop_types_default = createRule({
|
|
|
1730
1859
|
defaultOptions: []
|
|
1731
1860
|
});
|
|
1732
1861
|
var RULE_NAME33 = "no-redundant-should-component-update";
|
|
1862
|
+
var RULE_FEATURES33 = [
|
|
1863
|
+
"LNT"
|
|
1864
|
+
];
|
|
1733
1865
|
function isShouldComponentUpdate(node) {
|
|
1734
1866
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
|
|
1735
1867
|
}
|
|
@@ -1737,7 +1869,8 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1737
1869
|
meta: {
|
|
1738
1870
|
type: "problem",
|
|
1739
1871
|
docs: {
|
|
1740
|
-
description: "disallow using 'shouldComponentUpdate' in class component extends 'React.PureComponent'"
|
|
1872
|
+
description: "disallow using 'shouldComponentUpdate' in class component extends 'React.PureComponent'",
|
|
1873
|
+
[Symbol.for("rule_features")]: RULE_FEATURES33
|
|
1741
1874
|
},
|
|
1742
1875
|
messages: {
|
|
1743
1876
|
noRedundantShouldComponentUpdate: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'."
|
|
@@ -1773,6 +1906,9 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1773
1906
|
defaultOptions: []
|
|
1774
1907
|
});
|
|
1775
1908
|
var RULE_NAME34 = "no-set-state-in-component-did-mount";
|
|
1909
|
+
var RULE_FEATURES34 = [
|
|
1910
|
+
"LNT"
|
|
1911
|
+
];
|
|
1776
1912
|
function isComponentDidMount(node) {
|
|
1777
1913
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidMount";
|
|
1778
1914
|
}
|
|
@@ -1780,7 +1916,8 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
1780
1916
|
meta: {
|
|
1781
1917
|
type: "problem",
|
|
1782
1918
|
docs: {
|
|
1783
|
-
description: "disallow using 'setState' in 'componentDidMount'"
|
|
1919
|
+
description: "disallow using 'setState' in 'componentDidMount'",
|
|
1920
|
+
[Symbol.for("rule_features")]: RULE_FEATURES34
|
|
1784
1921
|
},
|
|
1785
1922
|
messages: {
|
|
1786
1923
|
noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions, such as callbacks."
|
|
@@ -1816,6 +1953,9 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
1816
1953
|
defaultOptions: []
|
|
1817
1954
|
});
|
|
1818
1955
|
var RULE_NAME35 = "no-set-state-in-component-did-update";
|
|
1956
|
+
var RULE_FEATURES35 = [
|
|
1957
|
+
"LNT"
|
|
1958
|
+
];
|
|
1819
1959
|
function isComponentDidUpdate(node) {
|
|
1820
1960
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentDidUpdate";
|
|
1821
1961
|
}
|
|
@@ -1823,7 +1963,8 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
1823
1963
|
meta: {
|
|
1824
1964
|
type: "problem",
|
|
1825
1965
|
docs: {
|
|
1826
|
-
description: "disallow using 'setState' in 'componentDidUpdate'"
|
|
1966
|
+
description: "disallow using 'setState' in 'componentDidUpdate'",
|
|
1967
|
+
[Symbol.for("rule_features")]: RULE_FEATURES35
|
|
1827
1968
|
},
|
|
1828
1969
|
messages: {
|
|
1829
1970
|
noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions, such as callbacks."
|
|
@@ -1859,6 +2000,9 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
1859
2000
|
defaultOptions: []
|
|
1860
2001
|
});
|
|
1861
2002
|
var RULE_NAME36 = "no-set-state-in-component-will-update";
|
|
2003
|
+
var RULE_FEATURES36 = [
|
|
2004
|
+
"LNT"
|
|
2005
|
+
];
|
|
1862
2006
|
function isComponentWillUpdate3(node) {
|
|
1863
2007
|
return AST11.isOneOf([AST_NODE_TYPES.MethodDefinition, AST_NODE_TYPES.PropertyDefinition])(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "componentWillUpdate";
|
|
1864
2008
|
}
|
|
@@ -1866,7 +2010,8 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
1866
2010
|
meta: {
|
|
1867
2011
|
type: "problem",
|
|
1868
2012
|
docs: {
|
|
1869
|
-
description: "disallow using 'setState' in 'componentWillUpdate'"
|
|
2013
|
+
description: "disallow using 'setState' in 'componentWillUpdate'",
|
|
2014
|
+
[Symbol.for("rule_features")]: RULE_FEATURES36
|
|
1870
2015
|
},
|
|
1871
2016
|
messages: {
|
|
1872
2017
|
noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions, such as callbacks."
|
|
@@ -1902,6 +2047,9 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
1902
2047
|
defaultOptions: []
|
|
1903
2048
|
});
|
|
1904
2049
|
var RULE_NAME37 = "no-string-refs";
|
|
2050
|
+
var RULE_FEATURES37 = [
|
|
2051
|
+
"LNT"
|
|
2052
|
+
];
|
|
1905
2053
|
function containsStringLiteral({ value }) {
|
|
1906
2054
|
return value?.type === AST_NODE_TYPES.Literal && isString(value.value);
|
|
1907
2055
|
}
|
|
@@ -1914,7 +2062,8 @@ var no_string_refs_default = createRule({
|
|
|
1914
2062
|
meta: {
|
|
1915
2063
|
type: "problem",
|
|
1916
2064
|
docs: {
|
|
1917
|
-
description: "disallow using deprecated string refs"
|
|
2065
|
+
description: "disallow using deprecated string refs",
|
|
2066
|
+
[Symbol.for("rule_features")]: RULE_FEATURES37
|
|
1918
2067
|
},
|
|
1919
2068
|
messages: {
|
|
1920
2069
|
noStringRefs: "[Deprecated] Use callback refs instead."
|
|
@@ -1938,6 +2087,9 @@ var no_string_refs_default = createRule({
|
|
|
1938
2087
|
defaultOptions: []
|
|
1939
2088
|
});
|
|
1940
2089
|
var RULE_NAME38 = "no-unsafe-component-will-mount";
|
|
2090
|
+
var RULE_FEATURES38 = [
|
|
2091
|
+
"LNT"
|
|
2092
|
+
];
|
|
1941
2093
|
function isUnsafeComponentWillMount(node) {
|
|
1942
2094
|
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
2095
|
}
|
|
@@ -1945,7 +2097,8 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
1945
2097
|
meta: {
|
|
1946
2098
|
type: "problem",
|
|
1947
2099
|
docs: {
|
|
1948
|
-
description: "disallow using 'UNSAFE_componentWillMount'"
|
|
2100
|
+
description: "disallow using 'UNSAFE_componentWillMount'",
|
|
2101
|
+
[Symbol.for("rule_features")]: RULE_FEATURES38
|
|
1949
2102
|
},
|
|
1950
2103
|
messages: {
|
|
1951
2104
|
noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'."
|
|
@@ -1977,6 +2130,9 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
1977
2130
|
defaultOptions: []
|
|
1978
2131
|
});
|
|
1979
2132
|
var RULE_NAME39 = "no-unsafe-component-will-receive-props";
|
|
2133
|
+
var RULE_FEATURES39 = [
|
|
2134
|
+
"LNT"
|
|
2135
|
+
];
|
|
1980
2136
|
function isUnsafeComponentWillReceiveProps(node) {
|
|
1981
2137
|
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
2138
|
}
|
|
@@ -1984,7 +2140,8 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
1984
2140
|
meta: {
|
|
1985
2141
|
type: "problem",
|
|
1986
2142
|
docs: {
|
|
1987
|
-
description: "disallow using 'UNSAFE_componentWillReceiveProps'"
|
|
2143
|
+
description: "disallow using 'UNSAFE_componentWillReceiveProps'",
|
|
2144
|
+
[Symbol.for("rule_features")]: RULE_FEATURES39
|
|
1988
2145
|
},
|
|
1989
2146
|
messages: {
|
|
1990
2147
|
noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'."
|
|
@@ -2016,6 +2173,9 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
2016
2173
|
defaultOptions: []
|
|
2017
2174
|
});
|
|
2018
2175
|
var RULE_NAME40 = "no-unsafe-component-will-update";
|
|
2176
|
+
var RULE_FEATURES40 = [
|
|
2177
|
+
"LNT"
|
|
2178
|
+
];
|
|
2019
2179
|
function isUnsafeComponentWillUpdate(node) {
|
|
2020
2180
|
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
2181
|
}
|
|
@@ -2023,7 +2183,8 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2023
2183
|
meta: {
|
|
2024
2184
|
type: "problem",
|
|
2025
2185
|
docs: {
|
|
2026
|
-
description: "disallow using 'UNSAFE_componentWillUpdate'"
|
|
2186
|
+
description: "disallow using 'UNSAFE_componentWillUpdate'",
|
|
2187
|
+
[Symbol.for("rule_features")]: RULE_FEATURES40
|
|
2027
2188
|
},
|
|
2028
2189
|
messages: {
|
|
2029
2190
|
noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'."
|
|
@@ -2055,11 +2216,15 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2055
2216
|
defaultOptions: []
|
|
2056
2217
|
});
|
|
2057
2218
|
var RULE_NAME41 = "no-unstable-context-value";
|
|
2219
|
+
var RULE_FEATURES41 = [
|
|
2220
|
+
"LNT"
|
|
2221
|
+
];
|
|
2058
2222
|
var no_unstable_context_value_default = createRule({
|
|
2059
2223
|
meta: {
|
|
2060
2224
|
type: "problem",
|
|
2061
2225
|
docs: {
|
|
2062
|
-
description: "disallow passing constructed values to context providers"
|
|
2226
|
+
description: "disallow passing constructed values to context providers",
|
|
2227
|
+
[Symbol.for("rule_features")]: RULE_FEATURES41
|
|
2063
2228
|
},
|
|
2064
2229
|
messages: {
|
|
2065
2230
|
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 +2287,15 @@ var no_unstable_context_value_default = createRule({
|
|
|
2122
2287
|
defaultOptions: []
|
|
2123
2288
|
});
|
|
2124
2289
|
var RULE_NAME42 = "no-unstable-default-props";
|
|
2290
|
+
var RULE_FEATURES42 = [
|
|
2291
|
+
"LNT"
|
|
2292
|
+
];
|
|
2125
2293
|
var no_unstable_default_props_default = createRule({
|
|
2126
2294
|
meta: {
|
|
2127
2295
|
type: "problem",
|
|
2128
2296
|
docs: {
|
|
2129
|
-
description: "disallow using unstable value as default param in function component"
|
|
2297
|
+
description: "disallow using unstable value as default param in function component",
|
|
2298
|
+
[Symbol.for("rule_features")]: RULE_FEATURES42
|
|
2130
2299
|
},
|
|
2131
2300
|
messages: {
|
|
2132
2301
|
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 +2356,9 @@ var no_unstable_default_props_default = createRule({
|
|
|
2187
2356
|
defaultOptions: []
|
|
2188
2357
|
});
|
|
2189
2358
|
var RULE_NAME43 = "no-unused-class-component-members";
|
|
2359
|
+
var RULE_FEATURES43 = [
|
|
2360
|
+
"LNT"
|
|
2361
|
+
];
|
|
2190
2362
|
var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
|
|
2191
2363
|
"componentDidCatch",
|
|
2192
2364
|
"componentDidMount",
|
|
@@ -2223,7 +2395,8 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2223
2395
|
meta: {
|
|
2224
2396
|
type: "problem",
|
|
2225
2397
|
docs: {
|
|
2226
|
-
description: "disallow unused class component members"
|
|
2398
|
+
description: "disallow unused class component members",
|
|
2399
|
+
[Symbol.for("rule_features")]: RULE_FEATURES43
|
|
2227
2400
|
},
|
|
2228
2401
|
messages: {
|
|
2229
2402
|
noUnusedClassComponentMembers: "Unused method or property '{{methodName}}'' of class '{{className}}'."
|
|
@@ -2314,6 +2487,9 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2314
2487
|
defaultOptions: []
|
|
2315
2488
|
});
|
|
2316
2489
|
var RULE_NAME44 = "no-unused-state";
|
|
2490
|
+
var RULE_FEATURES44 = [
|
|
2491
|
+
"LNT"
|
|
2492
|
+
];
|
|
2317
2493
|
function getName4(node) {
|
|
2318
2494
|
if (node.type === AST_NODE_TYPES.TSAsExpression) {
|
|
2319
2495
|
return getName4(node.expression);
|
|
@@ -2346,7 +2522,8 @@ var no_unused_state_default = createRule({
|
|
|
2346
2522
|
meta: {
|
|
2347
2523
|
type: "problem",
|
|
2348
2524
|
docs: {
|
|
2349
|
-
description: "disallow unused state of class component"
|
|
2525
|
+
description: "disallow unused state of class component",
|
|
2526
|
+
[Symbol.for("rule_features")]: RULE_FEATURES44
|
|
2350
2527
|
},
|
|
2351
2528
|
messages: {
|
|
2352
2529
|
noUnusedState: "Unused class component state in '{{className}}'"
|
|
@@ -2514,6 +2691,9 @@ var no_useless_fragment_default = createRule({
|
|
|
2514
2691
|
}]
|
|
2515
2692
|
});
|
|
2516
2693
|
var RULE_NAME46 = "prefer-destructuring-assignment";
|
|
2694
|
+
var RULE_FEATURES45 = [
|
|
2695
|
+
"LNT"
|
|
2696
|
+
];
|
|
2517
2697
|
function isMemberExpressionWithObjectName(node) {
|
|
2518
2698
|
return node.object.type === AST_NODE_TYPES.Identifier && "name" in node.object;
|
|
2519
2699
|
}
|
|
@@ -2521,7 +2701,8 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2521
2701
|
meta: {
|
|
2522
2702
|
type: "problem",
|
|
2523
2703
|
docs: {
|
|
2524
|
-
description: "enforce using destructuring assignment in component props and context"
|
|
2704
|
+
description: "enforce using destructuring assignment in component props and context",
|
|
2705
|
+
[Symbol.for("rule_features")]: RULE_FEATURES45
|
|
2525
2706
|
},
|
|
2526
2707
|
messages: {
|
|
2527
2708
|
preferDestructuringAssignment: "Use destructuring assignment for {{name}}."
|
|
@@ -2584,11 +2765,16 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2584
2765
|
defaultOptions: []
|
|
2585
2766
|
});
|
|
2586
2767
|
var RULE_NAME47 = "prefer-react-namespace-import";
|
|
2768
|
+
var RULE_FEATURES46 = [
|
|
2769
|
+
"LNT",
|
|
2770
|
+
"FIX"
|
|
2771
|
+
];
|
|
2587
2772
|
var prefer_react_namespace_import_default = createRule({
|
|
2588
2773
|
meta: {
|
|
2589
2774
|
type: "problem",
|
|
2590
2775
|
docs: {
|
|
2591
|
-
description: "enforce React is imported via a namespace import"
|
|
2776
|
+
description: "enforce React is imported via a namespace import",
|
|
2777
|
+
[Symbol.for("rule_features")]: RULE_FEATURES46
|
|
2592
2778
|
},
|
|
2593
2779
|
fixable: "code",
|
|
2594
2780
|
messages: {
|
|
@@ -2633,6 +2819,10 @@ ${importStringPrefix} ${specifiers} from ${importSourceQuoted}${semiColon}`
|
|
|
2633
2819
|
defaultOptions: []
|
|
2634
2820
|
});
|
|
2635
2821
|
var RULE_NAME48 = "prefer-read-only-props";
|
|
2822
|
+
var RULE_FEATURES47 = [
|
|
2823
|
+
"LNT",
|
|
2824
|
+
"TSC"
|
|
2825
|
+
];
|
|
2636
2826
|
function isReadonlyType(type, services) {
|
|
2637
2827
|
try {
|
|
2638
2828
|
const im = getTypeImmutability(services.program, type);
|
|
@@ -2645,7 +2835,8 @@ var prefer_read_only_props_default = createRule({
|
|
|
2645
2835
|
meta: {
|
|
2646
2836
|
type: "problem",
|
|
2647
2837
|
docs: {
|
|
2648
|
-
description: "enforce read-only props in components"
|
|
2838
|
+
description: "enforce read-only props in components",
|
|
2839
|
+
[Symbol.for("rule_features")]: RULE_FEATURES47
|
|
2649
2840
|
},
|
|
2650
2841
|
messages: {
|
|
2651
2842
|
preferReadOnlyProps: "A function component's props should be read-only."
|
|
@@ -2673,11 +2864,16 @@ var prefer_read_only_props_default = createRule({
|
|
|
2673
2864
|
defaultOptions: []
|
|
2674
2865
|
});
|
|
2675
2866
|
var RULE_NAME49 = "prefer-shorthand-boolean";
|
|
2867
|
+
var RULE_FEATURES48 = [
|
|
2868
|
+
"LNT",
|
|
2869
|
+
"FIX"
|
|
2870
|
+
];
|
|
2676
2871
|
var prefer_shorthand_boolean_default = createRule({
|
|
2677
2872
|
meta: {
|
|
2678
2873
|
type: "problem",
|
|
2679
2874
|
docs: {
|
|
2680
|
-
description: "enforce using shorthand boolean attributes"
|
|
2875
|
+
description: "enforce using shorthand boolean attributes",
|
|
2876
|
+
[Symbol.for("rule_features")]: RULE_FEATURES48
|
|
2681
2877
|
},
|
|
2682
2878
|
fixable: "code",
|
|
2683
2879
|
messages: {
|
|
@@ -2708,11 +2904,16 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
2708
2904
|
defaultOptions: []
|
|
2709
2905
|
});
|
|
2710
2906
|
var RULE_NAME50 = "prefer-shorthand-fragment";
|
|
2907
|
+
var RULE_FEATURES49 = [
|
|
2908
|
+
"LNT"
|
|
2909
|
+
// "FIX",
|
|
2910
|
+
];
|
|
2711
2911
|
var prefer_shorthand_fragment_default = createRule({
|
|
2712
2912
|
meta: {
|
|
2713
2913
|
type: "problem",
|
|
2714
2914
|
docs: {
|
|
2715
|
-
description: "enforce using fragment syntax instead of 'Fragment' component"
|
|
2915
|
+
description: "enforce using fragment syntax instead of 'Fragment' component",
|
|
2916
|
+
[Symbol.for("rule_features")]: RULE_FEATURES49
|
|
2716
2917
|
},
|
|
2717
2918
|
messages: {
|
|
2718
2919
|
preferShorthandFragment: "Use fragment shorthand syntax instead of 'Fragment' component."
|
|
@@ -2738,14 +2939,6 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
2738
2939
|
});
|
|
2739
2940
|
|
|
2740
2941
|
// 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
2942
|
var src_default = {
|
|
2750
2943
|
meta: {
|
|
2751
2944
|
name,
|
|
@@ -2805,8 +2998,7 @@ var src_default = {
|
|
|
2805
2998
|
// Deprecated Rules
|
|
2806
2999
|
/** @deprecated Use `no-complex-conditional-rendering` instead. */
|
|
2807
3000
|
"no-complicated-conditional-rendering": no_complex_conditional_rendering_default
|
|
2808
|
-
}
|
|
2809
|
-
DEFAULT_ESLINT_REACT_SETTINGS
|
|
3001
|
+
}
|
|
2810
3002
|
};
|
|
2811
3003
|
|
|
2812
3004
|
export { src_default as default };
|