eslint-plugin-react-x 3.0.0-next.29 → 3.0.0-next.32

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.
Files changed (2) hide show
  1. package/dist/index.js +406 -296
  2. package/package.json +6 -7
package/dist/index.js CHANGED
@@ -5,13 +5,13 @@ 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
+ import { DefinitionType } from "@typescript-eslint/scope-manager";
8
10
  import { constFalse, constTrue, constVoid, flow, getOrElseUpdate, identity, not, unit } from "@eslint-react/eff";
9
11
  import { compare } from "compare-versions";
10
- import { getConstrainedTypeAtLocation, isTypeReadonly } from "@typescript-eslint/type-utils";
11
- import { isPropertyReadonlyInType, unionConstituents } from "ts-api-utils";
12
- import { findEnclosingAssignmentTarget, findVariable, getChildScopes, getObjectType, getVariableInitializer, isAssignmentTargetEqual } from "@eslint-react/var";
12
+ import { getConstrainedTypeAtLocation } from "@typescript-eslint/type-utils";
13
+ import { unionConstituents } from "ts-api-utils";
13
14
  import { getStaticValue, isIdentifier, isVariableDeclarator } from "@typescript-eslint/utils/ast-utils";
14
- import { getTypeImmutability, isImmutable, isReadonlyDeep, isReadonlyShallow, isUnknown } from "is-immutable-type";
15
15
  import { snakeCase } from "string-ts";
16
16
 
17
17
  //#region \0rolldown/runtime.js
@@ -39,6 +39,7 @@ var disable_experimental_exports = /* @__PURE__ */ __exportAll({
39
39
  const name$8 = "react-x/disable-experimental";
40
40
  const rules$8 = {
41
41
  "react-x/exhaustive-deps": "off",
42
+ "react-x/immutability": "off",
42
43
  "react-x/jsx-key-before-spread": "off",
43
44
  "react-x/no-duplicate-key": "off",
44
45
  "react-x/no-implicit-key": "off",
@@ -46,7 +47,6 @@ const rules$8 = {
46
47
  "react-x/no-unnecessary-use-callback": "off",
47
48
  "react-x/no-unnecessary-use-memo": "off",
48
49
  "react-x/no-unused-props": "off",
49
- "react-x/prefer-read-only-props": "off",
50
50
  "react-x/refs": "off",
51
51
  "react-x/rules-of-hooks": "off",
52
52
  "react-x/set-state-in-render": "off"
@@ -62,14 +62,13 @@ const name$7 = "react-x/disable-type-checked";
62
62
  const rules$7 = {
63
63
  "react-x/no-implicit-key": "off",
64
64
  "react-x/no-leaked-conditional-rendering": "off",
65
- "react-x/no-unused-props": "off",
66
- "react-x/prefer-read-only-props": "off"
65
+ "react-x/no-unused-props": "off"
67
66
  };
68
67
 
69
68
  //#endregion
70
69
  //#region package.json
71
70
  var name$6 = "eslint-plugin-react-x";
72
- var version = "3.0.0-next.29";
71
+ var version = "3.0.0-next.32";
73
72
 
74
73
  //#endregion
75
74
  //#region src/utils/create-rule.ts
@@ -1238,9 +1237,173 @@ function getUnknownDependenciesMessage(reactiveHookName) {
1238
1237
  return `React Hook ${reactiveHookName} received a function whose dependencies are unknown. Pass an inline function instead.`;
1239
1238
  }
1240
1239
 
1240
+ //#endregion
1241
+ //#region src/rules/immutability.ts
1242
+ const RULE_NAME$60 = "immutability";
1243
+ /**
1244
+ * Array methods that mutate the array in place.
1245
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
1246
+ */
1247
+ const MUTATING_ARRAY_METHODS = new Set([
1248
+ "copyWithin",
1249
+ "fill",
1250
+ "pop",
1251
+ "push",
1252
+ "reverse",
1253
+ "shift",
1254
+ "sort",
1255
+ "splice",
1256
+ "unshift"
1257
+ ]);
1258
+ /**
1259
+ * Get the root identifier of a (possibly nested) member expression.
1260
+ * For `a.b.c`, returns the `a` Identifier node.
1261
+ * @param node The expression to analyze
1262
+ * @returns The root Identifier node, or null if it cannot be determined (e.g. non-identifier root)
1263
+ */
1264
+ function getRootIdentifier(node) {
1265
+ switch (node.type) {
1266
+ case AST_NODE_TYPES.Identifier: return node;
1267
+ case AST_NODE_TYPES.MemberExpression: return getRootIdentifier(node.object);
1268
+ default: return null;
1269
+ }
1270
+ }
1271
+ var immutability_default = createRule({
1272
+ meta: {
1273
+ type: "problem",
1274
+ docs: { description: "Validates against mutating props, state, and other values that are immutable." },
1275
+ messages: {
1276
+ mutatingArrayMethod: "Do not call '{{method}}()' on '{{name}}'. Props and state are immutable — create a new array instead.",
1277
+ mutatingAssignment: "Do not mutate '{{name}}' directly. Props and state are immutable — create a new object instead."
1278
+ },
1279
+ schema: []
1280
+ },
1281
+ name: RULE_NAME$60,
1282
+ create: create$60,
1283
+ defaultOptions: []
1284
+ });
1285
+ function create$60(context) {
1286
+ const { additionalStateHooks } = getSettingsFromContext(context);
1287
+ const hCollector = core.useHookCollector(context);
1288
+ const cCollector = core.useComponentCollector(context);
1289
+ /**
1290
+ * Violations accumulated while traversing. Each entry records the node to
1291
+ * report and the enclosing function so we can filter at Program:exit.
1292
+ */
1293
+ const violations = [];
1294
+ function isUseStateCall(node) {
1295
+ return core.isUseStateLikeCall(node, additionalStateHooks);
1296
+ }
1297
+ /**
1298
+ * Return true when `id` is the *value* variable (index 0) produced by a
1299
+ * `useState(…)` call, i.e. the first element of `const [value, setter] = useState(…)`.
1300
+ * @param id The identifier to check. May be a reference to the state variable, e.g. used inside an event handler nested in the component body — scope resolution will trace it back to the original declaration.
1301
+ * @returns True if `id` is a state variable, false otherwise.
1302
+ */
1303
+ function isStateValue(id) {
1304
+ const initNode = getVariableInitializer(findVariable(id, context.sourceCode.getScope(id)), 0);
1305
+ if (initNode == null || initNode.type !== AST_NODE_TYPES.CallExpression) return false;
1306
+ if (!isUseStateCall(initNode)) return false;
1307
+ const declarator = initNode.parent;
1308
+ if (!("id" in declarator) || declarator.id?.type !== AST_NODE_TYPES.ArrayPattern) return true;
1309
+ return declarator.id.elements.findIndex((el) => el?.type === AST_NODE_TYPES.Identifier && el.name === id.name) === 0;
1310
+ }
1311
+ /**
1312
+ * Return true when `id` is a direct (non-destructured) props parameter at
1313
+ * position 0 of any ancestor function.
1314
+ *
1315
+ * Uses scope resolution so that references to `props` inside nested arrow
1316
+ * functions (e.g. event handlers) are correctly traced back to the component
1317
+ * parameter, e.g.:
1318
+ *
1319
+ * function Component(props) { // ← props defined here
1320
+ * const handleClick = () => {
1321
+ * props.items.push(4); // ← props resolved via scope to Component's param
1322
+ * };
1323
+ * }
1324
+ * @param id The identifier to check. May be a reference to the props parameter, e.g. used inside an event handler nested in the component body — scope resolution will trace it back to the original declaration.
1325
+ * @returns True if `id` is a props parameter, false otherwise.
1326
+ */
1327
+ function isPropsObject(id) {
1328
+ const variable = findVariable(id, context.sourceCode.getScope(id));
1329
+ if (variable == null) return false;
1330
+ for (const def of variable.defs) {
1331
+ if (def.type !== DefinitionType.Parameter) continue;
1332
+ if (!ast.isFunction(def.node)) continue;
1333
+ const firstParam = def.node.params.at(0);
1334
+ return firstParam?.type === AST_NODE_TYPES.Identifier && firstParam.name === id.name;
1335
+ }
1336
+ return false;
1337
+ }
1338
+ return defineRuleListener(hCollector.visitor, cCollector.visitor, {
1339
+ CallExpression(node) {
1340
+ if (node.callee.type !== AST_NODE_TYPES.MemberExpression) return;
1341
+ const { object, property } = node.callee;
1342
+ if (property.type !== AST_NODE_TYPES.Identifier) return;
1343
+ if (!MUTATING_ARRAY_METHODS.has(property.name)) return;
1344
+ const rootId = getRootIdentifier(object);
1345
+ if (rootId == null) return;
1346
+ if (rootId.name === "draft") return;
1347
+ const enclosingFn = ast.findParentNode(node, ast.isFunction);
1348
+ if (enclosingFn == null) return;
1349
+ const isState = isStateValue(rootId);
1350
+ const isProps = isPropsObject(rootId);
1351
+ if (!isState && !isProps) return;
1352
+ violations.push({
1353
+ messageId: "mutatingArrayMethod",
1354
+ node,
1355
+ data: {
1356
+ name: context.sourceCode.getText(object),
1357
+ method: property.name
1358
+ },
1359
+ func: enclosingFn
1360
+ });
1361
+ },
1362
+ AssignmentExpression(node) {
1363
+ if (node.left.type !== AST_NODE_TYPES.MemberExpression) return;
1364
+ const rootId = getRootIdentifier(node.left);
1365
+ if (rootId == null) return;
1366
+ if (rootId.name === "draft") return;
1367
+ const enclosingFn = ast.findParentNode(node, ast.isFunction);
1368
+ if (enclosingFn == null) return;
1369
+ const isState = isStateValue(rootId);
1370
+ const isProps = isPropsObject(rootId);
1371
+ if (!isState && !isProps) return;
1372
+ violations.push({
1373
+ messageId: "mutatingAssignment",
1374
+ node,
1375
+ data: { name: context.sourceCode.getText(node.left.object) },
1376
+ func: enclosingFn
1377
+ });
1378
+ },
1379
+ "Program:exit"(program) {
1380
+ const components = cCollector.ctx.getAllComponents(program);
1381
+ const hooks = hCollector.ctx.getAllHooks(program);
1382
+ const componentAndHookFns = new Set([...components.map((c) => c.node), ...hooks.map((h) => h.node)]);
1383
+ for (const { messageId, node, data, func } of violations) {
1384
+ let current = func;
1385
+ let insideComponentOrHook = false;
1386
+ while (current != null) {
1387
+ if (componentAndHookFns.has(current)) {
1388
+ insideComponentOrHook = true;
1389
+ break;
1390
+ }
1391
+ current = ast.findParentNode(current, ast.isFunction);
1392
+ }
1393
+ if (!insideComponentOrHook) continue;
1394
+ context.report({
1395
+ messageId,
1396
+ node,
1397
+ data
1398
+ });
1399
+ }
1400
+ }
1401
+ });
1402
+ }
1403
+
1241
1404
  //#endregion
1242
1405
  //#region src/rules/jsx-dollar.ts
1243
- const RULE_NAME$60 = "jsx-dollar";
1406
+ const RULE_NAME$59 = "jsx-dollar";
1244
1407
  var jsx_dollar_default = createRule({
1245
1408
  meta: {
1246
1409
  type: "problem",
@@ -1253,11 +1416,11 @@ var jsx_dollar_default = createRule({
1253
1416
  },
1254
1417
  schema: []
1255
1418
  },
1256
- name: RULE_NAME$60,
1257
- create: create$60,
1419
+ name: RULE_NAME$59,
1420
+ create: create$59,
1258
1421
  defaultOptions: []
1259
1422
  });
1260
- function create$60(context) {
1423
+ function create$59(context) {
1261
1424
  /**
1262
1425
  * Visitor function for JSXElement and JSXFragment nodes
1263
1426
  * @param node The JSXElement or JSXFragment node to be checked
@@ -1298,7 +1461,7 @@ function create$60(context) {
1298
1461
 
1299
1462
  //#endregion
1300
1463
  //#region src/rules/jsx-key-before-spread.ts
1301
- const RULE_NAME$59 = "jsx-key-before-spread";
1464
+ const RULE_NAME$58 = "jsx-key-before-spread";
1302
1465
  var jsx_key_before_spread_default = createRule({
1303
1466
  meta: {
1304
1467
  type: "problem",
@@ -1306,11 +1469,11 @@ var jsx_key_before_spread_default = createRule({
1306
1469
  messages: { default: "The 'key' prop must be placed before any spread props when using the new JSX transform." },
1307
1470
  schema: []
1308
1471
  },
1309
- name: RULE_NAME$59,
1310
- create: create$59,
1472
+ name: RULE_NAME$58,
1473
+ create: create$58,
1311
1474
  defaultOptions: []
1312
1475
  });
1313
- function create$59(context) {
1476
+ function create$58(context) {
1314
1477
  const { jsx } = {
1315
1478
  ...core.getJsxConfigFromContext(context),
1316
1479
  ...core.getJsxConfigFromAnnotation(context)
@@ -1334,7 +1497,7 @@ function create$59(context) {
1334
1497
 
1335
1498
  //#endregion
1336
1499
  //#region src/rules/jsx-no-comment-textnodes.ts
1337
- const RULE_NAME$58 = "jsx-no-comment-textnodes";
1500
+ const RULE_NAME$57 = "jsx-no-comment-textnodes";
1338
1501
  var jsx_no_comment_textnodes_default = createRule({
1339
1502
  meta: {
1340
1503
  type: "problem",
@@ -1342,11 +1505,11 @@ var jsx_no_comment_textnodes_default = createRule({
1342
1505
  messages: { default: "Possible misused comment in text node. Comments inside children section of tag should be placed inside braces." },
1343
1506
  schema: []
1344
1507
  },
1345
- name: RULE_NAME$58,
1346
- create: create$58,
1508
+ name: RULE_NAME$57,
1509
+ create: create$57,
1347
1510
  defaultOptions: []
1348
1511
  });
1349
- function create$58(context) {
1512
+ function create$57(context) {
1350
1513
  function hasCommentLike(node) {
1351
1514
  if (ast.isOneOf([AST_NODE_TYPES.JSXAttribute, AST_NODE_TYPES.JSXExpressionContainer])(node.parent)) return false;
1352
1515
  return /^\s*\/(?:\/|\*)/mu.test(context.sourceCode.getText(node));
@@ -1367,7 +1530,7 @@ function create$58(context) {
1367
1530
 
1368
1531
  //#endregion
1369
1532
  //#region src/rules/jsx-no-duplicate-props.ts
1370
- const RULE_NAME$57 = "jsx-no-duplicate-props";
1533
+ const RULE_NAME$56 = "jsx-no-duplicate-props";
1371
1534
  var jsx_no_duplicate_props_default = createRule({
1372
1535
  meta: {
1373
1536
  type: "problem",
@@ -1375,11 +1538,11 @@ var jsx_no_duplicate_props_default = createRule({
1375
1538
  messages: { default: "This JSX property is assigned multiple times." },
1376
1539
  schema: []
1377
1540
  },
1378
- name: RULE_NAME$57,
1379
- create: create$57,
1541
+ name: RULE_NAME$56,
1542
+ create: create$56,
1380
1543
  defaultOptions: []
1381
1544
  });
1382
- function create$57(context) {
1545
+ function create$56(context) {
1383
1546
  return defineRuleListener({ JSXOpeningElement(node) {
1384
1547
  const props = [];
1385
1548
  for (const attr of node.attributes) {
@@ -1400,7 +1563,7 @@ function create$57(context) {
1400
1563
 
1401
1564
  //#endregion
1402
1565
  //#region src/rules/jsx-shorthand-boolean.ts
1403
- const RULE_NAME$56 = "jsx-shorthand-boolean";
1566
+ const RULE_NAME$55 = "jsx-shorthand-boolean";
1404
1567
  const defaultOptions$4 = [1];
1405
1568
  const schema$4 = [{
1406
1569
  type: "integer",
@@ -1414,11 +1577,11 @@ var jsx_shorthand_boolean_default = createRule({
1414
1577
  messages: { default: "{{message}}" },
1415
1578
  schema: schema$4
1416
1579
  },
1417
- name: RULE_NAME$56,
1418
- create: create$56,
1580
+ name: RULE_NAME$55,
1581
+ create: create$55,
1419
1582
  defaultOptions: defaultOptions$4
1420
1583
  });
1421
- function create$56(context) {
1584
+ function create$55(context) {
1422
1585
  const policy = context.options[0] ?? defaultOptions$4[0];
1423
1586
  return defineRuleListener({ JSXAttribute(node) {
1424
1587
  const { value } = node;
@@ -1446,7 +1609,7 @@ function create$56(context) {
1446
1609
 
1447
1610
  //#endregion
1448
1611
  //#region src/rules/jsx-shorthand-fragment.ts
1449
- const RULE_NAME$55 = "jsx-shorthand-fragment";
1612
+ const RULE_NAME$54 = "jsx-shorthand-fragment";
1450
1613
  const defaultOptions$3 = [1];
1451
1614
  const schema$3 = [{
1452
1615
  type: "integer",
@@ -1460,11 +1623,11 @@ var jsx_shorthand_fragment_default = createRule({
1460
1623
  messages: { default: "{{message}}" },
1461
1624
  schema: schema$3
1462
1625
  },
1463
- name: RULE_NAME$55,
1464
- create: create$55,
1626
+ name: RULE_NAME$54,
1627
+ create: create$54,
1465
1628
  defaultOptions: defaultOptions$3
1466
1629
  });
1467
- function create$55(context) {
1630
+ function create$54(context) {
1468
1631
  const policy = context.options[0] ?? defaultOptions$3[0];
1469
1632
  const jsxConfig = {
1470
1633
  ...core.getJsxConfigFromContext(context),
@@ -1499,7 +1662,7 @@ function create$55(context) {
1499
1662
 
1500
1663
  //#endregion
1501
1664
  //#region src/rules/jsx-uses-react.ts
1502
- const RULE_NAME$54 = "jsx-uses-react";
1665
+ const RULE_NAME$53 = "jsx-uses-react";
1503
1666
  var jsx_uses_react_default = createRule({
1504
1667
  meta: {
1505
1668
  type: "problem",
@@ -1507,11 +1670,11 @@ var jsx_uses_react_default = createRule({
1507
1670
  messages: { default: "Marked {{name}} as used." },
1508
1671
  schema: []
1509
1672
  },
1510
- name: RULE_NAME$54,
1511
- create: create$54,
1673
+ name: RULE_NAME$53,
1674
+ create: create$53,
1512
1675
  defaultOptions: []
1513
1676
  });
1514
- function create$54(context) {
1677
+ function create$53(context) {
1515
1678
  const { jsx, jsxFactory, jsxFragmentFactory } = {
1516
1679
  ...core.getJsxConfigFromContext(context),
1517
1680
  ...core.getJsxConfigFromAnnotation(context)
@@ -1542,7 +1705,7 @@ function debugReport(context, node, name) {
1542
1705
 
1543
1706
  //#endregion
1544
1707
  //#region src/rules/jsx-uses-vars.ts
1545
- const RULE_NAME$53 = "jsx-uses-vars";
1708
+ const RULE_NAME$52 = "jsx-uses-vars";
1546
1709
  var jsx_uses_vars_default = createRule({
1547
1710
  meta: {
1548
1711
  type: "problem",
@@ -1550,11 +1713,11 @@ var jsx_uses_vars_default = createRule({
1550
1713
  messages: { default: "An identifier in JSX is marked as used." },
1551
1714
  schema: []
1552
1715
  },
1553
- name: RULE_NAME$53,
1554
- create: create$53,
1716
+ name: RULE_NAME$52,
1717
+ create: create$52,
1555
1718
  defaultOptions: []
1556
1719
  });
1557
- function create$53(context) {
1720
+ function create$52(context) {
1558
1721
  return defineRuleListener({ JSXOpeningElement(node) {
1559
1722
  switch (node.name.type) {
1560
1723
  case AST_NODE_TYPES.JSXIdentifier:
@@ -1572,7 +1735,7 @@ function create$53(context) {
1572
1735
 
1573
1736
  //#endregion
1574
1737
  //#region src/rules/no-access-state-in-setstate.ts
1575
- const RULE_NAME$52 = "no-access-state-in-setstate";
1738
+ const RULE_NAME$51 = "no-access-state-in-setstate";
1576
1739
  function isKeyLiteral$2(node, key) {
1577
1740
  return match(key).with({ type: AST_NODE_TYPES.Literal }, constTrue).with({
1578
1741
  type: AST_NODE_TYPES.TemplateLiteral,
@@ -1586,11 +1749,11 @@ var no_access_state_in_setstate_default = createRule({
1586
1749
  messages: { default: "Do not access 'this.state' within 'setState'. Use the update function instead." },
1587
1750
  schema: []
1588
1751
  },
1589
- name: RULE_NAME$52,
1590
- create: create$52,
1752
+ name: RULE_NAME$51,
1753
+ create: create$51,
1591
1754
  defaultOptions: []
1592
1755
  });
1593
- function create$52(context) {
1756
+ function create$51(context) {
1594
1757
  if (!context.sourceCode.text.includes("setState")) return {};
1595
1758
  const classStack = [];
1596
1759
  const methodStack = [];
@@ -1661,7 +1824,7 @@ function create$52(context) {
1661
1824
 
1662
1825
  //#endregion
1663
1826
  //#region src/rules/no-array-index-key.ts
1664
- const RULE_NAME$51 = "no-array-index-key";
1827
+ const RULE_NAME$50 = "no-array-index-key";
1665
1828
  const REACT_CHILDREN_METHOD = ["forEach", "map"];
1666
1829
  function getIndexParamPosition(methodName) {
1667
1830
  switch (methodName) {
@@ -1720,11 +1883,11 @@ var no_array_index_key_default = createRule({
1720
1883
  messages: { default: "Do not use item index in the array as its key." },
1721
1884
  schema: []
1722
1885
  },
1723
- name: RULE_NAME$51,
1724
- create: create$51,
1886
+ name: RULE_NAME$50,
1887
+ create: create$50,
1725
1888
  defaultOptions: []
1726
1889
  });
1727
- function create$51(context) {
1890
+ function create$50(context) {
1728
1891
  const indexParamNames = [];
1729
1892
  function isArrayIndex(node) {
1730
1893
  return node.type === AST_NODE_TYPES.Identifier && indexParamNames.some((name) => name != null && name === node.name);
@@ -1790,7 +1953,7 @@ function create$51(context) {
1790
1953
 
1791
1954
  //#endregion
1792
1955
  //#region src/rules/no-children-count.ts
1793
- const RULE_NAME$50 = "no-children-count";
1956
+ const RULE_NAME$49 = "no-children-count";
1794
1957
  var no_children_count_default = createRule({
1795
1958
  meta: {
1796
1959
  type: "problem",
@@ -1798,11 +1961,11 @@ var no_children_count_default = createRule({
1798
1961
  messages: { default: "Using 'Children.count' is uncommon and can lead to fragile code. Use alternatives instead." },
1799
1962
  schema: []
1800
1963
  },
1801
- name: RULE_NAME$50,
1802
- create: create$50,
1964
+ name: RULE_NAME$49,
1965
+ create: create$49,
1803
1966
  defaultOptions: []
1804
1967
  });
1805
- function create$50(context) {
1968
+ function create$49(context) {
1806
1969
  return defineRuleListener({ MemberExpression(node) {
1807
1970
  if (core.isChildrenCount(context, node)) context.report({
1808
1971
  messageId: "default",
@@ -1813,7 +1976,7 @@ function create$50(context) {
1813
1976
 
1814
1977
  //#endregion
1815
1978
  //#region src/rules/no-children-for-each.ts
1816
- const RULE_NAME$49 = "no-children-for-each";
1979
+ const RULE_NAME$48 = "no-children-for-each";
1817
1980
  var no_children_for_each_default = createRule({
1818
1981
  meta: {
1819
1982
  type: "problem",
@@ -1821,11 +1984,11 @@ var no_children_for_each_default = createRule({
1821
1984
  messages: { default: "Using 'Children.forEach' is uncommon and can lead to fragile code. Use alternatives instead." },
1822
1985
  schema: []
1823
1986
  },
1824
- name: RULE_NAME$49,
1825
- create: create$49,
1987
+ name: RULE_NAME$48,
1988
+ create: create$48,
1826
1989
  defaultOptions: []
1827
1990
  });
1828
- function create$49(context) {
1991
+ function create$48(context) {
1829
1992
  return defineRuleListener({ MemberExpression(node) {
1830
1993
  if (core.isChildrenForEach(context, node)) context.report({
1831
1994
  messageId: "default",
@@ -1836,7 +1999,7 @@ function create$49(context) {
1836
1999
 
1837
2000
  //#endregion
1838
2001
  //#region src/rules/no-children-map.ts
1839
- const RULE_NAME$48 = "no-children-map";
2002
+ const RULE_NAME$47 = "no-children-map";
1840
2003
  var no_children_map_default = createRule({
1841
2004
  meta: {
1842
2005
  type: "problem",
@@ -1844,11 +2007,11 @@ var no_children_map_default = createRule({
1844
2007
  messages: { default: "Using 'Children.map' is uncommon and can lead to fragile code. Use alternatives instead." },
1845
2008
  schema: []
1846
2009
  },
1847
- name: RULE_NAME$48,
1848
- create: create$48,
2010
+ name: RULE_NAME$47,
2011
+ create: create$47,
1849
2012
  defaultOptions: []
1850
2013
  });
1851
- function create$48(context) {
2014
+ function create$47(context) {
1852
2015
  return defineRuleListener({ MemberExpression(node) {
1853
2016
  if (core.isChildrenMap(context, node)) context.report({
1854
2017
  messageId: "default",
@@ -1859,7 +2022,7 @@ function create$48(context) {
1859
2022
 
1860
2023
  //#endregion
1861
2024
  //#region src/rules/no-children-only.ts
1862
- const RULE_NAME$47 = "no-children-only";
2025
+ const RULE_NAME$46 = "no-children-only";
1863
2026
  var no_children_only_default = createRule({
1864
2027
  meta: {
1865
2028
  type: "problem",
@@ -1867,11 +2030,11 @@ var no_children_only_default = createRule({
1867
2030
  messages: { default: "Using 'Children.only' is uncommon and can lead to fragile code. Use alternatives instead." },
1868
2031
  schema: []
1869
2032
  },
1870
- name: RULE_NAME$47,
1871
- create: create$47,
2033
+ name: RULE_NAME$46,
2034
+ create: create$46,
1872
2035
  defaultOptions: []
1873
2036
  });
1874
- function create$47(context) {
2037
+ function create$46(context) {
1875
2038
  return defineRuleListener({ MemberExpression(node) {
1876
2039
  if (core.isChildrenOnly(context, node)) context.report({
1877
2040
  messageId: "default",
@@ -1882,7 +2045,7 @@ function create$47(context) {
1882
2045
 
1883
2046
  //#endregion
1884
2047
  //#region src/rules/no-children-prop.ts
1885
- const RULE_NAME$46 = "no-children-prop";
2048
+ const RULE_NAME$45 = "no-children-prop";
1886
2049
  var no_children_prop_default = createRule({
1887
2050
  meta: {
1888
2051
  type: "problem",
@@ -1890,11 +2053,11 @@ var no_children_prop_default = createRule({
1890
2053
  messages: { default: "Do not pass 'children' as props." },
1891
2054
  schema: []
1892
2055
  },
1893
- name: RULE_NAME$46,
1894
- create: create$46,
2056
+ name: RULE_NAME$45,
2057
+ create: create$45,
1895
2058
  defaultOptions: []
1896
2059
  });
1897
- function create$46(context) {
2060
+ function create$45(context) {
1898
2061
  return defineRuleListener({ JSXElement(node) {
1899
2062
  const childrenProp = core.getJsxAttribute(context, node)("children");
1900
2063
  if (childrenProp != null) context.report({
@@ -1906,7 +2069,7 @@ function create$46(context) {
1906
2069
 
1907
2070
  //#endregion
1908
2071
  //#region src/rules/no-children-to-array.ts
1909
- const RULE_NAME$45 = "no-children-to-array";
2072
+ const RULE_NAME$44 = "no-children-to-array";
1910
2073
  var no_children_to_array_default = createRule({
1911
2074
  meta: {
1912
2075
  type: "problem",
@@ -1914,11 +2077,11 @@ var no_children_to_array_default = createRule({
1914
2077
  messages: { default: "Using 'Children.toArray' is uncommon and can lead to fragile code. Use alternatives instead." },
1915
2078
  schema: []
1916
2079
  },
1917
- name: RULE_NAME$45,
1918
- create: create$45,
2080
+ name: RULE_NAME$44,
2081
+ create: create$44,
1919
2082
  defaultOptions: []
1920
2083
  });
1921
- function create$45(context) {
2084
+ function create$44(context) {
1922
2085
  return defineRuleListener({ MemberExpression(node) {
1923
2086
  if (core.isChildrenToArray(context, node)) context.report({
1924
2087
  messageId: "default",
@@ -1929,7 +2092,7 @@ function create$45(context) {
1929
2092
 
1930
2093
  //#endregion
1931
2094
  //#region src/rules/no-class-component.ts
1932
- const RULE_NAME$44 = "no-class-component";
2095
+ const RULE_NAME$43 = "no-class-component";
1933
2096
  var no_class_component_default = createRule({
1934
2097
  meta: {
1935
2098
  type: "problem",
@@ -1937,11 +2100,11 @@ var no_class_component_default = createRule({
1937
2100
  messages: { default: "Avoid using class components. Use function components instead." },
1938
2101
  schema: []
1939
2102
  },
1940
- name: RULE_NAME$44,
1941
- create: create$44,
2103
+ name: RULE_NAME$43,
2104
+ create: create$43,
1942
2105
  defaultOptions: []
1943
2106
  });
1944
- function create$44(context) {
2107
+ function create$43(context) {
1945
2108
  if (!context.sourceCode.text.includes("Component")) return {};
1946
2109
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
1947
2110
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -1958,7 +2121,7 @@ function create$44(context) {
1958
2121
 
1959
2122
  //#endregion
1960
2123
  //#region src/rules/no-clone-element.ts
1961
- const RULE_NAME$43 = "no-clone-element";
2124
+ const RULE_NAME$42 = "no-clone-element";
1962
2125
  var no_clone_element_default = createRule({
1963
2126
  meta: {
1964
2127
  type: "problem",
@@ -1966,11 +2129,11 @@ var no_clone_element_default = createRule({
1966
2129
  messages: { default: "Using 'cloneElement' is uncommon and can lead to fragile code. Use alternatives instead." },
1967
2130
  schema: []
1968
2131
  },
1969
- name: RULE_NAME$43,
1970
- create: create$43,
2132
+ name: RULE_NAME$42,
2133
+ create: create$42,
1971
2134
  defaultOptions: []
1972
2135
  });
1973
- function create$43(context) {
2136
+ function create$42(context) {
1974
2137
  return defineRuleListener({ CallExpression(node) {
1975
2138
  if (core.isCloneElementCall(context, node)) context.report({
1976
2139
  messageId: "default",
@@ -1981,7 +2144,7 @@ function create$43(context) {
1981
2144
 
1982
2145
  //#endregion
1983
2146
  //#region src/rules/no-component-will-mount.ts
1984
- const RULE_NAME$42 = "no-component-will-mount";
2147
+ const RULE_NAME$41 = "no-component-will-mount";
1985
2148
  var no_component_will_mount_default = createRule({
1986
2149
  meta: {
1987
2150
  type: "problem",
@@ -1990,11 +2153,11 @@ var no_component_will_mount_default = createRule({
1990
2153
  messages: { default: "[Deprecated] Use 'UNSAFE_componentWillMount' instead." },
1991
2154
  schema: []
1992
2155
  },
1993
- name: RULE_NAME$42,
1994
- create: create$42,
2156
+ name: RULE_NAME$41,
2157
+ create: create$41,
1995
2158
  defaultOptions: []
1996
2159
  });
1997
- function create$42(context) {
2160
+ function create$41(context) {
1998
2161
  if (!context.sourceCode.text.includes("componentWillMount")) return {};
1999
2162
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
2000
2163
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -2014,7 +2177,7 @@ function create$42(context) {
2014
2177
 
2015
2178
  //#endregion
2016
2179
  //#region src/rules/no-component-will-receive-props.ts
2017
- const RULE_NAME$41 = "no-component-will-receive-props";
2180
+ const RULE_NAME$40 = "no-component-will-receive-props";
2018
2181
  var no_component_will_receive_props_default = createRule({
2019
2182
  meta: {
2020
2183
  type: "problem",
@@ -2023,11 +2186,11 @@ var no_component_will_receive_props_default = createRule({
2023
2186
  messages: { default: "[Deprecated] Use 'UNSAFE_componentWillReceiveProps' instead." },
2024
2187
  schema: []
2025
2188
  },
2026
- name: RULE_NAME$41,
2027
- create: create$41,
2189
+ name: RULE_NAME$40,
2190
+ create: create$40,
2028
2191
  defaultOptions: []
2029
2192
  });
2030
- function create$41(context) {
2193
+ function create$40(context) {
2031
2194
  if (!context.sourceCode.text.includes("componentWillReceiveProps")) return {};
2032
2195
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
2033
2196
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -2047,7 +2210,7 @@ function create$41(context) {
2047
2210
 
2048
2211
  //#endregion
2049
2212
  //#region src/rules/no-component-will-update.ts
2050
- const RULE_NAME$40 = "no-component-will-update";
2213
+ const RULE_NAME$39 = "no-component-will-update";
2051
2214
  var no_component_will_update_default = createRule({
2052
2215
  meta: {
2053
2216
  type: "problem",
@@ -2056,11 +2219,11 @@ var no_component_will_update_default = createRule({
2056
2219
  messages: { default: "[Deprecated] Use 'UNSAFE_componentWillUpdate' instead." },
2057
2220
  schema: []
2058
2221
  },
2059
- name: RULE_NAME$40,
2060
- create: create$40,
2222
+ name: RULE_NAME$39,
2223
+ create: create$39,
2061
2224
  defaultOptions: []
2062
2225
  });
2063
- function create$40(context) {
2226
+ function create$39(context) {
2064
2227
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
2065
2228
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
2066
2229
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -2080,7 +2243,7 @@ function create$40(context) {
2080
2243
 
2081
2244
  //#endregion
2082
2245
  //#region src/rules/no-context-provider.ts
2083
- const RULE_NAME$39 = "no-context-provider";
2246
+ const RULE_NAME$38 = "no-context-provider";
2084
2247
  var no_context_provider_default = createRule({
2085
2248
  meta: {
2086
2249
  type: "problem",
@@ -2089,11 +2252,11 @@ var no_context_provider_default = createRule({
2089
2252
  messages: { default: "In React 19, you can render '<Context>' as a provider instead of '<Context.Provider>'." },
2090
2253
  schema: []
2091
2254
  },
2092
- name: RULE_NAME$39,
2093
- create: create$39,
2255
+ name: RULE_NAME$38,
2256
+ create: create$38,
2094
2257
  defaultOptions: []
2095
2258
  });
2096
- function create$39(context) {
2259
+ function create$38(context) {
2097
2260
  if (!context.sourceCode.text.includes("Provider")) return {};
2098
2261
  const { version } = getSettingsFromContext(context);
2099
2262
  if (compare(version, "19.0.0", "<")) return {};
@@ -2120,7 +2283,7 @@ function create$39(context) {
2120
2283
 
2121
2284
  //#endregion
2122
2285
  //#region src/rules/no-create-ref.ts
2123
- const RULE_NAME$38 = "no-create-ref";
2286
+ const RULE_NAME$37 = "no-create-ref";
2124
2287
  var no_create_ref_default = createRule({
2125
2288
  meta: {
2126
2289
  type: "problem",
@@ -2128,11 +2291,11 @@ var no_create_ref_default = createRule({
2128
2291
  messages: { default: "[Deprecated] Use 'useRef' instead." },
2129
2292
  schema: []
2130
2293
  },
2131
- name: RULE_NAME$38,
2132
- create: create$38,
2294
+ name: RULE_NAME$37,
2295
+ create: create$37,
2133
2296
  defaultOptions: []
2134
2297
  });
2135
- function create$38(context) {
2298
+ function create$37(context) {
2136
2299
  return defineRuleListener({ CallExpression(node) {
2137
2300
  if (core.isCreateRefCall(context, node) && ast.findParentNode(node, core.isClassComponent) == null) context.report({
2138
2301
  messageId: "default",
@@ -2143,7 +2306,7 @@ function create$38(context) {
2143
2306
 
2144
2307
  //#endregion
2145
2308
  //#region src/rules/no-direct-mutation-state.ts
2146
- const RULE_NAME$37 = "no-direct-mutation-state";
2309
+ const RULE_NAME$36 = "no-direct-mutation-state";
2147
2310
  function isConstructorFunction(node) {
2148
2311
  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";
2149
2312
  }
@@ -2154,11 +2317,11 @@ var no_direct_mutation_state_default = createRule({
2154
2317
  messages: { default: "Do not mutate state directly. Use 'setState()' instead." },
2155
2318
  schema: []
2156
2319
  },
2157
- name: RULE_NAME$37,
2158
- create: create$37,
2320
+ name: RULE_NAME$36,
2321
+ create: create$36,
2159
2322
  defaultOptions: []
2160
2323
  });
2161
- function create$37(context) {
2324
+ function create$36(context) {
2162
2325
  return defineRuleListener({ AssignmentExpression(node) {
2163
2326
  if (!core.isAssignmentToThisState(node)) return;
2164
2327
  const parentClass = ast.findParentNode(node, ast.isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]));
@@ -2172,7 +2335,7 @@ function create$37(context) {
2172
2335
 
2173
2336
  //#endregion
2174
2337
  //#region src/rules/no-duplicate-key.ts
2175
- const RULE_NAME$36 = "no-duplicate-key";
2338
+ const RULE_NAME$35 = "no-duplicate-key";
2176
2339
  var no_duplicate_key_default = createRule({
2177
2340
  meta: {
2178
2341
  type: "problem",
@@ -2180,11 +2343,11 @@ var no_duplicate_key_default = createRule({
2180
2343
  messages: { default: "The 'key' prop must be unique to its sibling elements." },
2181
2344
  schema: []
2182
2345
  },
2183
- name: RULE_NAME$36,
2184
- create: create$36,
2346
+ name: RULE_NAME$35,
2347
+ create: create$35,
2185
2348
  defaultOptions: []
2186
2349
  });
2187
- function create$36(context) {
2350
+ function create$35(context) {
2188
2351
  if (!context.sourceCode.text.includes("key=")) return {};
2189
2352
  const keyedEntries = /* @__PURE__ */ new Map();
2190
2353
  function isKeyValueEqual(a, b) {
@@ -2239,7 +2402,7 @@ function create$36(context) {
2239
2402
 
2240
2403
  //#endregion
2241
2404
  //#region src/rules/no-forward-ref.ts
2242
- const RULE_NAME$35 = "no-forward-ref";
2405
+ const RULE_NAME$34 = "no-forward-ref";
2243
2406
  var no_forward_ref_default = createRule({
2244
2407
  meta: {
2245
2408
  type: "problem",
@@ -2248,11 +2411,11 @@ var no_forward_ref_default = createRule({
2248
2411
  messages: { default: "In React 19, 'forwardRef' is no longer necessary. Pass 'ref' as a prop instead." },
2249
2412
  schema: []
2250
2413
  },
2251
- name: RULE_NAME$35,
2252
- create: create$35,
2414
+ name: RULE_NAME$34,
2415
+ create: create$34,
2253
2416
  defaultOptions: []
2254
2417
  });
2255
- function create$35(context) {
2418
+ function create$34(context) {
2256
2419
  if (!context.sourceCode.text.includes("forwardRef")) return {};
2257
2420
  const { version } = getSettingsFromContext(context);
2258
2421
  if (compare(version, "19.0.0", "<")) return {};
@@ -2347,7 +2510,7 @@ function getComponentPropsFixes(context, fixer, node, typeArguments) {
2347
2510
 
2348
2511
  //#endregion
2349
2512
  //#region src/rules/no-implicit-key.ts
2350
- const RULE_NAME$34 = "no-implicit-key";
2513
+ const RULE_NAME$33 = "no-implicit-key";
2351
2514
  var no_implicit_key_default = createRule({
2352
2515
  meta: {
2353
2516
  type: "problem",
@@ -2355,11 +2518,11 @@ var no_implicit_key_default = createRule({
2355
2518
  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}'." },
2356
2519
  schema: []
2357
2520
  },
2358
- name: RULE_NAME$34,
2359
- create: create$34,
2521
+ name: RULE_NAME$33,
2522
+ create: create$33,
2360
2523
  defaultOptions: []
2361
2524
  });
2362
- function create$34(context) {
2525
+ function create$33(context) {
2363
2526
  const services = ESLintUtils.getParserServices(context, false);
2364
2527
  const checker = services.program.getTypeChecker();
2365
2528
  return defineRuleListener({ JSXSpreadAttribute(node) {
@@ -2377,7 +2540,7 @@ function create$34(context) {
2377
2540
 
2378
2541
  //#endregion
2379
2542
  //#region src/rules/no-leaked-conditional-rendering.ts
2380
- const RULE_NAME$33 = "no-leaked-conditional-rendering";
2543
+ const RULE_NAME$32 = "no-leaked-conditional-rendering";
2381
2544
  var no_leaked_conditional_rendering_default = createRule({
2382
2545
  meta: {
2383
2546
  type: "problem",
@@ -2385,11 +2548,11 @@ var no_leaked_conditional_rendering_default = createRule({
2385
2548
  messages: { default: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes." },
2386
2549
  schema: []
2387
2550
  },
2388
- name: RULE_NAME$33,
2389
- create: create$33,
2551
+ name: RULE_NAME$32,
2552
+ create: create$32,
2390
2553
  defaultOptions: []
2391
2554
  });
2392
- function create$33(context) {
2555
+ function create$32(context) {
2393
2556
  if (!context.sourceCode.text.includes("&&")) return {};
2394
2557
  const { version } = getSettingsFromContext(context);
2395
2558
  const allowedVariants = [
@@ -2446,7 +2609,7 @@ function create$33(context) {
2446
2609
 
2447
2610
  //#endregion
2448
2611
  //#region src/rules/no-missing-component-display-name.ts
2449
- const RULE_NAME$32 = "no-missing-component-display-name";
2612
+ const RULE_NAME$31 = "no-missing-component-display-name";
2450
2613
  var no_missing_component_display_name_default = createRule({
2451
2614
  meta: {
2452
2615
  type: "problem",
@@ -2454,11 +2617,11 @@ var no_missing_component_display_name_default = createRule({
2454
2617
  messages: { default: "Add missing 'displayName' for component." },
2455
2618
  schema: []
2456
2619
  },
2457
- name: RULE_NAME$32,
2458
- create: create$32,
2620
+ name: RULE_NAME$31,
2621
+ create: create$31,
2459
2622
  defaultOptions: []
2460
2623
  });
2461
- function create$32(context) {
2624
+ function create$31(context) {
2462
2625
  if (!context.sourceCode.text.includes("memo") && !context.sourceCode.text.includes("forwardRef")) return {};
2463
2626
  const { ctx, visitor } = core.useComponentCollector(context, {
2464
2627
  collectDisplayName: true,
@@ -2480,7 +2643,7 @@ function create$32(context) {
2480
2643
 
2481
2644
  //#endregion
2482
2645
  //#region src/rules/no-missing-context-display-name.ts
2483
- const RULE_NAME$31 = "no-missing-context-display-name";
2646
+ const RULE_NAME$30 = "no-missing-context-display-name";
2484
2647
  var no_missing_context_display_name_default = createRule({
2485
2648
  meta: {
2486
2649
  type: "problem",
@@ -2489,11 +2652,11 @@ var no_missing_context_display_name_default = createRule({
2489
2652
  messages: { default: "Add missing 'displayName' for context." },
2490
2653
  schema: []
2491
2654
  },
2492
- name: RULE_NAME$31,
2493
- create: create$31,
2655
+ name: RULE_NAME$30,
2656
+ create: create$30,
2494
2657
  defaultOptions: []
2495
2658
  });
2496
- function create$31(context) {
2659
+ function create$30(context) {
2497
2660
  if (!context.sourceCode.text.includes("createContext")) return {};
2498
2661
  const createCalls = [];
2499
2662
  const displayNameAssignments = [];
@@ -2545,7 +2708,7 @@ function create$31(context) {
2545
2708
 
2546
2709
  //#endregion
2547
2710
  //#region src/rules/no-missing-key.ts
2548
- const RULE_NAME$30 = "no-missing-key";
2711
+ const RULE_NAME$29 = "no-missing-key";
2549
2712
  var no_missing_key_default = createRule({
2550
2713
  meta: {
2551
2714
  type: "problem",
@@ -2556,11 +2719,11 @@ var no_missing_key_default = createRule({
2556
2719
  },
2557
2720
  schema: []
2558
2721
  },
2559
- name: RULE_NAME$30,
2560
- create: create$30,
2722
+ name: RULE_NAME$29,
2723
+ create: create$29,
2561
2724
  defaultOptions: []
2562
2725
  });
2563
- function create$30(ctx) {
2726
+ function create$29(ctx) {
2564
2727
  let inChildrenToArray = false;
2565
2728
  function check(node) {
2566
2729
  if (node.type === AST_NODE_TYPES.JSXElement) return core.getJsxAttribute(ctx, node)("key") == null ? {
@@ -2631,7 +2794,7 @@ function create$30(ctx) {
2631
2794
 
2632
2795
  //#endregion
2633
2796
  //#region src/rules/no-misused-capture-owner-stack.ts
2634
- const RULE_NAME$29 = "no-misused-capture-owner-stack";
2797
+ const RULE_NAME$28 = "no-misused-capture-owner-stack";
2635
2798
  var no_misused_capture_owner_stack_default = createRule({
2636
2799
  meta: {
2637
2800
  type: "problem",
@@ -2642,11 +2805,11 @@ var no_misused_capture_owner_stack_default = createRule({
2642
2805
  },
2643
2806
  schema: []
2644
2807
  },
2645
- name: RULE_NAME$29,
2646
- create: create$29,
2808
+ name: RULE_NAME$28,
2809
+ create: create$28,
2647
2810
  defaultOptions: []
2648
2811
  });
2649
- function create$29(context) {
2812
+ function create$28(context) {
2650
2813
  if (!context.sourceCode.text.includes("captureOwnerStack")) return {};
2651
2814
  const { importSource } = getSettingsFromContext(context);
2652
2815
  return defineRuleListener({
@@ -2677,7 +2840,7 @@ function isDevelopmentOnlyCheck(node) {
2677
2840
 
2678
2841
  //#endregion
2679
2842
  //#region src/rules/no-nested-component-definitions.ts
2680
- const RULE_NAME$28 = "no-nested-component-definitions";
2843
+ const RULE_NAME$27 = "no-nested-component-definitions";
2681
2844
  var no_nested_component_definitions_default = createRule({
2682
2845
  meta: {
2683
2846
  type: "problem",
@@ -2685,11 +2848,11 @@ var no_nested_component_definitions_default = createRule({
2685
2848
  messages: { default: "Do not nest component definitions inside other components or props. {{suggestion}}" },
2686
2849
  schema: []
2687
2850
  },
2688
- name: RULE_NAME$28,
2689
- create: create$28,
2851
+ name: RULE_NAME$27,
2852
+ create: create$27,
2690
2853
  defaultOptions: []
2691
2854
  });
2692
- function create$28(context) {
2855
+ function create$27(context) {
2693
2856
  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;
2694
2857
  const fCollector = core.useComponentCollector(context, { hint });
2695
2858
  const cCollector = core.useComponentCollectorLegacy(context);
@@ -2795,7 +2958,7 @@ function isInsideCreateElementProps(context, node) {
2795
2958
 
2796
2959
  //#endregion
2797
2960
  //#region src/rules/no-nested-lazy-component-declarations.ts
2798
- const RULE_NAME$27 = "no-nested-lazy-component-declarations";
2961
+ const RULE_NAME$26 = "no-nested-lazy-component-declarations";
2799
2962
  var no_nested_lazy_component_declarations_default = createRule({
2800
2963
  meta: {
2801
2964
  type: "problem",
@@ -2803,11 +2966,11 @@ var no_nested_lazy_component_declarations_default = createRule({
2803
2966
  messages: { default: "Do not declare lazy components inside other components. Instead, always declare them at the top level of your module." },
2804
2967
  schema: []
2805
2968
  },
2806
- name: RULE_NAME$27,
2807
- create: create$27,
2969
+ name: RULE_NAME$26,
2970
+ create: create$26,
2808
2971
  defaultOptions: []
2809
2972
  });
2810
- function create$27(context) {
2973
+ function create$26(context) {
2811
2974
  const hint = core.ComponentDetectionHint.None;
2812
2975
  const collector = core.useComponentCollector(context, { hint });
2813
2976
  const collectorLegacy = core.useComponentCollectorLegacy(context);
@@ -2836,7 +2999,7 @@ function create$27(context) {
2836
2999
 
2837
3000
  //#endregion
2838
3001
  //#region src/rules/no-redundant-should-component-update.ts
2839
- const RULE_NAME$26 = "no-redundant-should-component-update";
3002
+ const RULE_NAME$25 = "no-redundant-should-component-update";
2840
3003
  function isShouldComponentUpdate(node) {
2841
3004
  return ast.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
2842
3005
  }
@@ -2847,11 +3010,11 @@ var no_redundant_should_component_update_default = createRule({
2847
3010
  messages: { default: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'." },
2848
3011
  schema: []
2849
3012
  },
2850
- name: RULE_NAME$26,
2851
- create: create$26,
3013
+ name: RULE_NAME$25,
3014
+ create: create$25,
2852
3015
  defaultOptions: []
2853
3016
  });
2854
- function create$26(context) {
3017
+ function create$25(context) {
2855
3018
  if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
2856
3019
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
2857
3020
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -2869,7 +3032,7 @@ function create$26(context) {
2869
3032
 
2870
3033
  //#endregion
2871
3034
  //#region src/rules/no-set-state-in-component-did-mount.ts
2872
- const RULE_NAME$25 = "no-set-state-in-component-did-mount";
3035
+ const RULE_NAME$24 = "no-set-state-in-component-did-mount";
2873
3036
  var no_set_state_in_component_did_mount_default = createRule({
2874
3037
  meta: {
2875
3038
  type: "problem",
@@ -2877,11 +3040,11 @@ var no_set_state_in_component_did_mount_default = createRule({
2877
3040
  messages: { default: "Do not call `this.setState` in `componentDidMount` outside functions such as callbacks." },
2878
3041
  schema: []
2879
3042
  },
2880
- name: RULE_NAME$25,
2881
- create: create$25,
3043
+ name: RULE_NAME$24,
3044
+ create: create$24,
2882
3045
  defaultOptions: []
2883
3046
  });
2884
- function create$25(context) {
3047
+ function create$24(context) {
2885
3048
  if (!context.sourceCode.text.includes("componentDidMount")) return {};
2886
3049
  return defineRuleListener({ CallExpression(node) {
2887
3050
  if (!core.isThisSetState(node)) return;
@@ -2899,7 +3062,7 @@ function create$25(context) {
2899
3062
 
2900
3063
  //#endregion
2901
3064
  //#region src/rules/no-set-state-in-component-did-update.ts
2902
- const RULE_NAME$24 = "no-set-state-in-component-did-update";
3065
+ const RULE_NAME$23 = "no-set-state-in-component-did-update";
2903
3066
  var no_set_state_in_component_did_update_default = createRule({
2904
3067
  meta: {
2905
3068
  type: "problem",
@@ -2907,11 +3070,11 @@ var no_set_state_in_component_did_update_default = createRule({
2907
3070
  messages: { default: "Do not call `this.setState` in `componentDidUpdate` outside functions such as callbacks." },
2908
3071
  schema: []
2909
3072
  },
2910
- name: RULE_NAME$24,
2911
- create: create$24,
3073
+ name: RULE_NAME$23,
3074
+ create: create$23,
2912
3075
  defaultOptions: []
2913
3076
  });
2914
- function create$24(context) {
3077
+ function create$23(context) {
2915
3078
  if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
2916
3079
  return defineRuleListener({ CallExpression(node) {
2917
3080
  if (!core.isThisSetState(node)) return;
@@ -2929,7 +3092,7 @@ function create$24(context) {
2929
3092
 
2930
3093
  //#endregion
2931
3094
  //#region src/rules/no-set-state-in-component-will-update.ts
2932
- const RULE_NAME$23 = "no-set-state-in-component-will-update";
3095
+ const RULE_NAME$22 = "no-set-state-in-component-will-update";
2933
3096
  var no_set_state_in_component_will_update_default = createRule({
2934
3097
  meta: {
2935
3098
  type: "problem",
@@ -2937,11 +3100,11 @@ var no_set_state_in_component_will_update_default = createRule({
2937
3100
  messages: { default: "Do not call `this.setState` in `componentWillUpdate` outside functions such as callbacks." },
2938
3101
  schema: []
2939
3102
  },
2940
- name: RULE_NAME$23,
2941
- create: create$23,
3103
+ name: RULE_NAME$22,
3104
+ create: create$22,
2942
3105
  defaultOptions: []
2943
3106
  });
2944
- function create$23(context) {
3107
+ function create$22(context) {
2945
3108
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
2946
3109
  return defineRuleListener({ CallExpression(node) {
2947
3110
  if (!core.isThisSetState(node)) return;
@@ -2959,7 +3122,7 @@ function create$23(context) {
2959
3122
 
2960
3123
  //#endregion
2961
3124
  //#region src/rules/no-unnecessary-use-callback.ts
2962
- const RULE_NAME$22 = "no-unnecessary-use-callback";
3125
+ const RULE_NAME$21 = "no-unnecessary-use-callback";
2963
3126
  var no_unnecessary_use_callback_default = createRule({
2964
3127
  meta: {
2965
3128
  type: "problem",
@@ -2970,11 +3133,11 @@ var no_unnecessary_use_callback_default = createRule({
2970
3133
  },
2971
3134
  schema: []
2972
3135
  },
2973
- name: RULE_NAME$22,
2974
- create: create$22,
3136
+ name: RULE_NAME$21,
3137
+ create: create$21,
2975
3138
  defaultOptions: []
2976
3139
  });
2977
- function create$22(context) {
3140
+ function create$21(context) {
2978
3141
  if (!context.sourceCode.text.includes("useCallback")) return {};
2979
3142
  return defineRuleListener({ VariableDeclarator(node) {
2980
3143
  const { id, init } = node;
@@ -2988,9 +3151,9 @@ function create$22(context) {
2988
3151
  const [arg0, arg1] = init.arguments;
2989
3152
  if (arg0 == null || arg1 == null) return;
2990
3153
  if (!match(arg1).with({ type: AST_NODE_TYPES.ArrayExpression }, (n) => n.elements.length === 0).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
2991
- const variableNode = getVariableInitializer(findVariable(n.name, scope), 0);
2992
- if (variableNode?.type !== AST_NODE_TYPES.ArrayExpression) return false;
2993
- return variableNode.elements.length === 0;
3154
+ const initNode = getVariableInitializer(findVariable(n.name, scope), 0);
3155
+ if (initNode?.type !== AST_NODE_TYPES.ArrayExpression) return false;
3156
+ return initNode.elements.length === 0;
2994
3157
  }).otherwise(() => false)) {
2995
3158
  report(context)(checkForUsageInsideUseEffectReport);
2996
3159
  return;
@@ -2999,9 +3162,9 @@ function create$22(context) {
2999
3162
  if (n.body.type === AST_NODE_TYPES.ArrowFunctionExpression) return n.body;
3000
3163
  return n;
3001
3164
  }).with({ type: AST_NODE_TYPES.FunctionExpression }, identity).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
3002
- const variableNode = getVariableInitializer(findVariable(n.name, scope), 0);
3003
- if (variableNode?.type !== AST_NODE_TYPES.ArrowFunctionExpression && variableNode?.type !== AST_NODE_TYPES.FunctionExpression) return null;
3004
- return variableNode;
3165
+ const initNode = getVariableInitializer(findVariable(n.name, scope), 0);
3166
+ if (initNode?.type !== AST_NODE_TYPES.ArrowFunctionExpression && initNode?.type !== AST_NODE_TYPES.FunctionExpression) return null;
3167
+ return initNode;
3005
3168
  }).otherwise(() => null);
3006
3169
  if (arg0Node == null) return;
3007
3170
  if (!getChildScopes(context.sourceCode.getScope(arg0Node)).flatMap((x) => x.references).some((x) => x.resolved?.scope.block === component)) {
@@ -3036,7 +3199,7 @@ function checkForUsageInsideUseEffect$1(sourceCode, node) {
3036
3199
 
3037
3200
  //#endregion
3038
3201
  //#region src/rules/no-unnecessary-use-memo.ts
3039
- const RULE_NAME$21 = "no-unnecessary-use-memo";
3202
+ const RULE_NAME$20 = "no-unnecessary-use-memo";
3040
3203
  var no_unnecessary_use_memo_default = createRule({
3041
3204
  meta: {
3042
3205
  type: "problem",
@@ -3047,11 +3210,11 @@ var no_unnecessary_use_memo_default = createRule({
3047
3210
  },
3048
3211
  schema: []
3049
3212
  },
3050
- name: RULE_NAME$21,
3051
- create: create$21,
3213
+ name: RULE_NAME$20,
3214
+ create: create$20,
3052
3215
  defaultOptions: []
3053
3216
  });
3054
- function create$21(context) {
3217
+ function create$20(context) {
3055
3218
  if (!context.sourceCode.text.includes("useMemo")) return {};
3056
3219
  return defineRuleListener({ VariableDeclarator(node) {
3057
3220
  const { id, init } = node;
@@ -3069,9 +3232,9 @@ function create$21(context) {
3069
3232
  return;
3070
3233
  }
3071
3234
  if (!match(arg1).with({ type: AST_NODE_TYPES.ArrayExpression }, (n) => n.elements.length === 0).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
3072
- const variableNode = getVariableInitializer(findVariable(n.name, scope), 0);
3073
- if (variableNode?.type !== AST_NODE_TYPES.ArrayExpression) return false;
3074
- return variableNode.elements.length === 0;
3235
+ const initNode = getVariableInitializer(findVariable(n.name, scope), 0);
3236
+ if (initNode?.type !== AST_NODE_TYPES.ArrayExpression) return false;
3237
+ return initNode.elements.length === 0;
3075
3238
  }).otherwise(() => false)) {
3076
3239
  report(context)(checkForUsageInsideUseEffectReport);
3077
3240
  return;
@@ -3117,7 +3280,7 @@ function checkForUsageInsideUseEffect(sourceCode, node) {
3117
3280
 
3118
3281
  //#endregion
3119
3282
  //#region src/rules/no-unnecessary-use-prefix.ts
3120
- const RULE_NAME$20 = "no-unnecessary-use-prefix";
3283
+ const RULE_NAME$19 = "no-unnecessary-use-prefix";
3121
3284
  const WELL_KNOWN_HOOKS = ["useMDXComponents"];
3122
3285
  function containsUseComments(context, node) {
3123
3286
  return context.sourceCode.getCommentsInside(node).some(({ value }) => /use\([\s\S]*?\)/u.test(value) || /use[A-Z0-9]\w*\([\s\S]*?\)/u.test(value));
@@ -3129,11 +3292,11 @@ var no_unnecessary_use_prefix_default = createRule({
3129
3292
  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." },
3130
3293
  schema: []
3131
3294
  },
3132
- name: RULE_NAME$20,
3133
- create: create$20,
3295
+ name: RULE_NAME$19,
3296
+ create: create$19,
3134
3297
  defaultOptions: []
3135
3298
  });
3136
- function create$20(context) {
3299
+ function create$19(context) {
3137
3300
  const { ctx, visitor } = core.useHookCollector(context);
3138
3301
  return defineRuleListener(visitor, { "Program:exit"(program) {
3139
3302
  for (const { id, name, node, hookCalls } of ctx.getAllHooks(program)) {
@@ -3153,7 +3316,7 @@ function create$20(context) {
3153
3316
 
3154
3317
  //#endregion
3155
3318
  //#region src/rules/no-unsafe-component-will-mount.ts
3156
- const RULE_NAME$19 = "no-unsafe-component-will-mount";
3319
+ const RULE_NAME$18 = "no-unsafe-component-will-mount";
3157
3320
  var no_unsafe_component_will_mount_default = createRule({
3158
3321
  meta: {
3159
3322
  type: "problem",
@@ -3161,11 +3324,11 @@ var no_unsafe_component_will_mount_default = createRule({
3161
3324
  messages: { default: "Do not use 'UNSAFE_componentWillMount'." },
3162
3325
  schema: []
3163
3326
  },
3164
- name: RULE_NAME$19,
3165
- create: create$19,
3327
+ name: RULE_NAME$18,
3328
+ create: create$18,
3166
3329
  defaultOptions: []
3167
3330
  });
3168
- function create$19(context) {
3331
+ function create$18(context) {
3169
3332
  if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
3170
3333
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
3171
3334
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -3181,7 +3344,7 @@ function create$19(context) {
3181
3344
 
3182
3345
  //#endregion
3183
3346
  //#region src/rules/no-unsafe-component-will-receive-props.ts
3184
- const RULE_NAME$18 = "no-unsafe-component-will-receive-props";
3347
+ const RULE_NAME$17 = "no-unsafe-component-will-receive-props";
3185
3348
  var no_unsafe_component_will_receive_props_default = createRule({
3186
3349
  meta: {
3187
3350
  type: "problem",
@@ -3189,11 +3352,11 @@ var no_unsafe_component_will_receive_props_default = createRule({
3189
3352
  messages: { default: "Do not use 'UNSAFE_componentWillReceiveProps'." },
3190
3353
  schema: []
3191
3354
  },
3192
- name: RULE_NAME$18,
3193
- create: create$18,
3355
+ name: RULE_NAME$17,
3356
+ create: create$17,
3194
3357
  defaultOptions: []
3195
3358
  });
3196
- function create$18(context) {
3359
+ function create$17(context) {
3197
3360
  if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) return {};
3198
3361
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
3199
3362
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -3209,7 +3372,7 @@ function create$18(context) {
3209
3372
 
3210
3373
  //#endregion
3211
3374
  //#region src/rules/no-unsafe-component-will-update.ts
3212
- const RULE_NAME$17 = "no-unsafe-component-will-update";
3375
+ const RULE_NAME$16 = "no-unsafe-component-will-update";
3213
3376
  var no_unsafe_component_will_update_default = createRule({
3214
3377
  meta: {
3215
3378
  type: "problem",
@@ -3217,11 +3380,11 @@ var no_unsafe_component_will_update_default = createRule({
3217
3380
  messages: { default: "Do not use 'UNSAFE_componentWillUpdate'." },
3218
3381
  schema: []
3219
3382
  },
3220
- name: RULE_NAME$17,
3221
- create: create$17,
3383
+ name: RULE_NAME$16,
3384
+ create: create$16,
3222
3385
  defaultOptions: []
3223
3386
  });
3224
- function create$17(context) {
3387
+ function create$16(context) {
3225
3388
  if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
3226
3389
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
3227
3390
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -3237,7 +3400,7 @@ function create$17(context) {
3237
3400
 
3238
3401
  //#endregion
3239
3402
  //#region src/rules/no-unstable-context-value.ts
3240
- const RULE_NAME$16 = "no-unstable-context-value";
3403
+ const RULE_NAME$15 = "no-unstable-context-value";
3241
3404
  var no_unstable_context_value_default = createRule({
3242
3405
  meta: {
3243
3406
  type: "problem",
@@ -3245,11 +3408,11 @@ var no_unstable_context_value_default = createRule({
3245
3408
  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}}" },
3246
3409
  schema: []
3247
3410
  },
3248
- name: RULE_NAME$16,
3249
- create: create$16,
3411
+ name: RULE_NAME$15,
3412
+ create: create$15,
3250
3413
  defaultOptions: []
3251
3414
  });
3252
- function create$16(context) {
3415
+ function create$15(context) {
3253
3416
  const { compilationMode, version } = getSettingsFromContext(context);
3254
3417
  if (compilationMode === "infer" || compilationMode === "all") return {};
3255
3418
  if (compilationMode === "annotation" && ast.isDirectiveInFile(context.sourceCode.ast, "use memo")) return {};
@@ -3301,7 +3464,7 @@ function isContextName(name, isReact18OrBelow) {
3301
3464
 
3302
3465
  //#endregion
3303
3466
  //#region src/rules/no-unstable-default-props.ts
3304
- const RULE_NAME$15 = "no-unstable-default-props";
3467
+ const RULE_NAME$14 = "no-unstable-default-props";
3305
3468
  const defaultOptions$2 = [{ safeDefaultProps: [] }];
3306
3469
  const schema$2 = [{
3307
3470
  type: "object",
@@ -3318,8 +3481,8 @@ var no_unstable_default_props_default = createRule({
3318
3481
  messages: { default: "A/an '{{kind}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{kind}}'." },
3319
3482
  schema: schema$2
3320
3483
  },
3321
- name: RULE_NAME$15,
3322
- create: create$15,
3484
+ name: RULE_NAME$14,
3485
+ create: create$14,
3323
3486
  defaultOptions: defaultOptions$2
3324
3487
  });
3325
3488
  function extractIdentifier(node) {
@@ -3330,7 +3493,7 @@ function extractIdentifier(node) {
3330
3493
  }
3331
3494
  return null;
3332
3495
  }
3333
- function create$15(context, [options]) {
3496
+ function create$14(context, [options]) {
3334
3497
  const { compilationMode } = getSettingsFromContext(context);
3335
3498
  if (compilationMode === "infer" || compilationMode === "all") return {};
3336
3499
  if (compilationMode === "annotation" && ast.isDirectiveInFile(context.sourceCode.ast, "use memo")) return {};
@@ -3376,7 +3539,7 @@ function create$15(context, [options]) {
3376
3539
 
3377
3540
  //#endregion
3378
3541
  //#region src/rules/no-unused-class-component-members.ts
3379
- const RULE_NAME$14 = "no-unused-class-component-members";
3542
+ const RULE_NAME$13 = "no-unused-class-component-members";
3380
3543
  const LIFECYCLE_METHODS = new Set([
3381
3544
  "componentDidCatch",
3382
3545
  "componentDidMount",
@@ -3407,11 +3570,11 @@ var no_unused_class_component_members_default = createRule({
3407
3570
  messages: { default: "Unused method or property '{{methodName}}'' of class '{{className}}'." },
3408
3571
  schema: []
3409
3572
  },
3410
- name: RULE_NAME$14,
3411
- create: create$14,
3573
+ name: RULE_NAME$13,
3574
+ create: create$13,
3412
3575
  defaultOptions: []
3413
3576
  });
3414
- function create$14(context) {
3577
+ function create$13(context) {
3415
3578
  const classStack = [];
3416
3579
  const methodStack = [];
3417
3580
  const propertyDefs = /* @__PURE__ */ new WeakMap();
@@ -3492,7 +3655,7 @@ function create$14(context) {
3492
3655
 
3493
3656
  //#endregion
3494
3657
  //#region src/rules/no-unused-props.ts
3495
- const RULE_NAME$13 = "no-unused-props";
3658
+ const RULE_NAME$12 = "no-unused-props";
3496
3659
  var no_unused_props_default = createRule({
3497
3660
  meta: {
3498
3661
  type: "problem",
@@ -3500,11 +3663,11 @@ var no_unused_props_default = createRule({
3500
3663
  messages: { default: "Prop `{{name}}` is declared but never used" },
3501
3664
  schema: []
3502
3665
  },
3503
- name: RULE_NAME$13,
3504
- create: create$13,
3666
+ name: RULE_NAME$12,
3667
+ create: create$12,
3505
3668
  defaultOptions: []
3506
3669
  });
3507
- function create$13(context) {
3670
+ function create$12(context) {
3508
3671
  const services = ESLintUtils.getParserServices(context, false);
3509
3672
  const checker = services.program.getTypeChecker();
3510
3673
  const { ctx, visitor } = core.useComponentCollector(context);
@@ -3604,7 +3767,7 @@ function reportUnusedProp(context, services, prop) {
3604
3767
 
3605
3768
  //#endregion
3606
3769
  //#region src/rules/no-unused-state.ts
3607
- const RULE_NAME$12 = "no-unused-state";
3770
+ const RULE_NAME$11 = "no-unused-state";
3608
3771
  function isKeyLiteral(node, key) {
3609
3772
  return match(key).with({ type: AST_NODE_TYPES.Literal }, constTrue).with({
3610
3773
  type: AST_NODE_TYPES.TemplateLiteral,
@@ -3618,11 +3781,11 @@ var no_unused_state_default = createRule({
3618
3781
  messages: { default: "Unused class component state in '{{className}}'" },
3619
3782
  schema: []
3620
3783
  },
3621
- name: RULE_NAME$12,
3622
- create: create$12,
3784
+ name: RULE_NAME$11,
3785
+ create: create$11,
3623
3786
  defaultOptions: []
3624
3787
  });
3625
- function create$12(context) {
3788
+ function create$11(context) {
3626
3789
  const classStack = [];
3627
3790
  const methodStack = [];
3628
3791
  const constructorStack = [];
@@ -3731,7 +3894,7 @@ function create$12(context) {
3731
3894
 
3732
3895
  //#endregion
3733
3896
  //#region src/rules/no-use-context.ts
3734
- const RULE_NAME$11 = "no-use-context";
3897
+ const RULE_NAME$10 = "no-use-context";
3735
3898
  var no_use_context_default = createRule({
3736
3899
  meta: {
3737
3900
  type: "problem",
@@ -3740,11 +3903,11 @@ var no_use_context_default = createRule({
3740
3903
  messages: { default: "In React 19, 'use' is preferred over 'useContext' because it is more flexible." },
3741
3904
  schema: []
3742
3905
  },
3743
- name: RULE_NAME$11,
3744
- create: create$11,
3906
+ name: RULE_NAME$10,
3907
+ create: create$10,
3745
3908
  defaultOptions: []
3746
3909
  });
3747
- function create$11(context) {
3910
+ function create$10(context) {
3748
3911
  if (!context.sourceCode.text.includes("useContext")) return {};
3749
3912
  const settings = getSettingsFromContext(context);
3750
3913
  if (compare(settings.version, "19.0.0", "<")) return {};
@@ -3809,7 +3972,7 @@ function getCorrelativeTokens(context, node) {
3809
3972
 
3810
3973
  //#endregion
3811
3974
  //#region src/rules/no-useless-fragment.ts
3812
- const RULE_NAME$10 = "no-useless-fragment";
3975
+ const RULE_NAME$9 = "no-useless-fragment";
3813
3976
  const defaultOptions$1 = [{
3814
3977
  allowEmptyFragment: false,
3815
3978
  allowExpressions: true
@@ -3837,11 +4000,11 @@ var no_useless_fragment_default = createRule({
3837
4000
  messages: { default: "A fragment {{reason}} is useless." },
3838
4001
  schema: schema$1
3839
4002
  },
3840
- name: RULE_NAME$10,
3841
- create: create$10,
4003
+ name: RULE_NAME$9,
4004
+ create: create$9,
3842
4005
  defaultOptions: defaultOptions$1
3843
4006
  });
3844
- function create$10(context, [option]) {
4007
+ function create$9(context, [option]) {
3845
4008
  const { allowEmptyFragment = false, allowExpressions = true } = option;
3846
4009
  const jsxConfig = {
3847
4010
  ...core.getJsxConfigFromContext(context),
@@ -3949,7 +4112,7 @@ function trimLikeReact(text) {
3949
4112
 
3950
4113
  //#endregion
3951
4114
  //#region src/rules/prefer-destructuring-assignment.ts
3952
- const RULE_NAME$9 = "prefer-destructuring-assignment";
4115
+ const RULE_NAME$8 = "prefer-destructuring-assignment";
3953
4116
  var prefer_destructuring_assignment_default = createRule({
3954
4117
  meta: {
3955
4118
  type: "problem",
@@ -3957,11 +4120,11 @@ var prefer_destructuring_assignment_default = createRule({
3957
4120
  messages: { default: "Use destructuring assignment for component props." },
3958
4121
  schema: []
3959
4122
  },
3960
- name: RULE_NAME$9,
3961
- create: create$9,
4123
+ name: RULE_NAME$8,
4124
+ create: create$8,
3962
4125
  defaultOptions: []
3963
4126
  });
3964
- function create$9(context) {
4127
+ function create$8(context) {
3965
4128
  const { ctx, visitor } = core.useComponentCollector(context);
3966
4129
  return defineRuleListener(visitor, { "Program:exit"(program) {
3967
4130
  for (const component of ctx.getAllComponents(program)) {
@@ -3985,7 +4148,7 @@ function create$9(context) {
3985
4148
 
3986
4149
  //#endregion
3987
4150
  //#region src/rules/prefer-namespace-import.ts
3988
- const RULE_NAME$8 = "prefer-namespace-import";
4151
+ const RULE_NAME$7 = "prefer-namespace-import";
3989
4152
  var prefer_namespace_import_default = createRule({
3990
4153
  meta: {
3991
4154
  type: "problem",
@@ -3994,11 +4157,11 @@ var prefer_namespace_import_default = createRule({
3994
4157
  messages: { default: "Prefer importing React as 'import * as React from \"{{importSource}}\"';" },
3995
4158
  schema: []
3996
4159
  },
3997
- name: RULE_NAME$8,
3998
- create: create$8,
4160
+ name: RULE_NAME$7,
4161
+ create: create$7,
3999
4162
  defaultOptions: []
4000
4163
  });
4001
- function create$8(context) {
4164
+ function create$7(context) {
4002
4165
  const { importSource } = getSettingsFromContext(context);
4003
4166
  return defineRuleListener({ [`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
4004
4167
  const hasOtherSpecifiers = node.parent.specifiers.length > 1;
@@ -4020,59 +4183,6 @@ function create$8(context) {
4020
4183
  } });
4021
4184
  }
4022
4185
 
4023
- //#endregion
4024
- //#region src/rules/prefer-read-only-props.ts
4025
- const RULE_NAME$7 = "prefer-read-only-props";
4026
- var prefer_read_only_props_default = createRule({
4027
- meta: {
4028
- type: "problem",
4029
- docs: { description: "Enforces read-only props in components." },
4030
- messages: { default: "A function component's props should be read-only." },
4031
- schema: []
4032
- },
4033
- name: RULE_NAME$7,
4034
- create: create$7,
4035
- defaultOptions: []
4036
- });
4037
- function create$7(context) {
4038
- const services = ESLintUtils.getParserServices(context, false);
4039
- const checker = services.program.getTypeChecker();
4040
- const { ctx, visitor } = core.useComponentCollector(context);
4041
- return defineRuleListener(visitor, { "Program:exit"(program) {
4042
- for (const component of ctx.getAllComponents(program)) {
4043
- const [props] = component.node.params;
4044
- if (component.id == null || component.name == null) continue;
4045
- if (props == null) continue;
4046
- const propsType = getConstrainedTypeAtLocation(services, props);
4047
- if (isTypeReadonly(services.program, propsType)) continue;
4048
- if (isTypeReadonlyLoose(services, propsType)) continue;
4049
- if (propsType.isClassOrInterface() && isClassOrInterfaceReadonlyLoose(checker, propsType)) continue;
4050
- context.report({
4051
- messageId: "default",
4052
- node: props
4053
- });
4054
- }
4055
- } });
4056
- }
4057
- function isTypeReadonlyLoose(services, type) {
4058
- try {
4059
- const im = getTypeImmutability(services.program, type);
4060
- return isUnknown(im) || isImmutable(im) || isReadonlyShallow(im) || isReadonlyDeep(im);
4061
- } catch {
4062
- return true;
4063
- }
4064
- }
4065
- function isClassOrInterfaceReadonlyLoose(checker, type) {
4066
- const props = type.getProperties();
4067
- const types = type.getBaseTypes() ?? [];
4068
- if (props.length === 0) return true;
4069
- if (types.length === 0) return props.every((p) => isPropertyReadonlyInType(type, p.getEscapedName(), checker));
4070
- return props.every((p) => {
4071
- if (isPropertyReadonlyInType(type, p.getEscapedName(), checker)) return true;
4072
- return types.every((t) => isPropertyReadonlyInType(t, p.getEscapedName(), checker));
4073
- });
4074
- }
4075
-
4076
4186
  //#endregion
4077
4187
  //#region src/rules/purity.ts
4078
4188
  const RULE_NAME$6 = "purity";
@@ -6796,11 +6906,11 @@ function create$4(context) {
6796
6906
  }
6797
6907
  }
6798
6908
  function isIdFromUseStateCall(topLevelId, at) {
6799
- const variableNode = getVariableInitializer(findVariable(topLevelId, context.sourceCode.getScope(topLevelId)), 0);
6800
- if (variableNode == null) return false;
6801
- if (variableNode.type !== AST_NODE_TYPES.CallExpression) return false;
6802
- if (!isUseStateCall(variableNode)) return false;
6803
- const variableNodeParent = variableNode.parent;
6909
+ const initNode = getVariableInitializer(findVariable(topLevelId, context.sourceCode.getScope(topLevelId)), 0);
6910
+ if (initNode == null) return false;
6911
+ if (initNode.type !== AST_NODE_TYPES.CallExpression) return false;
6912
+ if (!isUseStateCall(initNode)) return false;
6913
+ const variableNodeParent = initNode.parent;
6804
6914
  if (!("id" in variableNodeParent) || variableNodeParent.id?.type !== AST_NODE_TYPES.ArrayPattern) return true;
6805
6915
  return variableNodeParent.id.elements.findIndex((e) => e?.type === AST_NODE_TYPES.Identifier && e.name === topLevelId.name) === at;
6806
6916
  }
@@ -6978,13 +7088,13 @@ function create$3(context) {
6978
7088
  return core.isUseStateLikeCall(node, additionalStateHooks);
6979
7089
  }
6980
7090
  function isIdFromUseStateCall(topLevelId, at) {
6981
- const variableNode = getVariableInitializer(findVariable(topLevelId, context.sourceCode.getScope(topLevelId)), 0);
6982
- if (variableNode == null) return false;
6983
- if (variableNode.type !== AST_NODE_TYPES.CallExpression) return false;
6984
- if (!isUseStateCall(variableNode)) return false;
6985
- const variableNodeParent = variableNode.parent;
6986
- if (!("id" in variableNodeParent) || variableNodeParent.id?.type !== AST_NODE_TYPES.ArrayPattern) return true;
6987
- return variableNodeParent.id.elements.findIndex((e) => e?.type === AST_NODE_TYPES.Identifier && e.name === topLevelId.name) === at;
7091
+ const initNode = getVariableInitializer(findVariable(topLevelId, context.sourceCode.getScope(topLevelId)), 0);
7092
+ if (initNode == null) return false;
7093
+ if (initNode.type !== AST_NODE_TYPES.CallExpression) return false;
7094
+ if (!isUseStateCall(initNode)) return false;
7095
+ const initNodeParent = initNode.parent;
7096
+ if (!("id" in initNodeParent) || initNodeParent.id?.type !== AST_NODE_TYPES.ArrayPattern) return true;
7097
+ return initNodeParent.id.elements.findIndex((e) => e?.type === AST_NODE_TYPES.Identifier && e.name === topLevelId.name) === at;
6988
7098
  }
6989
7099
  function isSetStateCall(node) {
6990
7100
  switch (node.callee.type) {
@@ -7356,6 +7466,7 @@ const plugin = {
7356
7466
  "component-hook-factories": component_hook_factories_default,
7357
7467
  "error-boundaries": error_boundaries_default,
7358
7468
  "exhaustive-deps": rule$1,
7469
+ immutability: immutability_default,
7359
7470
  "jsx-dollar": jsx_dollar_default,
7360
7471
  "jsx-key-before-spread": jsx_key_before_spread_default,
7361
7472
  "jsx-no-comment-textnodes": jsx_no_comment_textnodes_default,
@@ -7409,7 +7520,6 @@ const plugin = {
7409
7520
  "no-useless-fragment": no_useless_fragment_default,
7410
7521
  "prefer-destructuring-assignment": prefer_destructuring_assignment_default,
7411
7522
  "prefer-namespace-import": prefer_namespace_import_default,
7412
- "prefer-read-only-props": prefer_read_only_props_default,
7413
7523
  purity: purity_default,
7414
7524
  refs: refs_default,
7415
7525
  "rules-of-hooks": rule,
@@ -7466,6 +7576,7 @@ const rules$6 = {
7466
7576
  "react-x/no-unsafe-component-will-mount": "warn",
7467
7577
  "react-x/no-unsafe-component-will-receive-props": "warn",
7468
7578
  "react-x/no-unsafe-component-will-update": "warn",
7579
+ "react-x/no-unused-class-component-members": "warn",
7469
7580
  "react-x/no-use-context": "warn",
7470
7581
  "react-x/purity": "warn",
7471
7582
  "react-x/rules-of-hooks": "error",
@@ -7540,7 +7651,6 @@ const rules$2 = {
7540
7651
  "react-x/no-unnecessary-use-memo": "warn",
7541
7652
  "react-x/no-unstable-context-value": "warn",
7542
7653
  "react-x/no-unstable-default-props": "warn",
7543
- "react-x/no-unused-class-component-members": "warn",
7544
7654
  "react-x/no-unused-state": "warn",
7545
7655
  "react-x/no-useless-fragment": "warn",
7546
7656
  "react-x/prefer-destructuring-assignment": "warn"