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.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.20.0-beta.
|
|
44
|
+
var version = "1.20.0-beta.9";
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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'."
|
|
@@ -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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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
|
+
"LNT"
|
|
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,9 @@ 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
|
+
"LNT"
|
|
823
|
+
];
|
|
755
824
|
function isComponentWillMount(node) {
|
|
756
825
|
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
826
|
}
|
|
@@ -759,7 +828,8 @@ var no_component_will_mount_default = createRule({
|
|
|
759
828
|
meta: {
|
|
760
829
|
type: "problem",
|
|
761
830
|
docs: {
|
|
762
|
-
description: "disallow using 'componentWillMount'"
|
|
831
|
+
description: "disallow using 'componentWillMount'",
|
|
832
|
+
[Symbol.for("rule_features")]: RULE_FEATURES18
|
|
763
833
|
},
|
|
764
834
|
messages: {
|
|
765
835
|
noComponentWillMount: "[Deprecated] Use 'UNSAFE_componentWillMount' instead."
|
|
@@ -791,6 +861,9 @@ var no_component_will_mount_default = createRule({
|
|
|
791
861
|
defaultOptions: []
|
|
792
862
|
});
|
|
793
863
|
var RULE_NAME19 = "no-component-will-receive-props";
|
|
864
|
+
var RULE_FEATURES19 = [
|
|
865
|
+
"LNT"
|
|
866
|
+
];
|
|
794
867
|
function isComponentWillUpdate(node) {
|
|
795
868
|
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
869
|
}
|
|
@@ -798,7 +871,8 @@ var no_component_will_receive_props_default = createRule({
|
|
|
798
871
|
meta: {
|
|
799
872
|
type: "problem",
|
|
800
873
|
docs: {
|
|
801
|
-
description: "disallow using 'componentWillReceiveProps'"
|
|
874
|
+
description: "disallow using 'componentWillReceiveProps'",
|
|
875
|
+
[Symbol.for("rule_features")]: RULE_FEATURES19
|
|
802
876
|
},
|
|
803
877
|
messages: {
|
|
804
878
|
noComponentWillReceiveProps: "[Deprecated] Use 'UNSAFE_componentWillReceiveProps' instead."
|
|
@@ -830,6 +904,9 @@ var no_component_will_receive_props_default = createRule({
|
|
|
830
904
|
defaultOptions: []
|
|
831
905
|
});
|
|
832
906
|
var RULE_NAME20 = "no-component-will-update";
|
|
907
|
+
var RULE_FEATURES20 = [
|
|
908
|
+
"LNT"
|
|
909
|
+
];
|
|
833
910
|
function isComponentWillUpdate2(node) {
|
|
834
911
|
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
912
|
}
|
|
@@ -837,7 +914,8 @@ var no_component_will_update_default = createRule({
|
|
|
837
914
|
meta: {
|
|
838
915
|
type: "problem",
|
|
839
916
|
docs: {
|
|
840
|
-
description: "disallow using 'componentWillReceiveProps'"
|
|
917
|
+
description: "disallow using 'componentWillReceiveProps'",
|
|
918
|
+
[Symbol.for("rule_features")]: RULE_FEATURES20
|
|
841
919
|
},
|
|
842
920
|
messages: {
|
|
843
921
|
noComponentWillUpdate: "[Deprecated] Use 'UNSAFE_componentWillUpdate' instead."
|
|
@@ -869,11 +947,16 @@ var no_component_will_update_default = createRule({
|
|
|
869
947
|
defaultOptions: []
|
|
870
948
|
});
|
|
871
949
|
var RULE_NAME21 = "no-context-provider";
|
|
950
|
+
var RULE_FEATURES21 = [
|
|
951
|
+
"LNT",
|
|
952
|
+
"FIX"
|
|
953
|
+
];
|
|
872
954
|
var no_context_provider_default = createRule({
|
|
873
955
|
meta: {
|
|
874
956
|
type: "problem",
|
|
875
957
|
docs: {
|
|
876
|
-
description: "disallow the use of '<Context.Provider>'"
|
|
958
|
+
description: "disallow the use of '<Context.Provider>'",
|
|
959
|
+
[Symbol.for("rule_features")]: RULE_FEATURES21
|
|
877
960
|
},
|
|
878
961
|
fixable: "code",
|
|
879
962
|
messages: {
|
|
@@ -910,11 +993,15 @@ var no_context_provider_default = createRule({
|
|
|
910
993
|
defaultOptions: []
|
|
911
994
|
});
|
|
912
995
|
var RULE_NAME22 = "no-create-ref";
|
|
996
|
+
var RULE_FEATURES22 = [
|
|
997
|
+
"LNT"
|
|
998
|
+
];
|
|
913
999
|
var no_create_ref_default = createRule({
|
|
914
1000
|
meta: {
|
|
915
1001
|
type: "problem",
|
|
916
1002
|
docs: {
|
|
917
|
-
description: "disallow using 'createRef' in function components"
|
|
1003
|
+
description: "disallow using 'createRef' in function components",
|
|
1004
|
+
[Symbol.for("rule_features")]: RULE_FEATURES22
|
|
918
1005
|
},
|
|
919
1006
|
messages: {
|
|
920
1007
|
noCreateRef: "[Deprecated] Use 'useRef' instead."
|
|
@@ -934,11 +1021,15 @@ var no_create_ref_default = createRule({
|
|
|
934
1021
|
defaultOptions: []
|
|
935
1022
|
});
|
|
936
1023
|
var RULE_NAME23 = "no-default-props";
|
|
1024
|
+
var RULE_FEATURES23 = [
|
|
1025
|
+
"LNT"
|
|
1026
|
+
];
|
|
937
1027
|
var no_default_props_default = createRule({
|
|
938
1028
|
meta: {
|
|
939
1029
|
type: "problem",
|
|
940
1030
|
docs: {
|
|
941
|
-
description: "disallow using 'defaultProps' property in components"
|
|
1031
|
+
description: "disallow using 'defaultProps' property in components",
|
|
1032
|
+
[Symbol.for("rule_features")]: RULE_FEATURES23
|
|
942
1033
|
},
|
|
943
1034
|
messages: {
|
|
944
1035
|
noDefaultProps: "[Deprecated] Use ES6 default parameters instead."
|
|
@@ -973,6 +1064,9 @@ var no_default_props_default = createRule({
|
|
|
973
1064
|
defaultOptions: []
|
|
974
1065
|
});
|
|
975
1066
|
var RULE_NAME24 = "no-direct-mutation-state";
|
|
1067
|
+
var RULE_FEATURES24 = [
|
|
1068
|
+
"LNT"
|
|
1069
|
+
];
|
|
976
1070
|
function getName2(node) {
|
|
977
1071
|
if (node.type === types.AST_NODE_TYPES.TSAsExpression) {
|
|
978
1072
|
return getName2(node.expression);
|
|
@@ -999,7 +1093,8 @@ var no_direct_mutation_state_default = createRule({
|
|
|
999
1093
|
meta: {
|
|
1000
1094
|
type: "problem",
|
|
1001
1095
|
docs: {
|
|
1002
|
-
description: "disallow direct mutation of state"
|
|
1096
|
+
description: "disallow direct mutation of state",
|
|
1097
|
+
[Symbol.for("rule_features")]: RULE_FEATURES24
|
|
1003
1098
|
},
|
|
1004
1099
|
messages: {
|
|
1005
1100
|
noDirectMutationState: "Do not mutate state directly. Use 'setState()' instead."
|
|
@@ -1031,11 +1126,15 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1031
1126
|
defaultOptions: []
|
|
1032
1127
|
});
|
|
1033
1128
|
var RULE_NAME25 = "no-duplicate-key";
|
|
1129
|
+
var RULE_FEATURES25 = [
|
|
1130
|
+
"LNT"
|
|
1131
|
+
];
|
|
1034
1132
|
var no_duplicate_key_default = createRule({
|
|
1035
1133
|
meta: {
|
|
1036
1134
|
type: "problem",
|
|
1037
1135
|
docs: {
|
|
1038
|
-
description: "disallow duplicate keys when rendering list"
|
|
1136
|
+
description: "disallow duplicate keys when rendering list",
|
|
1137
|
+
[Symbol.for("rule_features")]: RULE_FEATURES25
|
|
1039
1138
|
},
|
|
1040
1139
|
messages: {
|
|
1041
1140
|
noDuplicateKey: "A key must be unique. '{{value}}' is duplicated."
|
|
@@ -1160,11 +1259,16 @@ var no_duplicate_key_default = createRule({
|
|
|
1160
1259
|
defaultOptions: []
|
|
1161
1260
|
});
|
|
1162
1261
|
var RULE_NAME26 = "no-forward-ref";
|
|
1262
|
+
var RULE_FEATURES26 = [
|
|
1263
|
+
"LNT",
|
|
1264
|
+
"FIX"
|
|
1265
|
+
];
|
|
1163
1266
|
var no_forward_ref_default = createRule({
|
|
1164
1267
|
meta: {
|
|
1165
1268
|
type: "problem",
|
|
1166
1269
|
docs: {
|
|
1167
|
-
description: "disallow the use of 'forwardRef'"
|
|
1270
|
+
description: "disallow the use of 'forwardRef'",
|
|
1271
|
+
[Symbol.for("rule_features")]: RULE_FEATURES26
|
|
1168
1272
|
},
|
|
1169
1273
|
fixable: "code",
|
|
1170
1274
|
messages: {
|
|
@@ -1252,11 +1356,15 @@ function getComponentPropsFixes(node, typeArguments, fixer, context) {
|
|
|
1252
1356
|
];
|
|
1253
1357
|
}
|
|
1254
1358
|
var RULE_NAME27 = "no-implicit-key";
|
|
1359
|
+
var RULE_FEATURES27 = [
|
|
1360
|
+
"LNT"
|
|
1361
|
+
];
|
|
1255
1362
|
var no_implicit_key_default = createRule({
|
|
1256
1363
|
meta: {
|
|
1257
1364
|
type: "problem",
|
|
1258
1365
|
docs: {
|
|
1259
|
-
description: "disallow implicit 'key' props"
|
|
1366
|
+
description: "disallow implicit 'key' props",
|
|
1367
|
+
[Symbol.for("rule_features")]: RULE_FEATURES27
|
|
1260
1368
|
},
|
|
1261
1369
|
messages: {
|
|
1262
1370
|
noImplicitKey: "Do not use implicit 'key' props."
|
|
@@ -1307,6 +1415,10 @@ function unionTypeParts(type) {
|
|
|
1307
1415
|
return isUnionType(type) ? type.types : [type];
|
|
1308
1416
|
}
|
|
1309
1417
|
var RULE_NAME28 = "no-leaked-conditional-rendering";
|
|
1418
|
+
var RULE_FEATURES28 = [
|
|
1419
|
+
"LNT",
|
|
1420
|
+
"TSC"
|
|
1421
|
+
];
|
|
1310
1422
|
var tsHelpers = {
|
|
1311
1423
|
isAnyType: (type) => isTypeFlagSet(type, ts__default.default.TypeFlags.TypeParameter | ts__default.default.TypeFlags.Any),
|
|
1312
1424
|
isBigIntType: (type) => isTypeFlagSet(type, ts__default.default.TypeFlags.BigIntLike),
|
|
@@ -1403,7 +1515,8 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1403
1515
|
meta: {
|
|
1404
1516
|
type: "problem",
|
|
1405
1517
|
docs: {
|
|
1406
|
-
description: "disallow problematic leaked values from being rendered"
|
|
1518
|
+
description: "disallow problematic leaked values from being rendered",
|
|
1519
|
+
[Symbol.for("rule_features")]: RULE_FEATURES28
|
|
1407
1520
|
},
|
|
1408
1521
|
messages: {
|
|
1409
1522
|
noLeakedConditionalRendering: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes."
|
|
@@ -1468,11 +1581,15 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1468
1581
|
defaultOptions: []
|
|
1469
1582
|
});
|
|
1470
1583
|
var RULE_NAME29 = "no-missing-component-display-name";
|
|
1584
|
+
var RULE_FEATURES29 = [
|
|
1585
|
+
"LNT"
|
|
1586
|
+
];
|
|
1471
1587
|
var no_missing_component_display_name_default = createRule({
|
|
1472
1588
|
meta: {
|
|
1473
1589
|
type: "problem",
|
|
1474
1590
|
docs: {
|
|
1475
|
-
description: "require 'displayName' for 'memo' and 'forwardRef' components"
|
|
1591
|
+
description: "require 'displayName' for 'memo' and 'forwardRef' components",
|
|
1592
|
+
[Symbol.for("rule_features")]: RULE_FEATURES29
|
|
1476
1593
|
},
|
|
1477
1594
|
messages: {
|
|
1478
1595
|
noMissingComponentDisplayName: "Add missing 'displayName' for component."
|
|
@@ -1504,11 +1621,15 @@ var no_missing_component_display_name_default = createRule({
|
|
|
1504
1621
|
defaultOptions: []
|
|
1505
1622
|
});
|
|
1506
1623
|
var RULE_NAME30 = "no-missing-key";
|
|
1624
|
+
var RULE_FEATURES30 = [
|
|
1625
|
+
"LNT"
|
|
1626
|
+
];
|
|
1507
1627
|
var no_missing_key_default = createRule({
|
|
1508
1628
|
meta: {
|
|
1509
1629
|
type: "problem",
|
|
1510
1630
|
docs: {
|
|
1511
|
-
description: "require 'key' when rendering list"
|
|
1631
|
+
description: "require 'key' when rendering list",
|
|
1632
|
+
[Symbol.for("rule_features")]: RULE_FEATURES30
|
|
1512
1633
|
},
|
|
1513
1634
|
messages: {
|
|
1514
1635
|
noMissingKey: "Missing 'key' for element when rendering list.",
|
|
@@ -1621,11 +1742,15 @@ var no_missing_key_default = createRule({
|
|
|
1621
1742
|
defaultOptions: []
|
|
1622
1743
|
});
|
|
1623
1744
|
var RULE_NAME31 = "no-nested-components";
|
|
1745
|
+
var RULE_FEATURES31 = [
|
|
1746
|
+
"LNT"
|
|
1747
|
+
];
|
|
1624
1748
|
var no_nested_components_default = createRule({
|
|
1625
1749
|
meta: {
|
|
1626
1750
|
type: "problem",
|
|
1627
1751
|
docs: {
|
|
1628
|
-
description: "disallow using unstable nested components"
|
|
1752
|
+
description: "disallow using unstable nested components",
|
|
1753
|
+
[Symbol.for("rule_features")]: RULE_FEATURES31
|
|
1629
1754
|
},
|
|
1630
1755
|
messages: {
|
|
1631
1756
|
nestedComponent: "Do not nest components inside other components. Move it to the top level.",
|
|
@@ -1718,11 +1843,15 @@ var no_nested_components_default = createRule({
|
|
|
1718
1843
|
defaultOptions: []
|
|
1719
1844
|
});
|
|
1720
1845
|
var RULE_NAME32 = "no-prop-types";
|
|
1846
|
+
var RULE_FEATURES32 = [
|
|
1847
|
+
"LNT"
|
|
1848
|
+
];
|
|
1721
1849
|
var no_prop_types_default = createRule({
|
|
1722
1850
|
meta: {
|
|
1723
1851
|
type: "problem",
|
|
1724
1852
|
docs: {
|
|
1725
|
-
description: "disallow using 'propTypes' property in components"
|
|
1853
|
+
description: "disallow using 'propTypes' property in components",
|
|
1854
|
+
[Symbol.for("rule_features")]: RULE_FEATURES32
|
|
1726
1855
|
},
|
|
1727
1856
|
messages: {
|
|
1728
1857
|
noPropTypes: "[Deprecated] Use TypeScript or another type-checking solution instead."
|
|
@@ -1757,6 +1886,9 @@ var no_prop_types_default = createRule({
|
|
|
1757
1886
|
defaultOptions: []
|
|
1758
1887
|
});
|
|
1759
1888
|
var RULE_NAME33 = "no-redundant-should-component-update";
|
|
1889
|
+
var RULE_FEATURES33 = [
|
|
1890
|
+
"LNT"
|
|
1891
|
+
];
|
|
1760
1892
|
function isShouldComponentUpdate(node) {
|
|
1761
1893
|
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
1894
|
}
|
|
@@ -1764,7 +1896,8 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1764
1896
|
meta: {
|
|
1765
1897
|
type: "problem",
|
|
1766
1898
|
docs: {
|
|
1767
|
-
description: "disallow using 'shouldComponentUpdate' in class component extends 'React.PureComponent'"
|
|
1899
|
+
description: "disallow using 'shouldComponentUpdate' in class component extends 'React.PureComponent'",
|
|
1900
|
+
[Symbol.for("rule_features")]: RULE_FEATURES33
|
|
1768
1901
|
},
|
|
1769
1902
|
messages: {
|
|
1770
1903
|
noRedundantShouldComponentUpdate: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'."
|
|
@@ -1800,6 +1933,9 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1800
1933
|
defaultOptions: []
|
|
1801
1934
|
});
|
|
1802
1935
|
var RULE_NAME34 = "no-set-state-in-component-did-mount";
|
|
1936
|
+
var RULE_FEATURES34 = [
|
|
1937
|
+
"LNT"
|
|
1938
|
+
];
|
|
1803
1939
|
function isComponentDidMount(node) {
|
|
1804
1940
|
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
1941
|
}
|
|
@@ -1807,7 +1943,8 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
1807
1943
|
meta: {
|
|
1808
1944
|
type: "problem",
|
|
1809
1945
|
docs: {
|
|
1810
|
-
description: "disallow using 'setState' in 'componentDidMount'"
|
|
1946
|
+
description: "disallow using 'setState' in 'componentDidMount'",
|
|
1947
|
+
[Symbol.for("rule_features")]: RULE_FEATURES34
|
|
1811
1948
|
},
|
|
1812
1949
|
messages: {
|
|
1813
1950
|
noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions, such as callbacks."
|
|
@@ -1843,6 +1980,9 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
1843
1980
|
defaultOptions: []
|
|
1844
1981
|
});
|
|
1845
1982
|
var RULE_NAME35 = "no-set-state-in-component-did-update";
|
|
1983
|
+
var RULE_FEATURES35 = [
|
|
1984
|
+
"LNT"
|
|
1985
|
+
];
|
|
1846
1986
|
function isComponentDidUpdate(node) {
|
|
1847
1987
|
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
1988
|
}
|
|
@@ -1850,7 +1990,8 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
1850
1990
|
meta: {
|
|
1851
1991
|
type: "problem",
|
|
1852
1992
|
docs: {
|
|
1853
|
-
description: "disallow using 'setState' in 'componentDidUpdate'"
|
|
1993
|
+
description: "disallow using 'setState' in 'componentDidUpdate'",
|
|
1994
|
+
[Symbol.for("rule_features")]: RULE_FEATURES35
|
|
1854
1995
|
},
|
|
1855
1996
|
messages: {
|
|
1856
1997
|
noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions, such as callbacks."
|
|
@@ -1886,6 +2027,9 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
1886
2027
|
defaultOptions: []
|
|
1887
2028
|
});
|
|
1888
2029
|
var RULE_NAME36 = "no-set-state-in-component-will-update";
|
|
2030
|
+
var RULE_FEATURES36 = [
|
|
2031
|
+
"LNT"
|
|
2032
|
+
];
|
|
1889
2033
|
function isComponentWillUpdate3(node) {
|
|
1890
2034
|
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
2035
|
}
|
|
@@ -1893,7 +2037,8 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
1893
2037
|
meta: {
|
|
1894
2038
|
type: "problem",
|
|
1895
2039
|
docs: {
|
|
1896
|
-
description: "disallow using 'setState' in 'componentWillUpdate'"
|
|
2040
|
+
description: "disallow using 'setState' in 'componentWillUpdate'",
|
|
2041
|
+
[Symbol.for("rule_features")]: RULE_FEATURES36
|
|
1897
2042
|
},
|
|
1898
2043
|
messages: {
|
|
1899
2044
|
noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions, such as callbacks."
|
|
@@ -1929,6 +2074,9 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
1929
2074
|
defaultOptions: []
|
|
1930
2075
|
});
|
|
1931
2076
|
var RULE_NAME37 = "no-string-refs";
|
|
2077
|
+
var RULE_FEATURES37 = [
|
|
2078
|
+
"LNT"
|
|
2079
|
+
];
|
|
1932
2080
|
function containsStringLiteral({ value }) {
|
|
1933
2081
|
return value?.type === types.AST_NODE_TYPES.Literal && tools.isString(value.value);
|
|
1934
2082
|
}
|
|
@@ -1941,7 +2089,8 @@ var no_string_refs_default = createRule({
|
|
|
1941
2089
|
meta: {
|
|
1942
2090
|
type: "problem",
|
|
1943
2091
|
docs: {
|
|
1944
|
-
description: "disallow using deprecated string refs"
|
|
2092
|
+
description: "disallow using deprecated string refs",
|
|
2093
|
+
[Symbol.for("rule_features")]: RULE_FEATURES37
|
|
1945
2094
|
},
|
|
1946
2095
|
messages: {
|
|
1947
2096
|
noStringRefs: "[Deprecated] Use callback refs instead."
|
|
@@ -1965,6 +2114,9 @@ var no_string_refs_default = createRule({
|
|
|
1965
2114
|
defaultOptions: []
|
|
1966
2115
|
});
|
|
1967
2116
|
var RULE_NAME38 = "no-unsafe-component-will-mount";
|
|
2117
|
+
var RULE_FEATURES38 = [
|
|
2118
|
+
"LNT"
|
|
2119
|
+
];
|
|
1968
2120
|
function isUnsafeComponentWillMount(node) {
|
|
1969
2121
|
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
2122
|
}
|
|
@@ -1972,7 +2124,8 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
1972
2124
|
meta: {
|
|
1973
2125
|
type: "problem",
|
|
1974
2126
|
docs: {
|
|
1975
|
-
description: "disallow using 'UNSAFE_componentWillMount'"
|
|
2127
|
+
description: "disallow using 'UNSAFE_componentWillMount'",
|
|
2128
|
+
[Symbol.for("rule_features")]: RULE_FEATURES38
|
|
1976
2129
|
},
|
|
1977
2130
|
messages: {
|
|
1978
2131
|
noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'."
|
|
@@ -2004,6 +2157,9 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
2004
2157
|
defaultOptions: []
|
|
2005
2158
|
});
|
|
2006
2159
|
var RULE_NAME39 = "no-unsafe-component-will-receive-props";
|
|
2160
|
+
var RULE_FEATURES39 = [
|
|
2161
|
+
"LNT"
|
|
2162
|
+
];
|
|
2007
2163
|
function isUnsafeComponentWillReceiveProps(node) {
|
|
2008
2164
|
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
2165
|
}
|
|
@@ -2011,7 +2167,8 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
2011
2167
|
meta: {
|
|
2012
2168
|
type: "problem",
|
|
2013
2169
|
docs: {
|
|
2014
|
-
description: "disallow using 'UNSAFE_componentWillReceiveProps'"
|
|
2170
|
+
description: "disallow using 'UNSAFE_componentWillReceiveProps'",
|
|
2171
|
+
[Symbol.for("rule_features")]: RULE_FEATURES39
|
|
2015
2172
|
},
|
|
2016
2173
|
messages: {
|
|
2017
2174
|
noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'."
|
|
@@ -2043,6 +2200,9 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
2043
2200
|
defaultOptions: []
|
|
2044
2201
|
});
|
|
2045
2202
|
var RULE_NAME40 = "no-unsafe-component-will-update";
|
|
2203
|
+
var RULE_FEATURES40 = [
|
|
2204
|
+
"LNT"
|
|
2205
|
+
];
|
|
2046
2206
|
function isUnsafeComponentWillUpdate(node) {
|
|
2047
2207
|
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
2208
|
}
|
|
@@ -2050,7 +2210,8 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2050
2210
|
meta: {
|
|
2051
2211
|
type: "problem",
|
|
2052
2212
|
docs: {
|
|
2053
|
-
description: "disallow using 'UNSAFE_componentWillUpdate'"
|
|
2213
|
+
description: "disallow using 'UNSAFE_componentWillUpdate'",
|
|
2214
|
+
[Symbol.for("rule_features")]: RULE_FEATURES40
|
|
2054
2215
|
},
|
|
2055
2216
|
messages: {
|
|
2056
2217
|
noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'."
|
|
@@ -2082,11 +2243,15 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2082
2243
|
defaultOptions: []
|
|
2083
2244
|
});
|
|
2084
2245
|
var RULE_NAME41 = "no-unstable-context-value";
|
|
2246
|
+
var RULE_FEATURES41 = [
|
|
2247
|
+
"LNT"
|
|
2248
|
+
];
|
|
2085
2249
|
var no_unstable_context_value_default = createRule({
|
|
2086
2250
|
meta: {
|
|
2087
2251
|
type: "problem",
|
|
2088
2252
|
docs: {
|
|
2089
|
-
description: "disallow passing constructed values to context providers"
|
|
2253
|
+
description: "disallow passing constructed values to context providers",
|
|
2254
|
+
[Symbol.for("rule_features")]: RULE_FEATURES41
|
|
2090
2255
|
},
|
|
2091
2256
|
messages: {
|
|
2092
2257
|
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 +2314,15 @@ var no_unstable_context_value_default = createRule({
|
|
|
2149
2314
|
defaultOptions: []
|
|
2150
2315
|
});
|
|
2151
2316
|
var RULE_NAME42 = "no-unstable-default-props";
|
|
2317
|
+
var RULE_FEATURES42 = [
|
|
2318
|
+
"LNT"
|
|
2319
|
+
];
|
|
2152
2320
|
var no_unstable_default_props_default = createRule({
|
|
2153
2321
|
meta: {
|
|
2154
2322
|
type: "problem",
|
|
2155
2323
|
docs: {
|
|
2156
|
-
description: "disallow using unstable value as default param in function component"
|
|
2324
|
+
description: "disallow using unstable value as default param in function component",
|
|
2325
|
+
[Symbol.for("rule_features")]: RULE_FEATURES42
|
|
2157
2326
|
},
|
|
2158
2327
|
messages: {
|
|
2159
2328
|
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 +2383,9 @@ var no_unstable_default_props_default = createRule({
|
|
|
2214
2383
|
defaultOptions: []
|
|
2215
2384
|
});
|
|
2216
2385
|
var RULE_NAME43 = "no-unused-class-component-members";
|
|
2386
|
+
var RULE_FEATURES43 = [
|
|
2387
|
+
"LNT"
|
|
2388
|
+
];
|
|
2217
2389
|
var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
|
|
2218
2390
|
"componentDidCatch",
|
|
2219
2391
|
"componentDidMount",
|
|
@@ -2250,7 +2422,8 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2250
2422
|
meta: {
|
|
2251
2423
|
type: "problem",
|
|
2252
2424
|
docs: {
|
|
2253
|
-
description: "disallow unused class component members"
|
|
2425
|
+
description: "disallow unused class component members",
|
|
2426
|
+
[Symbol.for("rule_features")]: RULE_FEATURES43
|
|
2254
2427
|
},
|
|
2255
2428
|
messages: {
|
|
2256
2429
|
noUnusedClassComponentMembers: "Unused method or property '{{methodName}}'' of class '{{className}}'."
|
|
@@ -2341,6 +2514,9 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2341
2514
|
defaultOptions: []
|
|
2342
2515
|
});
|
|
2343
2516
|
var RULE_NAME44 = "no-unused-state";
|
|
2517
|
+
var RULE_FEATURES44 = [
|
|
2518
|
+
"LNT"
|
|
2519
|
+
];
|
|
2344
2520
|
function getName4(node) {
|
|
2345
2521
|
if (node.type === types.AST_NODE_TYPES.TSAsExpression) {
|
|
2346
2522
|
return getName4(node.expression);
|
|
@@ -2373,7 +2549,8 @@ var no_unused_state_default = createRule({
|
|
|
2373
2549
|
meta: {
|
|
2374
2550
|
type: "problem",
|
|
2375
2551
|
docs: {
|
|
2376
|
-
description: "disallow unused state of class component"
|
|
2552
|
+
description: "disallow unused state of class component",
|
|
2553
|
+
[Symbol.for("rule_features")]: RULE_FEATURES44
|
|
2377
2554
|
},
|
|
2378
2555
|
messages: {
|
|
2379
2556
|
noUnusedState: "Unused class component state in '{{className}}'"
|
|
@@ -2541,6 +2718,9 @@ var no_useless_fragment_default = createRule({
|
|
|
2541
2718
|
}]
|
|
2542
2719
|
});
|
|
2543
2720
|
var RULE_NAME46 = "prefer-destructuring-assignment";
|
|
2721
|
+
var RULE_FEATURES45 = [
|
|
2722
|
+
"LNT"
|
|
2723
|
+
];
|
|
2544
2724
|
function isMemberExpressionWithObjectName(node) {
|
|
2545
2725
|
return node.object.type === types.AST_NODE_TYPES.Identifier && "name" in node.object;
|
|
2546
2726
|
}
|
|
@@ -2548,7 +2728,8 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2548
2728
|
meta: {
|
|
2549
2729
|
type: "problem",
|
|
2550
2730
|
docs: {
|
|
2551
|
-
description: "enforce using destructuring assignment in component props and context"
|
|
2731
|
+
description: "enforce using destructuring assignment in component props and context",
|
|
2732
|
+
[Symbol.for("rule_features")]: RULE_FEATURES45
|
|
2552
2733
|
},
|
|
2553
2734
|
messages: {
|
|
2554
2735
|
preferDestructuringAssignment: "Use destructuring assignment for {{name}}."
|
|
@@ -2611,11 +2792,16 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
2611
2792
|
defaultOptions: []
|
|
2612
2793
|
});
|
|
2613
2794
|
var RULE_NAME47 = "prefer-react-namespace-import";
|
|
2795
|
+
var RULE_FEATURES46 = [
|
|
2796
|
+
"LNT",
|
|
2797
|
+
"FIX"
|
|
2798
|
+
];
|
|
2614
2799
|
var prefer_react_namespace_import_default = createRule({
|
|
2615
2800
|
meta: {
|
|
2616
2801
|
type: "problem",
|
|
2617
2802
|
docs: {
|
|
2618
|
-
description: "enforce React is imported via a namespace import"
|
|
2803
|
+
description: "enforce React is imported via a namespace import",
|
|
2804
|
+
[Symbol.for("rule_features")]: RULE_FEATURES46
|
|
2619
2805
|
},
|
|
2620
2806
|
fixable: "code",
|
|
2621
2807
|
messages: {
|
|
@@ -2660,6 +2846,10 @@ ${importStringPrefix} ${specifiers} from ${importSourceQuoted}${semiColon}`
|
|
|
2660
2846
|
defaultOptions: []
|
|
2661
2847
|
});
|
|
2662
2848
|
var RULE_NAME48 = "prefer-read-only-props";
|
|
2849
|
+
var RULE_FEATURES47 = [
|
|
2850
|
+
"LNT",
|
|
2851
|
+
"TSC"
|
|
2852
|
+
];
|
|
2663
2853
|
function isReadonlyType(type, services) {
|
|
2664
2854
|
try {
|
|
2665
2855
|
const im = isImmutableType.getTypeImmutability(services.program, type);
|
|
@@ -2672,7 +2862,8 @@ var prefer_read_only_props_default = createRule({
|
|
|
2672
2862
|
meta: {
|
|
2673
2863
|
type: "problem",
|
|
2674
2864
|
docs: {
|
|
2675
|
-
description: "enforce read-only props in components"
|
|
2865
|
+
description: "enforce read-only props in components",
|
|
2866
|
+
[Symbol.for("rule_features")]: RULE_FEATURES47
|
|
2676
2867
|
},
|
|
2677
2868
|
messages: {
|
|
2678
2869
|
preferReadOnlyProps: "A function component's props should be read-only."
|
|
@@ -2700,11 +2891,16 @@ var prefer_read_only_props_default = createRule({
|
|
|
2700
2891
|
defaultOptions: []
|
|
2701
2892
|
});
|
|
2702
2893
|
var RULE_NAME49 = "prefer-shorthand-boolean";
|
|
2894
|
+
var RULE_FEATURES48 = [
|
|
2895
|
+
"LNT",
|
|
2896
|
+
"FIX"
|
|
2897
|
+
];
|
|
2703
2898
|
var prefer_shorthand_boolean_default = createRule({
|
|
2704
2899
|
meta: {
|
|
2705
2900
|
type: "problem",
|
|
2706
2901
|
docs: {
|
|
2707
|
-
description: "enforce using shorthand boolean attributes"
|
|
2902
|
+
description: "enforce using shorthand boolean attributes",
|
|
2903
|
+
[Symbol.for("rule_features")]: RULE_FEATURES48
|
|
2708
2904
|
},
|
|
2709
2905
|
fixable: "code",
|
|
2710
2906
|
messages: {
|
|
@@ -2735,11 +2931,16 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
2735
2931
|
defaultOptions: []
|
|
2736
2932
|
});
|
|
2737
2933
|
var RULE_NAME50 = "prefer-shorthand-fragment";
|
|
2934
|
+
var RULE_FEATURES49 = [
|
|
2935
|
+
"LNT"
|
|
2936
|
+
// "FIX",
|
|
2937
|
+
];
|
|
2738
2938
|
var prefer_shorthand_fragment_default = createRule({
|
|
2739
2939
|
meta: {
|
|
2740
2940
|
type: "problem",
|
|
2741
2941
|
docs: {
|
|
2742
|
-
description: "enforce using fragment syntax instead of 'Fragment' component"
|
|
2942
|
+
description: "enforce using fragment syntax instead of 'Fragment' component",
|
|
2943
|
+
[Symbol.for("rule_features")]: RULE_FEATURES49
|
|
2743
2944
|
},
|
|
2744
2945
|
messages: {
|
|
2745
2946
|
preferShorthandFragment: "Use fragment shorthand syntax instead of 'Fragment' component."
|
|
@@ -2765,14 +2966,6 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
2765
2966
|
});
|
|
2766
2967
|
|
|
2767
2968
|
// 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
2969
|
var src_default = {
|
|
2777
2970
|
meta: {
|
|
2778
2971
|
name,
|
|
@@ -2832,8 +3025,7 @@ var src_default = {
|
|
|
2832
3025
|
// Deprecated Rules
|
|
2833
3026
|
/** @deprecated Use `no-complex-conditional-rendering` instead. */
|
|
2834
3027
|
"no-complicated-conditional-rendering": no_complex_conditional_rendering_default
|
|
2835
|
-
}
|
|
2836
|
-
DEFAULT_ESLINT_REACT_SETTINGS
|
|
3028
|
+
}
|
|
2837
3029
|
};
|
|
2838
3030
|
|
|
2839
3031
|
module.exports = src_default;
|