eslint-plugin-react-x 3.0.0-next.28 → 3.0.0-next.29
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 +221 -281
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -5,11 +5,11 @@ import { ESLintUtils } from "@typescript-eslint/utils";
|
|
|
5
5
|
import { P, isMatching, match } from "ts-pattern";
|
|
6
6
|
import ts from "typescript";
|
|
7
7
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
8
|
-
import { findEnclosingAssignmentTarget, findVariable, getChildScopes, getObjectType, getVariableInitializer, isAssignmentTargetEqual } from "@eslint-react/var";
|
|
9
8
|
import { constFalse, constTrue, constVoid, flow, getOrElseUpdate, identity, not, unit } from "@eslint-react/eff";
|
|
10
9
|
import { compare } from "compare-versions";
|
|
11
10
|
import { getConstrainedTypeAtLocation, isTypeReadonly } from "@typescript-eslint/type-utils";
|
|
12
11
|
import { isPropertyReadonlyInType, unionConstituents } from "ts-api-utils";
|
|
12
|
+
import { findEnclosingAssignmentTarget, findVariable, getChildScopes, getObjectType, getVariableInitializer, isAssignmentTargetEqual } from "@eslint-react/var";
|
|
13
13
|
import { getStaticValue, isIdentifier, isVariableDeclarator } from "@typescript-eslint/utils/ast-utils";
|
|
14
14
|
import { getTypeImmutability, isImmutable, isReadonlyDeep, isReadonlyShallow, isUnknown } from "is-immutable-type";
|
|
15
15
|
import { snakeCase } from "string-ts";
|
|
@@ -69,7 +69,7 @@ const rules$7 = {
|
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region package.json
|
|
71
71
|
var name$6 = "eslint-plugin-react-x";
|
|
72
|
-
var version = "3.0.0-next.
|
|
72
|
+
var version = "3.0.0-next.29";
|
|
73
73
|
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region src/utils/create-rule.ts
|
|
@@ -226,7 +226,7 @@ function getTypeVariants(types) {
|
|
|
226
226
|
|
|
227
227
|
//#endregion
|
|
228
228
|
//#region src/rules/component-hook-factories.ts
|
|
229
|
-
const RULE_NAME$
|
|
229
|
+
const RULE_NAME$62 = "component-hook-factories";
|
|
230
230
|
var component_hook_factories_default = createRule({
|
|
231
231
|
meta: {
|
|
232
232
|
type: "problem",
|
|
@@ -237,11 +237,11 @@ var component_hook_factories_default = createRule({
|
|
|
237
237
|
},
|
|
238
238
|
schema: []
|
|
239
239
|
},
|
|
240
|
-
name: RULE_NAME$
|
|
241
|
-
create: create$
|
|
240
|
+
name: RULE_NAME$62,
|
|
241
|
+
create: create$62,
|
|
242
242
|
defaultOptions: []
|
|
243
243
|
});
|
|
244
|
-
function create$
|
|
244
|
+
function create$62(context) {
|
|
245
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;
|
|
246
246
|
const fCollector = core.useComponentCollector(context, { hint });
|
|
247
247
|
const cCollector = core.useComponentCollectorLegacy(context);
|
|
@@ -285,7 +285,7 @@ function create$64(context) {
|
|
|
285
285
|
|
|
286
286
|
//#endregion
|
|
287
287
|
//#region src/rules/error-boundaries.ts
|
|
288
|
-
const RULE_NAME$
|
|
288
|
+
const RULE_NAME$61 = "error-boundaries";
|
|
289
289
|
var error_boundaries_default = createRule({
|
|
290
290
|
meta: {
|
|
291
291
|
type: "problem",
|
|
@@ -296,11 +296,11 @@ var error_boundaries_default = createRule({
|
|
|
296
296
|
},
|
|
297
297
|
schema: []
|
|
298
298
|
},
|
|
299
|
-
name: RULE_NAME$
|
|
300
|
-
create: create$
|
|
299
|
+
name: RULE_NAME$61,
|
|
300
|
+
create: create$61,
|
|
301
301
|
defaultOptions: []
|
|
302
302
|
});
|
|
303
|
-
function create$
|
|
303
|
+
function create$61(context) {
|
|
304
304
|
if (!context.sourceCode.text.includes("try")) return {};
|
|
305
305
|
const { ctx, visitor } = core.useComponentCollector(context);
|
|
306
306
|
const reported = /* @__PURE__ */ new Set();
|
|
@@ -1240,7 +1240,7 @@ function getUnknownDependenciesMessage(reactiveHookName) {
|
|
|
1240
1240
|
|
|
1241
1241
|
//#endregion
|
|
1242
1242
|
//#region src/rules/jsx-dollar.ts
|
|
1243
|
-
const RULE_NAME$
|
|
1243
|
+
const RULE_NAME$60 = "jsx-dollar";
|
|
1244
1244
|
var jsx_dollar_default = createRule({
|
|
1245
1245
|
meta: {
|
|
1246
1246
|
type: "problem",
|
|
@@ -1253,11 +1253,11 @@ var jsx_dollar_default = createRule({
|
|
|
1253
1253
|
},
|
|
1254
1254
|
schema: []
|
|
1255
1255
|
},
|
|
1256
|
-
name: RULE_NAME$
|
|
1257
|
-
create: create$
|
|
1256
|
+
name: RULE_NAME$60,
|
|
1257
|
+
create: create$60,
|
|
1258
1258
|
defaultOptions: []
|
|
1259
1259
|
});
|
|
1260
|
-
function create$
|
|
1260
|
+
function create$60(context) {
|
|
1261
1261
|
/**
|
|
1262
1262
|
* Visitor function for JSXElement and JSXFragment nodes
|
|
1263
1263
|
* @param node The JSXElement or JSXFragment node to be checked
|
|
@@ -1298,7 +1298,7 @@ function create$62(context) {
|
|
|
1298
1298
|
|
|
1299
1299
|
//#endregion
|
|
1300
1300
|
//#region src/rules/jsx-key-before-spread.ts
|
|
1301
|
-
const RULE_NAME$
|
|
1301
|
+
const RULE_NAME$59 = "jsx-key-before-spread";
|
|
1302
1302
|
var jsx_key_before_spread_default = createRule({
|
|
1303
1303
|
meta: {
|
|
1304
1304
|
type: "problem",
|
|
@@ -1306,11 +1306,11 @@ var jsx_key_before_spread_default = createRule({
|
|
|
1306
1306
|
messages: { default: "The 'key' prop must be placed before any spread props when using the new JSX transform." },
|
|
1307
1307
|
schema: []
|
|
1308
1308
|
},
|
|
1309
|
-
name: RULE_NAME$
|
|
1310
|
-
create: create$
|
|
1309
|
+
name: RULE_NAME$59,
|
|
1310
|
+
create: create$59,
|
|
1311
1311
|
defaultOptions: []
|
|
1312
1312
|
});
|
|
1313
|
-
function create$
|
|
1313
|
+
function create$59(context) {
|
|
1314
1314
|
const { jsx } = {
|
|
1315
1315
|
...core.getJsxConfigFromContext(context),
|
|
1316
1316
|
...core.getJsxConfigFromAnnotation(context)
|
|
@@ -1334,7 +1334,7 @@ function create$61(context) {
|
|
|
1334
1334
|
|
|
1335
1335
|
//#endregion
|
|
1336
1336
|
//#region src/rules/jsx-no-comment-textnodes.ts
|
|
1337
|
-
const RULE_NAME$
|
|
1337
|
+
const RULE_NAME$58 = "jsx-no-comment-textnodes";
|
|
1338
1338
|
var jsx_no_comment_textnodes_default = createRule({
|
|
1339
1339
|
meta: {
|
|
1340
1340
|
type: "problem",
|
|
@@ -1342,11 +1342,11 @@ var jsx_no_comment_textnodes_default = createRule({
|
|
|
1342
1342
|
messages: { default: "Possible misused comment in text node. Comments inside children section of tag should be placed inside braces." },
|
|
1343
1343
|
schema: []
|
|
1344
1344
|
},
|
|
1345
|
-
name: RULE_NAME$
|
|
1346
|
-
create: create$
|
|
1345
|
+
name: RULE_NAME$58,
|
|
1346
|
+
create: create$58,
|
|
1347
1347
|
defaultOptions: []
|
|
1348
1348
|
});
|
|
1349
|
-
function create$
|
|
1349
|
+
function create$58(context) {
|
|
1350
1350
|
function hasCommentLike(node) {
|
|
1351
1351
|
if (ast.isOneOf([AST_NODE_TYPES.JSXAttribute, AST_NODE_TYPES.JSXExpressionContainer])(node.parent)) return false;
|
|
1352
1352
|
return /^\s*\/(?:\/|\*)/mu.test(context.sourceCode.getText(node));
|
|
@@ -1367,7 +1367,7 @@ function create$60(context) {
|
|
|
1367
1367
|
|
|
1368
1368
|
//#endregion
|
|
1369
1369
|
//#region src/rules/jsx-no-duplicate-props.ts
|
|
1370
|
-
const RULE_NAME$
|
|
1370
|
+
const RULE_NAME$57 = "jsx-no-duplicate-props";
|
|
1371
1371
|
var jsx_no_duplicate_props_default = createRule({
|
|
1372
1372
|
meta: {
|
|
1373
1373
|
type: "problem",
|
|
@@ -1375,11 +1375,11 @@ var jsx_no_duplicate_props_default = createRule({
|
|
|
1375
1375
|
messages: { default: "This JSX property is assigned multiple times." },
|
|
1376
1376
|
schema: []
|
|
1377
1377
|
},
|
|
1378
|
-
name: RULE_NAME$
|
|
1379
|
-
create: create$
|
|
1378
|
+
name: RULE_NAME$57,
|
|
1379
|
+
create: create$57,
|
|
1380
1380
|
defaultOptions: []
|
|
1381
1381
|
});
|
|
1382
|
-
function create$
|
|
1382
|
+
function create$57(context) {
|
|
1383
1383
|
return defineRuleListener({ JSXOpeningElement(node) {
|
|
1384
1384
|
const props = [];
|
|
1385
1385
|
for (const attr of node.attributes) {
|
|
@@ -1398,40 +1398,9 @@ function create$59(context) {
|
|
|
1398
1398
|
} });
|
|
1399
1399
|
}
|
|
1400
1400
|
|
|
1401
|
-
//#endregion
|
|
1402
|
-
//#region src/rules/jsx-no-undef.ts
|
|
1403
|
-
const RULE_NAME$58 = "jsx-no-undef";
|
|
1404
|
-
var jsx_no_undef_default = createRule({
|
|
1405
|
-
meta: {
|
|
1406
|
-
type: "problem",
|
|
1407
|
-
docs: { description: "Prevents using variables in JSX that are not defined in the scope." },
|
|
1408
|
-
messages: { default: "JSX variable '{{name}}' is not defined." },
|
|
1409
|
-
schema: []
|
|
1410
|
-
},
|
|
1411
|
-
name: RULE_NAME$58,
|
|
1412
|
-
create: create$58,
|
|
1413
|
-
defaultOptions: []
|
|
1414
|
-
});
|
|
1415
|
-
function create$58(context) {
|
|
1416
|
-
return defineRuleListener({ JSXOpeningElement(node) {
|
|
1417
|
-
const name = match(node.name).with({ type: AST_NODE_TYPES.JSXIdentifier }, (n) => n.name).with({
|
|
1418
|
-
type: AST_NODE_TYPES.JSXMemberExpression,
|
|
1419
|
-
object: { type: AST_NODE_TYPES.JSXIdentifier }
|
|
1420
|
-
}, (n) => n.object.name).otherwise(() => null);
|
|
1421
|
-
if (name == null) return;
|
|
1422
|
-
if (name === "this") return;
|
|
1423
|
-
if (/^[a-z]/u.test(name)) return;
|
|
1424
|
-
if (findVariable(name, context.sourceCode.getScope(node)) == null) context.report({
|
|
1425
|
-
messageId: "default",
|
|
1426
|
-
node,
|
|
1427
|
-
data: { name }
|
|
1428
|
-
});
|
|
1429
|
-
} });
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
1401
|
//#endregion
|
|
1433
1402
|
//#region src/rules/jsx-shorthand-boolean.ts
|
|
1434
|
-
const RULE_NAME$
|
|
1403
|
+
const RULE_NAME$56 = "jsx-shorthand-boolean";
|
|
1435
1404
|
const defaultOptions$4 = [1];
|
|
1436
1405
|
const schema$4 = [{
|
|
1437
1406
|
type: "integer",
|
|
@@ -1445,11 +1414,11 @@ var jsx_shorthand_boolean_default = createRule({
|
|
|
1445
1414
|
messages: { default: "{{message}}" },
|
|
1446
1415
|
schema: schema$4
|
|
1447
1416
|
},
|
|
1448
|
-
name: RULE_NAME$
|
|
1449
|
-
create: create$
|
|
1417
|
+
name: RULE_NAME$56,
|
|
1418
|
+
create: create$56,
|
|
1450
1419
|
defaultOptions: defaultOptions$4
|
|
1451
1420
|
});
|
|
1452
|
-
function create$
|
|
1421
|
+
function create$56(context) {
|
|
1453
1422
|
const policy = context.options[0] ?? defaultOptions$4[0];
|
|
1454
1423
|
return defineRuleListener({ JSXAttribute(node) {
|
|
1455
1424
|
const { value } = node;
|
|
@@ -1477,7 +1446,7 @@ function create$57(context) {
|
|
|
1477
1446
|
|
|
1478
1447
|
//#endregion
|
|
1479
1448
|
//#region src/rules/jsx-shorthand-fragment.ts
|
|
1480
|
-
const RULE_NAME$
|
|
1449
|
+
const RULE_NAME$55 = "jsx-shorthand-fragment";
|
|
1481
1450
|
const defaultOptions$3 = [1];
|
|
1482
1451
|
const schema$3 = [{
|
|
1483
1452
|
type: "integer",
|
|
@@ -1491,11 +1460,11 @@ var jsx_shorthand_fragment_default = createRule({
|
|
|
1491
1460
|
messages: { default: "{{message}}" },
|
|
1492
1461
|
schema: schema$3
|
|
1493
1462
|
},
|
|
1494
|
-
name: RULE_NAME$
|
|
1495
|
-
create: create$
|
|
1463
|
+
name: RULE_NAME$55,
|
|
1464
|
+
create: create$55,
|
|
1496
1465
|
defaultOptions: defaultOptions$3
|
|
1497
1466
|
});
|
|
1498
|
-
function create$
|
|
1467
|
+
function create$55(context) {
|
|
1499
1468
|
const policy = context.options[0] ?? defaultOptions$3[0];
|
|
1500
1469
|
const jsxConfig = {
|
|
1501
1470
|
...core.getJsxConfigFromContext(context),
|
|
@@ -1530,7 +1499,7 @@ function create$56(context) {
|
|
|
1530
1499
|
|
|
1531
1500
|
//#endregion
|
|
1532
1501
|
//#region src/rules/jsx-uses-react.ts
|
|
1533
|
-
const RULE_NAME$
|
|
1502
|
+
const RULE_NAME$54 = "jsx-uses-react";
|
|
1534
1503
|
var jsx_uses_react_default = createRule({
|
|
1535
1504
|
meta: {
|
|
1536
1505
|
type: "problem",
|
|
@@ -1538,11 +1507,11 @@ var jsx_uses_react_default = createRule({
|
|
|
1538
1507
|
messages: { default: "Marked {{name}} as used." },
|
|
1539
1508
|
schema: []
|
|
1540
1509
|
},
|
|
1541
|
-
name: RULE_NAME$
|
|
1542
|
-
create: create$
|
|
1510
|
+
name: RULE_NAME$54,
|
|
1511
|
+
create: create$54,
|
|
1543
1512
|
defaultOptions: []
|
|
1544
1513
|
});
|
|
1545
|
-
function create$
|
|
1514
|
+
function create$54(context) {
|
|
1546
1515
|
const { jsx, jsxFactory, jsxFragmentFactory } = {
|
|
1547
1516
|
...core.getJsxConfigFromContext(context),
|
|
1548
1517
|
...core.getJsxConfigFromAnnotation(context)
|
|
@@ -1573,7 +1542,7 @@ function debugReport(context, node, name) {
|
|
|
1573
1542
|
|
|
1574
1543
|
//#endregion
|
|
1575
1544
|
//#region src/rules/jsx-uses-vars.ts
|
|
1576
|
-
const RULE_NAME$
|
|
1545
|
+
const RULE_NAME$53 = "jsx-uses-vars";
|
|
1577
1546
|
var jsx_uses_vars_default = createRule({
|
|
1578
1547
|
meta: {
|
|
1579
1548
|
type: "problem",
|
|
@@ -1581,11 +1550,11 @@ var jsx_uses_vars_default = createRule({
|
|
|
1581
1550
|
messages: { default: "An identifier in JSX is marked as used." },
|
|
1582
1551
|
schema: []
|
|
1583
1552
|
},
|
|
1584
|
-
name: RULE_NAME$
|
|
1585
|
-
create: create$
|
|
1553
|
+
name: RULE_NAME$53,
|
|
1554
|
+
create: create$53,
|
|
1586
1555
|
defaultOptions: []
|
|
1587
1556
|
});
|
|
1588
|
-
function create$
|
|
1557
|
+
function create$53(context) {
|
|
1589
1558
|
return defineRuleListener({ JSXOpeningElement(node) {
|
|
1590
1559
|
switch (node.name.type) {
|
|
1591
1560
|
case AST_NODE_TYPES.JSXIdentifier:
|
|
@@ -1603,7 +1572,7 @@ function create$54(context) {
|
|
|
1603
1572
|
|
|
1604
1573
|
//#endregion
|
|
1605
1574
|
//#region src/rules/no-access-state-in-setstate.ts
|
|
1606
|
-
const RULE_NAME$
|
|
1575
|
+
const RULE_NAME$52 = "no-access-state-in-setstate";
|
|
1607
1576
|
function isKeyLiteral$2(node, key) {
|
|
1608
1577
|
return match(key).with({ type: AST_NODE_TYPES.Literal }, constTrue).with({
|
|
1609
1578
|
type: AST_NODE_TYPES.TemplateLiteral,
|
|
@@ -1617,11 +1586,11 @@ var no_access_state_in_setstate_default = createRule({
|
|
|
1617
1586
|
messages: { default: "Do not access 'this.state' within 'setState'. Use the update function instead." },
|
|
1618
1587
|
schema: []
|
|
1619
1588
|
},
|
|
1620
|
-
name: RULE_NAME$
|
|
1621
|
-
create: create$
|
|
1589
|
+
name: RULE_NAME$52,
|
|
1590
|
+
create: create$52,
|
|
1622
1591
|
defaultOptions: []
|
|
1623
1592
|
});
|
|
1624
|
-
function create$
|
|
1593
|
+
function create$52(context) {
|
|
1625
1594
|
if (!context.sourceCode.text.includes("setState")) return {};
|
|
1626
1595
|
const classStack = [];
|
|
1627
1596
|
const methodStack = [];
|
|
@@ -1692,7 +1661,7 @@ function create$53(context) {
|
|
|
1692
1661
|
|
|
1693
1662
|
//#endregion
|
|
1694
1663
|
//#region src/rules/no-array-index-key.ts
|
|
1695
|
-
const RULE_NAME$
|
|
1664
|
+
const RULE_NAME$51 = "no-array-index-key";
|
|
1696
1665
|
const REACT_CHILDREN_METHOD = ["forEach", "map"];
|
|
1697
1666
|
function getIndexParamPosition(methodName) {
|
|
1698
1667
|
switch (methodName) {
|
|
@@ -1751,11 +1720,11 @@ var no_array_index_key_default = createRule({
|
|
|
1751
1720
|
messages: { default: "Do not use item index in the array as its key." },
|
|
1752
1721
|
schema: []
|
|
1753
1722
|
},
|
|
1754
|
-
name: RULE_NAME$
|
|
1755
|
-
create: create$
|
|
1723
|
+
name: RULE_NAME$51,
|
|
1724
|
+
create: create$51,
|
|
1756
1725
|
defaultOptions: []
|
|
1757
1726
|
});
|
|
1758
|
-
function create$
|
|
1727
|
+
function create$51(context) {
|
|
1759
1728
|
const indexParamNames = [];
|
|
1760
1729
|
function isArrayIndex(node) {
|
|
1761
1730
|
return node.type === AST_NODE_TYPES.Identifier && indexParamNames.some((name) => name != null && name === node.name);
|
|
@@ -1821,7 +1790,7 @@ function create$52(context) {
|
|
|
1821
1790
|
|
|
1822
1791
|
//#endregion
|
|
1823
1792
|
//#region src/rules/no-children-count.ts
|
|
1824
|
-
const RULE_NAME$
|
|
1793
|
+
const RULE_NAME$50 = "no-children-count";
|
|
1825
1794
|
var no_children_count_default = createRule({
|
|
1826
1795
|
meta: {
|
|
1827
1796
|
type: "problem",
|
|
@@ -1829,11 +1798,11 @@ var no_children_count_default = createRule({
|
|
|
1829
1798
|
messages: { default: "Using 'Children.count' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
1830
1799
|
schema: []
|
|
1831
1800
|
},
|
|
1832
|
-
name: RULE_NAME$
|
|
1833
|
-
create: create$
|
|
1801
|
+
name: RULE_NAME$50,
|
|
1802
|
+
create: create$50,
|
|
1834
1803
|
defaultOptions: []
|
|
1835
1804
|
});
|
|
1836
|
-
function create$
|
|
1805
|
+
function create$50(context) {
|
|
1837
1806
|
return defineRuleListener({ MemberExpression(node) {
|
|
1838
1807
|
if (core.isChildrenCount(context, node)) context.report({
|
|
1839
1808
|
messageId: "default",
|
|
@@ -1844,7 +1813,7 @@ function create$51(context) {
|
|
|
1844
1813
|
|
|
1845
1814
|
//#endregion
|
|
1846
1815
|
//#region src/rules/no-children-for-each.ts
|
|
1847
|
-
const RULE_NAME$
|
|
1816
|
+
const RULE_NAME$49 = "no-children-for-each";
|
|
1848
1817
|
var no_children_for_each_default = createRule({
|
|
1849
1818
|
meta: {
|
|
1850
1819
|
type: "problem",
|
|
@@ -1852,11 +1821,11 @@ var no_children_for_each_default = createRule({
|
|
|
1852
1821
|
messages: { default: "Using 'Children.forEach' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
1853
1822
|
schema: []
|
|
1854
1823
|
},
|
|
1855
|
-
name: RULE_NAME$
|
|
1856
|
-
create: create$
|
|
1824
|
+
name: RULE_NAME$49,
|
|
1825
|
+
create: create$49,
|
|
1857
1826
|
defaultOptions: []
|
|
1858
1827
|
});
|
|
1859
|
-
function create$
|
|
1828
|
+
function create$49(context) {
|
|
1860
1829
|
return defineRuleListener({ MemberExpression(node) {
|
|
1861
1830
|
if (core.isChildrenForEach(context, node)) context.report({
|
|
1862
1831
|
messageId: "default",
|
|
@@ -1867,7 +1836,7 @@ function create$50(context) {
|
|
|
1867
1836
|
|
|
1868
1837
|
//#endregion
|
|
1869
1838
|
//#region src/rules/no-children-map.ts
|
|
1870
|
-
const RULE_NAME$
|
|
1839
|
+
const RULE_NAME$48 = "no-children-map";
|
|
1871
1840
|
var no_children_map_default = createRule({
|
|
1872
1841
|
meta: {
|
|
1873
1842
|
type: "problem",
|
|
@@ -1875,11 +1844,11 @@ var no_children_map_default = createRule({
|
|
|
1875
1844
|
messages: { default: "Using 'Children.map' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
1876
1845
|
schema: []
|
|
1877
1846
|
},
|
|
1878
|
-
name: RULE_NAME$
|
|
1879
|
-
create: create$
|
|
1847
|
+
name: RULE_NAME$48,
|
|
1848
|
+
create: create$48,
|
|
1880
1849
|
defaultOptions: []
|
|
1881
1850
|
});
|
|
1882
|
-
function create$
|
|
1851
|
+
function create$48(context) {
|
|
1883
1852
|
return defineRuleListener({ MemberExpression(node) {
|
|
1884
1853
|
if (core.isChildrenMap(context, node)) context.report({
|
|
1885
1854
|
messageId: "default",
|
|
@@ -1890,7 +1859,7 @@ function create$49(context) {
|
|
|
1890
1859
|
|
|
1891
1860
|
//#endregion
|
|
1892
1861
|
//#region src/rules/no-children-only.ts
|
|
1893
|
-
const RULE_NAME$
|
|
1862
|
+
const RULE_NAME$47 = "no-children-only";
|
|
1894
1863
|
var no_children_only_default = createRule({
|
|
1895
1864
|
meta: {
|
|
1896
1865
|
type: "problem",
|
|
@@ -1898,11 +1867,11 @@ var no_children_only_default = createRule({
|
|
|
1898
1867
|
messages: { default: "Using 'Children.only' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
1899
1868
|
schema: []
|
|
1900
1869
|
},
|
|
1901
|
-
name: RULE_NAME$
|
|
1902
|
-
create: create$
|
|
1870
|
+
name: RULE_NAME$47,
|
|
1871
|
+
create: create$47,
|
|
1903
1872
|
defaultOptions: []
|
|
1904
1873
|
});
|
|
1905
|
-
function create$
|
|
1874
|
+
function create$47(context) {
|
|
1906
1875
|
return defineRuleListener({ MemberExpression(node) {
|
|
1907
1876
|
if (core.isChildrenOnly(context, node)) context.report({
|
|
1908
1877
|
messageId: "default",
|
|
@@ -1913,7 +1882,7 @@ function create$48(context) {
|
|
|
1913
1882
|
|
|
1914
1883
|
//#endregion
|
|
1915
1884
|
//#region src/rules/no-children-prop.ts
|
|
1916
|
-
const RULE_NAME$
|
|
1885
|
+
const RULE_NAME$46 = "no-children-prop";
|
|
1917
1886
|
var no_children_prop_default = createRule({
|
|
1918
1887
|
meta: {
|
|
1919
1888
|
type: "problem",
|
|
@@ -1921,11 +1890,11 @@ var no_children_prop_default = createRule({
|
|
|
1921
1890
|
messages: { default: "Do not pass 'children' as props." },
|
|
1922
1891
|
schema: []
|
|
1923
1892
|
},
|
|
1924
|
-
name: RULE_NAME$
|
|
1925
|
-
create: create$
|
|
1893
|
+
name: RULE_NAME$46,
|
|
1894
|
+
create: create$46,
|
|
1926
1895
|
defaultOptions: []
|
|
1927
1896
|
});
|
|
1928
|
-
function create$
|
|
1897
|
+
function create$46(context) {
|
|
1929
1898
|
return defineRuleListener({ JSXElement(node) {
|
|
1930
1899
|
const childrenProp = core.getJsxAttribute(context, node)("children");
|
|
1931
1900
|
if (childrenProp != null) context.report({
|
|
@@ -1937,7 +1906,7 @@ function create$47(context) {
|
|
|
1937
1906
|
|
|
1938
1907
|
//#endregion
|
|
1939
1908
|
//#region src/rules/no-children-to-array.ts
|
|
1940
|
-
const RULE_NAME$
|
|
1909
|
+
const RULE_NAME$45 = "no-children-to-array";
|
|
1941
1910
|
var no_children_to_array_default = createRule({
|
|
1942
1911
|
meta: {
|
|
1943
1912
|
type: "problem",
|
|
@@ -1945,11 +1914,11 @@ var no_children_to_array_default = createRule({
|
|
|
1945
1914
|
messages: { default: "Using 'Children.toArray' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
1946
1915
|
schema: []
|
|
1947
1916
|
},
|
|
1948
|
-
name: RULE_NAME$
|
|
1949
|
-
create: create$
|
|
1917
|
+
name: RULE_NAME$45,
|
|
1918
|
+
create: create$45,
|
|
1950
1919
|
defaultOptions: []
|
|
1951
1920
|
});
|
|
1952
|
-
function create$
|
|
1921
|
+
function create$45(context) {
|
|
1953
1922
|
return defineRuleListener({ MemberExpression(node) {
|
|
1954
1923
|
if (core.isChildrenToArray(context, node)) context.report({
|
|
1955
1924
|
messageId: "default",
|
|
@@ -1960,7 +1929,7 @@ function create$46(context) {
|
|
|
1960
1929
|
|
|
1961
1930
|
//#endregion
|
|
1962
1931
|
//#region src/rules/no-class-component.ts
|
|
1963
|
-
const RULE_NAME$
|
|
1932
|
+
const RULE_NAME$44 = "no-class-component";
|
|
1964
1933
|
var no_class_component_default = createRule({
|
|
1965
1934
|
meta: {
|
|
1966
1935
|
type: "problem",
|
|
@@ -1968,11 +1937,11 @@ var no_class_component_default = createRule({
|
|
|
1968
1937
|
messages: { default: "Avoid using class components. Use function components instead." },
|
|
1969
1938
|
schema: []
|
|
1970
1939
|
},
|
|
1971
|
-
name: RULE_NAME$
|
|
1972
|
-
create: create$
|
|
1940
|
+
name: RULE_NAME$44,
|
|
1941
|
+
create: create$44,
|
|
1973
1942
|
defaultOptions: []
|
|
1974
1943
|
});
|
|
1975
|
-
function create$
|
|
1944
|
+
function create$44(context) {
|
|
1976
1945
|
if (!context.sourceCode.text.includes("Component")) return {};
|
|
1977
1946
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
1978
1947
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -1989,7 +1958,7 @@ function create$45(context) {
|
|
|
1989
1958
|
|
|
1990
1959
|
//#endregion
|
|
1991
1960
|
//#region src/rules/no-clone-element.ts
|
|
1992
|
-
const RULE_NAME$
|
|
1961
|
+
const RULE_NAME$43 = "no-clone-element";
|
|
1993
1962
|
var no_clone_element_default = createRule({
|
|
1994
1963
|
meta: {
|
|
1995
1964
|
type: "problem",
|
|
@@ -1997,11 +1966,11 @@ var no_clone_element_default = createRule({
|
|
|
1997
1966
|
messages: { default: "Using 'cloneElement' is uncommon and can lead to fragile code. Use alternatives instead." },
|
|
1998
1967
|
schema: []
|
|
1999
1968
|
},
|
|
2000
|
-
name: RULE_NAME$
|
|
2001
|
-
create: create$
|
|
1969
|
+
name: RULE_NAME$43,
|
|
1970
|
+
create: create$43,
|
|
2002
1971
|
defaultOptions: []
|
|
2003
1972
|
});
|
|
2004
|
-
function create$
|
|
1973
|
+
function create$43(context) {
|
|
2005
1974
|
return defineRuleListener({ CallExpression(node) {
|
|
2006
1975
|
if (core.isCloneElementCall(context, node)) context.report({
|
|
2007
1976
|
messageId: "default",
|
|
@@ -2012,7 +1981,7 @@ function create$44(context) {
|
|
|
2012
1981
|
|
|
2013
1982
|
//#endregion
|
|
2014
1983
|
//#region src/rules/no-component-will-mount.ts
|
|
2015
|
-
const RULE_NAME$
|
|
1984
|
+
const RULE_NAME$42 = "no-component-will-mount";
|
|
2016
1985
|
var no_component_will_mount_default = createRule({
|
|
2017
1986
|
meta: {
|
|
2018
1987
|
type: "problem",
|
|
@@ -2021,11 +1990,11 @@ var no_component_will_mount_default = createRule({
|
|
|
2021
1990
|
messages: { default: "[Deprecated] Use 'UNSAFE_componentWillMount' instead." },
|
|
2022
1991
|
schema: []
|
|
2023
1992
|
},
|
|
2024
|
-
name: RULE_NAME$
|
|
2025
|
-
create: create$
|
|
1993
|
+
name: RULE_NAME$42,
|
|
1994
|
+
create: create$42,
|
|
2026
1995
|
defaultOptions: []
|
|
2027
1996
|
});
|
|
2028
|
-
function create$
|
|
1997
|
+
function create$42(context) {
|
|
2029
1998
|
if (!context.sourceCode.text.includes("componentWillMount")) return {};
|
|
2030
1999
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
2031
2000
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -2045,7 +2014,7 @@ function create$43(context) {
|
|
|
2045
2014
|
|
|
2046
2015
|
//#endregion
|
|
2047
2016
|
//#region src/rules/no-component-will-receive-props.ts
|
|
2048
|
-
const RULE_NAME$
|
|
2017
|
+
const RULE_NAME$41 = "no-component-will-receive-props";
|
|
2049
2018
|
var no_component_will_receive_props_default = createRule({
|
|
2050
2019
|
meta: {
|
|
2051
2020
|
type: "problem",
|
|
@@ -2054,11 +2023,11 @@ var no_component_will_receive_props_default = createRule({
|
|
|
2054
2023
|
messages: { default: "[Deprecated] Use 'UNSAFE_componentWillReceiveProps' instead." },
|
|
2055
2024
|
schema: []
|
|
2056
2025
|
},
|
|
2057
|
-
name: RULE_NAME$
|
|
2058
|
-
create: create$
|
|
2026
|
+
name: RULE_NAME$41,
|
|
2027
|
+
create: create$41,
|
|
2059
2028
|
defaultOptions: []
|
|
2060
2029
|
});
|
|
2061
|
-
function create$
|
|
2030
|
+
function create$41(context) {
|
|
2062
2031
|
if (!context.sourceCode.text.includes("componentWillReceiveProps")) return {};
|
|
2063
2032
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
2064
2033
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -2078,7 +2047,7 @@ function create$42(context) {
|
|
|
2078
2047
|
|
|
2079
2048
|
//#endregion
|
|
2080
2049
|
//#region src/rules/no-component-will-update.ts
|
|
2081
|
-
const RULE_NAME$
|
|
2050
|
+
const RULE_NAME$40 = "no-component-will-update";
|
|
2082
2051
|
var no_component_will_update_default = createRule({
|
|
2083
2052
|
meta: {
|
|
2084
2053
|
type: "problem",
|
|
@@ -2087,11 +2056,11 @@ var no_component_will_update_default = createRule({
|
|
|
2087
2056
|
messages: { default: "[Deprecated] Use 'UNSAFE_componentWillUpdate' instead." },
|
|
2088
2057
|
schema: []
|
|
2089
2058
|
},
|
|
2090
|
-
name: RULE_NAME$
|
|
2091
|
-
create: create$
|
|
2059
|
+
name: RULE_NAME$40,
|
|
2060
|
+
create: create$40,
|
|
2092
2061
|
defaultOptions: []
|
|
2093
2062
|
});
|
|
2094
|
-
function create$
|
|
2063
|
+
function create$40(context) {
|
|
2095
2064
|
if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
|
|
2096
2065
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
2097
2066
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -2111,7 +2080,7 @@ function create$41(context) {
|
|
|
2111
2080
|
|
|
2112
2081
|
//#endregion
|
|
2113
2082
|
//#region src/rules/no-context-provider.ts
|
|
2114
|
-
const RULE_NAME$
|
|
2083
|
+
const RULE_NAME$39 = "no-context-provider";
|
|
2115
2084
|
var no_context_provider_default = createRule({
|
|
2116
2085
|
meta: {
|
|
2117
2086
|
type: "problem",
|
|
@@ -2120,11 +2089,11 @@ var no_context_provider_default = createRule({
|
|
|
2120
2089
|
messages: { default: "In React 19, you can render '<Context>' as a provider instead of '<Context.Provider>'." },
|
|
2121
2090
|
schema: []
|
|
2122
2091
|
},
|
|
2123
|
-
name: RULE_NAME$
|
|
2124
|
-
create: create$
|
|
2092
|
+
name: RULE_NAME$39,
|
|
2093
|
+
create: create$39,
|
|
2125
2094
|
defaultOptions: []
|
|
2126
2095
|
});
|
|
2127
|
-
function create$
|
|
2096
|
+
function create$39(context) {
|
|
2128
2097
|
if (!context.sourceCode.text.includes("Provider")) return {};
|
|
2129
2098
|
const { version } = getSettingsFromContext(context);
|
|
2130
2099
|
if (compare(version, "19.0.0", "<")) return {};
|
|
@@ -2151,7 +2120,7 @@ function create$40(context) {
|
|
|
2151
2120
|
|
|
2152
2121
|
//#endregion
|
|
2153
2122
|
//#region src/rules/no-create-ref.ts
|
|
2154
|
-
const RULE_NAME$
|
|
2123
|
+
const RULE_NAME$38 = "no-create-ref";
|
|
2155
2124
|
var no_create_ref_default = createRule({
|
|
2156
2125
|
meta: {
|
|
2157
2126
|
type: "problem",
|
|
@@ -2159,11 +2128,11 @@ var no_create_ref_default = createRule({
|
|
|
2159
2128
|
messages: { default: "[Deprecated] Use 'useRef' instead." },
|
|
2160
2129
|
schema: []
|
|
2161
2130
|
},
|
|
2162
|
-
name: RULE_NAME$
|
|
2163
|
-
create: create$
|
|
2131
|
+
name: RULE_NAME$38,
|
|
2132
|
+
create: create$38,
|
|
2164
2133
|
defaultOptions: []
|
|
2165
2134
|
});
|
|
2166
|
-
function create$
|
|
2135
|
+
function create$38(context) {
|
|
2167
2136
|
return defineRuleListener({ CallExpression(node) {
|
|
2168
2137
|
if (core.isCreateRefCall(context, node) && ast.findParentNode(node, core.isClassComponent) == null) context.report({
|
|
2169
2138
|
messageId: "default",
|
|
@@ -2174,7 +2143,7 @@ function create$39(context) {
|
|
|
2174
2143
|
|
|
2175
2144
|
//#endregion
|
|
2176
2145
|
//#region src/rules/no-direct-mutation-state.ts
|
|
2177
|
-
const RULE_NAME$
|
|
2146
|
+
const RULE_NAME$37 = "no-direct-mutation-state";
|
|
2178
2147
|
function isConstructorFunction(node) {
|
|
2179
2148
|
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";
|
|
2180
2149
|
}
|
|
@@ -2185,11 +2154,11 @@ var no_direct_mutation_state_default = createRule({
|
|
|
2185
2154
|
messages: { default: "Do not mutate state directly. Use 'setState()' instead." },
|
|
2186
2155
|
schema: []
|
|
2187
2156
|
},
|
|
2188
|
-
name: RULE_NAME$
|
|
2189
|
-
create: create$
|
|
2157
|
+
name: RULE_NAME$37,
|
|
2158
|
+
create: create$37,
|
|
2190
2159
|
defaultOptions: []
|
|
2191
2160
|
});
|
|
2192
|
-
function create$
|
|
2161
|
+
function create$37(context) {
|
|
2193
2162
|
return defineRuleListener({ AssignmentExpression(node) {
|
|
2194
2163
|
if (!core.isAssignmentToThisState(node)) return;
|
|
2195
2164
|
const parentClass = ast.findParentNode(node, ast.isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]));
|
|
@@ -2203,7 +2172,7 @@ function create$38(context) {
|
|
|
2203
2172
|
|
|
2204
2173
|
//#endregion
|
|
2205
2174
|
//#region src/rules/no-duplicate-key.ts
|
|
2206
|
-
const RULE_NAME$
|
|
2175
|
+
const RULE_NAME$36 = "no-duplicate-key";
|
|
2207
2176
|
var no_duplicate_key_default = createRule({
|
|
2208
2177
|
meta: {
|
|
2209
2178
|
type: "problem",
|
|
@@ -2211,11 +2180,11 @@ var no_duplicate_key_default = createRule({
|
|
|
2211
2180
|
messages: { default: "The 'key' prop must be unique to its sibling elements." },
|
|
2212
2181
|
schema: []
|
|
2213
2182
|
},
|
|
2214
|
-
name: RULE_NAME$
|
|
2215
|
-
create: create$
|
|
2183
|
+
name: RULE_NAME$36,
|
|
2184
|
+
create: create$36,
|
|
2216
2185
|
defaultOptions: []
|
|
2217
2186
|
});
|
|
2218
|
-
function create$
|
|
2187
|
+
function create$36(context) {
|
|
2219
2188
|
if (!context.sourceCode.text.includes("key=")) return {};
|
|
2220
2189
|
const keyedEntries = /* @__PURE__ */ new Map();
|
|
2221
2190
|
function isKeyValueEqual(a, b) {
|
|
@@ -2270,7 +2239,7 @@ function create$37(context) {
|
|
|
2270
2239
|
|
|
2271
2240
|
//#endregion
|
|
2272
2241
|
//#region src/rules/no-forward-ref.ts
|
|
2273
|
-
const RULE_NAME$
|
|
2242
|
+
const RULE_NAME$35 = "no-forward-ref";
|
|
2274
2243
|
var no_forward_ref_default = createRule({
|
|
2275
2244
|
meta: {
|
|
2276
2245
|
type: "problem",
|
|
@@ -2279,11 +2248,11 @@ var no_forward_ref_default = createRule({
|
|
|
2279
2248
|
messages: { default: "In React 19, 'forwardRef' is no longer necessary. Pass 'ref' as a prop instead." },
|
|
2280
2249
|
schema: []
|
|
2281
2250
|
},
|
|
2282
|
-
name: RULE_NAME$
|
|
2283
|
-
create: create$
|
|
2251
|
+
name: RULE_NAME$35,
|
|
2252
|
+
create: create$35,
|
|
2284
2253
|
defaultOptions: []
|
|
2285
2254
|
});
|
|
2286
|
-
function create$
|
|
2255
|
+
function create$35(context) {
|
|
2287
2256
|
if (!context.sourceCode.text.includes("forwardRef")) return {};
|
|
2288
2257
|
const { version } = getSettingsFromContext(context);
|
|
2289
2258
|
if (compare(version, "19.0.0", "<")) return {};
|
|
@@ -2378,7 +2347,7 @@ function getComponentPropsFixes(context, fixer, node, typeArguments) {
|
|
|
2378
2347
|
|
|
2379
2348
|
//#endregion
|
|
2380
2349
|
//#region src/rules/no-implicit-key.ts
|
|
2381
|
-
const RULE_NAME$
|
|
2350
|
+
const RULE_NAME$34 = "no-implicit-key";
|
|
2382
2351
|
var no_implicit_key_default = createRule({
|
|
2383
2352
|
meta: {
|
|
2384
2353
|
type: "problem",
|
|
@@ -2386,11 +2355,11 @@ var no_implicit_key_default = createRule({
|
|
|
2386
2355
|
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}'." },
|
|
2387
2356
|
schema: []
|
|
2388
2357
|
},
|
|
2389
|
-
name: RULE_NAME$
|
|
2390
|
-
create: create$
|
|
2358
|
+
name: RULE_NAME$34,
|
|
2359
|
+
create: create$34,
|
|
2391
2360
|
defaultOptions: []
|
|
2392
2361
|
});
|
|
2393
|
-
function create$
|
|
2362
|
+
function create$34(context) {
|
|
2394
2363
|
const services = ESLintUtils.getParserServices(context, false);
|
|
2395
2364
|
const checker = services.program.getTypeChecker();
|
|
2396
2365
|
return defineRuleListener({ JSXSpreadAttribute(node) {
|
|
@@ -2408,7 +2377,7 @@ function create$35(context) {
|
|
|
2408
2377
|
|
|
2409
2378
|
//#endregion
|
|
2410
2379
|
//#region src/rules/no-leaked-conditional-rendering.ts
|
|
2411
|
-
const RULE_NAME$
|
|
2380
|
+
const RULE_NAME$33 = "no-leaked-conditional-rendering";
|
|
2412
2381
|
var no_leaked_conditional_rendering_default = createRule({
|
|
2413
2382
|
meta: {
|
|
2414
2383
|
type: "problem",
|
|
@@ -2416,11 +2385,11 @@ var no_leaked_conditional_rendering_default = createRule({
|
|
|
2416
2385
|
messages: { default: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes." },
|
|
2417
2386
|
schema: []
|
|
2418
2387
|
},
|
|
2419
|
-
name: RULE_NAME$
|
|
2420
|
-
create: create$
|
|
2388
|
+
name: RULE_NAME$33,
|
|
2389
|
+
create: create$33,
|
|
2421
2390
|
defaultOptions: []
|
|
2422
2391
|
});
|
|
2423
|
-
function create$
|
|
2392
|
+
function create$33(context) {
|
|
2424
2393
|
if (!context.sourceCode.text.includes("&&")) return {};
|
|
2425
2394
|
const { version } = getSettingsFromContext(context);
|
|
2426
2395
|
const allowedVariants = [
|
|
@@ -2477,7 +2446,7 @@ function create$34(context) {
|
|
|
2477
2446
|
|
|
2478
2447
|
//#endregion
|
|
2479
2448
|
//#region src/rules/no-missing-component-display-name.ts
|
|
2480
|
-
const RULE_NAME$
|
|
2449
|
+
const RULE_NAME$32 = "no-missing-component-display-name";
|
|
2481
2450
|
var no_missing_component_display_name_default = createRule({
|
|
2482
2451
|
meta: {
|
|
2483
2452
|
type: "problem",
|
|
@@ -2485,11 +2454,11 @@ var no_missing_component_display_name_default = createRule({
|
|
|
2485
2454
|
messages: { default: "Add missing 'displayName' for component." },
|
|
2486
2455
|
schema: []
|
|
2487
2456
|
},
|
|
2488
|
-
name: RULE_NAME$
|
|
2489
|
-
create: create$
|
|
2457
|
+
name: RULE_NAME$32,
|
|
2458
|
+
create: create$32,
|
|
2490
2459
|
defaultOptions: []
|
|
2491
2460
|
});
|
|
2492
|
-
function create$
|
|
2461
|
+
function create$32(context) {
|
|
2493
2462
|
if (!context.sourceCode.text.includes("memo") && !context.sourceCode.text.includes("forwardRef")) return {};
|
|
2494
2463
|
const { ctx, visitor } = core.useComponentCollector(context, {
|
|
2495
2464
|
collectDisplayName: true,
|
|
@@ -2511,7 +2480,7 @@ function create$33(context) {
|
|
|
2511
2480
|
|
|
2512
2481
|
//#endregion
|
|
2513
2482
|
//#region src/rules/no-missing-context-display-name.ts
|
|
2514
|
-
const RULE_NAME$
|
|
2483
|
+
const RULE_NAME$31 = "no-missing-context-display-name";
|
|
2515
2484
|
var no_missing_context_display_name_default = createRule({
|
|
2516
2485
|
meta: {
|
|
2517
2486
|
type: "problem",
|
|
@@ -2520,11 +2489,11 @@ var no_missing_context_display_name_default = createRule({
|
|
|
2520
2489
|
messages: { default: "Add missing 'displayName' for context." },
|
|
2521
2490
|
schema: []
|
|
2522
2491
|
},
|
|
2523
|
-
name: RULE_NAME$
|
|
2524
|
-
create: create$
|
|
2492
|
+
name: RULE_NAME$31,
|
|
2493
|
+
create: create$31,
|
|
2525
2494
|
defaultOptions: []
|
|
2526
2495
|
});
|
|
2527
|
-
function create$
|
|
2496
|
+
function create$31(context) {
|
|
2528
2497
|
if (!context.sourceCode.text.includes("createContext")) return {};
|
|
2529
2498
|
const createCalls = [];
|
|
2530
2499
|
const displayNameAssignments = [];
|
|
@@ -2576,7 +2545,7 @@ function create$32(context) {
|
|
|
2576
2545
|
|
|
2577
2546
|
//#endregion
|
|
2578
2547
|
//#region src/rules/no-missing-key.ts
|
|
2579
|
-
const RULE_NAME$
|
|
2548
|
+
const RULE_NAME$30 = "no-missing-key";
|
|
2580
2549
|
var no_missing_key_default = createRule({
|
|
2581
2550
|
meta: {
|
|
2582
2551
|
type: "problem",
|
|
@@ -2587,11 +2556,11 @@ var no_missing_key_default = createRule({
|
|
|
2587
2556
|
},
|
|
2588
2557
|
schema: []
|
|
2589
2558
|
},
|
|
2590
|
-
name: RULE_NAME$
|
|
2591
|
-
create: create$
|
|
2559
|
+
name: RULE_NAME$30,
|
|
2560
|
+
create: create$30,
|
|
2592
2561
|
defaultOptions: []
|
|
2593
2562
|
});
|
|
2594
|
-
function create$
|
|
2563
|
+
function create$30(ctx) {
|
|
2595
2564
|
let inChildrenToArray = false;
|
|
2596
2565
|
function check(node) {
|
|
2597
2566
|
if (node.type === AST_NODE_TYPES.JSXElement) return core.getJsxAttribute(ctx, node)("key") == null ? {
|
|
@@ -2662,7 +2631,7 @@ function create$31(ctx) {
|
|
|
2662
2631
|
|
|
2663
2632
|
//#endregion
|
|
2664
2633
|
//#region src/rules/no-misused-capture-owner-stack.ts
|
|
2665
|
-
const RULE_NAME$
|
|
2634
|
+
const RULE_NAME$29 = "no-misused-capture-owner-stack";
|
|
2666
2635
|
var no_misused_capture_owner_stack_default = createRule({
|
|
2667
2636
|
meta: {
|
|
2668
2637
|
type: "problem",
|
|
@@ -2673,11 +2642,11 @@ var no_misused_capture_owner_stack_default = createRule({
|
|
|
2673
2642
|
},
|
|
2674
2643
|
schema: []
|
|
2675
2644
|
},
|
|
2676
|
-
name: RULE_NAME$
|
|
2677
|
-
create: create$
|
|
2645
|
+
name: RULE_NAME$29,
|
|
2646
|
+
create: create$29,
|
|
2678
2647
|
defaultOptions: []
|
|
2679
2648
|
});
|
|
2680
|
-
function create$
|
|
2649
|
+
function create$29(context) {
|
|
2681
2650
|
if (!context.sourceCode.text.includes("captureOwnerStack")) return {};
|
|
2682
2651
|
const { importSource } = getSettingsFromContext(context);
|
|
2683
2652
|
return defineRuleListener({
|
|
@@ -2708,7 +2677,7 @@ function isDevelopmentOnlyCheck(node) {
|
|
|
2708
2677
|
|
|
2709
2678
|
//#endregion
|
|
2710
2679
|
//#region src/rules/no-nested-component-definitions.ts
|
|
2711
|
-
const RULE_NAME$
|
|
2680
|
+
const RULE_NAME$28 = "no-nested-component-definitions";
|
|
2712
2681
|
var no_nested_component_definitions_default = createRule({
|
|
2713
2682
|
meta: {
|
|
2714
2683
|
type: "problem",
|
|
@@ -2716,23 +2685,24 @@ var no_nested_component_definitions_default = createRule({
|
|
|
2716
2685
|
messages: { default: "Do not nest component definitions inside other components or props. {{suggestion}}" },
|
|
2717
2686
|
schema: []
|
|
2718
2687
|
},
|
|
2719
|
-
name: RULE_NAME$
|
|
2720
|
-
create: create$
|
|
2688
|
+
name: RULE_NAME$28,
|
|
2689
|
+
create: create$28,
|
|
2721
2690
|
defaultOptions: []
|
|
2722
2691
|
});
|
|
2723
|
-
function create$
|
|
2692
|
+
function create$28(context) {
|
|
2724
2693
|
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;
|
|
2725
2694
|
const fCollector = core.useComponentCollector(context, { hint });
|
|
2726
2695
|
const cCollector = core.useComponentCollectorLegacy(context);
|
|
2727
2696
|
return defineRuleListener(fCollector.visitor, cCollector.visitor, { "Program:exit"(program) {
|
|
2728
2697
|
const fComponents = [...fCollector.ctx.getAllComponents(program)];
|
|
2729
2698
|
const cComponents = [...cCollector.ctx.getAllComponents(program)];
|
|
2730
|
-
|
|
2731
|
-
return ast.
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2699
|
+
function findEnclosingComponent(node) {
|
|
2700
|
+
return ast.findParentNode(node, (n) => {
|
|
2701
|
+
if (ast.isFunction(n)) return fComponents.some((c) => c.node === n);
|
|
2702
|
+
if (ast.isClass(n)) return cComponents.some((c) => c.node === n);
|
|
2703
|
+
return false;
|
|
2704
|
+
});
|
|
2705
|
+
}
|
|
2736
2706
|
for (const { name, node: component } of fComponents) {
|
|
2737
2707
|
if (name == null) continue;
|
|
2738
2708
|
if (core.isDirectValueOfRenderPropertyLoose(component)) continue;
|
|
@@ -2758,8 +2728,8 @@ function create$29(context) {
|
|
|
2758
2728
|
});
|
|
2759
2729
|
continue;
|
|
2760
2730
|
}
|
|
2761
|
-
const
|
|
2762
|
-
if (
|
|
2731
|
+
const enclosingComponent = findEnclosingComponent(component);
|
|
2732
|
+
if (enclosingComponent != null && !core.isDirectValueOfRenderPropertyLoose(enclosingComponent)) {
|
|
2763
2733
|
context.report({
|
|
2764
2734
|
messageId: "default",
|
|
2765
2735
|
node: component,
|
|
@@ -2780,7 +2750,7 @@ function create$29(context) {
|
|
|
2780
2750
|
});
|
|
2781
2751
|
}
|
|
2782
2752
|
for (const { name = "unknown", node: component } of cComponents) {
|
|
2783
|
-
if (
|
|
2753
|
+
if (findEnclosingComponent(component) == null) continue;
|
|
2784
2754
|
context.report({
|
|
2785
2755
|
messageId: "default",
|
|
2786
2756
|
node: component,
|
|
@@ -2825,7 +2795,7 @@ function isInsideCreateElementProps(context, node) {
|
|
|
2825
2795
|
|
|
2826
2796
|
//#endregion
|
|
2827
2797
|
//#region src/rules/no-nested-lazy-component-declarations.ts
|
|
2828
|
-
const RULE_NAME$
|
|
2798
|
+
const RULE_NAME$27 = "no-nested-lazy-component-declarations";
|
|
2829
2799
|
var no_nested_lazy_component_declarations_default = createRule({
|
|
2830
2800
|
meta: {
|
|
2831
2801
|
type: "problem",
|
|
@@ -2833,11 +2803,11 @@ var no_nested_lazy_component_declarations_default = createRule({
|
|
|
2833
2803
|
messages: { default: "Do not declare lazy components inside other components. Instead, always declare them at the top level of your module." },
|
|
2834
2804
|
schema: []
|
|
2835
2805
|
},
|
|
2836
|
-
name: RULE_NAME$
|
|
2837
|
-
create: create$
|
|
2806
|
+
name: RULE_NAME$27,
|
|
2807
|
+
create: create$27,
|
|
2838
2808
|
defaultOptions: []
|
|
2839
2809
|
});
|
|
2840
|
-
function create$
|
|
2810
|
+
function create$27(context) {
|
|
2841
2811
|
const hint = core.ComponentDetectionHint.None;
|
|
2842
2812
|
const collector = core.useComponentCollector(context, { hint });
|
|
2843
2813
|
const collectorLegacy = core.useComponentCollectorLegacy(context);
|
|
@@ -2866,7 +2836,7 @@ function create$28(context) {
|
|
|
2866
2836
|
|
|
2867
2837
|
//#endregion
|
|
2868
2838
|
//#region src/rules/no-redundant-should-component-update.ts
|
|
2869
|
-
const RULE_NAME$
|
|
2839
|
+
const RULE_NAME$26 = "no-redundant-should-component-update";
|
|
2870
2840
|
function isShouldComponentUpdate(node) {
|
|
2871
2841
|
return ast.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
|
|
2872
2842
|
}
|
|
@@ -2877,11 +2847,11 @@ var no_redundant_should_component_update_default = createRule({
|
|
|
2877
2847
|
messages: { default: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'." },
|
|
2878
2848
|
schema: []
|
|
2879
2849
|
},
|
|
2880
|
-
name: RULE_NAME$
|
|
2881
|
-
create: create$
|
|
2850
|
+
name: RULE_NAME$26,
|
|
2851
|
+
create: create$26,
|
|
2882
2852
|
defaultOptions: []
|
|
2883
2853
|
});
|
|
2884
|
-
function create$
|
|
2854
|
+
function create$26(context) {
|
|
2885
2855
|
if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
|
|
2886
2856
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
2887
2857
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -2899,7 +2869,7 @@ function create$27(context) {
|
|
|
2899
2869
|
|
|
2900
2870
|
//#endregion
|
|
2901
2871
|
//#region src/rules/no-set-state-in-component-did-mount.ts
|
|
2902
|
-
const RULE_NAME$
|
|
2872
|
+
const RULE_NAME$25 = "no-set-state-in-component-did-mount";
|
|
2903
2873
|
var no_set_state_in_component_did_mount_default = createRule({
|
|
2904
2874
|
meta: {
|
|
2905
2875
|
type: "problem",
|
|
@@ -2907,11 +2877,11 @@ var no_set_state_in_component_did_mount_default = createRule({
|
|
|
2907
2877
|
messages: { default: "Do not call `this.setState` in `componentDidMount` outside functions such as callbacks." },
|
|
2908
2878
|
schema: []
|
|
2909
2879
|
},
|
|
2910
|
-
name: RULE_NAME$
|
|
2911
|
-
create: create$
|
|
2880
|
+
name: RULE_NAME$25,
|
|
2881
|
+
create: create$25,
|
|
2912
2882
|
defaultOptions: []
|
|
2913
2883
|
});
|
|
2914
|
-
function create$
|
|
2884
|
+
function create$25(context) {
|
|
2915
2885
|
if (!context.sourceCode.text.includes("componentDidMount")) return {};
|
|
2916
2886
|
return defineRuleListener({ CallExpression(node) {
|
|
2917
2887
|
if (!core.isThisSetState(node)) return;
|
|
@@ -2929,7 +2899,7 @@ function create$26(context) {
|
|
|
2929
2899
|
|
|
2930
2900
|
//#endregion
|
|
2931
2901
|
//#region src/rules/no-set-state-in-component-did-update.ts
|
|
2932
|
-
const RULE_NAME$
|
|
2902
|
+
const RULE_NAME$24 = "no-set-state-in-component-did-update";
|
|
2933
2903
|
var no_set_state_in_component_did_update_default = createRule({
|
|
2934
2904
|
meta: {
|
|
2935
2905
|
type: "problem",
|
|
@@ -2937,11 +2907,11 @@ var no_set_state_in_component_did_update_default = createRule({
|
|
|
2937
2907
|
messages: { default: "Do not call `this.setState` in `componentDidUpdate` outside functions such as callbacks." },
|
|
2938
2908
|
schema: []
|
|
2939
2909
|
},
|
|
2940
|
-
name: RULE_NAME$
|
|
2941
|
-
create: create$
|
|
2910
|
+
name: RULE_NAME$24,
|
|
2911
|
+
create: create$24,
|
|
2942
2912
|
defaultOptions: []
|
|
2943
2913
|
});
|
|
2944
|
-
function create$
|
|
2914
|
+
function create$24(context) {
|
|
2945
2915
|
if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
|
|
2946
2916
|
return defineRuleListener({ CallExpression(node) {
|
|
2947
2917
|
if (!core.isThisSetState(node)) return;
|
|
@@ -2959,7 +2929,7 @@ function create$25(context) {
|
|
|
2959
2929
|
|
|
2960
2930
|
//#endregion
|
|
2961
2931
|
//#region src/rules/no-set-state-in-component-will-update.ts
|
|
2962
|
-
const RULE_NAME$
|
|
2932
|
+
const RULE_NAME$23 = "no-set-state-in-component-will-update";
|
|
2963
2933
|
var no_set_state_in_component_will_update_default = createRule({
|
|
2964
2934
|
meta: {
|
|
2965
2935
|
type: "problem",
|
|
@@ -2967,11 +2937,11 @@ var no_set_state_in_component_will_update_default = createRule({
|
|
|
2967
2937
|
messages: { default: "Do not call `this.setState` in `componentWillUpdate` outside functions such as callbacks." },
|
|
2968
2938
|
schema: []
|
|
2969
2939
|
},
|
|
2970
|
-
name: RULE_NAME$
|
|
2971
|
-
create: create$
|
|
2940
|
+
name: RULE_NAME$23,
|
|
2941
|
+
create: create$23,
|
|
2972
2942
|
defaultOptions: []
|
|
2973
2943
|
});
|
|
2974
|
-
function create$
|
|
2944
|
+
function create$23(context) {
|
|
2975
2945
|
if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
|
|
2976
2946
|
return defineRuleListener({ CallExpression(node) {
|
|
2977
2947
|
if (!core.isThisSetState(node)) return;
|
|
@@ -2989,7 +2959,7 @@ function create$24(context) {
|
|
|
2989
2959
|
|
|
2990
2960
|
//#endregion
|
|
2991
2961
|
//#region src/rules/no-unnecessary-use-callback.ts
|
|
2992
|
-
const RULE_NAME$
|
|
2962
|
+
const RULE_NAME$22 = "no-unnecessary-use-callback";
|
|
2993
2963
|
var no_unnecessary_use_callback_default = createRule({
|
|
2994
2964
|
meta: {
|
|
2995
2965
|
type: "problem",
|
|
@@ -3000,11 +2970,11 @@ var no_unnecessary_use_callback_default = createRule({
|
|
|
3000
2970
|
},
|
|
3001
2971
|
schema: []
|
|
3002
2972
|
},
|
|
3003
|
-
name: RULE_NAME$
|
|
3004
|
-
create: create$
|
|
2973
|
+
name: RULE_NAME$22,
|
|
2974
|
+
create: create$22,
|
|
3005
2975
|
defaultOptions: []
|
|
3006
2976
|
});
|
|
3007
|
-
function create$
|
|
2977
|
+
function create$22(context) {
|
|
3008
2978
|
if (!context.sourceCode.text.includes("useCallback")) return {};
|
|
3009
2979
|
return defineRuleListener({ VariableDeclarator(node) {
|
|
3010
2980
|
const { id, init } = node;
|
|
@@ -3066,7 +3036,7 @@ function checkForUsageInsideUseEffect$1(sourceCode, node) {
|
|
|
3066
3036
|
|
|
3067
3037
|
//#endregion
|
|
3068
3038
|
//#region src/rules/no-unnecessary-use-memo.ts
|
|
3069
|
-
const RULE_NAME$
|
|
3039
|
+
const RULE_NAME$21 = "no-unnecessary-use-memo";
|
|
3070
3040
|
var no_unnecessary_use_memo_default = createRule({
|
|
3071
3041
|
meta: {
|
|
3072
3042
|
type: "problem",
|
|
@@ -3077,11 +3047,11 @@ var no_unnecessary_use_memo_default = createRule({
|
|
|
3077
3047
|
},
|
|
3078
3048
|
schema: []
|
|
3079
3049
|
},
|
|
3080
|
-
name: RULE_NAME$
|
|
3081
|
-
create: create$
|
|
3050
|
+
name: RULE_NAME$21,
|
|
3051
|
+
create: create$21,
|
|
3082
3052
|
defaultOptions: []
|
|
3083
3053
|
});
|
|
3084
|
-
function create$
|
|
3054
|
+
function create$21(context) {
|
|
3085
3055
|
if (!context.sourceCode.text.includes("useMemo")) return {};
|
|
3086
3056
|
return defineRuleListener({ VariableDeclarator(node) {
|
|
3087
3057
|
const { id, init } = node;
|
|
@@ -3147,7 +3117,7 @@ function checkForUsageInsideUseEffect(sourceCode, node) {
|
|
|
3147
3117
|
|
|
3148
3118
|
//#endregion
|
|
3149
3119
|
//#region src/rules/no-unnecessary-use-prefix.ts
|
|
3150
|
-
const RULE_NAME$
|
|
3120
|
+
const RULE_NAME$20 = "no-unnecessary-use-prefix";
|
|
3151
3121
|
const WELL_KNOWN_HOOKS = ["useMDXComponents"];
|
|
3152
3122
|
function containsUseComments(context, node) {
|
|
3153
3123
|
return context.sourceCode.getCommentsInside(node).some(({ value }) => /use\([\s\S]*?\)/u.test(value) || /use[A-Z0-9]\w*\([\s\S]*?\)/u.test(value));
|
|
@@ -3159,11 +3129,11 @@ var no_unnecessary_use_prefix_default = createRule({
|
|
|
3159
3129
|
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." },
|
|
3160
3130
|
schema: []
|
|
3161
3131
|
},
|
|
3162
|
-
name: RULE_NAME$
|
|
3163
|
-
create: create$
|
|
3132
|
+
name: RULE_NAME$20,
|
|
3133
|
+
create: create$20,
|
|
3164
3134
|
defaultOptions: []
|
|
3165
3135
|
});
|
|
3166
|
-
function create$
|
|
3136
|
+
function create$20(context) {
|
|
3167
3137
|
const { ctx, visitor } = core.useHookCollector(context);
|
|
3168
3138
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
3169
3139
|
for (const { id, name, node, hookCalls } of ctx.getAllHooks(program)) {
|
|
@@ -3183,7 +3153,7 @@ function create$21(context) {
|
|
|
3183
3153
|
|
|
3184
3154
|
//#endregion
|
|
3185
3155
|
//#region src/rules/no-unsafe-component-will-mount.ts
|
|
3186
|
-
const RULE_NAME$
|
|
3156
|
+
const RULE_NAME$19 = "no-unsafe-component-will-mount";
|
|
3187
3157
|
var no_unsafe_component_will_mount_default = createRule({
|
|
3188
3158
|
meta: {
|
|
3189
3159
|
type: "problem",
|
|
@@ -3191,11 +3161,11 @@ var no_unsafe_component_will_mount_default = createRule({
|
|
|
3191
3161
|
messages: { default: "Do not use 'UNSAFE_componentWillMount'." },
|
|
3192
3162
|
schema: []
|
|
3193
3163
|
},
|
|
3194
|
-
name: RULE_NAME$
|
|
3195
|
-
create: create$
|
|
3164
|
+
name: RULE_NAME$19,
|
|
3165
|
+
create: create$19,
|
|
3196
3166
|
defaultOptions: []
|
|
3197
3167
|
});
|
|
3198
|
-
function create$
|
|
3168
|
+
function create$19(context) {
|
|
3199
3169
|
if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
|
|
3200
3170
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
3201
3171
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -3211,7 +3181,7 @@ function create$20(context) {
|
|
|
3211
3181
|
|
|
3212
3182
|
//#endregion
|
|
3213
3183
|
//#region src/rules/no-unsafe-component-will-receive-props.ts
|
|
3214
|
-
const RULE_NAME$
|
|
3184
|
+
const RULE_NAME$18 = "no-unsafe-component-will-receive-props";
|
|
3215
3185
|
var no_unsafe_component_will_receive_props_default = createRule({
|
|
3216
3186
|
meta: {
|
|
3217
3187
|
type: "problem",
|
|
@@ -3219,11 +3189,11 @@ var no_unsafe_component_will_receive_props_default = createRule({
|
|
|
3219
3189
|
messages: { default: "Do not use 'UNSAFE_componentWillReceiveProps'." },
|
|
3220
3190
|
schema: []
|
|
3221
3191
|
},
|
|
3222
|
-
name: RULE_NAME$
|
|
3223
|
-
create: create$
|
|
3192
|
+
name: RULE_NAME$18,
|
|
3193
|
+
create: create$18,
|
|
3224
3194
|
defaultOptions: []
|
|
3225
3195
|
});
|
|
3226
|
-
function create$
|
|
3196
|
+
function create$18(context) {
|
|
3227
3197
|
if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) return {};
|
|
3228
3198
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
3229
3199
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -3239,7 +3209,7 @@ function create$19(context) {
|
|
|
3239
3209
|
|
|
3240
3210
|
//#endregion
|
|
3241
3211
|
//#region src/rules/no-unsafe-component-will-update.ts
|
|
3242
|
-
const RULE_NAME$
|
|
3212
|
+
const RULE_NAME$17 = "no-unsafe-component-will-update";
|
|
3243
3213
|
var no_unsafe_component_will_update_default = createRule({
|
|
3244
3214
|
meta: {
|
|
3245
3215
|
type: "problem",
|
|
@@ -3247,11 +3217,11 @@ var no_unsafe_component_will_update_default = createRule({
|
|
|
3247
3217
|
messages: { default: "Do not use 'UNSAFE_componentWillUpdate'." },
|
|
3248
3218
|
schema: []
|
|
3249
3219
|
},
|
|
3250
|
-
name: RULE_NAME$
|
|
3251
|
-
create: create$
|
|
3220
|
+
name: RULE_NAME$17,
|
|
3221
|
+
create: create$17,
|
|
3252
3222
|
defaultOptions: []
|
|
3253
3223
|
});
|
|
3254
|
-
function create$
|
|
3224
|
+
function create$17(context) {
|
|
3255
3225
|
if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
|
|
3256
3226
|
const { ctx, visitor } = core.useComponentCollectorLegacy(context);
|
|
3257
3227
|
return defineRuleListener(visitor, { "Program:exit"(program) {
|
|
@@ -3267,7 +3237,7 @@ function create$18(context) {
|
|
|
3267
3237
|
|
|
3268
3238
|
//#endregion
|
|
3269
3239
|
//#region src/rules/no-unstable-context-value.ts
|
|
3270
|
-
const RULE_NAME$
|
|
3240
|
+
const RULE_NAME$16 = "no-unstable-context-value";
|
|
3271
3241
|
var no_unstable_context_value_default = createRule({
|
|
3272
3242
|
meta: {
|
|
3273
3243
|
type: "problem",
|
|
@@ -3275,11 +3245,11 @@ var no_unstable_context_value_default = createRule({
|
|
|
3275
3245
|
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}}" },
|
|
3276
3246
|
schema: []
|
|
3277
3247
|
},
|
|
3278
|
-
name: RULE_NAME$
|
|
3279
|
-
create: create$
|
|
3248
|
+
name: RULE_NAME$16,
|
|
3249
|
+
create: create$16,
|
|
3280
3250
|
defaultOptions: []
|
|
3281
3251
|
});
|
|
3282
|
-
function create$
|
|
3252
|
+
function create$16(context) {
|
|
3283
3253
|
const { compilationMode, version } = getSettingsFromContext(context);
|
|
3284
3254
|
if (compilationMode === "infer" || compilationMode === "all") return {};
|
|
3285
3255
|
if (compilationMode === "annotation" && ast.isDirectiveInFile(context.sourceCode.ast, "use memo")) return {};
|
|
@@ -3331,7 +3301,7 @@ function isContextName(name, isReact18OrBelow) {
|
|
|
3331
3301
|
|
|
3332
3302
|
//#endregion
|
|
3333
3303
|
//#region src/rules/no-unstable-default-props.ts
|
|
3334
|
-
const RULE_NAME$
|
|
3304
|
+
const RULE_NAME$15 = "no-unstable-default-props";
|
|
3335
3305
|
const defaultOptions$2 = [{ safeDefaultProps: [] }];
|
|
3336
3306
|
const schema$2 = [{
|
|
3337
3307
|
type: "object",
|
|
@@ -3348,8 +3318,8 @@ var no_unstable_default_props_default = createRule({
|
|
|
3348
3318
|
messages: { default: "A/an '{{kind}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{kind}}'." },
|
|
3349
3319
|
schema: schema$2
|
|
3350
3320
|
},
|
|
3351
|
-
name: RULE_NAME$
|
|
3352
|
-
create: create$
|
|
3321
|
+
name: RULE_NAME$15,
|
|
3322
|
+
create: create$15,
|
|
3353
3323
|
defaultOptions: defaultOptions$2
|
|
3354
3324
|
});
|
|
3355
3325
|
function extractIdentifier(node) {
|
|
@@ -3360,7 +3330,7 @@ function extractIdentifier(node) {
|
|
|
3360
3330
|
}
|
|
3361
3331
|
return null;
|
|
3362
3332
|
}
|
|
3363
|
-
function create$
|
|
3333
|
+
function create$15(context, [options]) {
|
|
3364
3334
|
const { compilationMode } = getSettingsFromContext(context);
|
|
3365
3335
|
if (compilationMode === "infer" || compilationMode === "all") return {};
|
|
3366
3336
|
if (compilationMode === "annotation" && ast.isDirectiveInFile(context.sourceCode.ast, "use memo")) return {};
|
|
@@ -3406,7 +3376,7 @@ function create$16(context, [options]) {
|
|
|
3406
3376
|
|
|
3407
3377
|
//#endregion
|
|
3408
3378
|
//#region src/rules/no-unused-class-component-members.ts
|
|
3409
|
-
const RULE_NAME$
|
|
3379
|
+
const RULE_NAME$14 = "no-unused-class-component-members";
|
|
3410
3380
|
const LIFECYCLE_METHODS = new Set([
|
|
3411
3381
|
"componentDidCatch",
|
|
3412
3382
|
"componentDidMount",
|
|
@@ -3437,11 +3407,11 @@ var no_unused_class_component_members_default = createRule({
|
|
|
3437
3407
|
messages: { default: "Unused method or property '{{methodName}}'' of class '{{className}}'." },
|
|
3438
3408
|
schema: []
|
|
3439
3409
|
},
|
|
3440
|
-
name: RULE_NAME$
|
|
3441
|
-
create: create$
|
|
3410
|
+
name: RULE_NAME$14,
|
|
3411
|
+
create: create$14,
|
|
3442
3412
|
defaultOptions: []
|
|
3443
3413
|
});
|
|
3444
|
-
function create$
|
|
3414
|
+
function create$14(context) {
|
|
3445
3415
|
const classStack = [];
|
|
3446
3416
|
const methodStack = [];
|
|
3447
3417
|
const propertyDefs = /* @__PURE__ */ new WeakMap();
|
|
@@ -3522,7 +3492,7 @@ function create$15(context) {
|
|
|
3522
3492
|
|
|
3523
3493
|
//#endregion
|
|
3524
3494
|
//#region src/rules/no-unused-props.ts
|
|
3525
|
-
const RULE_NAME$
|
|
3495
|
+
const RULE_NAME$13 = "no-unused-props";
|
|
3526
3496
|
var no_unused_props_default = createRule({
|
|
3527
3497
|
meta: {
|
|
3528
3498
|
type: "problem",
|
|
@@ -3530,11 +3500,11 @@ var no_unused_props_default = createRule({
|
|
|
3530
3500
|
messages: { default: "Prop `{{name}}` is declared but never used" },
|
|
3531
3501
|
schema: []
|
|
3532
3502
|
},
|
|
3533
|
-
name: RULE_NAME$
|
|
3534
|
-
create: create$
|
|
3503
|
+
name: RULE_NAME$13,
|
|
3504
|
+
create: create$13,
|
|
3535
3505
|
defaultOptions: []
|
|
3536
3506
|
});
|
|
3537
|
-
function create$
|
|
3507
|
+
function create$13(context) {
|
|
3538
3508
|
const services = ESLintUtils.getParserServices(context, false);
|
|
3539
3509
|
const checker = services.program.getTypeChecker();
|
|
3540
3510
|
const { ctx, visitor } = core.useComponentCollector(context);
|
|
@@ -3634,7 +3604,7 @@ function reportUnusedProp(context, services, prop) {
|
|
|
3634
3604
|
|
|
3635
3605
|
//#endregion
|
|
3636
3606
|
//#region src/rules/no-unused-state.ts
|
|
3637
|
-
const RULE_NAME$
|
|
3607
|
+
const RULE_NAME$12 = "no-unused-state";
|
|
3638
3608
|
function isKeyLiteral(node, key) {
|
|
3639
3609
|
return match(key).with({ type: AST_NODE_TYPES.Literal }, constTrue).with({
|
|
3640
3610
|
type: AST_NODE_TYPES.TemplateLiteral,
|
|
@@ -3648,11 +3618,11 @@ var no_unused_state_default = createRule({
|
|
|
3648
3618
|
messages: { default: "Unused class component state in '{{className}}'" },
|
|
3649
3619
|
schema: []
|
|
3650
3620
|
},
|
|
3651
|
-
name: RULE_NAME$
|
|
3652
|
-
create: create$
|
|
3621
|
+
name: RULE_NAME$12,
|
|
3622
|
+
create: create$12,
|
|
3653
3623
|
defaultOptions: []
|
|
3654
3624
|
});
|
|
3655
|
-
function create$
|
|
3625
|
+
function create$12(context) {
|
|
3656
3626
|
const classStack = [];
|
|
3657
3627
|
const methodStack = [];
|
|
3658
3628
|
const constructorStack = [];
|
|
@@ -3761,7 +3731,7 @@ function create$13(context) {
|
|
|
3761
3731
|
|
|
3762
3732
|
//#endregion
|
|
3763
3733
|
//#region src/rules/no-use-context.ts
|
|
3764
|
-
const RULE_NAME$
|
|
3734
|
+
const RULE_NAME$11 = "no-use-context";
|
|
3765
3735
|
var no_use_context_default = createRule({
|
|
3766
3736
|
meta: {
|
|
3767
3737
|
type: "problem",
|
|
@@ -3770,11 +3740,11 @@ var no_use_context_default = createRule({
|
|
|
3770
3740
|
messages: { default: "In React 19, 'use' is preferred over 'useContext' because it is more flexible." },
|
|
3771
3741
|
schema: []
|
|
3772
3742
|
},
|
|
3773
|
-
name: RULE_NAME$
|
|
3774
|
-
create: create$
|
|
3743
|
+
name: RULE_NAME$11,
|
|
3744
|
+
create: create$11,
|
|
3775
3745
|
defaultOptions: []
|
|
3776
3746
|
});
|
|
3777
|
-
function create$
|
|
3747
|
+
function create$11(context) {
|
|
3778
3748
|
if (!context.sourceCode.text.includes("useContext")) return {};
|
|
3779
3749
|
const settings = getSettingsFromContext(context);
|
|
3780
3750
|
if (compare(settings.version, "19.0.0", "<")) return {};
|
|
@@ -3837,33 +3807,6 @@ function getCorrelativeTokens(context, node) {
|
|
|
3837
3807
|
return tokens;
|
|
3838
3808
|
}
|
|
3839
3809
|
|
|
3840
|
-
//#endregion
|
|
3841
|
-
//#region src/rules/no-useless-forward-ref.ts
|
|
3842
|
-
const RULE_NAME$11 = "no-useless-forward-ref";
|
|
3843
|
-
var no_useless_forward_ref_default = createRule({
|
|
3844
|
-
meta: {
|
|
3845
|
-
type: "problem",
|
|
3846
|
-
docs: { description: "Disallows useless 'forwardRef' calls on components that don't use 'ref's." },
|
|
3847
|
-
messages: { default: "A 'forwardRef' is used with this component but no 'ref' parameter is set." },
|
|
3848
|
-
schema: []
|
|
3849
|
-
},
|
|
3850
|
-
name: RULE_NAME$11,
|
|
3851
|
-
create: create$11,
|
|
3852
|
-
defaultOptions: []
|
|
3853
|
-
});
|
|
3854
|
-
function create$11(context) {
|
|
3855
|
-
return defineRuleListener({ CallExpression(node) {
|
|
3856
|
-
if (!core.isForwardRefCall(context, node)) return;
|
|
3857
|
-
const [component] = node.arguments;
|
|
3858
|
-
if (component == null || !ast.isFunction(component)) return;
|
|
3859
|
-
if (component.params[1] != null) return;
|
|
3860
|
-
context.report({
|
|
3861
|
-
messageId: "default",
|
|
3862
|
-
node: node.callee
|
|
3863
|
-
});
|
|
3864
|
-
} });
|
|
3865
|
-
}
|
|
3866
|
-
|
|
3867
3810
|
//#endregion
|
|
3868
3811
|
//#region src/rules/no-useless-fragment.ts
|
|
3869
3812
|
const RULE_NAME$10 = "no-useless-fragment";
|
|
@@ -7417,7 +7360,6 @@ const plugin = {
|
|
|
7417
7360
|
"jsx-key-before-spread": jsx_key_before_spread_default,
|
|
7418
7361
|
"jsx-no-comment-textnodes": jsx_no_comment_textnodes_default,
|
|
7419
7362
|
"jsx-no-duplicate-props": jsx_no_duplicate_props_default,
|
|
7420
|
-
"jsx-no-undef": jsx_no_undef_default,
|
|
7421
7363
|
"jsx-shorthand-boolean": jsx_shorthand_boolean_default,
|
|
7422
7364
|
"jsx-shorthand-fragment": jsx_shorthand_fragment_default,
|
|
7423
7365
|
"jsx-uses-react": jsx_uses_react_default,
|
|
@@ -7464,7 +7406,6 @@ const plugin = {
|
|
|
7464
7406
|
"no-unused-props": no_unused_props_default,
|
|
7465
7407
|
"no-unused-state": no_unused_state_default,
|
|
7466
7408
|
"no-use-context": no_use_context_default,
|
|
7467
|
-
"no-useless-forward-ref": no_useless_forward_ref_default,
|
|
7468
7409
|
"no-useless-fragment": no_useless_fragment_default,
|
|
7469
7410
|
"prefer-destructuring-assignment": prefer_destructuring_assignment_default,
|
|
7470
7411
|
"prefer-namespace-import": prefer_namespace_import_default,
|
|
@@ -7474,6 +7415,7 @@ const plugin = {
|
|
|
7474
7415
|
"rules-of-hooks": rule,
|
|
7475
7416
|
"set-state-in-effect": set_state_in_effect_default,
|
|
7476
7417
|
"set-state-in-render": set_state_in_render_default,
|
|
7418
|
+
"static-components": no_nested_component_definitions_default,
|
|
7477
7419
|
"unsupported-syntax": unsupported_syntax_default,
|
|
7478
7420
|
"use-memo": use_memo_default,
|
|
7479
7421
|
"use-state": use_state_default
|
|
@@ -7525,7 +7467,6 @@ const rules$6 = {
|
|
|
7525
7467
|
"react-x/no-unsafe-component-will-receive-props": "warn",
|
|
7526
7468
|
"react-x/no-unsafe-component-will-update": "warn",
|
|
7527
7469
|
"react-x/no-use-context": "warn",
|
|
7528
|
-
"react-x/no-useless-forward-ref": "warn",
|
|
7529
7470
|
"react-x/purity": "warn",
|
|
7530
7471
|
"react-x/rules-of-hooks": "error",
|
|
7531
7472
|
"react-x/set-state-in-effect": "warn",
|
|
@@ -7544,7 +7485,6 @@ const settings$5 = { "react-x": DEFAULT_ESLINT_REACT_SETTINGS };
|
|
|
7544
7485
|
*/
|
|
7545
7486
|
const rules$5 = {
|
|
7546
7487
|
"react-x/jsx-no-duplicate-props": "off",
|
|
7547
|
-
"react-x/jsx-no-undef": "off",
|
|
7548
7488
|
"react-x/jsx-uses-react": "off",
|
|
7549
7489
|
"react-x/jsx-uses-vars": "off"
|
|
7550
7490
|
};
|