eslint-plugin-react-x 1.37.1-next.3 → 1.37.1-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +90 -91
- package/dist/index.mjs +90 -91
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -115,7 +115,6 @@ __export(recommended_typescript_exports, {
|
|
|
115
115
|
var name2 = "react-x/recommended-typescript";
|
|
116
116
|
var rules2 = {
|
|
117
117
|
...rules,
|
|
118
|
-
"react-x/dom/no-unknown-property": "off",
|
|
119
118
|
"react-x/no-duplicate-jsx-props": "off",
|
|
120
119
|
"react-x/use-jsx-vars": "off"
|
|
121
120
|
};
|
|
@@ -136,7 +135,7 @@ var settings3 = {
|
|
|
136
135
|
|
|
137
136
|
// package.json
|
|
138
137
|
var name4 = "eslint-plugin-react-x";
|
|
139
|
-
var version = "1.37.1-next.
|
|
138
|
+
var version = "1.37.1-next.5";
|
|
140
139
|
var createRule = shared.createRuleForPlugin("x");
|
|
141
140
|
|
|
142
141
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -146,7 +145,7 @@ var avoid_shorthand_boolean_default = createRule({
|
|
|
146
145
|
meta: {
|
|
147
146
|
type: "problem",
|
|
148
147
|
docs: {
|
|
149
|
-
description: "
|
|
148
|
+
description: "Enforces explicit boolean values for boolean attributes.",
|
|
150
149
|
[Symbol.for("rule_features")]: RULE_FEATURES
|
|
151
150
|
},
|
|
152
151
|
fixable: "code",
|
|
@@ -183,7 +182,7 @@ var avoid_shorthand_fragment_default = createRule({
|
|
|
183
182
|
meta: {
|
|
184
183
|
type: "problem",
|
|
185
184
|
docs: {
|
|
186
|
-
description: "
|
|
185
|
+
description: "Enforces explicit `<Fragment>` components instead of the shorthand `<>` or `</>` syntax.",
|
|
187
186
|
[Symbol.for("rule_features")]: RULE_FEATURES2
|
|
188
187
|
},
|
|
189
188
|
messages: {
|
|
@@ -214,7 +213,7 @@ var no_access_state_in_setstate_default = createRule({
|
|
|
214
213
|
meta: {
|
|
215
214
|
type: "problem",
|
|
216
215
|
docs: {
|
|
217
|
-
description: "
|
|
216
|
+
description: "Disallow accessing `this.state` inside `setState` calls.",
|
|
218
217
|
[Symbol.for("rule_features")]: RULE_FEATURES3
|
|
219
218
|
},
|
|
220
219
|
messages: {
|
|
@@ -401,7 +400,7 @@ var no_array_index_key_default = createRule({
|
|
|
401
400
|
meta: {
|
|
402
401
|
type: "problem",
|
|
403
402
|
docs: {
|
|
404
|
-
description: "
|
|
403
|
+
description: "Disallow an item's index in the array as its key.",
|
|
405
404
|
[Symbol.for("rule_features")]: RULE_FEATURES4
|
|
406
405
|
},
|
|
407
406
|
messages: {
|
|
@@ -517,7 +516,7 @@ var no_children_count_default = createRule({
|
|
|
517
516
|
meta: {
|
|
518
517
|
type: "problem",
|
|
519
518
|
docs: {
|
|
520
|
-
description: "
|
|
519
|
+
description: "Disallow `Children.count`.",
|
|
521
520
|
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
522
521
|
},
|
|
523
522
|
messages: {
|
|
@@ -547,7 +546,7 @@ var no_children_for_each_default = createRule({
|
|
|
547
546
|
meta: {
|
|
548
547
|
type: "problem",
|
|
549
548
|
docs: {
|
|
550
|
-
description: "
|
|
549
|
+
description: "Disallow 'Children.forEach'.",
|
|
551
550
|
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
552
551
|
},
|
|
553
552
|
messages: {
|
|
@@ -577,7 +576,7 @@ var no_children_map_default = createRule({
|
|
|
577
576
|
meta: {
|
|
578
577
|
type: "problem",
|
|
579
578
|
docs: {
|
|
580
|
-
description: "
|
|
579
|
+
description: "Disallow `Children.map`.",
|
|
581
580
|
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
582
581
|
},
|
|
583
582
|
messages: {
|
|
@@ -606,7 +605,7 @@ var no_children_only_default = createRule({
|
|
|
606
605
|
meta: {
|
|
607
606
|
type: "problem",
|
|
608
607
|
docs: {
|
|
609
|
-
description: "
|
|
608
|
+
description: "Disallow `Children.only`.",
|
|
610
609
|
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
611
610
|
},
|
|
612
611
|
messages: {
|
|
@@ -636,7 +635,7 @@ var no_children_prop_default = createRule({
|
|
|
636
635
|
meta: {
|
|
637
636
|
type: "problem",
|
|
638
637
|
docs: {
|
|
639
|
-
description: "
|
|
638
|
+
description: "Disallow passing `children` as a prop.",
|
|
640
639
|
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
641
640
|
},
|
|
642
641
|
messages: {
|
|
@@ -671,7 +670,7 @@ var no_children_to_array_default = createRule({
|
|
|
671
670
|
meta: {
|
|
672
671
|
type: "problem",
|
|
673
672
|
docs: {
|
|
674
|
-
description: "
|
|
673
|
+
description: "Disallow `Children.toArray`.",
|
|
675
674
|
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
676
675
|
},
|
|
677
676
|
messages: {
|
|
@@ -701,7 +700,7 @@ var no_class_component_default = createRule({
|
|
|
701
700
|
meta: {
|
|
702
701
|
type: "problem",
|
|
703
702
|
docs: {
|
|
704
|
-
description: "
|
|
703
|
+
description: "Disallow class components.",
|
|
705
704
|
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
706
705
|
},
|
|
707
706
|
messages: {
|
|
@@ -741,7 +740,7 @@ var no_clone_element_default = createRule({
|
|
|
741
740
|
meta: {
|
|
742
741
|
type: "problem",
|
|
743
742
|
docs: {
|
|
744
|
-
description: "
|
|
743
|
+
description: "Disallow `cloneElement`.",
|
|
745
744
|
[Symbol.for("rule_features")]: RULE_FEATURES12
|
|
746
745
|
},
|
|
747
746
|
messages: {
|
|
@@ -772,7 +771,7 @@ var no_comment_textnodes_default = createRule({
|
|
|
772
771
|
meta: {
|
|
773
772
|
type: "problem",
|
|
774
773
|
docs: {
|
|
775
|
-
description: "
|
|
774
|
+
description: "Prevents comments from being inserted as text nodes.",
|
|
776
775
|
[Symbol.for("rule_features")]: RULE_FEATURES13
|
|
777
776
|
},
|
|
778
777
|
messages: {
|
|
@@ -817,7 +816,7 @@ var no_complex_conditional_rendering_default = createRule({
|
|
|
817
816
|
meta: {
|
|
818
817
|
type: "problem",
|
|
819
818
|
docs: {
|
|
820
|
-
description: "
|
|
819
|
+
description: "Disallow complex conditional rendering in JSX expressions.",
|
|
821
820
|
[Symbol.for("rule_features")]: RULE_FEATURES14
|
|
822
821
|
},
|
|
823
822
|
messages: {
|
|
@@ -865,7 +864,7 @@ var no_component_will_mount_default = createRule({
|
|
|
865
864
|
meta: {
|
|
866
865
|
type: "problem",
|
|
867
866
|
docs: {
|
|
868
|
-
description: "
|
|
867
|
+
description: "Replace usages of `componentWillMount` with `UNSAFE_componentWillMount`.",
|
|
869
868
|
[Symbol.for("rule_features")]: RULE_FEATURES15
|
|
870
869
|
},
|
|
871
870
|
fixable: "code",
|
|
@@ -916,7 +915,7 @@ var no_component_will_receive_props_default = createRule({
|
|
|
916
915
|
meta: {
|
|
917
916
|
type: "problem",
|
|
918
917
|
docs: {
|
|
919
|
-
description: "
|
|
918
|
+
description: "Replace usages of `componentWillReceiveProps` with `UNSAFE_componentWillReceiveProps`.",
|
|
920
919
|
[Symbol.for("rule_features")]: RULE_FEATURES16
|
|
921
920
|
},
|
|
922
921
|
fixable: "code",
|
|
@@ -967,7 +966,7 @@ var no_component_will_update_default = createRule({
|
|
|
967
966
|
meta: {
|
|
968
967
|
type: "problem",
|
|
969
968
|
docs: {
|
|
970
|
-
description: "
|
|
969
|
+
description: "Replace usages of `componentWillUpdate` with `UNSAFE_componentWillUpdate`.",
|
|
971
970
|
[Symbol.for("rule_features")]: RULE_FEATURES17
|
|
972
971
|
},
|
|
973
972
|
fixable: "code",
|
|
@@ -1015,7 +1014,7 @@ var no_context_provider_default = createRule({
|
|
|
1015
1014
|
meta: {
|
|
1016
1015
|
type: "problem",
|
|
1017
1016
|
docs: {
|
|
1018
|
-
description: "
|
|
1017
|
+
description: "Replace usages of `<Context.Provider>` with `<Context>`.",
|
|
1019
1018
|
[Symbol.for("rule_features")]: RULE_FEATURES18
|
|
1020
1019
|
},
|
|
1021
1020
|
fixable: "code",
|
|
@@ -1066,7 +1065,7 @@ var no_create_ref_default = createRule({
|
|
|
1066
1065
|
meta: {
|
|
1067
1066
|
type: "problem",
|
|
1068
1067
|
docs: {
|
|
1069
|
-
description: "
|
|
1068
|
+
description: "Disallow `createRef` in function components.",
|
|
1070
1069
|
[Symbol.for("rule_features")]: RULE_FEATURES19
|
|
1071
1070
|
},
|
|
1072
1071
|
messages: {
|
|
@@ -1093,7 +1092,7 @@ var no_default_props_default = createRule({
|
|
|
1093
1092
|
meta: {
|
|
1094
1093
|
type: "problem",
|
|
1095
1094
|
docs: {
|
|
1096
|
-
description: "
|
|
1095
|
+
description: "Disallow `defaultProps` property in favor of ES6 default parameters.",
|
|
1097
1096
|
[Symbol.for("rule_features")]: RULE_FEATURES20
|
|
1098
1097
|
},
|
|
1099
1098
|
messages: {
|
|
@@ -1148,7 +1147,7 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1148
1147
|
meta: {
|
|
1149
1148
|
type: "problem",
|
|
1150
1149
|
docs: {
|
|
1151
|
-
description: "
|
|
1150
|
+
description: "Disallow direct mutation of `this.state`.",
|
|
1152
1151
|
[Symbol.for("rule_features")]: RULE_FEATURES21
|
|
1153
1152
|
},
|
|
1154
1153
|
messages: {
|
|
@@ -1187,7 +1186,7 @@ var no_duplicate_jsx_props_default = createRule({
|
|
|
1187
1186
|
meta: {
|
|
1188
1187
|
type: "problem",
|
|
1189
1188
|
docs: {
|
|
1190
|
-
description: "
|
|
1189
|
+
description: "Disallow duplicate props in JSX elements.",
|
|
1191
1190
|
[Symbol.for("rule_features")]: RULE_FEATURES22
|
|
1192
1191
|
},
|
|
1193
1192
|
messages: {
|
|
@@ -1229,7 +1228,7 @@ var no_duplicate_key_default = createRule({
|
|
|
1229
1228
|
meta: {
|
|
1230
1229
|
type: "problem",
|
|
1231
1230
|
docs: {
|
|
1232
|
-
description: "
|
|
1231
|
+
description: "Disallow duplicate `key` on elements in the same array or a list of `children`.",
|
|
1233
1232
|
[Symbol.for("rule_features")]: RULE_FEATURES23
|
|
1234
1233
|
},
|
|
1235
1234
|
messages: {
|
|
@@ -1313,7 +1312,7 @@ var no_forward_ref_default = createRule({
|
|
|
1313
1312
|
meta: {
|
|
1314
1313
|
type: "problem",
|
|
1315
1314
|
docs: {
|
|
1316
|
-
description: "
|
|
1315
|
+
description: "Replaces usages of `forwardRef` with passing `ref` as a prop.",
|
|
1317
1316
|
[Symbol.for("rule_features")]: RULE_FEATURES24
|
|
1318
1317
|
},
|
|
1319
1318
|
fixable: "code",
|
|
@@ -1420,7 +1419,7 @@ var no_implicit_key_default = createRule({
|
|
|
1420
1419
|
meta: {
|
|
1421
1420
|
type: "problem",
|
|
1422
1421
|
docs: {
|
|
1423
|
-
description: "
|
|
1422
|
+
description: "Prevents `key` from not being explicitly specified (e.g. spreading `key` from objects).",
|
|
1424
1423
|
[Symbol.for("rule_features")]: RULE_FEATURES25
|
|
1425
1424
|
},
|
|
1426
1425
|
messages: {
|
|
@@ -1532,7 +1531,7 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1532
1531
|
meta: {
|
|
1533
1532
|
type: "problem",
|
|
1534
1533
|
docs: {
|
|
1535
|
-
description: "
|
|
1534
|
+
description: "Prevents problematic leaked values from being rendered.",
|
|
1536
1535
|
[Symbol.for("rule_features")]: RULE_FEATURES26
|
|
1537
1536
|
},
|
|
1538
1537
|
messages: {
|
|
@@ -1607,7 +1606,7 @@ var no_missing_component_display_name_default = createRule({
|
|
|
1607
1606
|
meta: {
|
|
1608
1607
|
type: "problem",
|
|
1609
1608
|
docs: {
|
|
1610
|
-
description: "
|
|
1609
|
+
description: "Enforces that all components have a `displayName` which can be used in devtools.",
|
|
1611
1610
|
[Symbol.for("rule_features")]: RULE_FEATURES27
|
|
1612
1611
|
},
|
|
1613
1612
|
messages: {
|
|
@@ -1660,7 +1659,7 @@ var no_missing_context_display_name_default = createRule({
|
|
|
1660
1659
|
meta: {
|
|
1661
1660
|
type: "problem",
|
|
1662
1661
|
docs: {
|
|
1663
|
-
description: "
|
|
1662
|
+
description: "Enforces that all contexts have a `displayName` which can be used in devtools.",
|
|
1664
1663
|
[Symbol.for("rule_features")]: RULE_FEATURES28
|
|
1665
1664
|
},
|
|
1666
1665
|
messages: {
|
|
@@ -1716,7 +1715,7 @@ var no_missing_key_default = createRule({
|
|
|
1716
1715
|
meta: {
|
|
1717
1716
|
type: "problem",
|
|
1718
1717
|
docs: {
|
|
1719
|
-
description: "
|
|
1718
|
+
description: "Disallow missing `key` on items in list rendering.",
|
|
1720
1719
|
[Symbol.for("rule_features")]: RULE_FEATURES29
|
|
1721
1720
|
},
|
|
1722
1721
|
messages: {
|
|
@@ -1848,7 +1847,7 @@ var no_nested_component_definitions_default = createRule({
|
|
|
1848
1847
|
meta: {
|
|
1849
1848
|
type: "problem",
|
|
1850
1849
|
docs: {
|
|
1851
|
-
description: "
|
|
1850
|
+
description: "Disallow nesting component definitions inside other components.",
|
|
1852
1851
|
[Symbol.for("rule_features")]: RULE_FEATURES30
|
|
1853
1852
|
},
|
|
1854
1853
|
messages: {
|
|
@@ -1958,7 +1957,7 @@ var no_prop_types_default = createRule({
|
|
|
1958
1957
|
meta: {
|
|
1959
1958
|
type: "problem",
|
|
1960
1959
|
docs: {
|
|
1961
|
-
description: "
|
|
1960
|
+
description: "Disallow `propTypes` in favor of TypeScript or another type-checking solution.",
|
|
1962
1961
|
[Symbol.for("rule_features")]: RULE_FEATURES31
|
|
1963
1962
|
},
|
|
1964
1963
|
messages: {
|
|
@@ -2015,7 +2014,7 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
2015
2014
|
meta: {
|
|
2016
2015
|
type: "problem",
|
|
2017
2016
|
docs: {
|
|
2018
|
-
description: "
|
|
2017
|
+
description: "Disallow `shouldComponentUpdate` when extending `React.PureComponent`.",
|
|
2019
2018
|
[Symbol.for("rule_features")]: RULE_FEATURES32
|
|
2020
2019
|
},
|
|
2021
2020
|
messages: {
|
|
@@ -2063,7 +2062,7 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
2063
2062
|
meta: {
|
|
2064
2063
|
type: "problem",
|
|
2065
2064
|
docs: {
|
|
2066
|
-
description: "
|
|
2065
|
+
description: "Disallow calling `this.setState` in `componentDidMount` outside of functions, such as callbacks.",
|
|
2067
2066
|
[Symbol.for("rule_features")]: RULE_FEATURES33
|
|
2068
2067
|
},
|
|
2069
2068
|
messages: {
|
|
@@ -2105,7 +2104,7 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
2105
2104
|
meta: {
|
|
2106
2105
|
type: "problem",
|
|
2107
2106
|
docs: {
|
|
2108
|
-
description: "
|
|
2107
|
+
description: "Disallows calling `this.setState` in `componentDidUpdate` outside of functions, such as callbacks.",
|
|
2109
2108
|
[Symbol.for("rule_features")]: RULE_FEATURES34
|
|
2110
2109
|
},
|
|
2111
2110
|
messages: {
|
|
@@ -2147,7 +2146,7 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
2147
2146
|
meta: {
|
|
2148
2147
|
type: "problem",
|
|
2149
2148
|
docs: {
|
|
2150
|
-
description: "
|
|
2149
|
+
description: "Disallows calling `this.setState` in `componentWillUpdate` outside of functions, such as callbacks.",
|
|
2151
2150
|
[Symbol.for("rule_features")]: RULE_FEATURES35
|
|
2152
2151
|
},
|
|
2153
2152
|
messages: {
|
|
@@ -2198,7 +2197,7 @@ var no_string_refs_default = createRule({
|
|
|
2198
2197
|
meta: {
|
|
2199
2198
|
type: "problem",
|
|
2200
2199
|
docs: {
|
|
2201
|
-
description: "
|
|
2200
|
+
description: "Disallow deprecated string `refs`.",
|
|
2202
2201
|
[Symbol.for("rule_features")]: RULE_FEATURES36
|
|
2203
2202
|
},
|
|
2204
2203
|
messages: {
|
|
@@ -2234,7 +2233,7 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
2234
2233
|
meta: {
|
|
2235
2234
|
type: "problem",
|
|
2236
2235
|
docs: {
|
|
2237
|
-
description: "
|
|
2236
|
+
description: "Warns the usage of `UNSAFE_componentWillMount` in class components.",
|
|
2238
2237
|
[Symbol.for("rule_features")]: RULE_FEATURES37
|
|
2239
2238
|
},
|
|
2240
2239
|
messages: {
|
|
@@ -2276,7 +2275,7 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
2276
2275
|
meta: {
|
|
2277
2276
|
type: "problem",
|
|
2278
2277
|
docs: {
|
|
2279
|
-
description: "
|
|
2278
|
+
description: "Warns the usage of `UNSAFE_componentWillReceiveProps` in class components.",
|
|
2280
2279
|
[Symbol.for("rule_features")]: RULE_FEATURES38
|
|
2281
2280
|
},
|
|
2282
2281
|
messages: {
|
|
@@ -2320,7 +2319,7 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2320
2319
|
meta: {
|
|
2321
2320
|
type: "problem",
|
|
2322
2321
|
docs: {
|
|
2323
|
-
description: "
|
|
2322
|
+
description: "Warns the usage of `UNSAFE_componentWillUpdate` in class components.",
|
|
2324
2323
|
[Symbol.for("rule_features")]: RULE_FEATURES39
|
|
2325
2324
|
},
|
|
2326
2325
|
messages: {
|
|
@@ -2359,7 +2358,7 @@ var no_unstable_context_value_default = createRule({
|
|
|
2359
2358
|
meta: {
|
|
2360
2359
|
type: "problem",
|
|
2361
2360
|
docs: {
|
|
2362
|
-
description: "
|
|
2361
|
+
description: "Prevents non-stable values (i.e. object literals) from being used as a value for `Context.Provider`.",
|
|
2363
2362
|
[Symbol.for("rule_features")]: RULE_FEATURES40
|
|
2364
2363
|
},
|
|
2365
2364
|
messages: {
|
|
@@ -2432,7 +2431,7 @@ var no_unstable_default_props_default = createRule({
|
|
|
2432
2431
|
meta: {
|
|
2433
2432
|
type: "problem",
|
|
2434
2433
|
docs: {
|
|
2435
|
-
description: "
|
|
2434
|
+
description: "Prevents using referential-type values as default props in object destructuring.",
|
|
2436
2435
|
[Symbol.for("rule_features")]: RULE_FEATURES41
|
|
2437
2436
|
},
|
|
2438
2437
|
messages: {
|
|
@@ -2526,7 +2525,7 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2526
2525
|
meta: {
|
|
2527
2526
|
type: "problem",
|
|
2528
2527
|
docs: {
|
|
2529
|
-
description: "
|
|
2528
|
+
description: "Warns unused class component methods and properties.",
|
|
2530
2529
|
[Symbol.for("rule_features")]: RULE_FEATURES42
|
|
2531
2530
|
},
|
|
2532
2531
|
messages: {
|
|
@@ -2657,7 +2656,7 @@ var no_unused_state_default = createRule({
|
|
|
2657
2656
|
meta: {
|
|
2658
2657
|
type: "problem",
|
|
2659
2658
|
docs: {
|
|
2660
|
-
description: "
|
|
2659
|
+
description: "Warns unused class component state.",
|
|
2661
2660
|
[Symbol.for("rule_features")]: RULE_FEATURES43
|
|
2662
2661
|
},
|
|
2663
2662
|
messages: {
|
|
@@ -2811,7 +2810,7 @@ var no_use_context_default = createRule({
|
|
|
2811
2810
|
meta: {
|
|
2812
2811
|
type: "problem",
|
|
2813
2812
|
docs: {
|
|
2814
|
-
description: "
|
|
2813
|
+
description: "Replaces usages of `useContext` with `use`.",
|
|
2815
2814
|
[Symbol.for("rule_features")]: RULE_FEATURES44
|
|
2816
2815
|
},
|
|
2817
2816
|
fixable: "code",
|
|
@@ -2908,7 +2907,7 @@ var no_useless_forward_ref_default = createRule({
|
|
|
2908
2907
|
meta: {
|
|
2909
2908
|
type: "problem",
|
|
2910
2909
|
docs: {
|
|
2911
|
-
description: "
|
|
2910
|
+
description: "Disallow useless `forwardRef` calls on components that don't use `ref`s.",
|
|
2912
2911
|
[Symbol.for("rule_features")]: RULE_FEATURES45
|
|
2913
2912
|
},
|
|
2914
2913
|
messages: {
|
|
@@ -2945,6 +2944,44 @@ var RULE_NAME46 = "no-useless-fragment";
|
|
|
2945
2944
|
var defaultOptions = [{
|
|
2946
2945
|
allowExpressions: true
|
|
2947
2946
|
}];
|
|
2947
|
+
var no_useless_fragment_default = createRule({
|
|
2948
|
+
meta: {
|
|
2949
|
+
type: "problem",
|
|
2950
|
+
defaultOptions: [...defaultOptions],
|
|
2951
|
+
docs: {
|
|
2952
|
+
description: "Disallow useless fragment elements."
|
|
2953
|
+
},
|
|
2954
|
+
fixable: "code",
|
|
2955
|
+
messages: {
|
|
2956
|
+
uselessFragment: "A fragment {{reason}} is useless."
|
|
2957
|
+
},
|
|
2958
|
+
schema: [{
|
|
2959
|
+
type: "object",
|
|
2960
|
+
additionalProperties: false,
|
|
2961
|
+
properties: {
|
|
2962
|
+
allowExpressions: {
|
|
2963
|
+
type: "boolean",
|
|
2964
|
+
description: "Allow fragments with a single expression child"
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
}]
|
|
2968
|
+
},
|
|
2969
|
+
name: RULE_NAME46,
|
|
2970
|
+
create: create44,
|
|
2971
|
+
defaultOptions
|
|
2972
|
+
});
|
|
2973
|
+
function create44(context, [option]) {
|
|
2974
|
+
const { allowExpressions = true } = option;
|
|
2975
|
+
return {
|
|
2976
|
+
JSXElement(node) {
|
|
2977
|
+
if (!JSX8__namespace.isFragmentElement(node)) return;
|
|
2978
|
+
doCheck(context, node, allowExpressions);
|
|
2979
|
+
},
|
|
2980
|
+
JSXFragment(node) {
|
|
2981
|
+
doCheck(context, node, allowExpressions);
|
|
2982
|
+
}
|
|
2983
|
+
};
|
|
2984
|
+
}
|
|
2948
2985
|
function trimLikeReact(text) {
|
|
2949
2986
|
const leadingSpaces = /^\s*/.exec(text)?.[0] ?? "";
|
|
2950
2987
|
const trailingSpaces = /\s*$/.exec(text)?.[0] ?? "";
|
|
@@ -3045,44 +3082,6 @@ function doCheck(context, node, allowExpressions) {
|
|
|
3045
3082
|
}
|
|
3046
3083
|
return;
|
|
3047
3084
|
}
|
|
3048
|
-
var no_useless_fragment_default = createRule({
|
|
3049
|
-
meta: {
|
|
3050
|
-
type: "problem",
|
|
3051
|
-
defaultOptions: [...defaultOptions],
|
|
3052
|
-
docs: {
|
|
3053
|
-
description: "disallow useless fragments"
|
|
3054
|
-
},
|
|
3055
|
-
fixable: "code",
|
|
3056
|
-
messages: {
|
|
3057
|
-
uselessFragment: "A fragment {{reason}} is useless."
|
|
3058
|
-
},
|
|
3059
|
-
schema: [{
|
|
3060
|
-
type: "object",
|
|
3061
|
-
additionalProperties: false,
|
|
3062
|
-
properties: {
|
|
3063
|
-
allowExpressions: {
|
|
3064
|
-
type: "boolean",
|
|
3065
|
-
description: "Allow fragments with a single expression child"
|
|
3066
|
-
}
|
|
3067
|
-
}
|
|
3068
|
-
}]
|
|
3069
|
-
},
|
|
3070
|
-
name: RULE_NAME46,
|
|
3071
|
-
create: create44,
|
|
3072
|
-
defaultOptions
|
|
3073
|
-
});
|
|
3074
|
-
function create44(context, [option]) {
|
|
3075
|
-
const { allowExpressions = true } = option;
|
|
3076
|
-
return {
|
|
3077
|
-
JSXElement(node) {
|
|
3078
|
-
if (!JSX8__namespace.isFragmentElement(node)) return;
|
|
3079
|
-
doCheck(context, node, allowExpressions);
|
|
3080
|
-
},
|
|
3081
|
-
JSXFragment(node) {
|
|
3082
|
-
doCheck(context, node, allowExpressions);
|
|
3083
|
-
}
|
|
3084
|
-
};
|
|
3085
|
-
}
|
|
3086
3085
|
var RULE_NAME47 = "prefer-destructuring-assignment";
|
|
3087
3086
|
var RULE_FEATURES46 = [];
|
|
3088
3087
|
function isMemberExpressionWithObjectName(node) {
|
|
@@ -3092,7 +3091,7 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
3092
3091
|
meta: {
|
|
3093
3092
|
type: "problem",
|
|
3094
3093
|
docs: {
|
|
3095
|
-
description: "
|
|
3094
|
+
description: "Enforces destructuring assignment for component props and context.",
|
|
3096
3095
|
[Symbol.for("rule_features")]: RULE_FEATURES46
|
|
3097
3096
|
},
|
|
3098
3097
|
messages: {
|
|
@@ -3172,7 +3171,7 @@ var prefer_react_namespace_import_default = createRule({
|
|
|
3172
3171
|
meta: {
|
|
3173
3172
|
type: "problem",
|
|
3174
3173
|
docs: {
|
|
3175
|
-
description: "
|
|
3174
|
+
description: "Enforces React is imported via a namespace import.",
|
|
3176
3175
|
[Symbol.for("rule_features")]: RULE_FEATURES47
|
|
3177
3176
|
},
|
|
3178
3177
|
fixable: "code",
|
|
@@ -3226,7 +3225,7 @@ var prefer_read_only_props_default = createRule({
|
|
|
3226
3225
|
meta: {
|
|
3227
3226
|
type: "problem",
|
|
3228
3227
|
docs: {
|
|
3229
|
-
description: "
|
|
3228
|
+
description: "Enforces read-only props in components.",
|
|
3230
3229
|
[Symbol.for("rule_features")]: RULE_FEATURES48
|
|
3231
3230
|
},
|
|
3232
3231
|
messages: {
|
|
@@ -3267,7 +3266,7 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
3267
3266
|
meta: {
|
|
3268
3267
|
type: "problem",
|
|
3269
3268
|
docs: {
|
|
3270
|
-
description: "
|
|
3269
|
+
description: "Enforces shorthand syntax for boolean attributes.",
|
|
3271
3270
|
[Symbol.for("rule_features")]: RULE_FEATURES49
|
|
3272
3271
|
},
|
|
3273
3272
|
fixable: "code",
|
|
@@ -3308,7 +3307,7 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
3308
3307
|
meta: {
|
|
3309
3308
|
type: "problem",
|
|
3310
3309
|
docs: {
|
|
3311
|
-
description: "
|
|
3310
|
+
description: "Enforces shorthand syntax for fragments.",
|
|
3312
3311
|
[Symbol.for("rule_features")]: RULE_FEATURES50
|
|
3313
3312
|
},
|
|
3314
3313
|
fixable: "code",
|
|
@@ -3352,7 +3351,7 @@ var use_jsx_vars_default = createRule({
|
|
|
3352
3351
|
meta: {
|
|
3353
3352
|
type: "problem",
|
|
3354
3353
|
docs: {
|
|
3355
|
-
description: "
|
|
3354
|
+
description: "Marks variables used in JSX as used.",
|
|
3356
3355
|
[Symbol.for("rule_features")]: RULE_FEATURES51
|
|
3357
3356
|
},
|
|
3358
3357
|
messages: {
|
package/dist/index.mjs
CHANGED
|
@@ -88,7 +88,6 @@ __export(recommended_typescript_exports, {
|
|
|
88
88
|
var name2 = "react-x/recommended-typescript";
|
|
89
89
|
var rules2 = {
|
|
90
90
|
...rules,
|
|
91
|
-
"react-x/dom/no-unknown-property": "off",
|
|
92
91
|
"react-x/no-duplicate-jsx-props": "off",
|
|
93
92
|
"react-x/use-jsx-vars": "off"
|
|
94
93
|
};
|
|
@@ -109,7 +108,7 @@ var settings3 = {
|
|
|
109
108
|
|
|
110
109
|
// package.json
|
|
111
110
|
var name4 = "eslint-plugin-react-x";
|
|
112
|
-
var version = "1.37.1-next.
|
|
111
|
+
var version = "1.37.1-next.5";
|
|
113
112
|
var createRule = createRuleForPlugin("x");
|
|
114
113
|
|
|
115
114
|
// src/rules/avoid-shorthand-boolean.ts
|
|
@@ -119,7 +118,7 @@ var avoid_shorthand_boolean_default = createRule({
|
|
|
119
118
|
meta: {
|
|
120
119
|
type: "problem",
|
|
121
120
|
docs: {
|
|
122
|
-
description: "
|
|
121
|
+
description: "Enforces explicit boolean values for boolean attributes.",
|
|
123
122
|
[Symbol.for("rule_features")]: RULE_FEATURES
|
|
124
123
|
},
|
|
125
124
|
fixable: "code",
|
|
@@ -156,7 +155,7 @@ var avoid_shorthand_fragment_default = createRule({
|
|
|
156
155
|
meta: {
|
|
157
156
|
type: "problem",
|
|
158
157
|
docs: {
|
|
159
|
-
description: "
|
|
158
|
+
description: "Enforces explicit `<Fragment>` components instead of the shorthand `<>` or `</>` syntax.",
|
|
160
159
|
[Symbol.for("rule_features")]: RULE_FEATURES2
|
|
161
160
|
},
|
|
162
161
|
messages: {
|
|
@@ -187,7 +186,7 @@ var no_access_state_in_setstate_default = createRule({
|
|
|
187
186
|
meta: {
|
|
188
187
|
type: "problem",
|
|
189
188
|
docs: {
|
|
190
|
-
description: "
|
|
189
|
+
description: "Disallow accessing `this.state` inside `setState` calls.",
|
|
191
190
|
[Symbol.for("rule_features")]: RULE_FEATURES3
|
|
192
191
|
},
|
|
193
192
|
messages: {
|
|
@@ -374,7 +373,7 @@ var no_array_index_key_default = createRule({
|
|
|
374
373
|
meta: {
|
|
375
374
|
type: "problem",
|
|
376
375
|
docs: {
|
|
377
|
-
description: "
|
|
376
|
+
description: "Disallow an item's index in the array as its key.",
|
|
378
377
|
[Symbol.for("rule_features")]: RULE_FEATURES4
|
|
379
378
|
},
|
|
380
379
|
messages: {
|
|
@@ -490,7 +489,7 @@ var no_children_count_default = createRule({
|
|
|
490
489
|
meta: {
|
|
491
490
|
type: "problem",
|
|
492
491
|
docs: {
|
|
493
|
-
description: "
|
|
492
|
+
description: "Disallow `Children.count`.",
|
|
494
493
|
[Symbol.for("rule_features")]: RULE_FEATURES5
|
|
495
494
|
},
|
|
496
495
|
messages: {
|
|
@@ -520,7 +519,7 @@ var no_children_for_each_default = createRule({
|
|
|
520
519
|
meta: {
|
|
521
520
|
type: "problem",
|
|
522
521
|
docs: {
|
|
523
|
-
description: "
|
|
522
|
+
description: "Disallow 'Children.forEach'.",
|
|
524
523
|
[Symbol.for("rule_features")]: RULE_FEATURES6
|
|
525
524
|
},
|
|
526
525
|
messages: {
|
|
@@ -550,7 +549,7 @@ var no_children_map_default = createRule({
|
|
|
550
549
|
meta: {
|
|
551
550
|
type: "problem",
|
|
552
551
|
docs: {
|
|
553
|
-
description: "
|
|
552
|
+
description: "Disallow `Children.map`.",
|
|
554
553
|
[Symbol.for("rule_features")]: RULE_FEATURES7
|
|
555
554
|
},
|
|
556
555
|
messages: {
|
|
@@ -579,7 +578,7 @@ var no_children_only_default = createRule({
|
|
|
579
578
|
meta: {
|
|
580
579
|
type: "problem",
|
|
581
580
|
docs: {
|
|
582
|
-
description: "
|
|
581
|
+
description: "Disallow `Children.only`.",
|
|
583
582
|
[Symbol.for("rule_features")]: RULE_FEATURES8
|
|
584
583
|
},
|
|
585
584
|
messages: {
|
|
@@ -609,7 +608,7 @@ var no_children_prop_default = createRule({
|
|
|
609
608
|
meta: {
|
|
610
609
|
type: "problem",
|
|
611
610
|
docs: {
|
|
612
|
-
description: "
|
|
611
|
+
description: "Disallow passing `children` as a prop.",
|
|
613
612
|
[Symbol.for("rule_features")]: RULE_FEATURES9
|
|
614
613
|
},
|
|
615
614
|
messages: {
|
|
@@ -644,7 +643,7 @@ var no_children_to_array_default = createRule({
|
|
|
644
643
|
meta: {
|
|
645
644
|
type: "problem",
|
|
646
645
|
docs: {
|
|
647
|
-
description: "
|
|
646
|
+
description: "Disallow `Children.toArray`.",
|
|
648
647
|
[Symbol.for("rule_features")]: RULE_FEATURES10
|
|
649
648
|
},
|
|
650
649
|
messages: {
|
|
@@ -674,7 +673,7 @@ var no_class_component_default = createRule({
|
|
|
674
673
|
meta: {
|
|
675
674
|
type: "problem",
|
|
676
675
|
docs: {
|
|
677
|
-
description: "
|
|
676
|
+
description: "Disallow class components.",
|
|
678
677
|
[Symbol.for("rule_features")]: RULE_FEATURES11
|
|
679
678
|
},
|
|
680
679
|
messages: {
|
|
@@ -714,7 +713,7 @@ var no_clone_element_default = createRule({
|
|
|
714
713
|
meta: {
|
|
715
714
|
type: "problem",
|
|
716
715
|
docs: {
|
|
717
|
-
description: "
|
|
716
|
+
description: "Disallow `cloneElement`.",
|
|
718
717
|
[Symbol.for("rule_features")]: RULE_FEATURES12
|
|
719
718
|
},
|
|
720
719
|
messages: {
|
|
@@ -745,7 +744,7 @@ var no_comment_textnodes_default = createRule({
|
|
|
745
744
|
meta: {
|
|
746
745
|
type: "problem",
|
|
747
746
|
docs: {
|
|
748
|
-
description: "
|
|
747
|
+
description: "Prevents comments from being inserted as text nodes.",
|
|
749
748
|
[Symbol.for("rule_features")]: RULE_FEATURES13
|
|
750
749
|
},
|
|
751
750
|
messages: {
|
|
@@ -790,7 +789,7 @@ var no_complex_conditional_rendering_default = createRule({
|
|
|
790
789
|
meta: {
|
|
791
790
|
type: "problem",
|
|
792
791
|
docs: {
|
|
793
|
-
description: "
|
|
792
|
+
description: "Disallow complex conditional rendering in JSX expressions.",
|
|
794
793
|
[Symbol.for("rule_features")]: RULE_FEATURES14
|
|
795
794
|
},
|
|
796
795
|
messages: {
|
|
@@ -838,7 +837,7 @@ var no_component_will_mount_default = createRule({
|
|
|
838
837
|
meta: {
|
|
839
838
|
type: "problem",
|
|
840
839
|
docs: {
|
|
841
|
-
description: "
|
|
840
|
+
description: "Replace usages of `componentWillMount` with `UNSAFE_componentWillMount`.",
|
|
842
841
|
[Symbol.for("rule_features")]: RULE_FEATURES15
|
|
843
842
|
},
|
|
844
843
|
fixable: "code",
|
|
@@ -889,7 +888,7 @@ var no_component_will_receive_props_default = createRule({
|
|
|
889
888
|
meta: {
|
|
890
889
|
type: "problem",
|
|
891
890
|
docs: {
|
|
892
|
-
description: "
|
|
891
|
+
description: "Replace usages of `componentWillReceiveProps` with `UNSAFE_componentWillReceiveProps`.",
|
|
893
892
|
[Symbol.for("rule_features")]: RULE_FEATURES16
|
|
894
893
|
},
|
|
895
894
|
fixable: "code",
|
|
@@ -940,7 +939,7 @@ var no_component_will_update_default = createRule({
|
|
|
940
939
|
meta: {
|
|
941
940
|
type: "problem",
|
|
942
941
|
docs: {
|
|
943
|
-
description: "
|
|
942
|
+
description: "Replace usages of `componentWillUpdate` with `UNSAFE_componentWillUpdate`.",
|
|
944
943
|
[Symbol.for("rule_features")]: RULE_FEATURES17
|
|
945
944
|
},
|
|
946
945
|
fixable: "code",
|
|
@@ -988,7 +987,7 @@ var no_context_provider_default = createRule({
|
|
|
988
987
|
meta: {
|
|
989
988
|
type: "problem",
|
|
990
989
|
docs: {
|
|
991
|
-
description: "
|
|
990
|
+
description: "Replace usages of `<Context.Provider>` with `<Context>`.",
|
|
992
991
|
[Symbol.for("rule_features")]: RULE_FEATURES18
|
|
993
992
|
},
|
|
994
993
|
fixable: "code",
|
|
@@ -1039,7 +1038,7 @@ var no_create_ref_default = createRule({
|
|
|
1039
1038
|
meta: {
|
|
1040
1039
|
type: "problem",
|
|
1041
1040
|
docs: {
|
|
1042
|
-
description: "
|
|
1041
|
+
description: "Disallow `createRef` in function components.",
|
|
1043
1042
|
[Symbol.for("rule_features")]: RULE_FEATURES19
|
|
1044
1043
|
},
|
|
1045
1044
|
messages: {
|
|
@@ -1066,7 +1065,7 @@ var no_default_props_default = createRule({
|
|
|
1066
1065
|
meta: {
|
|
1067
1066
|
type: "problem",
|
|
1068
1067
|
docs: {
|
|
1069
|
-
description: "
|
|
1068
|
+
description: "Disallow `defaultProps` property in favor of ES6 default parameters.",
|
|
1070
1069
|
[Symbol.for("rule_features")]: RULE_FEATURES20
|
|
1071
1070
|
},
|
|
1072
1071
|
messages: {
|
|
@@ -1121,7 +1120,7 @@ var no_direct_mutation_state_default = createRule({
|
|
|
1121
1120
|
meta: {
|
|
1122
1121
|
type: "problem",
|
|
1123
1122
|
docs: {
|
|
1124
|
-
description: "
|
|
1123
|
+
description: "Disallow direct mutation of `this.state`.",
|
|
1125
1124
|
[Symbol.for("rule_features")]: RULE_FEATURES21
|
|
1126
1125
|
},
|
|
1127
1126
|
messages: {
|
|
@@ -1160,7 +1159,7 @@ var no_duplicate_jsx_props_default = createRule({
|
|
|
1160
1159
|
meta: {
|
|
1161
1160
|
type: "problem",
|
|
1162
1161
|
docs: {
|
|
1163
|
-
description: "
|
|
1162
|
+
description: "Disallow duplicate props in JSX elements.",
|
|
1164
1163
|
[Symbol.for("rule_features")]: RULE_FEATURES22
|
|
1165
1164
|
},
|
|
1166
1165
|
messages: {
|
|
@@ -1202,7 +1201,7 @@ var no_duplicate_key_default = createRule({
|
|
|
1202
1201
|
meta: {
|
|
1203
1202
|
type: "problem",
|
|
1204
1203
|
docs: {
|
|
1205
|
-
description: "
|
|
1204
|
+
description: "Disallow duplicate `key` on elements in the same array or a list of `children`.",
|
|
1206
1205
|
[Symbol.for("rule_features")]: RULE_FEATURES23
|
|
1207
1206
|
},
|
|
1208
1207
|
messages: {
|
|
@@ -1286,7 +1285,7 @@ var no_forward_ref_default = createRule({
|
|
|
1286
1285
|
meta: {
|
|
1287
1286
|
type: "problem",
|
|
1288
1287
|
docs: {
|
|
1289
|
-
description: "
|
|
1288
|
+
description: "Replaces usages of `forwardRef` with passing `ref` as a prop.",
|
|
1290
1289
|
[Symbol.for("rule_features")]: RULE_FEATURES24
|
|
1291
1290
|
},
|
|
1292
1291
|
fixable: "code",
|
|
@@ -1393,7 +1392,7 @@ var no_implicit_key_default = createRule({
|
|
|
1393
1392
|
meta: {
|
|
1394
1393
|
type: "problem",
|
|
1395
1394
|
docs: {
|
|
1396
|
-
description: "
|
|
1395
|
+
description: "Prevents `key` from not being explicitly specified (e.g. spreading `key` from objects).",
|
|
1397
1396
|
[Symbol.for("rule_features")]: RULE_FEATURES25
|
|
1398
1397
|
},
|
|
1399
1398
|
messages: {
|
|
@@ -1505,7 +1504,7 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
1505
1504
|
meta: {
|
|
1506
1505
|
type: "problem",
|
|
1507
1506
|
docs: {
|
|
1508
|
-
description: "
|
|
1507
|
+
description: "Prevents problematic leaked values from being rendered.",
|
|
1509
1508
|
[Symbol.for("rule_features")]: RULE_FEATURES26
|
|
1510
1509
|
},
|
|
1511
1510
|
messages: {
|
|
@@ -1580,7 +1579,7 @@ var no_missing_component_display_name_default = createRule({
|
|
|
1580
1579
|
meta: {
|
|
1581
1580
|
type: "problem",
|
|
1582
1581
|
docs: {
|
|
1583
|
-
description: "
|
|
1582
|
+
description: "Enforces that all components have a `displayName` which can be used in devtools.",
|
|
1584
1583
|
[Symbol.for("rule_features")]: RULE_FEATURES27
|
|
1585
1584
|
},
|
|
1586
1585
|
messages: {
|
|
@@ -1633,7 +1632,7 @@ var no_missing_context_display_name_default = createRule({
|
|
|
1633
1632
|
meta: {
|
|
1634
1633
|
type: "problem",
|
|
1635
1634
|
docs: {
|
|
1636
|
-
description: "
|
|
1635
|
+
description: "Enforces that all contexts have a `displayName` which can be used in devtools.",
|
|
1637
1636
|
[Symbol.for("rule_features")]: RULE_FEATURES28
|
|
1638
1637
|
},
|
|
1639
1638
|
messages: {
|
|
@@ -1689,7 +1688,7 @@ var no_missing_key_default = createRule({
|
|
|
1689
1688
|
meta: {
|
|
1690
1689
|
type: "problem",
|
|
1691
1690
|
docs: {
|
|
1692
|
-
description: "
|
|
1691
|
+
description: "Disallow missing `key` on items in list rendering.",
|
|
1693
1692
|
[Symbol.for("rule_features")]: RULE_FEATURES29
|
|
1694
1693
|
},
|
|
1695
1694
|
messages: {
|
|
@@ -1821,7 +1820,7 @@ var no_nested_component_definitions_default = createRule({
|
|
|
1821
1820
|
meta: {
|
|
1822
1821
|
type: "problem",
|
|
1823
1822
|
docs: {
|
|
1824
|
-
description: "
|
|
1823
|
+
description: "Disallow nesting component definitions inside other components.",
|
|
1825
1824
|
[Symbol.for("rule_features")]: RULE_FEATURES30
|
|
1826
1825
|
},
|
|
1827
1826
|
messages: {
|
|
@@ -1931,7 +1930,7 @@ var no_prop_types_default = createRule({
|
|
|
1931
1930
|
meta: {
|
|
1932
1931
|
type: "problem",
|
|
1933
1932
|
docs: {
|
|
1934
|
-
description: "
|
|
1933
|
+
description: "Disallow `propTypes` in favor of TypeScript or another type-checking solution.",
|
|
1935
1934
|
[Symbol.for("rule_features")]: RULE_FEATURES31
|
|
1936
1935
|
},
|
|
1937
1936
|
messages: {
|
|
@@ -1988,7 +1987,7 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
1988
1987
|
meta: {
|
|
1989
1988
|
type: "problem",
|
|
1990
1989
|
docs: {
|
|
1991
|
-
description: "
|
|
1990
|
+
description: "Disallow `shouldComponentUpdate` when extending `React.PureComponent`.",
|
|
1992
1991
|
[Symbol.for("rule_features")]: RULE_FEATURES32
|
|
1993
1992
|
},
|
|
1994
1993
|
messages: {
|
|
@@ -2036,7 +2035,7 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
2036
2035
|
meta: {
|
|
2037
2036
|
type: "problem",
|
|
2038
2037
|
docs: {
|
|
2039
|
-
description: "
|
|
2038
|
+
description: "Disallow calling `this.setState` in `componentDidMount` outside of functions, such as callbacks.",
|
|
2040
2039
|
[Symbol.for("rule_features")]: RULE_FEATURES33
|
|
2041
2040
|
},
|
|
2042
2041
|
messages: {
|
|
@@ -2078,7 +2077,7 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
2078
2077
|
meta: {
|
|
2079
2078
|
type: "problem",
|
|
2080
2079
|
docs: {
|
|
2081
|
-
description: "
|
|
2080
|
+
description: "Disallows calling `this.setState` in `componentDidUpdate` outside of functions, such as callbacks.",
|
|
2082
2081
|
[Symbol.for("rule_features")]: RULE_FEATURES34
|
|
2083
2082
|
},
|
|
2084
2083
|
messages: {
|
|
@@ -2120,7 +2119,7 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
2120
2119
|
meta: {
|
|
2121
2120
|
type: "problem",
|
|
2122
2121
|
docs: {
|
|
2123
|
-
description: "
|
|
2122
|
+
description: "Disallows calling `this.setState` in `componentWillUpdate` outside of functions, such as callbacks.",
|
|
2124
2123
|
[Symbol.for("rule_features")]: RULE_FEATURES35
|
|
2125
2124
|
},
|
|
2126
2125
|
messages: {
|
|
@@ -2171,7 +2170,7 @@ var no_string_refs_default = createRule({
|
|
|
2171
2170
|
meta: {
|
|
2172
2171
|
type: "problem",
|
|
2173
2172
|
docs: {
|
|
2174
|
-
description: "
|
|
2173
|
+
description: "Disallow deprecated string `refs`.",
|
|
2175
2174
|
[Symbol.for("rule_features")]: RULE_FEATURES36
|
|
2176
2175
|
},
|
|
2177
2176
|
messages: {
|
|
@@ -2207,7 +2206,7 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
2207
2206
|
meta: {
|
|
2208
2207
|
type: "problem",
|
|
2209
2208
|
docs: {
|
|
2210
|
-
description: "
|
|
2209
|
+
description: "Warns the usage of `UNSAFE_componentWillMount` in class components.",
|
|
2211
2210
|
[Symbol.for("rule_features")]: RULE_FEATURES37
|
|
2212
2211
|
},
|
|
2213
2212
|
messages: {
|
|
@@ -2249,7 +2248,7 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
2249
2248
|
meta: {
|
|
2250
2249
|
type: "problem",
|
|
2251
2250
|
docs: {
|
|
2252
|
-
description: "
|
|
2251
|
+
description: "Warns the usage of `UNSAFE_componentWillReceiveProps` in class components.",
|
|
2253
2252
|
[Symbol.for("rule_features")]: RULE_FEATURES38
|
|
2254
2253
|
},
|
|
2255
2254
|
messages: {
|
|
@@ -2293,7 +2292,7 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
2293
2292
|
meta: {
|
|
2294
2293
|
type: "problem",
|
|
2295
2294
|
docs: {
|
|
2296
|
-
description: "
|
|
2295
|
+
description: "Warns the usage of `UNSAFE_componentWillUpdate` in class components.",
|
|
2297
2296
|
[Symbol.for("rule_features")]: RULE_FEATURES39
|
|
2298
2297
|
},
|
|
2299
2298
|
messages: {
|
|
@@ -2332,7 +2331,7 @@ var no_unstable_context_value_default = createRule({
|
|
|
2332
2331
|
meta: {
|
|
2333
2332
|
type: "problem",
|
|
2334
2333
|
docs: {
|
|
2335
|
-
description: "
|
|
2334
|
+
description: "Prevents non-stable values (i.e. object literals) from being used as a value for `Context.Provider`.",
|
|
2336
2335
|
[Symbol.for("rule_features")]: RULE_FEATURES40
|
|
2337
2336
|
},
|
|
2338
2337
|
messages: {
|
|
@@ -2405,7 +2404,7 @@ var no_unstable_default_props_default = createRule({
|
|
|
2405
2404
|
meta: {
|
|
2406
2405
|
type: "problem",
|
|
2407
2406
|
docs: {
|
|
2408
|
-
description: "
|
|
2407
|
+
description: "Prevents using referential-type values as default props in object destructuring.",
|
|
2409
2408
|
[Symbol.for("rule_features")]: RULE_FEATURES41
|
|
2410
2409
|
},
|
|
2411
2410
|
messages: {
|
|
@@ -2499,7 +2498,7 @@ var no_unused_class_component_members_default = createRule({
|
|
|
2499
2498
|
meta: {
|
|
2500
2499
|
type: "problem",
|
|
2501
2500
|
docs: {
|
|
2502
|
-
description: "
|
|
2501
|
+
description: "Warns unused class component methods and properties.",
|
|
2503
2502
|
[Symbol.for("rule_features")]: RULE_FEATURES42
|
|
2504
2503
|
},
|
|
2505
2504
|
messages: {
|
|
@@ -2630,7 +2629,7 @@ var no_unused_state_default = createRule({
|
|
|
2630
2629
|
meta: {
|
|
2631
2630
|
type: "problem",
|
|
2632
2631
|
docs: {
|
|
2633
|
-
description: "
|
|
2632
|
+
description: "Warns unused class component state.",
|
|
2634
2633
|
[Symbol.for("rule_features")]: RULE_FEATURES43
|
|
2635
2634
|
},
|
|
2636
2635
|
messages: {
|
|
@@ -2784,7 +2783,7 @@ var no_use_context_default = createRule({
|
|
|
2784
2783
|
meta: {
|
|
2785
2784
|
type: "problem",
|
|
2786
2785
|
docs: {
|
|
2787
|
-
description: "
|
|
2786
|
+
description: "Replaces usages of `useContext` with `use`.",
|
|
2788
2787
|
[Symbol.for("rule_features")]: RULE_FEATURES44
|
|
2789
2788
|
},
|
|
2790
2789
|
fixable: "code",
|
|
@@ -2881,7 +2880,7 @@ var no_useless_forward_ref_default = createRule({
|
|
|
2881
2880
|
meta: {
|
|
2882
2881
|
type: "problem",
|
|
2883
2882
|
docs: {
|
|
2884
|
-
description: "
|
|
2883
|
+
description: "Disallow useless `forwardRef` calls on components that don't use `ref`s.",
|
|
2885
2884
|
[Symbol.for("rule_features")]: RULE_FEATURES45
|
|
2886
2885
|
},
|
|
2887
2886
|
messages: {
|
|
@@ -2918,6 +2917,44 @@ var RULE_NAME46 = "no-useless-fragment";
|
|
|
2918
2917
|
var defaultOptions = [{
|
|
2919
2918
|
allowExpressions: true
|
|
2920
2919
|
}];
|
|
2920
|
+
var no_useless_fragment_default = createRule({
|
|
2921
|
+
meta: {
|
|
2922
|
+
type: "problem",
|
|
2923
|
+
defaultOptions: [...defaultOptions],
|
|
2924
|
+
docs: {
|
|
2925
|
+
description: "Disallow useless fragment elements."
|
|
2926
|
+
},
|
|
2927
|
+
fixable: "code",
|
|
2928
|
+
messages: {
|
|
2929
|
+
uselessFragment: "A fragment {{reason}} is useless."
|
|
2930
|
+
},
|
|
2931
|
+
schema: [{
|
|
2932
|
+
type: "object",
|
|
2933
|
+
additionalProperties: false,
|
|
2934
|
+
properties: {
|
|
2935
|
+
allowExpressions: {
|
|
2936
|
+
type: "boolean",
|
|
2937
|
+
description: "Allow fragments with a single expression child"
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
}]
|
|
2941
|
+
},
|
|
2942
|
+
name: RULE_NAME46,
|
|
2943
|
+
create: create44,
|
|
2944
|
+
defaultOptions
|
|
2945
|
+
});
|
|
2946
|
+
function create44(context, [option]) {
|
|
2947
|
+
const { allowExpressions = true } = option;
|
|
2948
|
+
return {
|
|
2949
|
+
JSXElement(node) {
|
|
2950
|
+
if (!JSX8.isFragmentElement(node)) return;
|
|
2951
|
+
doCheck(context, node, allowExpressions);
|
|
2952
|
+
},
|
|
2953
|
+
JSXFragment(node) {
|
|
2954
|
+
doCheck(context, node, allowExpressions);
|
|
2955
|
+
}
|
|
2956
|
+
};
|
|
2957
|
+
}
|
|
2921
2958
|
function trimLikeReact(text) {
|
|
2922
2959
|
const leadingSpaces = /^\s*/.exec(text)?.[0] ?? "";
|
|
2923
2960
|
const trailingSpaces = /\s*$/.exec(text)?.[0] ?? "";
|
|
@@ -3018,44 +3055,6 @@ function doCheck(context, node, allowExpressions) {
|
|
|
3018
3055
|
}
|
|
3019
3056
|
return;
|
|
3020
3057
|
}
|
|
3021
|
-
var no_useless_fragment_default = createRule({
|
|
3022
|
-
meta: {
|
|
3023
|
-
type: "problem",
|
|
3024
|
-
defaultOptions: [...defaultOptions],
|
|
3025
|
-
docs: {
|
|
3026
|
-
description: "disallow useless fragments"
|
|
3027
|
-
},
|
|
3028
|
-
fixable: "code",
|
|
3029
|
-
messages: {
|
|
3030
|
-
uselessFragment: "A fragment {{reason}} is useless."
|
|
3031
|
-
},
|
|
3032
|
-
schema: [{
|
|
3033
|
-
type: "object",
|
|
3034
|
-
additionalProperties: false,
|
|
3035
|
-
properties: {
|
|
3036
|
-
allowExpressions: {
|
|
3037
|
-
type: "boolean",
|
|
3038
|
-
description: "Allow fragments with a single expression child"
|
|
3039
|
-
}
|
|
3040
|
-
}
|
|
3041
|
-
}]
|
|
3042
|
-
},
|
|
3043
|
-
name: RULE_NAME46,
|
|
3044
|
-
create: create44,
|
|
3045
|
-
defaultOptions
|
|
3046
|
-
});
|
|
3047
|
-
function create44(context, [option]) {
|
|
3048
|
-
const { allowExpressions = true } = option;
|
|
3049
|
-
return {
|
|
3050
|
-
JSXElement(node) {
|
|
3051
|
-
if (!JSX8.isFragmentElement(node)) return;
|
|
3052
|
-
doCheck(context, node, allowExpressions);
|
|
3053
|
-
},
|
|
3054
|
-
JSXFragment(node) {
|
|
3055
|
-
doCheck(context, node, allowExpressions);
|
|
3056
|
-
}
|
|
3057
|
-
};
|
|
3058
|
-
}
|
|
3059
3058
|
var RULE_NAME47 = "prefer-destructuring-assignment";
|
|
3060
3059
|
var RULE_FEATURES46 = [];
|
|
3061
3060
|
function isMemberExpressionWithObjectName(node) {
|
|
@@ -3065,7 +3064,7 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
3065
3064
|
meta: {
|
|
3066
3065
|
type: "problem",
|
|
3067
3066
|
docs: {
|
|
3068
|
-
description: "
|
|
3067
|
+
description: "Enforces destructuring assignment for component props and context.",
|
|
3069
3068
|
[Symbol.for("rule_features")]: RULE_FEATURES46
|
|
3070
3069
|
},
|
|
3071
3070
|
messages: {
|
|
@@ -3145,7 +3144,7 @@ var prefer_react_namespace_import_default = createRule({
|
|
|
3145
3144
|
meta: {
|
|
3146
3145
|
type: "problem",
|
|
3147
3146
|
docs: {
|
|
3148
|
-
description: "
|
|
3147
|
+
description: "Enforces React is imported via a namespace import.",
|
|
3149
3148
|
[Symbol.for("rule_features")]: RULE_FEATURES47
|
|
3150
3149
|
},
|
|
3151
3150
|
fixable: "code",
|
|
@@ -3199,7 +3198,7 @@ var prefer_read_only_props_default = createRule({
|
|
|
3199
3198
|
meta: {
|
|
3200
3199
|
type: "problem",
|
|
3201
3200
|
docs: {
|
|
3202
|
-
description: "
|
|
3201
|
+
description: "Enforces read-only props in components.",
|
|
3203
3202
|
[Symbol.for("rule_features")]: RULE_FEATURES48
|
|
3204
3203
|
},
|
|
3205
3204
|
messages: {
|
|
@@ -3240,7 +3239,7 @@ var prefer_shorthand_boolean_default = createRule({
|
|
|
3240
3239
|
meta: {
|
|
3241
3240
|
type: "problem",
|
|
3242
3241
|
docs: {
|
|
3243
|
-
description: "
|
|
3242
|
+
description: "Enforces shorthand syntax for boolean attributes.",
|
|
3244
3243
|
[Symbol.for("rule_features")]: RULE_FEATURES49
|
|
3245
3244
|
},
|
|
3246
3245
|
fixable: "code",
|
|
@@ -3281,7 +3280,7 @@ var prefer_shorthand_fragment_default = createRule({
|
|
|
3281
3280
|
meta: {
|
|
3282
3281
|
type: "problem",
|
|
3283
3282
|
docs: {
|
|
3284
|
-
description: "
|
|
3283
|
+
description: "Enforces shorthand syntax for fragments.",
|
|
3285
3284
|
[Symbol.for("rule_features")]: RULE_FEATURES50
|
|
3286
3285
|
},
|
|
3287
3286
|
fixable: "code",
|
|
@@ -3325,7 +3324,7 @@ var use_jsx_vars_default = createRule({
|
|
|
3325
3324
|
meta: {
|
|
3326
3325
|
type: "problem",
|
|
3327
3326
|
docs: {
|
|
3328
|
-
description: "
|
|
3327
|
+
description: "Marks variables used in JSX as used.",
|
|
3329
3328
|
[Symbol.for("rule_features")]: RULE_FEATURES51
|
|
3330
3329
|
},
|
|
3331
3330
|
messages: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "1.37.1-next.
|
|
3
|
+
"version": "1.37.1-next.5",
|
|
4
4
|
"description": "A set of composable linting rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"compare-versions": "^6.1.1",
|
|
50
50
|
"string-ts": "^2.2.1",
|
|
51
51
|
"ts-pattern": "^5.6.2",
|
|
52
|
-
"@eslint-react/ast": "1.37.1-next.
|
|
53
|
-
"@eslint-react/core": "1.37.1-next.
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
52
|
+
"@eslint-react/ast": "1.37.1-next.5",
|
|
53
|
+
"@eslint-react/core": "1.37.1-next.5",
|
|
54
|
+
"@eslint-react/jsx": "1.37.1-next.5",
|
|
55
|
+
"@eslint-react/eff": "1.37.1-next.5",
|
|
56
|
+
"@eslint-react/var": "1.37.1-next.5",
|
|
57
|
+
"@eslint-react/shared": "1.37.1-next.5"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/react": "^19.0.12",
|