eslint-plugin-react-x 3.0.0-next.59 → 3.0.0-next.60
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 +302 -253
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ const rules$8 = {
|
|
|
47
47
|
"react-x/no-unnecessary-use-callback": "off",
|
|
48
48
|
"react-x/no-unnecessary-use-memo": "off",
|
|
49
49
|
"react-x/no-unused-props": "off",
|
|
50
|
+
"react-x/unstable-rules-of-props": "off",
|
|
50
51
|
"react-x/refs": "off",
|
|
51
52
|
"react-x/rules-of-hooks": "off",
|
|
52
53
|
"react-x/set-state-in-render": "off"
|
|
@@ -68,7 +69,7 @@ const rules$7 = {
|
|
|
68
69
|
//#endregion
|
|
69
70
|
//#region package.json
|
|
70
71
|
var name$6 = "eslint-plugin-react-x";
|
|
71
|
-
var version = "3.0.0-next.
|
|
72
|
+
var version = "3.0.0-next.60";
|
|
72
73
|
|
|
73
74
|
//#endregion
|
|
74
75
|
//#region src/utils/create-rule.ts
|
|
@@ -225,7 +226,7 @@ function getTypeVariants(types) {
|
|
|
225
226
|
|
|
226
227
|
//#endregion
|
|
227
228
|
//#region src/rules/component-hook-factories/component-hook-factories.ts
|
|
228
|
-
const RULE_NAME$
|
|
229
|
+
const RULE_NAME$63 = "component-hook-factories";
|
|
229
230
|
var component_hook_factories_default = createRule({
|
|
230
231
|
meta: {
|
|
231
232
|
type: "problem",
|
|
@@ -236,11 +237,11 @@ var component_hook_factories_default = createRule({
|
|
|
236
237
|
},
|
|
237
238
|
schema: []
|
|
238
239
|
},
|
|
239
|
-
name: RULE_NAME$
|
|
240
|
-
create: create$
|
|
240
|
+
name: RULE_NAME$63,
|
|
241
|
+
create: create$63,
|
|
241
242
|
defaultOptions: []
|
|
242
243
|
});
|
|
243
|
-
function create$
|
|
244
|
+
function create$63(context) {
|
|
244
245
|
const hint = core.ComponentDetectionHint.DoNotIncludeJsxWithNumberValue | core.ComponentDetectionHint.DoNotIncludeJsxWithBooleanValue | core.ComponentDetectionHint.DoNotIncludeJsxWithNullValue | core.ComponentDetectionHint.DoNotIncludeJsxWithStringValue | core.ComponentDetectionHint.DoNotIncludeJsxWithUndefinedValue | core.ComponentDetectionHint.RequireBothSidesOfLogicalExpressionToBeJsx | core.ComponentDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJsx | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedInArrayPattern | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedInArrayExpression | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayMapCallback;
|
|
245
246
|
const fCollector = core.useComponentCollector(context, { hint });
|
|
246
247
|
const cCollector = core.useComponentCollectorLegacy(context);
|
|
@@ -284,7 +285,7 @@ function create$62(context) {
|
|
|
284
285
|
|
|
285
286
|
//#endregion
|
|
286
287
|
//#region src/rules/error-boundaries/error-boundaries.ts
|
|
287
|
-
const RULE_NAME$
|
|
288
|
+
const RULE_NAME$62 = "error-boundaries";
|
|
288
289
|
var error_boundaries_default = createRule({
|
|
289
290
|
meta: {
|
|
290
291
|
type: "problem",
|
|
@@ -295,11 +296,11 @@ var error_boundaries_default = createRule({
|
|
|
295
296
|
},
|
|
296
297
|
schema: []
|
|
297
298
|
},
|
|
298
|
-
name: RULE_NAME$
|
|
299
|
-
create: create$
|
|
299
|
+
name: RULE_NAME$62,
|
|
300
|
+
create: create$62,
|
|
300
301
|
defaultOptions: []
|
|
301
302
|
});
|
|
302
|
-
function create$
|
|
303
|
+
function create$62(context) {
|
|
303
304
|
if (!context.sourceCode.text.includes("try")) return {};
|
|
304
305
|
const { ctx, visitor } = core.useComponentCollector(context);
|
|
305
306
|
const reported = /* @__PURE__ */ new Set();
|
|
@@ -1239,7 +1240,7 @@ function getUnknownDependenciesMessage(reactiveHookName) {
|
|
|
1239
1240
|
|
|
1240
1241
|
//#endregion
|
|
1241
1242
|
//#region src/rules/immutability/immutability.ts
|
|
1242
|
-
const RULE_NAME$
|
|
1243
|
+
const RULE_NAME$61 = "immutability";
|
|
1243
1244
|
/**
|
|
1244
1245
|
* Array methods that mutate the array in place.
|
|
1245
1246
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
@@ -1265,11 +1266,11 @@ var immutability_default = createRule({
|
|
|
1265
1266
|
},
|
|
1266
1267
|
schema: []
|
|
1267
1268
|
},
|
|
1268
|
-
name: RULE_NAME$
|
|
1269
|
-
create: create$
|
|
1269
|
+
name: RULE_NAME$61,
|
|
1270
|
+
create: create$61,
|
|
1270
1271
|
defaultOptions: []
|
|
1271
1272
|
});
|
|
1272
|
-
function create$
|
|
1273
|
+
function create$61(context) {
|
|
1273
1274
|
const { additionalStateHooks } = getSettingsFromContext(context);
|
|
1274
1275
|
const hCollector = core.useHookCollector(context);
|
|
1275
1276
|
const cCollector = core.useComponentCollector(context);
|
|
@@ -1390,7 +1391,7 @@ function create$60(context) {
|
|
|
1390
1391
|
|
|
1391
1392
|
//#endregion
|
|
1392
1393
|
//#region src/rules/jsx-dollar/jsx-dollar.ts
|
|
1393
|
-
const RULE_NAME$
|
|
1394
|
+
const RULE_NAME$60 = "jsx-dollar";
|
|
1394
1395
|
var jsx_dollar_default = createRule({
|
|
1395
1396
|
meta: {
|
|
1396
1397
|
type: "suggestion",
|
|
@@ -1403,11 +1404,11 @@ var jsx_dollar_default = createRule({
|
|
|
1403
1404
|
},
|
|
1404
1405
|
schema: []
|
|
1405
1406
|
},
|
|
1406
|
-
name: RULE_NAME$
|
|
1407
|
-
create: create$
|
|
1407
|
+
name: RULE_NAME$60,
|
|
1408
|
+
create: create$60,
|
|
1408
1409
|
defaultOptions: []
|
|
1409
1410
|
});
|
|
1410
|
-
function create$
|
|
1411
|
+
function create$60(context) {
|
|
1411
1412
|
/**
|
|
1412
1413
|
* Visitor function for JSXElement and JSXFragment nodes
|
|
1413
1414
|
* @param node The JSXElement or JSXFragment node to be checked
|
|
@@ -1448,7 +1449,7 @@ function create$59(context) {
|
|
|
1448
1449
|
|
|
1449
1450
|
//#endregion
|
|
1450
1451
|
//#region src/rules/jsx-key-before-spread/jsx-key-before-spread.ts
|
|
1451
|
-
const RULE_NAME$
|
|
1452
|
+
const RULE_NAME$59 = "jsx-key-before-spread";
|
|
1452
1453
|
var jsx_key_before_spread_default = createRule({
|
|
1453
1454
|
meta: {
|
|
1454
1455
|
type: "problem",
|
|
@@ -1456,11 +1457,11 @@ var jsx_key_before_spread_default = createRule({
|
|
|
1456
1457
|
messages: { default: "The 'key' prop must be placed before any spread props when using the new JSX transform." },
|
|
1457
1458
|
schema: []
|
|
1458
1459
|
},
|
|
1459
|
-
name: RULE_NAME$
|
|
1460
|
-
create: create$
|
|
1460
|
+
name: RULE_NAME$59,
|
|
1461
|
+
create: create$59,
|
|
1461
1462
|
defaultOptions: []
|
|
1462
1463
|
});
|
|
1463
|
-
function create$
|
|
1464
|
+
function create$59(context) {
|
|
1464
1465
|
const { jsx } = {
|
|
1465
1466
|
...core.getJsxConfigFromContext(context),
|
|
1466
1467
|
...core.getJsxConfigFromAnnotation(context)
|
|
@@ -1484,7 +1485,7 @@ function create$58(context) {
|
|
|
1484
1485
|
|
|
1485
1486
|
//#endregion
|
|
1486
1487
|
//#region src/rules/jsx-no-comment-textnodes/jsx-no-comment-textnodes.ts
|
|
1487
|
-
const RULE_NAME$
|
|
1488
|
+
const RULE_NAME$58 = "jsx-no-comment-textnodes";
|
|
1488
1489
|
var jsx_no_comment_textnodes_default = createRule({
|
|
1489
1490
|
meta: {
|
|
1490
1491
|
type: "problem",
|
|
@@ -1492,11 +1493,11 @@ var jsx_no_comment_textnodes_default = createRule({
|
|
|
1492
1493
|
messages: { default: "Possible misused comment in text node. Comments inside children section of tag should be placed inside braces." },
|
|
1493
1494
|
schema: []
|
|
1494
1495
|
},
|
|
1495
|
-
name: RULE_NAME$
|
|
1496
|
-
create: create$
|
|
1496
|
+
name: RULE_NAME$58,
|
|
1497
|
+
create: create$58,
|
|
1497
1498
|
defaultOptions: []
|
|
1498
1499
|
});
|
|
1499
|
-
function create$
|
|
1500
|
+
function create$58(context) {
|
|
1500
1501
|
function hasCommentLike(node) {
|
|
1501
1502
|
if (ast.isOneOf([AST_NODE_TYPES.JSXAttribute, AST_NODE_TYPES.JSXExpressionContainer])(node.parent)) return false;
|
|
1502
1503
|
return /^\s*\/(?:\/|\*)/mu.test(context.sourceCode.getText(node));
|
|
@@ -1517,7 +1518,7 @@ function create$57(context) {
|
|
|
1517
1518
|
|
|
1518
1519
|
//#endregion
|
|
1519
1520
|
//#region src/rules/jsx-no-duplicate-props/jsx-no-duplicate-props.ts
|
|
1520
|
-
const RULE_NAME$
|
|
1521
|
+
const RULE_NAME$57 = "jsx-no-duplicate-props";
|
|
1521
1522
|
var jsx_no_duplicate_props_default = createRule({
|
|
1522
1523
|
meta: {
|
|
1523
1524
|
type: "problem",
|
|
@@ -1525,11 +1526,11 @@ var jsx_no_duplicate_props_default = createRule({
|
|
|
1525
1526
|
messages: { default: "This JSX property is assigned multiple times." },
|
|
1526
1527
|
schema: []
|
|
1527
1528
|
},
|
|
1528
|
-
name: RULE_NAME$
|
|
1529
|
-
create: create$
|
|
1529
|
+
name: RULE_NAME$57,
|
|
1530
|
+
create: create$57,
|
|
1530
1531
|
defaultOptions: []
|
|
1531
1532
|
});
|
|
1532
|
-
function create$
|
|
1533
|
+
function create$57(context) {
|
|
1533
1534
|
return defineRuleListener({ JSXOpeningElement(node) {
|
|
1534
1535
|
const props = [];
|
|
1535
1536
|
for (const attr of node.attributes) {
|
|
@@ -1550,7 +1551,7 @@ function create$56(context) {
|
|
|
1550
1551
|
|
|
1551
1552
|
//#endregion
|
|
1552
1553
|
//#region src/rules/jsx-shorthand-boolean/jsx-shorthand-boolean.ts
|
|
1553
|
-
const RULE_NAME$
|
|
1554
|
+
const RULE_NAME$56 = "jsx-shorthand-boolean";
|
|
1554
1555
|
const defaultOptions$4 = [1];
|
|
1555
1556
|
const schema$4 = [{
|
|
1556
1557
|
type: "integer",
|
|
@@ -1564,11 +1565,11 @@ var jsx_shorthand_boolean_default = createRule({
|
|
|
1564
1565
|
messages: { default: "{{message}}" },
|
|
1565
1566
|
schema: schema$4
|
|
1566
1567
|
},
|
|
1567
|
-
name: RULE_NAME$
|
|
1568
|
-
create: create$
|
|
1568
|
+
name: RULE_NAME$56,
|
|
1569
|
+
create: create$56,
|
|
1569
1570
|
defaultOptions: defaultOptions$4
|
|
1570
1571
|
});
|
|
1571
|
-
function create$
|
|
1572
|
+
function create$56(context) {
|
|
1572
1573
|
const policy = context.options[0] ?? defaultOptions$4[0];
|
|
1573
1574
|
return defineRuleListener({ JSXAttribute(node) {
|
|
1574
1575
|
const { value } = node;
|
|
@@ -1596,7 +1597,7 @@ function create$55(context) {
|
|
|
1596
1597
|
|
|
1597
1598
|
//#endregion
|
|
1598
1599
|
//#region src/rules/jsx-shorthand-fragment/jsx-shorthand-fragment.ts
|
|
1599
|
-
const RULE_NAME$
|
|
1600
|
+
const RULE_NAME$55 = "jsx-shorthand-fragment";
|
|
1600
1601
|
const defaultOptions$3 = [1];
|
|
1601
1602
|
const schema$3 = [{
|
|
1602
1603
|
type: "integer",
|
|
@@ -1610,11 +1611,11 @@ var jsx_shorthand_fragment_default = createRule({
|
|
|
1610
1611
|
messages: { default: "{{message}}" },
|
|
1611
1612
|
schema: schema$3
|
|
1612
1613
|
},
|
|
1613
|
-
name: RULE_NAME$
|
|
1614
|
-
create: create$
|
|
1614
|
+
name: RULE_NAME$55,
|
|
1615
|
+
create: create$55,
|
|
1615
1616
|
defaultOptions: defaultOptions$3
|
|
1616
1617
|
});
|
|
1617
|
-
function create$
|
|
1618
|
+
function create$55(context) {
|
|
1618
1619
|
const policy = context.options[0] ?? defaultOptions$3[0];
|
|
1619
1620
|
const jsxConfig = {
|
|
1620
1621
|
...core.getJsxConfigFromContext(context),
|
|
@@ -1649,7 +1650,7 @@ function create$54(context) {
|
|
|
1649
1650
|
|
|
1650
1651
|
//#endregion
|
|
1651
1652
|
//#region src/rules/jsx-uses-react/jsx-uses-react.ts
|
|
1652
|
-
const RULE_NAME$
|
|
1653
|
+
const RULE_NAME$54 = "jsx-uses-react";
|
|
1653
1654
|
var jsx_uses_react_default = createRule({
|
|
1654
1655
|
meta: {
|
|
1655
1656
|
type: "problem",
|
|
@@ -1657,11 +1658,11 @@ var jsx_uses_react_default = createRule({
|
|
|
1657
1658
|
messages: { default: "Marked {{name}} as used." },
|
|
1658
1659
|
schema: []
|
|
1659
1660
|
},
|
|
1660
|
-
name: RULE_NAME$
|
|
1661
|
-
create: create$
|
|
1661
|
+
name: RULE_NAME$54,
|
|
1662
|
+
create: create$54,
|
|
1662
1663
|
defaultOptions: []
|
|
1663
1664
|
});
|
|
1664
|
-
function create$
|
|
1665
|
+
function create$54(context) {
|
|
1665
1666
|
const { jsx, jsxFactory, jsxFragmentFactory } = {
|
|
1666
1667
|
...core.getJsxConfigFromContext(context),
|
|
1667
1668
|
...core.getJsxConfigFromAnnotation(context)
|
|
@@ -1692,7 +1693,7 @@ function debugReport(context, node, name) {
|
|
|
1692
1693
|
|
|
1693
1694
|
//#endregion
|
|
1694
1695
|
//#region src/rules/jsx-uses-vars/jsx-uses-vars.ts
|
|
1695
|
-
const RULE_NAME$
|
|
1696
|
+
const RULE_NAME$53 = "jsx-uses-vars";
|
|
1696
1697
|
var jsx_uses_vars_default = createRule({
|
|
1697
1698
|
meta: {
|
|
1698
1699
|
type: "problem",
|
|
@@ -1700,11 +1701,11 @@ var jsx_uses_vars_default = createRule({
|
|
|
1700
1701
|
messages: { default: "An identifier in JSX is marked as used." },
|
|
1701
1702
|
schema: []
|
|
1702
1703
|
},
|
|
1703
|
-
name: RULE_NAME$
|
|
1704
|
-
create: create$
|
|
1704
|
+
name: RULE_NAME$53,
|
|
1705
|
+
create: create$53,
|
|
1705
1706
|
defaultOptions: []
|
|
1706
1707
|
});
|
|
1707
|
-
function create$
|
|
1708
|
+
function create$53(context) {
|
|
1708
1709
|
return defineRuleListener({ JSXOpeningElement(node) {
|
|
1709
1710
|
switch (node.name.type) {
|
|
1710
1711
|
case AST_NODE_TYPES.JSXIdentifier:
|
|
@@ -1722,7 +1723,7 @@ function create$52(context) {
|
|
|
1722
1723
|
|
|
1723
1724
|
//#endregion
|
|
1724
1725
|
//#region src/rules/no-access-state-in-setstate/no-access-state-in-setstate.ts
|
|
1725
|
-
const RULE_NAME$
|
|
1726
|
+
const RULE_NAME$52 = "no-access-state-in-setstate";
|
|
1726
1727
|
function isKeyLiteral$2(node, key) {
|
|
1727
1728
|
return match(key).with({ type: AST_NODE_TYPES.Literal }, constTrue).with({
|
|
1728
1729
|
type: AST_NODE_TYPES.TemplateLiteral,
|
|
@@ -1736,11 +1737,11 @@ var no_access_state_in_setstate_default = createRule({
|
|
|
1736
1737
|
messages: { default: "Do not access 'this.state' within 'setState'. Use the update function instead." },
|
|
1737
1738
|
schema: []
|
|
1738
1739
|
},
|
|
1739
|
-
name: RULE_NAME$
|
|
1740
|
-
create: create$
|
|
1740
|
+
name: RULE_NAME$52,
|
|
1741
|
+
create: create$52,
|
|
1741
1742
|
defaultOptions: []
|
|
1742
1743
|
});
|
|
1743
|
-
function create$
|
|
1744
|
+
function create$52(context) {
|
|
1744
1745
|
if (!context.sourceCode.text.includes("setState")) return {};
|
|
1745
1746
|
const classStack = [];
|
|
1746
1747
|
const methodStack = [];
|
|
@@ -1811,7 +1812,7 @@ function create$51(context) {
|
|
|
1811
1812
|
|
|
1812
1813
|
//#endregion
|
|
1813
1814
|
//#region src/rules/no-array-index-key/no-array-index-key.ts
|
|
1814
|
-
const RULE_NAME$
|
|
1815
|
+
const RULE_NAME$51 = "no-array-index-key";
|
|
1815
1816
|
function getIndexParamPosition(methodName) {
|
|
1816
1817
|
switch (methodName) {
|
|
1817
1818
|
case "every":
|
|
@@ -1856,11 +1857,11 @@ var no_array_index_key_default = createRule({
|
|
|
1856
1857
|
messages: { default: "Do not use item index in the array as its key." },
|
|
1857
1858
|
schema: []
|
|
1858
1859
|
},
|
|
1859
|
-
name: RULE_NAME$
|
|
1860
|
-
create: create$
|
|
1860
|
+
name: RULE_NAME$51,
|
|
1861
|
+
create: create$51,
|
|
1861
1862
|
defaultOptions: []
|
|
1862
1863
|
});
|
|
1863
|
-
function create$
|
|
1864
|
+
function create$51(context) {
|
|
1864
1865
|
const indexParamNames = [];
|
|
1865
1866
|
function isArrayIndex(node) {
|
|
1866
1867
|
return node.type === AST_NODE_TYPES.Identifier && indexParamNames.some((name) => name != null && name === node.name);
|
|
@@ -1926,7 +1927,7 @@ function create$50(context) {
|
|
|
1926
1927
|
|
|
1927
1928
|
//#endregion
|
|
1928
1929
|
//#region src/rules/no-children-count/no-children-count.ts
|
|
1929
|
-
const RULE_NAME$
|
|
1930
|
+
const RULE_NAME$50 = "no-children-count";
|
|
1930
1931
|
var no_children_count_default = createRule({
|
|
1931
1932
|
meta: {
|
|
1932
1933
|
type: "suggestion",
|
|
@@ -1934,11 +1935,11 @@ var no_children_count_default = createRule({
|
|
|
1934
1935
|
messages: { default: "Using 'Children.count' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
1935
1936
|
schema: []
|
|
1936
1937
|
},
|
|
1937
|
-
name: RULE_NAME$
|
|
1938
|
-
create: create$
|
|
1938
|
+
name: RULE_NAME$50,
|
|
1939
|
+
create: create$50,
|
|
1939
1940
|
defaultOptions: []
|
|
1940
1941
|
});
|
|
1941
|
-
function create$
|
|
1942
|
+
function create$50(context) {
|
|
1942
1943
|
return defineRuleListener({ MemberExpression(node) {
|
|
1943
1944
|
if (core.isChildrenCount(context, node)) context.report({
|
|
1944
1945
|
messageId: "default",
|
|
@@ -1949,7 +1950,7 @@ function create$49(context) {
|
|
|
1949
1950
|
|
|
1950
1951
|
//#endregion
|
|
1951
1952
|
//#region src/rules/no-children-for-each/no-children-for-each.ts
|
|
1952
|
-
const RULE_NAME$
|
|
1953
|
+
const RULE_NAME$49 = "no-children-for-each";
|
|
1953
1954
|
var no_children_for_each_default = createRule({
|
|
1954
1955
|
meta: {
|
|
1955
1956
|
type: "suggestion",
|
|
@@ -1957,11 +1958,11 @@ var no_children_for_each_default = createRule({
|
|
|
1957
1958
|
messages: { default: "Using 'Children.forEach' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
1958
1959
|
schema: []
|
|
1959
1960
|
},
|
|
1960
|
-
name: RULE_NAME$
|
|
1961
|
-
create: create$
|
|
1961
|
+
name: RULE_NAME$49,
|
|
1962
|
+
create: create$49,
|
|
1962
1963
|
defaultOptions: []
|
|
1963
1964
|
});
|
|
1964
|
-
function create$
|
|
1965
|
+
function create$49(context) {
|
|
1965
1966
|
return defineRuleListener({ MemberExpression(node) {
|
|
1966
1967
|
if (core.isChildrenForEach(context, node)) context.report({
|
|
1967
1968
|
messageId: "default",
|
|
@@ -1972,7 +1973,7 @@ function create$48(context) {
|
|
|
1972
1973
|
|
|
1973
1974
|
//#endregion
|
|
1974
1975
|
//#region src/rules/no-children-map/no-children-map.ts
|
|
1975
|
-
const RULE_NAME$
|
|
1976
|
+
const RULE_NAME$48 = "no-children-map";
|
|
1976
1977
|
var no_children_map_default = createRule({
|
|
1977
1978
|
meta: {
|
|
1978
1979
|
type: "suggestion",
|
|
@@ -1980,11 +1981,11 @@ var no_children_map_default = createRule({
|
|
|
1980
1981
|
messages: { default: "Using 'Children.map' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
1981
1982
|
schema: []
|
|
1982
1983
|
},
|
|
1983
|
-
name: RULE_NAME$
|
|
1984
|
-
create: create$
|
|
1984
|
+
name: RULE_NAME$48,
|
|
1985
|
+
create: create$48,
|
|
1985
1986
|
defaultOptions: []
|
|
1986
1987
|
});
|
|
1987
|
-
function create$
|
|
1988
|
+
function create$48(context) {
|
|
1988
1989
|
return defineRuleListener({ MemberExpression(node) {
|
|
1989
1990
|
if (core.isChildrenMap(context, node)) context.report({
|
|
1990
1991
|
messageId: "default",
|
|
@@ -1995,7 +1996,7 @@ function create$47(context) {
|
|
|
1995
1996
|
|
|
1996
1997
|
//#endregion
|
|
1997
1998
|
//#region src/rules/no-children-only/no-children-only.ts
|
|
1998
|
-
const RULE_NAME$
|
|
1999
|
+
const RULE_NAME$47 = "no-children-only";
|
|
1999
2000
|
var no_children_only_default = createRule({
|
|
2000
2001
|
meta: {
|
|
2001
2002
|
type: "suggestion",
|
|
@@ -2003,11 +2004,11 @@ var no_children_only_default = createRule({
|
|
|
2003
2004
|
messages: { default: "Using 'Children.only' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
2004
2005
|
schema: []
|
|
2005
2006
|
},
|
|
2006
|
-
name: RULE_NAME$
|
|
2007
|
-
create: create$
|
|
2007
|
+
name: RULE_NAME$47,
|
|
2008
|
+
create: create$47,
|
|
2008
2009
|
defaultOptions: []
|
|
2009
2010
|
});
|
|
2010
|
-
function create$
|
|
2011
|
+
function create$47(context) {
|
|
2011
2012
|
return defineRuleListener({ MemberExpression(node) {
|
|
2012
2013
|
if (core.isChildrenOnly(context, node)) context.report({
|
|
2013
2014
|
messageId: "default",
|
|
@@ -2018,7 +2019,7 @@ function create$46(context) {
|
|
|
2018
2019
|
|
|
2019
2020
|
//#endregion
|
|
2020
2021
|
//#region src/rules/no-children-prop/no-children-prop.ts
|
|
2021
|
-
const RULE_NAME$
|
|
2022
|
+
const RULE_NAME$46 = "no-children-prop";
|
|
2022
2023
|
var no_children_prop_default = createRule({
|
|
2023
2024
|
meta: {
|
|
2024
2025
|
type: "suggestion",
|
|
@@ -2026,11 +2027,11 @@ var no_children_prop_default = createRule({
|
|
|
2026
2027
|
messages: { default: "Do not pass 'children' as props." },
|
|
2027
2028
|
schema: []
|
|
2028
2029
|
},
|
|
2029
|
-
name: RULE_NAME$
|
|
2030
|
-
create: create$
|
|
2030
|
+
name: RULE_NAME$46,
|
|
2031
|
+
create: create$46,
|
|
2031
2032
|
defaultOptions: []
|
|
2032
2033
|
});
|
|
2033
|
-
function create$
|
|
2034
|
+
function create$46(context) {
|
|
2034
2035
|
return defineRuleListener({ JSXElement(node) {
|
|
2035
2036
|
const childrenProp = core.getJsxAttribute(context, node)("children");
|
|
2036
2037
|
if (childrenProp != null) context.report({
|
|
@@ -2042,7 +2043,7 @@ function create$45(context) {
|
|
|
2042
2043
|
|
|
2043
2044
|
//#endregion
|
|
2044
2045
|
//#region src/rules/no-children-to-array/no-children-to-array.ts
|
|
2045
|
-
const RULE_NAME$
|
|
2046
|
+
const RULE_NAME$45 = "no-children-to-array";
|
|
2046
2047
|
var no_children_to_array_default = createRule({
|
|
2047
2048
|
meta: {
|
|
2048
2049
|
type: "suggestion",
|
|
@@ -2050,11 +2051,11 @@ var no_children_to_array_default = createRule({
|
|
|
2050
2051
|
messages: { default: "Using 'Children.toArray' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
2051
2052
|
schema: []
|
|
2052
2053
|
},
|
|
2053
|
-
name: RULE_NAME$
|
|
2054
|
-
create: create$
|
|
2054
|
+
name: RULE_NAME$45,
|
|
2055
|
+
create: create$45,
|
|
2055
2056
|
defaultOptions: []
|
|
2056
2057
|
});
|
|
2057
|
-
function create$
|
|
2058
|
+
function create$45(context) {
|
|
2058
2059
|
return defineRuleListener({ MemberExpression(node) {
|
|
2059
2060
|
if (core.isChildrenToArray(context, node)) context.report({
|
|
2060
2061
|
messageId: "default",
|
|
@@ -2065,7 +2066,7 @@ function create$44(context) {
|
|
|
2065
2066
|
|
|
2066
2067
|
//#endregion
|
|
2067
2068
|
//#region src/rules/no-class-component/no-class-component.ts
|
|
2068
|
-
const RULE_NAME$
|
|
2069
|
+
const RULE_NAME$44 = "no-class-component";
|
|
2069
2070
|
var no_class_component_default = createRule({
|
|
2070
2071
|
meta: {
|
|
2071
2072
|
type: "suggestion",
|
|
@@ -2073,11 +2074,11 @@ var no_class_component_default = createRule({
|
|
|
2073
2074
|
messages: { default: "Avoid using class components. Use function components instead." },
|
|
2074
2075
|
schema: []
|
|
2075
2076
|
},
|
|
2076
|
-
name: RULE_NAME$
|
|
2077
|
-
create: create$
|
|
2077
|
+
name: RULE_NAME$44,
|
|
2078
|
+
create: create$44,
|
|
2078
2079
|
defaultOptions: []
|
|
2079
2080
|
});
|
|
2080
|
-
function create$
|
|
2081
|
+
function create$44(context) {
|
|
2081
2082
|
if (!context.sourceCode.text.includes("Component")) return {};
|
|
2082
2083
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
2083
2084
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -2094,7 +2095,7 @@ function create$43(context) {
|
|
|
2094
2095
|
|
|
2095
2096
|
//#endregion
|
|
2096
2097
|
//#region src/rules/no-clone-element/no-clone-element.ts
|
|
2097
|
-
const RULE_NAME$
|
|
2098
|
+
const RULE_NAME$43 = "no-clone-element";
|
|
2098
2099
|
var no_clone_element_default = createRule({
|
|
2099
2100
|
meta: {
|
|
2100
2101
|
type: "suggestion",
|
|
@@ -2102,11 +2103,11 @@ var no_clone_element_default = createRule({
|
|
|
2102
2103
|
messages: { default: "Using 'cloneElement' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
2103
2104
|
schema: []
|
|
2104
2105
|
},
|
|
2105
|
-
name: RULE_NAME$
|
|
2106
|
-
create: create$
|
|
2106
|
+
name: RULE_NAME$43,
|
|
2107
|
+
create: create$43,
|
|
2107
2108
|
defaultOptions: []
|
|
2108
2109
|
});
|
|
2109
|
-
function create$
|
|
2110
|
+
function create$43(context) {
|
|
2110
2111
|
return defineRuleListener({ CallExpression(node) {
|
|
2111
2112
|
if (core.isCloneElementCall(context, node)) context.report({
|
|
2112
2113
|
messageId: "default",
|
|
@@ -2117,7 +2118,7 @@ function create$42(context) {
|
|
|
2117
2118
|
|
|
2118
2119
|
//#endregion
|
|
2119
2120
|
//#region src/rules/no-component-will-mount/no-component-will-mount.ts
|
|
2120
|
-
const RULE_NAME$
|
|
2121
|
+
const RULE_NAME$42 = "no-component-will-mount";
|
|
2121
2122
|
var no_component_will_mount_default = createRule({
|
|
2122
2123
|
meta: {
|
|
2123
2124
|
type: "problem",
|
|
@@ -2126,11 +2127,11 @@ var no_component_will_mount_default = createRule({
|
|
|
2126
2127
|
messages: { default: "[Deprecated] Use 'UNSAFE_componentWillMount' instead." },
|
|
2127
2128
|
schema: []
|
|
2128
2129
|
},
|
|
2129
|
-
name: RULE_NAME$
|
|
2130
|
-
create: create$
|
|
2130
|
+
name: RULE_NAME$42,
|
|
2131
|
+
create: create$42,
|
|
2131
2132
|
defaultOptions: []
|
|
2132
2133
|
});
|
|
2133
|
-
function create$
|
|
2134
|
+
function create$42(context) {
|
|
2134
2135
|
if (!context.sourceCode.text.includes("componentWillMount")) return {};
|
|
2135
2136
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
2136
2137
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -2150,7 +2151,7 @@ function create$41(context) {
|
|
|
2150
2151
|
|
|
2151
2152
|
//#endregion
|
|
2152
2153
|
//#region src/rules/no-component-will-receive-props/no-component-will-receive-props.ts
|
|
2153
|
-
const RULE_NAME$
|
|
2154
|
+
const RULE_NAME$41 = "no-component-will-receive-props";
|
|
2154
2155
|
var no_component_will_receive_props_default = createRule({
|
|
2155
2156
|
meta: {
|
|
2156
2157
|
type: "problem",
|
|
@@ -2159,11 +2160,11 @@ var no_component_will_receive_props_default = createRule({
|
|
|
2159
2160
|
messages: { default: "[Deprecated] Use 'UNSAFE_componentWillReceiveProps' instead." },
|
|
2160
2161
|
schema: []
|
|
2161
2162
|
},
|
|
2162
|
-
name: RULE_NAME$
|
|
2163
|
-
create: create$
|
|
2163
|
+
name: RULE_NAME$41,
|
|
2164
|
+
create: create$41,
|
|
2164
2165
|
defaultOptions: []
|
|
2165
2166
|
});
|
|
2166
|
-
function create$
|
|
2167
|
+
function create$41(context) {
|
|
2167
2168
|
if (!context.sourceCode.text.includes("componentWillReceiveProps")) return {};
|
|
2168
2169
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
2169
2170
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -2183,7 +2184,7 @@ function create$40(context) {
|
|
|
2183
2184
|
|
|
2184
2185
|
//#endregion
|
|
2185
2186
|
//#region src/rules/no-component-will-update/no-component-will-update.ts
|
|
2186
|
-
const RULE_NAME$
|
|
2187
|
+
const RULE_NAME$40 = "no-component-will-update";
|
|
2187
2188
|
var no_component_will_update_default = createRule({
|
|
2188
2189
|
meta: {
|
|
2189
2190
|
type: "problem",
|
|
@@ -2192,11 +2193,11 @@ var no_component_will_update_default = createRule({
|
|
|
2192
2193
|
messages: { default: "[Deprecated] Use 'UNSAFE_componentWillUpdate' instead." },
|
|
2193
2194
|
schema: []
|
|
2194
2195
|
},
|
|
2195
|
-
name: RULE_NAME$
|
|
2196
|
-
create: create$
|
|
2196
|
+
name: RULE_NAME$40,
|
|
2197
|
+
create: create$40,
|
|
2197
2198
|
defaultOptions: []
|
|
2198
2199
|
});
|
|
2199
|
-
function create$
|
|
2200
|
+
function create$40(context) {
|
|
2200
2201
|
if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
|
|
2201
2202
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
2202
2203
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -2216,7 +2217,7 @@ function create$39(context) {
|
|
|
2216
2217
|
|
|
2217
2218
|
//#endregion
|
|
2218
2219
|
//#region src/rules/no-context-provider/no-context-provider.ts
|
|
2219
|
-
const RULE_NAME$
|
|
2220
|
+
const RULE_NAME$39 = "no-context-provider";
|
|
2220
2221
|
var no_context_provider_default = createRule({
|
|
2221
2222
|
meta: {
|
|
2222
2223
|
type: "suggestion",
|
|
@@ -2229,11 +2230,11 @@ var no_context_provider_default = createRule({
|
|
|
2229
2230
|
},
|
|
2230
2231
|
schema: []
|
|
2231
2232
|
},
|
|
2232
|
-
name: RULE_NAME$
|
|
2233
|
-
create: create$
|
|
2233
|
+
name: RULE_NAME$39,
|
|
2234
|
+
create: create$39,
|
|
2234
2235
|
defaultOptions: []
|
|
2235
2236
|
});
|
|
2236
|
-
function create$
|
|
2237
|
+
function create$39(context) {
|
|
2237
2238
|
if (!context.sourceCode.text.includes("Provider")) return {};
|
|
2238
2239
|
const { version } = getSettingsFromContext(context);
|
|
2239
2240
|
if (compare(version, "19.0.0", "<")) return {};
|
|
@@ -2263,7 +2264,7 @@ function create$38(context) {
|
|
|
2263
2264
|
|
|
2264
2265
|
//#endregion
|
|
2265
2266
|
//#region src/rules/no-create-ref/no-create-ref.ts
|
|
2266
|
-
const RULE_NAME$
|
|
2267
|
+
const RULE_NAME$38 = "no-create-ref";
|
|
2267
2268
|
var no_create_ref_default = createRule({
|
|
2268
2269
|
meta: {
|
|
2269
2270
|
type: "suggestion",
|
|
@@ -2271,11 +2272,11 @@ var no_create_ref_default = createRule({
|
|
|
2271
2272
|
messages: { default: "[Deprecated] Use 'useRef' instead." },
|
|
2272
2273
|
schema: []
|
|
2273
2274
|
},
|
|
2274
|
-
name: RULE_NAME$
|
|
2275
|
-
create: create$
|
|
2275
|
+
name: RULE_NAME$38,
|
|
2276
|
+
create: create$38,
|
|
2276
2277
|
defaultOptions: []
|
|
2277
2278
|
});
|
|
2278
|
-
function create$
|
|
2279
|
+
function create$38(context) {
|
|
2279
2280
|
return defineRuleListener({ CallExpression(node) {
|
|
2280
2281
|
if (core.isCreateRefCall(context, node) && ast.findParentNode(node, core.isClassComponent) == null) context.report({
|
|
2281
2282
|
messageId: "default",
|
|
@@ -2286,7 +2287,7 @@ function create$37(context) {
|
|
|
2286
2287
|
|
|
2287
2288
|
//#endregion
|
|
2288
2289
|
//#region src/rules/no-direct-mutation-state/no-direct-mutation-state.ts
|
|
2289
|
-
const RULE_NAME$
|
|
2290
|
+
const RULE_NAME$37 = "no-direct-mutation-state";
|
|
2290
2291
|
function isConstructorFunction(node) {
|
|
2291
2292
|
return ast.isOneOf([AST_NODE_TYPES.FunctionDeclaration, AST_NODE_TYPES.FunctionExpression])(node) && ast.isMethodOrProperty(node.parent) && node.parent.key.type === AST_NODE_TYPES.Identifier && node.parent.key.name === "constructor";
|
|
2292
2293
|
}
|
|
@@ -2297,11 +2298,11 @@ var no_direct_mutation_state_default = createRule({
|
|
|
2297
2298
|
messages: { default: "Do not mutate state directly. Use 'setState()' instead." },
|
|
2298
2299
|
schema: []
|
|
2299
2300
|
},
|
|
2300
|
-
name: RULE_NAME$
|
|
2301
|
-
create: create$
|
|
2301
|
+
name: RULE_NAME$37,
|
|
2302
|
+
create: create$37,
|
|
2302
2303
|
defaultOptions: []
|
|
2303
2304
|
});
|
|
2304
|
-
function create$
|
|
2305
|
+
function create$37(context) {
|
|
2305
2306
|
return defineRuleListener({ AssignmentExpression(node) {
|
|
2306
2307
|
if (!core.isAssignmentToThisState(node)) return;
|
|
2307
2308
|
const parentClass = ast.findParentNode(node, ast.isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]));
|
|
@@ -2315,7 +2316,7 @@ function create$36(context) {
|
|
|
2315
2316
|
|
|
2316
2317
|
//#endregion
|
|
2317
2318
|
//#region src/rules/no-duplicate-key/no-duplicate-key.ts
|
|
2318
|
-
const RULE_NAME$
|
|
2319
|
+
const RULE_NAME$36 = "no-duplicate-key";
|
|
2319
2320
|
var no_duplicate_key_default = createRule({
|
|
2320
2321
|
meta: {
|
|
2321
2322
|
type: "problem",
|
|
@@ -2323,11 +2324,11 @@ var no_duplicate_key_default = createRule({
|
|
|
2323
2324
|
messages: { default: "The 'key' prop must be unique to its sibling elements." },
|
|
2324
2325
|
schema: []
|
|
2325
2326
|
},
|
|
2326
|
-
name: RULE_NAME$
|
|
2327
|
-
create: create$
|
|
2327
|
+
name: RULE_NAME$36,
|
|
2328
|
+
create: create$36,
|
|
2328
2329
|
defaultOptions: []
|
|
2329
2330
|
});
|
|
2330
|
-
function create$
|
|
2331
|
+
function create$36(context) {
|
|
2331
2332
|
if (!context.sourceCode.text.includes("key=")) return {};
|
|
2332
2333
|
const keyedEntries = /* @__PURE__ */ new Map();
|
|
2333
2334
|
function isKeyValueEqual(a, b) {
|
|
@@ -2382,7 +2383,7 @@ function create$35(context) {
|
|
|
2382
2383
|
|
|
2383
2384
|
//#endregion
|
|
2384
2385
|
//#region src/rules/no-forward-ref/no-forward-ref.ts
|
|
2385
|
-
const RULE_NAME$
|
|
2386
|
+
const RULE_NAME$35 = "no-forward-ref";
|
|
2386
2387
|
var no_forward_ref_default = createRule({
|
|
2387
2388
|
meta: {
|
|
2388
2389
|
type: "suggestion",
|
|
@@ -2395,11 +2396,11 @@ var no_forward_ref_default = createRule({
|
|
|
2395
2396
|
},
|
|
2396
2397
|
schema: []
|
|
2397
2398
|
},
|
|
2398
|
-
name: RULE_NAME$
|
|
2399
|
-
create: create$
|
|
2399
|
+
name: RULE_NAME$35,
|
|
2400
|
+
create: create$35,
|
|
2400
2401
|
defaultOptions: []
|
|
2401
2402
|
});
|
|
2402
|
-
function create$
|
|
2403
|
+
function create$35(context) {
|
|
2403
2404
|
if (!context.sourceCode.text.includes("forwardRef")) return {};
|
|
2404
2405
|
const { version } = getSettingsFromContext(context);
|
|
2405
2406
|
if (compare(version, "19.0.0", "<")) return {};
|
|
@@ -2504,7 +2505,7 @@ function getComponentPropsFixes(context, fixer, node, typeArguments) {
|
|
|
2504
2505
|
|
|
2505
2506
|
//#endregion
|
|
2506
2507
|
//#region src/rules/no-implicit-key/no-implicit-key.ts
|
|
2507
|
-
const RULE_NAME$
|
|
2508
|
+
const RULE_NAME$34 = "no-implicit-key";
|
|
2508
2509
|
var no_implicit_key_default = createRule({
|
|
2509
2510
|
meta: {
|
|
2510
2511
|
type: "problem",
|
|
@@ -2512,11 +2513,11 @@ var no_implicit_key_default = createRule({
|
|
|
2512
2513
|
messages: { default: "This spread attribute implicitly passes the 'key' prop to a component, this could lead to unexpected behavior. If you intend to pass the 'key' prop, use 'key={value}'." },
|
|
2513
2514
|
schema: []
|
|
2514
2515
|
},
|
|
2515
|
-
name: RULE_NAME$
|
|
2516
|
-
create: create$
|
|
2516
|
+
name: RULE_NAME$34,
|
|
2517
|
+
create: create$34,
|
|
2517
2518
|
defaultOptions: []
|
|
2518
2519
|
});
|
|
2519
|
-
function create$
|
|
2520
|
+
function create$34(context) {
|
|
2520
2521
|
const services = ESLintUtils.getParserServices(context, false);
|
|
2521
2522
|
const checker = services.program.getTypeChecker();
|
|
2522
2523
|
return defineRuleListener({ JSXSpreadAttribute(node) {
|
|
@@ -2534,7 +2535,7 @@ function create$33(context) {
|
|
|
2534
2535
|
|
|
2535
2536
|
//#endregion
|
|
2536
2537
|
//#region src/rules/no-leaked-conditional-rendering/no-leaked-conditional-rendering.ts
|
|
2537
|
-
const RULE_NAME$
|
|
2538
|
+
const RULE_NAME$33 = "no-leaked-conditional-rendering";
|
|
2538
2539
|
var no_leaked_conditional_rendering_default = createRule({
|
|
2539
2540
|
meta: {
|
|
2540
2541
|
type: "problem",
|
|
@@ -2542,11 +2543,11 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
2542
2543
|
messages: { default: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes." },
|
|
2543
2544
|
schema: []
|
|
2544
2545
|
},
|
|
2545
|
-
name: RULE_NAME$
|
|
2546
|
-
create: create$
|
|
2546
|
+
name: RULE_NAME$33,
|
|
2547
|
+
create: create$33,
|
|
2547
2548
|
defaultOptions: []
|
|
2548
2549
|
});
|
|
2549
|
-
function create$
|
|
2550
|
+
function create$33(context) {
|
|
2550
2551
|
if (!context.sourceCode.text.includes("&&")) return {};
|
|
2551
2552
|
const { version } = getSettingsFromContext(context);
|
|
2552
2553
|
const allowedVariants = [
|
|
@@ -2603,7 +2604,7 @@ function create$32(context) {
|
|
|
2603
2604
|
|
|
2604
2605
|
//#endregion
|
|
2605
2606
|
//#region src/rules/no-missing-component-display-name/no-missing-component-display-name.ts
|
|
2606
|
-
const RULE_NAME$
|
|
2607
|
+
const RULE_NAME$32 = "no-missing-component-display-name";
|
|
2607
2608
|
var no_missing_component_display_name_default = createRule({
|
|
2608
2609
|
meta: {
|
|
2609
2610
|
type: "suggestion",
|
|
@@ -2611,11 +2612,11 @@ var no_missing_component_display_name_default = createRule({
|
|
|
2611
2612
|
messages: { default: "Add missing 'displayName' for component." },
|
|
2612
2613
|
schema: []
|
|
2613
2614
|
},
|
|
2614
|
-
name: RULE_NAME$
|
|
2615
|
-
create: create$
|
|
2615
|
+
name: RULE_NAME$32,
|
|
2616
|
+
create: create$32,
|
|
2616
2617
|
defaultOptions: []
|
|
2617
2618
|
});
|
|
2618
|
-
function create$
|
|
2619
|
+
function create$32(context) {
|
|
2619
2620
|
if (!context.sourceCode.text.includes("memo") && !context.sourceCode.text.includes("forwardRef")) return {};
|
|
2620
2621
|
const { ctx, visitor } = core.useComponentCollector(context, {
|
|
2621
2622
|
collectDisplayName: true,
|
|
@@ -2637,7 +2638,7 @@ function create$31(context) {
|
|
|
2637
2638
|
|
|
2638
2639
|
//#endregion
|
|
2639
2640
|
//#region src/rules/no-missing-context-display-name/no-missing-context-display-name.ts
|
|
2640
|
-
const RULE_NAME$
|
|
2641
|
+
const RULE_NAME$31 = "no-missing-context-display-name";
|
|
2641
2642
|
var no_missing_context_display_name_default = createRule({
|
|
2642
2643
|
meta: {
|
|
2643
2644
|
type: "suggestion",
|
|
@@ -2646,11 +2647,11 @@ var no_missing_context_display_name_default = createRule({
|
|
|
2646
2647
|
messages: { default: "Add missing 'displayName' for context." },
|
|
2647
2648
|
schema: []
|
|
2648
2649
|
},
|
|
2649
|
-
name: RULE_NAME$
|
|
2650
|
-
create: create$
|
|
2650
|
+
name: RULE_NAME$31,
|
|
2651
|
+
create: create$31,
|
|
2651
2652
|
defaultOptions: []
|
|
2652
2653
|
});
|
|
2653
|
-
function create$
|
|
2654
|
+
function create$31(context) {
|
|
2654
2655
|
if (!context.sourceCode.text.includes("createContext")) return {};
|
|
2655
2656
|
const createCalls = [];
|
|
2656
2657
|
const displayNameAssignments = [];
|
|
@@ -2702,7 +2703,7 @@ function create$30(context) {
|
|
|
2702
2703
|
|
|
2703
2704
|
//#endregion
|
|
2704
2705
|
//#region src/rules/no-missing-key/no-missing-key.ts
|
|
2705
|
-
const RULE_NAME$
|
|
2706
|
+
const RULE_NAME$30 = "no-missing-key";
|
|
2706
2707
|
var no_missing_key_default = createRule({
|
|
2707
2708
|
meta: {
|
|
2708
2709
|
type: "problem",
|
|
@@ -2713,11 +2714,11 @@ var no_missing_key_default = createRule({
|
|
|
2713
2714
|
},
|
|
2714
2715
|
schema: []
|
|
2715
2716
|
},
|
|
2716
|
-
name: RULE_NAME$
|
|
2717
|
-
create: create$
|
|
2717
|
+
name: RULE_NAME$30,
|
|
2718
|
+
create: create$30,
|
|
2718
2719
|
defaultOptions: []
|
|
2719
2720
|
});
|
|
2720
|
-
function create$
|
|
2721
|
+
function create$30(ctx) {
|
|
2721
2722
|
let inChildrenToArray = false;
|
|
2722
2723
|
function check(node) {
|
|
2723
2724
|
if (node.type === AST_NODE_TYPES.JSXElement) return core.getJsxAttribute(ctx, node)("key") == null ? {
|
|
@@ -2788,7 +2789,7 @@ function create$29(ctx) {
|
|
|
2788
2789
|
|
|
2789
2790
|
//#endregion
|
|
2790
2791
|
//#region src/rules/no-misused-capture-owner-stack/no-misused-capture-owner-stack.ts
|
|
2791
|
-
const RULE_NAME$
|
|
2792
|
+
const RULE_NAME$29 = "no-misused-capture-owner-stack";
|
|
2792
2793
|
var no_misused_capture_owner_stack_default = createRule({
|
|
2793
2794
|
meta: {
|
|
2794
2795
|
type: "problem",
|
|
@@ -2799,11 +2800,11 @@ var no_misused_capture_owner_stack_default = createRule({
|
|
|
2799
2800
|
},
|
|
2800
2801
|
schema: []
|
|
2801
2802
|
},
|
|
2802
|
-
name: RULE_NAME$
|
|
2803
|
-
create: create$
|
|
2803
|
+
name: RULE_NAME$29,
|
|
2804
|
+
create: create$29,
|
|
2804
2805
|
defaultOptions: []
|
|
2805
2806
|
});
|
|
2806
|
-
function create$
|
|
2807
|
+
function create$29(context) {
|
|
2807
2808
|
if (!context.sourceCode.text.includes("captureOwnerStack")) return {};
|
|
2808
2809
|
const { importSource } = getSettingsFromContext(context);
|
|
2809
2810
|
return defineRuleListener({
|
|
@@ -2834,7 +2835,7 @@ function isDevelopmentOnlyCheck(node) {
|
|
|
2834
2835
|
|
|
2835
2836
|
//#endregion
|
|
2836
2837
|
//#region src/rules/no-nested-component-definitions/no-nested-component-definitions.ts
|
|
2837
|
-
const RULE_NAME$
|
|
2838
|
+
const RULE_NAME$28 = "no-nested-component-definitions";
|
|
2838
2839
|
var no_nested_component_definitions_default = createRule({
|
|
2839
2840
|
meta: {
|
|
2840
2841
|
type: "problem",
|
|
@@ -2842,11 +2843,11 @@ var no_nested_component_definitions_default = createRule({
|
|
|
2842
2843
|
messages: { default: "Do not nest component definitions inside other components or props. {{suggestion}}" },
|
|
2843
2844
|
schema: []
|
|
2844
2845
|
},
|
|
2845
|
-
name: RULE_NAME$
|
|
2846
|
-
create: create$
|
|
2846
|
+
name: RULE_NAME$28,
|
|
2847
|
+
create: create$28,
|
|
2847
2848
|
defaultOptions: []
|
|
2848
2849
|
});
|
|
2849
|
-
function create$
|
|
2850
|
+
function create$28(context) {
|
|
2850
2851
|
const hint = core.ComponentDetectionHint.DoNotIncludeJsxWithNumberValue | core.ComponentDetectionHint.DoNotIncludeJsxWithBooleanValue | core.ComponentDetectionHint.DoNotIncludeJsxWithNullValue | core.ComponentDetectionHint.DoNotIncludeJsxWithStringValue | core.ComponentDetectionHint.DoNotIncludeJsxWithUndefinedValue | core.ComponentDetectionHint.RequireBothSidesOfLogicalExpressionToBeJsx | core.ComponentDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJsx | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedInArrayPattern | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedInArrayExpression | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayMapCallback;
|
|
2851
2852
|
const fCollector = core.useComponentCollector(context, { hint });
|
|
2852
2853
|
const cCollector = core.useComponentCollectorLegacy(context);
|
|
@@ -2950,7 +2951,7 @@ function isInsideCreateElementProps(context, node) {
|
|
|
2950
2951
|
|
|
2951
2952
|
//#endregion
|
|
2952
2953
|
//#region src/rules/no-nested-lazy-component-declarations/no-nested-lazy-component-declarations.ts
|
|
2953
|
-
const RULE_NAME$
|
|
2954
|
+
const RULE_NAME$27 = "no-nested-lazy-component-declarations";
|
|
2954
2955
|
var no_nested_lazy_component_declarations_default = createRule({
|
|
2955
2956
|
meta: {
|
|
2956
2957
|
type: "problem",
|
|
@@ -2958,11 +2959,11 @@ var no_nested_lazy_component_declarations_default = createRule({
|
|
|
2958
2959
|
messages: { default: "Do not declare lazy components inside other components. Instead, always declare them at the top level of your module." },
|
|
2959
2960
|
schema: []
|
|
2960
2961
|
},
|
|
2961
|
-
name: RULE_NAME$
|
|
2962
|
-
create: create$
|
|
2962
|
+
name: RULE_NAME$27,
|
|
2963
|
+
create: create$27,
|
|
2963
2964
|
defaultOptions: []
|
|
2964
2965
|
});
|
|
2965
|
-
function create$
|
|
2966
|
+
function create$27(context) {
|
|
2966
2967
|
const hint = core.ComponentDetectionHint.None;
|
|
2967
2968
|
const collector = core.useComponentCollector(context, { hint });
|
|
2968
2969
|
const collectorLegacy = core.useComponentCollectorLegacy(context);
|
|
@@ -2991,7 +2992,7 @@ function create$26(context) {
|
|
|
2991
2992
|
|
|
2992
2993
|
//#endregion
|
|
2993
2994
|
//#region src/rules/no-redundant-should-component-update/no-redundant-should-component-update.ts
|
|
2994
|
-
const RULE_NAME$
|
|
2995
|
+
const RULE_NAME$26 = "no-redundant-should-component-update";
|
|
2995
2996
|
function isShouldComponentUpdate(node) {
|
|
2996
2997
|
return ast.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
|
|
2997
2998
|
}
|
|
@@ -3002,11 +3003,11 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
3002
3003
|
messages: { default: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'." },
|
|
3003
3004
|
schema: []
|
|
3004
3005
|
},
|
|
3005
|
-
name: RULE_NAME$
|
|
3006
|
-
create: create$
|
|
3006
|
+
name: RULE_NAME$26,
|
|
3007
|
+
create: create$26,
|
|
3007
3008
|
defaultOptions: []
|
|
3008
3009
|
});
|
|
3009
|
-
function create$
|
|
3010
|
+
function create$26(context) {
|
|
3010
3011
|
if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
|
|
3011
3012
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
3012
3013
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -3024,7 +3025,7 @@ function create$25(context) {
|
|
|
3024
3025
|
|
|
3025
3026
|
//#endregion
|
|
3026
3027
|
//#region src/rules/no-set-state-in-component-did-mount/no-set-state-in-component-did-mount.ts
|
|
3027
|
-
const RULE_NAME$
|
|
3028
|
+
const RULE_NAME$25 = "no-set-state-in-component-did-mount";
|
|
3028
3029
|
var no_set_state_in_component_did_mount_default = createRule({
|
|
3029
3030
|
meta: {
|
|
3030
3031
|
type: "problem",
|
|
@@ -3032,11 +3033,11 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
3032
3033
|
messages: { default: "Do not call `this.setState` in `componentDidMount` outside functions such as callbacks." },
|
|
3033
3034
|
schema: []
|
|
3034
3035
|
},
|
|
3035
|
-
name: RULE_NAME$
|
|
3036
|
-
create: create$
|
|
3036
|
+
name: RULE_NAME$25,
|
|
3037
|
+
create: create$25,
|
|
3037
3038
|
defaultOptions: []
|
|
3038
3039
|
});
|
|
3039
|
-
function create$
|
|
3040
|
+
function create$25(context) {
|
|
3040
3041
|
if (!context.sourceCode.text.includes("componentDidMount")) return {};
|
|
3041
3042
|
return defineRuleListener({ CallExpression(node) {
|
|
3042
3043
|
if (!core.isThisSetState(node)) return;
|
|
@@ -3054,7 +3055,7 @@ function create$24(context) {
|
|
|
3054
3055
|
|
|
3055
3056
|
//#endregion
|
|
3056
3057
|
//#region src/rules/no-set-state-in-component-did-update/no-set-state-in-component-did-update.ts
|
|
3057
|
-
const RULE_NAME$
|
|
3058
|
+
const RULE_NAME$24 = "no-set-state-in-component-did-update";
|
|
3058
3059
|
var no_set_state_in_component_did_update_default = createRule({
|
|
3059
3060
|
meta: {
|
|
3060
3061
|
type: "problem",
|
|
@@ -3062,11 +3063,11 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
3062
3063
|
messages: { default: "Do not call `this.setState` in `componentDidUpdate` outside functions such as callbacks." },
|
|
3063
3064
|
schema: []
|
|
3064
3065
|
},
|
|
3065
|
-
name: RULE_NAME$
|
|
3066
|
-
create: create$
|
|
3066
|
+
name: RULE_NAME$24,
|
|
3067
|
+
create: create$24,
|
|
3067
3068
|
defaultOptions: []
|
|
3068
3069
|
});
|
|
3069
|
-
function create$
|
|
3070
|
+
function create$24(context) {
|
|
3070
3071
|
if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
|
|
3071
3072
|
return defineRuleListener({ CallExpression(node) {
|
|
3072
3073
|
if (!core.isThisSetState(node)) return;
|
|
@@ -3084,7 +3085,7 @@ function create$23(context) {
|
|
|
3084
3085
|
|
|
3085
3086
|
//#endregion
|
|
3086
3087
|
//#region src/rules/no-set-state-in-component-will-update/no-set-state-in-component-will-update.ts
|
|
3087
|
-
const RULE_NAME$
|
|
3088
|
+
const RULE_NAME$23 = "no-set-state-in-component-will-update";
|
|
3088
3089
|
var no_set_state_in_component_will_update_default = createRule({
|
|
3089
3090
|
meta: {
|
|
3090
3091
|
type: "problem",
|
|
@@ -3092,11 +3093,11 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
3092
3093
|
messages: { default: "Do not call `this.setState` in `componentWillUpdate` outside functions such as callbacks." },
|
|
3093
3094
|
schema: []
|
|
3094
3095
|
},
|
|
3095
|
-
name: RULE_NAME$
|
|
3096
|
-
create: create$
|
|
3096
|
+
name: RULE_NAME$23,
|
|
3097
|
+
create: create$23,
|
|
3097
3098
|
defaultOptions: []
|
|
3098
3099
|
});
|
|
3099
|
-
function create$
|
|
3100
|
+
function create$23(context) {
|
|
3100
3101
|
if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
|
|
3101
3102
|
return defineRuleListener({ CallExpression(node) {
|
|
3102
3103
|
if (!core.isThisSetState(node)) return;
|
|
@@ -3114,7 +3115,7 @@ function create$22(context) {
|
|
|
3114
3115
|
|
|
3115
3116
|
//#endregion
|
|
3116
3117
|
//#region src/rules/no-unnecessary-use-callback/no-unnecessary-use-callback.ts
|
|
3117
|
-
const RULE_NAME$
|
|
3118
|
+
const RULE_NAME$22 = "no-unnecessary-use-callback";
|
|
3118
3119
|
var no_unnecessary_use_callback_default = createRule({
|
|
3119
3120
|
meta: {
|
|
3120
3121
|
type: "suggestion",
|
|
@@ -3125,11 +3126,11 @@ var no_unnecessary_use_callback_default = createRule({
|
|
|
3125
3126
|
},
|
|
3126
3127
|
schema: []
|
|
3127
3128
|
},
|
|
3128
|
-
name: RULE_NAME$
|
|
3129
|
-
create: create$
|
|
3129
|
+
name: RULE_NAME$22,
|
|
3130
|
+
create: create$22,
|
|
3130
3131
|
defaultOptions: []
|
|
3131
3132
|
});
|
|
3132
|
-
function create$
|
|
3133
|
+
function create$22(context) {
|
|
3133
3134
|
if (!context.sourceCode.text.includes("useCallback")) return {};
|
|
3134
3135
|
return defineRuleListener({ VariableDeclarator(node) {
|
|
3135
3136
|
const { id, init } = node;
|
|
@@ -3194,7 +3195,7 @@ function checkForUsageInsideUseEffect$1(sourceCode, node) {
|
|
|
3194
3195
|
|
|
3195
3196
|
//#endregion
|
|
3196
3197
|
//#region src/rules/no-unnecessary-use-memo/no-unnecessary-use-memo.ts
|
|
3197
|
-
const RULE_NAME$
|
|
3198
|
+
const RULE_NAME$21 = "no-unnecessary-use-memo";
|
|
3198
3199
|
var no_unnecessary_use_memo_default = createRule({
|
|
3199
3200
|
meta: {
|
|
3200
3201
|
type: "suggestion",
|
|
@@ -3205,11 +3206,11 @@ var no_unnecessary_use_memo_default = createRule({
|
|
|
3205
3206
|
},
|
|
3206
3207
|
schema: []
|
|
3207
3208
|
},
|
|
3208
|
-
name: RULE_NAME$
|
|
3209
|
-
create: create$
|
|
3209
|
+
name: RULE_NAME$21,
|
|
3210
|
+
create: create$21,
|
|
3210
3211
|
defaultOptions: []
|
|
3211
3212
|
});
|
|
3212
|
-
function create$
|
|
3213
|
+
function create$21(context) {
|
|
3213
3214
|
if (!context.sourceCode.text.includes("useMemo")) return {};
|
|
3214
3215
|
return defineRuleListener({ VariableDeclarator(node) {
|
|
3215
3216
|
const { id, init } = node;
|
|
@@ -3278,7 +3279,7 @@ function checkForUsageInsideUseEffect(sourceCode, node) {
|
|
|
3278
3279
|
|
|
3279
3280
|
//#endregion
|
|
3280
3281
|
//#region src/rules/no-unnecessary-use-prefix/no-unnecessary-use-prefix.ts
|
|
3281
|
-
const RULE_NAME$
|
|
3282
|
+
const RULE_NAME$20 = "no-unnecessary-use-prefix";
|
|
3282
3283
|
const WELL_KNOWN_HOOKS = ["useMDXComponents"];
|
|
3283
3284
|
function containsUseComments(context, node) {
|
|
3284
3285
|
return context.sourceCode.getCommentsInside(node).some(({ value }) => /use\([\s\S]*?\)/u.test(value) || /use[A-Z0-9]\w*\([\s\S]*?\)/u.test(value));
|
|
@@ -3290,11 +3291,11 @@ var no_unnecessary_use_prefix_default = createRule({
|
|
|
3290
3291
|
messages: { default: "If your function doesn't call any Hooks, avoid the 'use' prefix. Instead, write it as a regular function without the 'use' prefix." },
|
|
3291
3292
|
schema: []
|
|
3292
3293
|
},
|
|
3293
|
-
name: RULE_NAME$
|
|
3294
|
-
create: create$
|
|
3294
|
+
name: RULE_NAME$20,
|
|
3295
|
+
create: create$20,
|
|
3295
3296
|
defaultOptions: []
|
|
3296
3297
|
});
|
|
3297
|
-
function create$
|
|
3298
|
+
function create$20(context) {
|
|
3298
3299
|
const { ctx, visitor } = core.useHookCollector(context);
|
|
3299
3300
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
3300
3301
|
for (const { id, name, hookCalls, node } of ctx.getAllHooks(program)) {
|
|
@@ -3314,7 +3315,7 @@ function create$19(context) {
|
|
|
3314
3315
|
|
|
3315
3316
|
//#endregion
|
|
3316
3317
|
//#region src/rules/no-unsafe-component-will-mount/no-unsafe-component-will-mount.ts
|
|
3317
|
-
const RULE_NAME$
|
|
3318
|
+
const RULE_NAME$19 = "no-unsafe-component-will-mount";
|
|
3318
3319
|
var no_unsafe_component_will_mount_default = createRule({
|
|
3319
3320
|
meta: {
|
|
3320
3321
|
type: "problem",
|
|
@@ -3322,11 +3323,11 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
3322
3323
|
messages: { default: "Do not use 'UNSAFE_componentWillMount'." },
|
|
3323
3324
|
schema: []
|
|
3324
3325
|
},
|
|
3325
|
-
name: RULE_NAME$
|
|
3326
|
-
create: create$
|
|
3326
|
+
name: RULE_NAME$19,
|
|
3327
|
+
create: create$19,
|
|
3327
3328
|
defaultOptions: []
|
|
3328
3329
|
});
|
|
3329
|
-
function create$
|
|
3330
|
+
function create$19(context) {
|
|
3330
3331
|
if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
|
|
3331
3332
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
3332
3333
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -3342,7 +3343,7 @@ function create$18(context) {
|
|
|
3342
3343
|
|
|
3343
3344
|
//#endregion
|
|
3344
3345
|
//#region src/rules/no-unsafe-component-will-receive-props/no-unsafe-component-will-receive-props.ts
|
|
3345
|
-
const RULE_NAME$
|
|
3346
|
+
const RULE_NAME$18 = "no-unsafe-component-will-receive-props";
|
|
3346
3347
|
var no_unsafe_component_will_receive_props_default = createRule({
|
|
3347
3348
|
meta: {
|
|
3348
3349
|
type: "problem",
|
|
@@ -3350,11 +3351,11 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
3350
3351
|
messages: { default: "Do not use 'UNSAFE_componentWillReceiveProps'." },
|
|
3351
3352
|
schema: []
|
|
3352
3353
|
},
|
|
3353
|
-
name: RULE_NAME$
|
|
3354
|
-
create: create$
|
|
3354
|
+
name: RULE_NAME$18,
|
|
3355
|
+
create: create$18,
|
|
3355
3356
|
defaultOptions: []
|
|
3356
3357
|
});
|
|
3357
|
-
function create$
|
|
3358
|
+
function create$18(context) {
|
|
3358
3359
|
if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) return {};
|
|
3359
3360
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
3360
3361
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -3370,7 +3371,7 @@ function create$17(context) {
|
|
|
3370
3371
|
|
|
3371
3372
|
//#endregion
|
|
3372
3373
|
//#region src/rules/no-unsafe-component-will-update/no-unsafe-component-will-update.ts
|
|
3373
|
-
const RULE_NAME$
|
|
3374
|
+
const RULE_NAME$17 = "no-unsafe-component-will-update";
|
|
3374
3375
|
var no_unsafe_component_will_update_default = createRule({
|
|
3375
3376
|
meta: {
|
|
3376
3377
|
type: "problem",
|
|
@@ -3378,11 +3379,11 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
3378
3379
|
messages: { default: "Do not use 'UNSAFE_componentWillUpdate'." },
|
|
3379
3380
|
schema: []
|
|
3380
3381
|
},
|
|
3381
|
-
name: RULE_NAME$
|
|
3382
|
-
create: create$
|
|
3382
|
+
name: RULE_NAME$17,
|
|
3383
|
+
create: create$17,
|
|
3383
3384
|
defaultOptions: []
|
|
3384
3385
|
});
|
|
3385
|
-
function create$
|
|
3386
|
+
function create$17(context) {
|
|
3386
3387
|
if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
|
|
3387
3388
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
3388
3389
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -3398,7 +3399,7 @@ function create$16(context) {
|
|
|
3398
3399
|
|
|
3399
3400
|
//#endregion
|
|
3400
3401
|
//#region src/rules/no-unstable-context-value/no-unstable-context-value.ts
|
|
3401
|
-
const RULE_NAME$
|
|
3402
|
+
const RULE_NAME$16 = "no-unstable-context-value";
|
|
3402
3403
|
var no_unstable_context_value_default = createRule({
|
|
3403
3404
|
meta: {
|
|
3404
3405
|
type: "problem",
|
|
@@ -3406,11 +3407,11 @@ var no_unstable_context_value_default = createRule({
|
|
|
3406
3407
|
messages: { unstableContextValue: "A/an '{{kind}}' passed as the value prop to the context provider should not be constructed. It will change on every render. {{suggestion}}" },
|
|
3407
3408
|
schema: []
|
|
3408
3409
|
},
|
|
3409
|
-
name: RULE_NAME$
|
|
3410
|
-
create: create$
|
|
3410
|
+
name: RULE_NAME$16,
|
|
3411
|
+
create: create$16,
|
|
3411
3412
|
defaultOptions: []
|
|
3412
3413
|
});
|
|
3413
|
-
function create$
|
|
3414
|
+
function create$16(context) {
|
|
3414
3415
|
const { compilationMode, version } = getSettingsFromContext(context);
|
|
3415
3416
|
if (compilationMode === "infer" || compilationMode === "all") return {};
|
|
3416
3417
|
if (compilationMode === "annotation" && ast.isDirectiveInFile(context.sourceCode.ast, "use memo")) return {};
|
|
@@ -3462,7 +3463,7 @@ function isContextName(name, isReact18OrBelow) {
|
|
|
3462
3463
|
|
|
3463
3464
|
//#endregion
|
|
3464
3465
|
//#region src/rules/no-unstable-default-props/no-unstable-default-props.ts
|
|
3465
|
-
const RULE_NAME$
|
|
3466
|
+
const RULE_NAME$15 = "no-unstable-default-props";
|
|
3466
3467
|
const defaultOptions$2 = [{ safeDefaultProps: [] }];
|
|
3467
3468
|
const schema$2 = [{
|
|
3468
3469
|
type: "object",
|
|
@@ -3479,8 +3480,8 @@ var no_unstable_default_props_default = createRule({
|
|
|
3479
3480
|
messages: { default: "A/an '{{kind}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{kind}}'." },
|
|
3480
3481
|
schema: schema$2
|
|
3481
3482
|
},
|
|
3482
|
-
name: RULE_NAME$
|
|
3483
|
-
create: create$
|
|
3483
|
+
name: RULE_NAME$15,
|
|
3484
|
+
create: create$15,
|
|
3484
3485
|
defaultOptions: defaultOptions$2
|
|
3485
3486
|
});
|
|
3486
3487
|
function extractIdentifier(node) {
|
|
@@ -3491,7 +3492,7 @@ function extractIdentifier(node) {
|
|
|
3491
3492
|
}
|
|
3492
3493
|
return null;
|
|
3493
3494
|
}
|
|
3494
|
-
function create$
|
|
3495
|
+
function create$15(context, [options]) {
|
|
3495
3496
|
const { compilationMode } = getSettingsFromContext(context);
|
|
3496
3497
|
if (compilationMode === "infer" || compilationMode === "all") return {};
|
|
3497
3498
|
if (compilationMode === "annotation" && ast.isDirectiveInFile(context.sourceCode.ast, "use memo")) return {};
|
|
@@ -3537,7 +3538,7 @@ function create$14(context, [options]) {
|
|
|
3537
3538
|
|
|
3538
3539
|
//#endregion
|
|
3539
3540
|
//#region src/rules/no-unused-class-component-members/no-unused-class-component-members.ts
|
|
3540
|
-
const RULE_NAME$
|
|
3541
|
+
const RULE_NAME$14 = "no-unused-class-component-members";
|
|
3541
3542
|
const LIFECYCLE_METHODS = new Set([
|
|
3542
3543
|
"componentDidCatch",
|
|
3543
3544
|
"componentDidMount",
|
|
@@ -3568,11 +3569,11 @@ var no_unused_class_component_members_default = createRule({
|
|
|
3568
3569
|
messages: { default: "Unused method or property '{{methodName}}'' of class '{{className}}'." },
|
|
3569
3570
|
schema: []
|
|
3570
3571
|
},
|
|
3571
|
-
name: RULE_NAME$
|
|
3572
|
-
create: create$
|
|
3572
|
+
name: RULE_NAME$14,
|
|
3573
|
+
create: create$14,
|
|
3573
3574
|
defaultOptions: []
|
|
3574
3575
|
});
|
|
3575
|
-
function create$
|
|
3576
|
+
function create$14(context) {
|
|
3576
3577
|
const classStack = [];
|
|
3577
3578
|
const methodStack = [];
|
|
3578
3579
|
const propertyDefs = /* @__PURE__ */ new WeakMap();
|
|
@@ -3653,7 +3654,7 @@ function create$13(context) {
|
|
|
3653
3654
|
|
|
3654
3655
|
//#endregion
|
|
3655
3656
|
//#region src/rules/no-unused-props/no-unused-props.ts
|
|
3656
|
-
const RULE_NAME$
|
|
3657
|
+
const RULE_NAME$13 = "no-unused-props";
|
|
3657
3658
|
var no_unused_props_default = createRule({
|
|
3658
3659
|
meta: {
|
|
3659
3660
|
type: "suggestion",
|
|
@@ -3661,11 +3662,11 @@ var no_unused_props_default = createRule({
|
|
|
3661
3662
|
messages: { default: "Prop `{{name}}` is declared but never used" },
|
|
3662
3663
|
schema: []
|
|
3663
3664
|
},
|
|
3664
|
-
name: RULE_NAME$
|
|
3665
|
-
create: create$
|
|
3665
|
+
name: RULE_NAME$13,
|
|
3666
|
+
create: create$13,
|
|
3666
3667
|
defaultOptions: []
|
|
3667
3668
|
});
|
|
3668
|
-
function create$
|
|
3669
|
+
function create$13(context) {
|
|
3669
3670
|
const services = ESLintUtils.getParserServices(context, false);
|
|
3670
3671
|
const checker = services.program.getTypeChecker();
|
|
3671
3672
|
const { ctx, visitor } = core.useComponentCollector(context);
|
|
@@ -3765,7 +3766,7 @@ function reportUnusedProp(context, services, prop) {
|
|
|
3765
3766
|
|
|
3766
3767
|
//#endregion
|
|
3767
3768
|
//#region src/rules/no-unused-state/no-unused-state.ts
|
|
3768
|
-
const RULE_NAME$
|
|
3769
|
+
const RULE_NAME$12 = "no-unused-state";
|
|
3769
3770
|
function isKeyLiteral(node, key) {
|
|
3770
3771
|
return match(key).with({ type: AST_NODE_TYPES.Literal }, constTrue).with({
|
|
3771
3772
|
type: AST_NODE_TYPES.TemplateLiteral,
|
|
@@ -3779,11 +3780,11 @@ var no_unused_state_default = createRule({
|
|
|
3779
3780
|
messages: { default: "Unused class component state in '{{className}}'" },
|
|
3780
3781
|
schema: []
|
|
3781
3782
|
},
|
|
3782
|
-
name: RULE_NAME$
|
|
3783
|
-
create: create$
|
|
3783
|
+
name: RULE_NAME$12,
|
|
3784
|
+
create: create$12,
|
|
3784
3785
|
defaultOptions: []
|
|
3785
3786
|
});
|
|
3786
|
-
function create$
|
|
3787
|
+
function create$12(context) {
|
|
3787
3788
|
const classStack = [];
|
|
3788
3789
|
const methodStack = [];
|
|
3789
3790
|
const constructorStack = [];
|
|
@@ -3892,7 +3893,7 @@ function create$11(context) {
|
|
|
3892
3893
|
|
|
3893
3894
|
//#endregion
|
|
3894
3895
|
//#region src/rules/no-use-context/no-use-context.ts
|
|
3895
|
-
const RULE_NAME$
|
|
3896
|
+
const RULE_NAME$11 = "no-use-context";
|
|
3896
3897
|
var no_use_context_default = createRule({
|
|
3897
3898
|
meta: {
|
|
3898
3899
|
type: "suggestion",
|
|
@@ -3905,11 +3906,11 @@ var no_use_context_default = createRule({
|
|
|
3905
3906
|
},
|
|
3906
3907
|
schema: []
|
|
3907
3908
|
},
|
|
3908
|
-
name: RULE_NAME$
|
|
3909
|
-
create: create$
|
|
3909
|
+
name: RULE_NAME$11,
|
|
3910
|
+
create: create$11,
|
|
3910
3911
|
defaultOptions: []
|
|
3911
3912
|
});
|
|
3912
|
-
function create$
|
|
3913
|
+
function create$11(context) {
|
|
3913
3914
|
if (!context.sourceCode.text.includes("useContext")) return {};
|
|
3914
3915
|
const { version } = getSettingsFromContext(context);
|
|
3915
3916
|
if (compare(version, "19.0.0", "<")) return {};
|
|
@@ -3934,7 +3935,7 @@ function create$10(context) {
|
|
|
3934
3935
|
|
|
3935
3936
|
//#endregion
|
|
3936
3937
|
//#region src/rules/no-useless-fragment/no-useless-fragment.ts
|
|
3937
|
-
const RULE_NAME$
|
|
3938
|
+
const RULE_NAME$10 = "no-useless-fragment";
|
|
3938
3939
|
const defaultOptions$1 = [{
|
|
3939
3940
|
allowEmptyFragment: false,
|
|
3940
3941
|
allowExpressions: true
|
|
@@ -3962,11 +3963,11 @@ var no_useless_fragment_default = createRule({
|
|
|
3962
3963
|
messages: { default: "A fragment {{reason}} is useless." },
|
|
3963
3964
|
schema: schema$1
|
|
3964
3965
|
},
|
|
3965
|
-
name: RULE_NAME$
|
|
3966
|
-
create: create$
|
|
3966
|
+
name: RULE_NAME$10,
|
|
3967
|
+
create: create$10,
|
|
3967
3968
|
defaultOptions: defaultOptions$1
|
|
3968
3969
|
});
|
|
3969
|
-
function create$
|
|
3970
|
+
function create$10(context, [option]) {
|
|
3970
3971
|
const { allowEmptyFragment = false, allowExpressions = true } = option;
|
|
3971
3972
|
const jsxConfig = {
|
|
3972
3973
|
...core.getJsxConfigFromContext(context),
|
|
@@ -4075,7 +4076,7 @@ function trimLikeReact(text) {
|
|
|
4075
4076
|
|
|
4076
4077
|
//#endregion
|
|
4077
4078
|
//#region src/rules/prefer-destructuring-assignment/prefer-destructuring-assignment.ts
|
|
4078
|
-
const RULE_NAME$
|
|
4079
|
+
const RULE_NAME$9 = "prefer-destructuring-assignment";
|
|
4079
4080
|
var prefer_destructuring_assignment_default = createRule({
|
|
4080
4081
|
meta: {
|
|
4081
4082
|
type: "suggestion",
|
|
@@ -4083,11 +4084,11 @@ var prefer_destructuring_assignment_default = createRule({
|
|
|
4083
4084
|
messages: { default: "Use destructuring assignment for component props." },
|
|
4084
4085
|
schema: []
|
|
4085
4086
|
},
|
|
4086
|
-
name: RULE_NAME$
|
|
4087
|
-
create: create$
|
|
4087
|
+
name: RULE_NAME$9,
|
|
4088
|
+
create: create$9,
|
|
4088
4089
|
defaultOptions: []
|
|
4089
4090
|
});
|
|
4090
|
-
function create$
|
|
4091
|
+
function create$9(context) {
|
|
4091
4092
|
const { ctx, visitor } = core.useComponentCollector(context);
|
|
4092
4093
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
4093
4094
|
for (const component of ctx.getAllComponents(program)) {
|
|
@@ -4111,7 +4112,7 @@ function create$8(context) {
|
|
|
4111
4112
|
|
|
4112
4113
|
//#endregion
|
|
4113
4114
|
//#region src/rules/prefer-namespace-import/prefer-namespace-import.ts
|
|
4114
|
-
const RULE_NAME$
|
|
4115
|
+
const RULE_NAME$8 = "prefer-namespace-import";
|
|
4115
4116
|
var prefer_namespace_import_default = createRule({
|
|
4116
4117
|
meta: {
|
|
4117
4118
|
type: "suggestion",
|
|
@@ -4120,11 +4121,11 @@ var prefer_namespace_import_default = createRule({
|
|
|
4120
4121
|
messages: { default: "Prefer importing React as 'import * as React from \"{{importSource}}\"';" },
|
|
4121
4122
|
schema: []
|
|
4122
4123
|
},
|
|
4123
|
-
name: RULE_NAME$
|
|
4124
|
-
create: create$
|
|
4124
|
+
name: RULE_NAME$8,
|
|
4125
|
+
create: create$8,
|
|
4125
4126
|
defaultOptions: []
|
|
4126
4127
|
});
|
|
4127
|
-
function create$
|
|
4128
|
+
function create$8(context) {
|
|
4128
4129
|
const { importSource } = getSettingsFromContext(context);
|
|
4129
4130
|
return defineRuleListener({ [`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
|
|
4130
4131
|
const hasOtherSpecifiers = node.parent.specifiers.length > 1;
|
|
@@ -4148,7 +4149,7 @@ function create$7(context) {
|
|
|
4148
4149
|
|
|
4149
4150
|
//#endregion
|
|
4150
4151
|
//#region src/rules/purity/purity.ts
|
|
4151
|
-
const RULE_NAME$
|
|
4152
|
+
const RULE_NAME$7 = "purity";
|
|
4152
4153
|
var purity_default = createRule({
|
|
4153
4154
|
meta: {
|
|
4154
4155
|
type: "problem",
|
|
@@ -4156,11 +4157,11 @@ var purity_default = createRule({
|
|
|
4156
4157
|
messages: { default: "Do not call '{{name}}' during render. Components and hooks must be pure. Move this call into an event handler, effect, or state initializer." },
|
|
4157
4158
|
schema: []
|
|
4158
4159
|
},
|
|
4159
|
-
name: RULE_NAME$
|
|
4160
|
-
create: create$
|
|
4160
|
+
name: RULE_NAME$7,
|
|
4161
|
+
create: create$7,
|
|
4161
4162
|
defaultOptions: []
|
|
4162
4163
|
});
|
|
4163
|
-
function create$
|
|
4164
|
+
function create$7(context) {
|
|
4164
4165
|
const hCollector = core.useHookCollector(context);
|
|
4165
4166
|
const cCollector = core.useComponentCollector(context);
|
|
4166
4167
|
const cExprs = [];
|
|
@@ -4211,7 +4212,7 @@ function create$6(context) {
|
|
|
4211
4212
|
|
|
4212
4213
|
//#endregion
|
|
4213
4214
|
//#region src/rules/refs/refs.ts
|
|
4214
|
-
const RULE_NAME$
|
|
4215
|
+
const RULE_NAME$6 = "refs";
|
|
4215
4216
|
var refs_default = createRule({
|
|
4216
4217
|
meta: {
|
|
4217
4218
|
type: "problem",
|
|
@@ -4222,11 +4223,11 @@ var refs_default = createRule({
|
|
|
4222
4223
|
},
|
|
4223
4224
|
schema: []
|
|
4224
4225
|
},
|
|
4225
|
-
name: RULE_NAME$
|
|
4226
|
-
create: create$
|
|
4226
|
+
name: RULE_NAME$6,
|
|
4227
|
+
create: create$6,
|
|
4227
4228
|
defaultOptions: []
|
|
4228
4229
|
});
|
|
4229
|
-
function create$
|
|
4230
|
+
function create$6(context) {
|
|
4230
4231
|
const hCollector = core.useHookCollector(context);
|
|
4231
4232
|
const cCollector = core.useComponentCollector(context);
|
|
4232
4233
|
const refAccesses = [];
|
|
@@ -6487,7 +6488,7 @@ function last(array) {
|
|
|
6487
6488
|
|
|
6488
6489
|
//#endregion
|
|
6489
6490
|
//#region src/rules/set-state-in-effect/set-state-in-effect.ts
|
|
6490
|
-
const RULE_NAME$
|
|
6491
|
+
const RULE_NAME$5 = "set-state-in-effect";
|
|
6491
6492
|
var set_state_in_effect_default = createRule({
|
|
6492
6493
|
meta: {
|
|
6493
6494
|
type: "problem",
|
|
@@ -6495,11 +6496,11 @@ var set_state_in_effect_default = createRule({
|
|
|
6495
6496
|
messages: { default: "Do not call the 'set' function '{{name}}' of 'useState' synchronously in an effect. This can lead to unnecessary re-renders and performance issues." },
|
|
6496
6497
|
schema: []
|
|
6497
6498
|
},
|
|
6498
|
-
name: RULE_NAME$
|
|
6499
|
-
create: create$
|
|
6499
|
+
name: RULE_NAME$5,
|
|
6500
|
+
create: create$5,
|
|
6500
6501
|
defaultOptions: []
|
|
6501
6502
|
});
|
|
6502
|
-
function create$
|
|
6503
|
+
function create$5(context) {
|
|
6503
6504
|
if (!/use\w*Effect/u.test(context.sourceCode.text)) return {};
|
|
6504
6505
|
const { additionalStateHooks } = getSettingsFromContext(context);
|
|
6505
6506
|
const functionEntries = [];
|
|
@@ -6705,7 +6706,7 @@ function create$4(context) {
|
|
|
6705
6706
|
|
|
6706
6707
|
//#endregion
|
|
6707
6708
|
//#region src/rules/set-state-in-render/set-state-in-render.ts
|
|
6708
|
-
const RULE_NAME$
|
|
6709
|
+
const RULE_NAME$4 = "set-state-in-render";
|
|
6709
6710
|
var set_state_in_render_default = createRule({
|
|
6710
6711
|
meta: {
|
|
6711
6712
|
type: "problem",
|
|
@@ -6713,11 +6714,11 @@ var set_state_in_render_default = createRule({
|
|
|
6713
6714
|
messages: { default: "Do not call the 'set' function '{{name}}' unconditionally during render. This will trigger an infinite render loop." },
|
|
6714
6715
|
schema: []
|
|
6715
6716
|
},
|
|
6716
|
-
name: RULE_NAME$
|
|
6717
|
-
create: create$
|
|
6717
|
+
name: RULE_NAME$4,
|
|
6718
|
+
create: create$4,
|
|
6718
6719
|
defaultOptions: []
|
|
6719
6720
|
});
|
|
6720
|
-
function create$
|
|
6721
|
+
function create$4(context) {
|
|
6721
6722
|
const { additionalStateHooks } = getSettingsFromContext(context);
|
|
6722
6723
|
const functionEntries = [];
|
|
6723
6724
|
const componentFnRef = { current: null };
|
|
@@ -6842,7 +6843,7 @@ function create$3(context) {
|
|
|
6842
6843
|
|
|
6843
6844
|
//#endregion
|
|
6844
6845
|
//#region src/rules/unsupported-syntax/unsupported-syntax.ts
|
|
6845
|
-
const RULE_NAME$
|
|
6846
|
+
const RULE_NAME$3 = "unsupported-syntax";
|
|
6846
6847
|
var unsupported_syntax_default = createRule({
|
|
6847
6848
|
meta: {
|
|
6848
6849
|
type: "problem",
|
|
@@ -6854,8 +6855,8 @@ var unsupported_syntax_default = createRule({
|
|
|
6854
6855
|
},
|
|
6855
6856
|
schema: []
|
|
6856
6857
|
},
|
|
6857
|
-
name: RULE_NAME$
|
|
6858
|
-
create: create$
|
|
6858
|
+
name: RULE_NAME$3,
|
|
6859
|
+
create: create$3,
|
|
6859
6860
|
defaultOptions: []
|
|
6860
6861
|
});
|
|
6861
6862
|
function isEvalCall(node) {
|
|
@@ -6864,7 +6865,7 @@ function isEvalCall(node) {
|
|
|
6864
6865
|
function isIifeCall(node) {
|
|
6865
6866
|
return node.parent.type === AST_NODE_TYPES.CallExpression && node.parent.callee === node;
|
|
6866
6867
|
}
|
|
6867
|
-
function create$
|
|
6868
|
+
function create$3(context) {
|
|
6868
6869
|
const hCollector = core.useHookCollector(context);
|
|
6869
6870
|
const cCollector = core.useComponentCollector(context);
|
|
6870
6871
|
const evalCalls = [];
|
|
@@ -6923,7 +6924,7 @@ function create$2(context) {
|
|
|
6923
6924
|
|
|
6924
6925
|
//#endregion
|
|
6925
6926
|
//#region src/rules/use-memo/use-memo.ts
|
|
6926
|
-
const RULE_NAME$
|
|
6927
|
+
const RULE_NAME$2 = "use-memo";
|
|
6927
6928
|
var use_memo_default = createRule({
|
|
6928
6929
|
meta: {
|
|
6929
6930
|
type: "problem",
|
|
@@ -6934,11 +6935,11 @@ var use_memo_default = createRule({
|
|
|
6934
6935
|
},
|
|
6935
6936
|
schema: []
|
|
6936
6937
|
},
|
|
6937
|
-
name: RULE_NAME$
|
|
6938
|
-
create: create$
|
|
6938
|
+
name: RULE_NAME$2,
|
|
6939
|
+
create: create$2,
|
|
6939
6940
|
defaultOptions: []
|
|
6940
6941
|
});
|
|
6941
|
-
function create$
|
|
6942
|
+
function create$2(context) {
|
|
6942
6943
|
if (!context.sourceCode.text.includes("useMemo")) return {};
|
|
6943
6944
|
return defineRuleListener({ CallExpression(node) {
|
|
6944
6945
|
if (!core.isUseMemoCall(node)) return;
|
|
@@ -6972,7 +6973,7 @@ function create$1(context) {
|
|
|
6972
6973
|
|
|
6973
6974
|
//#endregion
|
|
6974
6975
|
//#region src/rules/use-state/use-state.ts
|
|
6975
|
-
const RULE_NAME = "use-state";
|
|
6976
|
+
const RULE_NAME$1 = "use-state";
|
|
6976
6977
|
const defaultOptions = [{
|
|
6977
6978
|
enforceAssignment: true,
|
|
6978
6979
|
enforceLazyInitialization: true,
|
|
@@ -7012,11 +7013,11 @@ var use_state_default = createRule({
|
|
|
7012
7013
|
},
|
|
7013
7014
|
schema
|
|
7014
7015
|
},
|
|
7015
|
-
name: RULE_NAME,
|
|
7016
|
-
create,
|
|
7016
|
+
name: RULE_NAME$1,
|
|
7017
|
+
create: create$1,
|
|
7017
7018
|
defaultOptions
|
|
7018
7019
|
});
|
|
7019
|
-
function create(context) {
|
|
7020
|
+
function create$1(context) {
|
|
7020
7021
|
if (!context.sourceCode.text.includes("useState")) return {};
|
|
7021
7022
|
const { enforceAssignment = true, enforceLazyInitialization = true, enforceSetterName = true } = context.options[0] ?? defaultOptions[0];
|
|
7022
7023
|
return defineRuleListener({ CallExpression(node) {
|
|
@@ -7093,6 +7094,53 @@ function create(context) {
|
|
|
7093
7094
|
} });
|
|
7094
7095
|
}
|
|
7095
7096
|
|
|
7097
|
+
//#endregion
|
|
7098
|
+
//#region src/rules/unstable-rules-of-props/unstable-rules-of-props.ts
|
|
7099
|
+
const RULE_NAME = "unstable-rules-of-props";
|
|
7100
|
+
/**
|
|
7101
|
+
* Pairs of [controlled prop, uncontrolled prop] that must not appear together
|
|
7102
|
+
* on the same JSX element.
|
|
7103
|
+
*
|
|
7104
|
+
* - `value` → controlled; `defaultValue` → uncontrolled
|
|
7105
|
+
* - `checked` → controlled; `defaultChecked` → uncontrolled
|
|
7106
|
+
*/
|
|
7107
|
+
const CONTROLLED_UNCONTROLLED_PAIRS = [["value", "defaultValue"], ["checked", "defaultChecked"]];
|
|
7108
|
+
var unstable_rules_of_props_default = createRule({
|
|
7109
|
+
meta: {
|
|
7110
|
+
type: "problem",
|
|
7111
|
+
docs: { description: "Enforces the Rules of Props." },
|
|
7112
|
+
messages: { noControlledAndUncontrolledTogether: "Prop `{{controlled}}` and `{{uncontrolled}}` should not be used together. Use either controlled or uncontrolled components, not both." },
|
|
7113
|
+
schema: []
|
|
7114
|
+
},
|
|
7115
|
+
name: RULE_NAME,
|
|
7116
|
+
create,
|
|
7117
|
+
defaultOptions: []
|
|
7118
|
+
});
|
|
7119
|
+
function create(context) {
|
|
7120
|
+
return defineRuleListener({ JSXOpeningElement(node) {
|
|
7121
|
+
const propMap = /* @__PURE__ */ new Map();
|
|
7122
|
+
for (const attr of node.attributes) {
|
|
7123
|
+
if (attr.type === AST_NODE_TYPES.JSXSpreadAttribute) continue;
|
|
7124
|
+
const { name } = attr.name;
|
|
7125
|
+
if (typeof name !== "string") continue;
|
|
7126
|
+
propMap.set(name, attr);
|
|
7127
|
+
}
|
|
7128
|
+
for (const [controlled, uncontrolled] of CONTROLLED_UNCONTROLLED_PAIRS) {
|
|
7129
|
+
if (!propMap.has(controlled) || !propMap.has(uncontrolled)) continue;
|
|
7130
|
+
const uncontrolledAttr = propMap.get(uncontrolled);
|
|
7131
|
+
if (uncontrolledAttr == null) continue;
|
|
7132
|
+
context.report({
|
|
7133
|
+
data: {
|
|
7134
|
+
controlled,
|
|
7135
|
+
uncontrolled
|
|
7136
|
+
},
|
|
7137
|
+
messageId: "noControlledAndUncontrolledTogether",
|
|
7138
|
+
node: uncontrolledAttr
|
|
7139
|
+
});
|
|
7140
|
+
}
|
|
7141
|
+
} });
|
|
7142
|
+
}
|
|
7143
|
+
|
|
7096
7144
|
//#endregion
|
|
7097
7145
|
//#region src/plugin.ts
|
|
7098
7146
|
const plugin = {
|
|
@@ -7163,6 +7211,7 @@ const plugin = {
|
|
|
7163
7211
|
"rules-of-hooks": rule,
|
|
7164
7212
|
"set-state-in-effect": set_state_in_effect_default,
|
|
7165
7213
|
"set-state-in-render": set_state_in_render_default,
|
|
7214
|
+
"unstable-rules-of-props": unstable_rules_of_props_default,
|
|
7166
7215
|
"unsupported-syntax": unsupported_syntax_default,
|
|
7167
7216
|
"use-memo": use_memo_default,
|
|
7168
7217
|
"use-state": use_state_default
|