eslint-plugin-react-x 2.9.2 → 2.9.3-next.0

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 (3) hide show
  1. package/README.md +0 -3
  2. package/dist/index.js +279 -279
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -70,8 +70,6 @@ export default defineConfig(
70
70
  ### Props
71
71
 
72
72
  - [`no-children-prop`](https://eslint-react.xyz/docs/rules/no-children-prop) - Disallows passing `children` as a prop
73
- - [`no-default-props`](https://eslint-react.xyz/docs/rules/no-default-props) - Disallows the `defaultProps` property in favor of ES6 default parameters
74
- - [`no-prop-types`](https://eslint-react.xyz/docs/rules/no-prop-types) - Disallows `propTypes` in favor of TypeScript or another type-checking solution
75
73
  - [`no-unstable-default-props`](https://eslint-react.xyz/docs/rules/no-unstable-default-props) - Prevents using referential-type values as default props in object destructuring (⚙️ Configurable)
76
74
  - [`no-unused-props`](https://eslint-react.xyz/docs/rules/no-unused-props) - Warns about component props that are defined but never used (💭 Type Checking, 🧪 Experimental)
77
75
  - [`prefer-destructuring-assignment`](https://eslint-react.xyz/docs/rules/prefer-destructuring-assignment) - Enforces destructuring assignment for component props and context
@@ -125,7 +123,6 @@ export default defineConfig(
125
123
  - [`no-set-state-in-component-did-mount`](https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-mount) - Disallows calling `this.setState` in `componentDidMount` outside functions such as callbacks
126
124
  - [`no-set-state-in-component-did-update`](https://eslint-react.xyz/docs/rules/no-set-state-in-component-did-update) - Disallows calling `this.setState` in `componentDidUpdate` outside functions such as callbacks
127
125
  - [`no-set-state-in-component-will-update`](https://eslint-react.xyz/docs/rules/no-set-state-in-component-will-update) - Disallows calling `this.setState` in `componentWillUpdate` outside functions such as callbacks
128
- - [`no-string-refs`](https://eslint-react.xyz/docs/rules/no-string-refs) - Replaces string refs with callback refs (🔄 Codemod, `React` >=16.3.0)
129
126
  - [`no-unsafe-component-will-mount`](https://eslint-react.xyz/docs/rules/no-unsafe-component-will-mount) - Warns about the use of `UNSAFE_componentWillMount` in class components
130
127
  - [`no-unsafe-component-will-receive-props`](https://eslint-react.xyz/docs/rules/no-unsafe-component-will-receive-props) - Warns about the use of `UNSAFE_componentWillReceiveProps` in class components
131
128
  - [`no-unsafe-component-will-update`](https://eslint-react.xyz/docs/rules/no-unsafe-component-will-update) - Warns about the use of `UNSAFE_componentWillUpdate` in class components
package/dist/index.js CHANGED
@@ -66,7 +66,7 @@ const rules$7 = {
66
66
  //#endregion
67
67
  //#region package.json
68
68
  var name$6 = "eslint-plugin-react-x";
69
- var version = "2.9.2";
69
+ var version = "2.9.3-next.0";
70
70
 
71
71
  //#endregion
72
72
  //#region src/utils/create-rule.ts
@@ -1133,41 +1133,9 @@ function create$39(context) {
1133
1133
  } };
1134
1134
  }
1135
1135
 
1136
- //#endregion
1137
- //#region src/rules/no-default-props.ts
1138
- const RULE_NAME$38 = "no-default-props";
1139
- var no_default_props_default = createRule({
1140
- meta: {
1141
- type: "problem",
1142
- docs: { description: "Disallows the 'defaultProps' property in favor of ES6 default parameters." },
1143
- messages: { default: "[Deprecated] Use ES6 default parameters instead." },
1144
- schema: []
1145
- },
1146
- name: RULE_NAME$38,
1147
- create: create$38,
1148
- defaultOptions: []
1149
- });
1150
- function create$38(context) {
1151
- if (!context.sourceCode.text.includes("defaultProps")) return {};
1152
- return { AssignmentExpression(node) {
1153
- if (node.operator !== "=" || node.left.type !== AST_NODE_TYPES.MemberExpression) return;
1154
- const { object, property } = node.left;
1155
- if (object.type !== AST_NODE_TYPES.Identifier) return;
1156
- if (property.type !== AST_NODE_TYPES.Identifier || property.name !== "defaultProps") return;
1157
- if (!core.isComponentNameLoose(object.name)) return;
1158
- const variableNode = getVariableDefinitionNode(findVariable(object.name, context.sourceCode.getScope(node)), 0);
1159
- if (variableNode == null) return;
1160
- if (!ast.isFunction(variableNode)) return;
1161
- context.report({
1162
- messageId: "default",
1163
- node: property
1164
- });
1165
- } };
1166
- }
1167
-
1168
1136
  //#endregion
1169
1137
  //#region src/rules/no-direct-mutation-state.ts
1170
- const RULE_NAME$37 = "no-direct-mutation-state";
1138
+ const RULE_NAME$38 = "no-direct-mutation-state";
1171
1139
  function isConstructorFunction(node) {
1172
1140
  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";
1173
1141
  }
@@ -1178,11 +1146,11 @@ var no_direct_mutation_state_default = createRule({
1178
1146
  messages: { default: "Do not mutate state directly. Use 'setState()' instead." },
1179
1147
  schema: []
1180
1148
  },
1181
- name: RULE_NAME$37,
1182
- create: create$37,
1149
+ name: RULE_NAME$38,
1150
+ create: create$38,
1183
1151
  defaultOptions: []
1184
1152
  });
1185
- function create$37(context) {
1153
+ function create$38(context) {
1186
1154
  return { AssignmentExpression(node) {
1187
1155
  if (!core.isAssignmentToThisState(node)) return;
1188
1156
  const parentClass = ast.findParentNode(node, ast.isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]));
@@ -1196,7 +1164,7 @@ function create$37(context) {
1196
1164
 
1197
1165
  //#endregion
1198
1166
  //#region src/rules/no-duplicate-key.ts
1199
- const RULE_NAME$36 = "no-duplicate-key";
1167
+ const RULE_NAME$37 = "no-duplicate-key";
1200
1168
  var no_duplicate_key_default = createRule({
1201
1169
  meta: {
1202
1170
  type: "problem",
@@ -1204,11 +1172,11 @@ var no_duplicate_key_default = createRule({
1204
1172
  messages: { default: "The 'key' prop must be unique to its sibling elements." },
1205
1173
  schema: []
1206
1174
  },
1207
- name: RULE_NAME$36,
1208
- create: create$36,
1175
+ name: RULE_NAME$37,
1176
+ create: create$37,
1209
1177
  defaultOptions: []
1210
1178
  });
1211
- function create$36(context) {
1179
+ function create$37(context) {
1212
1180
  if (!context.sourceCode.text.includes("key=")) return {};
1213
1181
  const keyedEntries = /* @__PURE__ */ new Map();
1214
1182
  function isKeyValueEqual(a, b) {
@@ -1263,7 +1231,7 @@ function create$36(context) {
1263
1231
 
1264
1232
  //#endregion
1265
1233
  //#region src/rules/no-forward-ref.ts
1266
- const RULE_NAME$35 = "no-forward-ref";
1234
+ const RULE_NAME$36 = "no-forward-ref";
1267
1235
  var no_forward_ref_default = createRule({
1268
1236
  meta: {
1269
1237
  type: "problem",
@@ -1272,11 +1240,11 @@ var no_forward_ref_default = createRule({
1272
1240
  messages: { default: "In React 19, 'forwardRef' is no longer necessary. Pass 'ref' as a prop instead." },
1273
1241
  schema: []
1274
1242
  },
1275
- name: RULE_NAME$35,
1276
- create: create$35,
1243
+ name: RULE_NAME$36,
1244
+ create: create$36,
1277
1245
  defaultOptions: []
1278
1246
  });
1279
- function create$35(context) {
1247
+ function create$36(context) {
1280
1248
  if (!context.sourceCode.text.includes("forwardRef")) return {};
1281
1249
  const { version } = getSettingsFromContext(context);
1282
1250
  if (compare(version, "19.0.0", "<")) return {};
@@ -1371,7 +1339,7 @@ function getComponentPropsFixes(context, fixer, node, typeArguments) {
1371
1339
 
1372
1340
  //#endregion
1373
1341
  //#region src/rules/no-implicit-key.ts
1374
- const RULE_NAME$34 = "no-implicit-key";
1342
+ const RULE_NAME$35 = "no-implicit-key";
1375
1343
  var no_implicit_key_default = createRule({
1376
1344
  meta: {
1377
1345
  type: "problem",
@@ -1379,11 +1347,11 @@ var no_implicit_key_default = createRule({
1379
1347
  messages: { default: "Do not use implicit 'key' props." },
1380
1348
  schema: []
1381
1349
  },
1382
- name: RULE_NAME$34,
1383
- create: create$34,
1350
+ name: RULE_NAME$35,
1351
+ create: create$35,
1384
1352
  defaultOptions: []
1385
1353
  });
1386
- function create$34(context) {
1354
+ function create$35(context) {
1387
1355
  return { JSXOpeningElement(node) {
1388
1356
  const keyProp = core.getJsxAttribute(context, node.parent)("key");
1389
1357
  const isKeyPropOnElement = node.attributes.some((n) => n.type === AST_NODE_TYPES.JSXAttribute && n.name.type === AST_NODE_TYPES.JSXIdentifier && n.name.name === "key");
@@ -1396,7 +1364,7 @@ function create$34(context) {
1396
1364
 
1397
1365
  //#endregion
1398
1366
  //#region src/rules/no-leaked-conditional-rendering.ts
1399
- const RULE_NAME$33 = "no-leaked-conditional-rendering";
1367
+ const RULE_NAME$34 = "no-leaked-conditional-rendering";
1400
1368
  var no_leaked_conditional_rendering_default = createRule({
1401
1369
  meta: {
1402
1370
  type: "problem",
@@ -1404,11 +1372,11 @@ var no_leaked_conditional_rendering_default = createRule({
1404
1372
  messages: { default: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes." },
1405
1373
  schema: []
1406
1374
  },
1407
- name: RULE_NAME$33,
1408
- create: create$33,
1375
+ name: RULE_NAME$34,
1376
+ create: create$34,
1409
1377
  defaultOptions: []
1410
1378
  });
1411
- function create$33(context) {
1379
+ function create$34(context) {
1412
1380
  if (!context.sourceCode.text.includes("&&")) return {};
1413
1381
  const { version } = getSettingsFromContext(context);
1414
1382
  const allowedVariants = [
@@ -1465,7 +1433,7 @@ function create$33(context) {
1465
1433
 
1466
1434
  //#endregion
1467
1435
  //#region src/rules/no-missing-component-display-name.ts
1468
- const RULE_NAME$32 = "no-missing-component-display-name";
1436
+ const RULE_NAME$33 = "no-missing-component-display-name";
1469
1437
  var no_missing_component_display_name_default = createRule({
1470
1438
  meta: {
1471
1439
  type: "problem",
@@ -1473,11 +1441,11 @@ var no_missing_component_display_name_default = createRule({
1473
1441
  messages: { default: "Add missing 'displayName' for component." },
1474
1442
  schema: []
1475
1443
  },
1476
- name: RULE_NAME$32,
1477
- create: create$32,
1444
+ name: RULE_NAME$33,
1445
+ create: create$33,
1478
1446
  defaultOptions: []
1479
1447
  });
1480
- function create$32(context) {
1448
+ function create$33(context) {
1481
1449
  if (!context.sourceCode.text.includes("memo") && !context.sourceCode.text.includes("forwardRef")) return {};
1482
1450
  const { ctx, visitor } = core.useComponentCollector(context, {
1483
1451
  collectDisplayName: true,
@@ -1499,7 +1467,7 @@ function create$32(context) {
1499
1467
 
1500
1468
  //#endregion
1501
1469
  //#region src/rules/no-missing-context-display-name.ts
1502
- const RULE_NAME$31 = "no-missing-context-display-name";
1470
+ const RULE_NAME$32 = "no-missing-context-display-name";
1503
1471
  var no_missing_context_display_name_default = createRule({
1504
1472
  meta: {
1505
1473
  type: "problem",
@@ -1508,11 +1476,11 @@ var no_missing_context_display_name_default = createRule({
1508
1476
  messages: { default: "Add missing 'displayName' for context." },
1509
1477
  schema: []
1510
1478
  },
1511
- name: RULE_NAME$31,
1512
- create: create$31,
1479
+ name: RULE_NAME$32,
1480
+ create: create$32,
1513
1481
  defaultOptions: []
1514
1482
  });
1515
- function create$31(context) {
1483
+ function create$32(context) {
1516
1484
  if (!context.sourceCode.text.includes("createContext")) return {};
1517
1485
  const createCalls = [];
1518
1486
  const displayNameAssignments = [];
@@ -1564,7 +1532,7 @@ function create$31(context) {
1564
1532
 
1565
1533
  //#endregion
1566
1534
  //#region src/rules/no-missing-key.ts
1567
- const RULE_NAME$30 = "no-missing-key";
1535
+ const RULE_NAME$31 = "no-missing-key";
1568
1536
  var no_missing_key_default = createRule({
1569
1537
  meta: {
1570
1538
  type: "problem",
@@ -1575,11 +1543,11 @@ var no_missing_key_default = createRule({
1575
1543
  },
1576
1544
  schema: []
1577
1545
  },
1578
- name: RULE_NAME$30,
1579
- create: create$30,
1546
+ name: RULE_NAME$31,
1547
+ create: create$31,
1580
1548
  defaultOptions: []
1581
1549
  });
1582
- function create$30(ctx) {
1550
+ function create$31(ctx) {
1583
1551
  let inChildrenToArray = false;
1584
1552
  function check(node) {
1585
1553
  if (node.type === AST_NODE_TYPES.JSXElement) return core.getJsxAttribute(ctx, node)("key") == null ? {
@@ -1643,7 +1611,7 @@ function create$30(ctx) {
1643
1611
 
1644
1612
  //#endregion
1645
1613
  //#region src/rules/no-misused-capture-owner-stack.ts
1646
- const RULE_NAME$29 = "no-misused-capture-owner-stack";
1614
+ const RULE_NAME$30 = "no-misused-capture-owner-stack";
1647
1615
  var no_misused_capture_owner_stack_default = createRule({
1648
1616
  meta: {
1649
1617
  type: "problem",
@@ -1654,11 +1622,11 @@ var no_misused_capture_owner_stack_default = createRule({
1654
1622
  },
1655
1623
  schema: []
1656
1624
  },
1657
- name: RULE_NAME$29,
1658
- create: create$29,
1625
+ name: RULE_NAME$30,
1626
+ create: create$30,
1659
1627
  defaultOptions: []
1660
1628
  });
1661
- function create$29(context) {
1629
+ function create$30(context) {
1662
1630
  if (!context.sourceCode.text.includes("captureOwnerStack")) return {};
1663
1631
  const { importSource } = getSettingsFromContext(context);
1664
1632
  return {
@@ -1689,7 +1657,7 @@ function isDevelopmentOnlyCheck(node) {
1689
1657
 
1690
1658
  //#endregion
1691
1659
  //#region src/rules/no-nested-component-definitions.ts
1692
- const RULE_NAME$28 = "no-nested-component-definitions";
1660
+ const RULE_NAME$29 = "no-nested-component-definitions";
1693
1661
  var no_nested_component_definitions_default = createRule({
1694
1662
  meta: {
1695
1663
  type: "problem",
@@ -1697,11 +1665,11 @@ var no_nested_component_definitions_default = createRule({
1697
1665
  messages: { default: "Do not nest component definitions inside other components or props. {{suggestion}}" },
1698
1666
  schema: []
1699
1667
  },
1700
- name: RULE_NAME$28,
1701
- create: create$28,
1668
+ name: RULE_NAME$29,
1669
+ create: create$29,
1702
1670
  defaultOptions: []
1703
1671
  });
1704
- function create$28(context) {
1672
+ function create$29(context) {
1705
1673
  const hint = core.ComponentDetectionHint.SkipArrayMapCallback | core.ComponentDetectionHint.SkipNullLiteral | core.ComponentDetectionHint.SkipUndefined | core.ComponentDetectionHint.SkipBooleanLiteral | core.ComponentDetectionHint.SkipStringLiteral | core.ComponentDetectionHint.SkipNumberLiteral | core.ComponentDetectionHint.StrictLogical | core.ComponentDetectionHint.StrictConditional;
1706
1674
  const fCollector = core.useComponentCollector(context, { hint });
1707
1675
  const cCollector = core.useComponentCollectorLegacy(context);
@@ -1806,7 +1774,7 @@ function isInsideCreateElementProps(context, node) {
1806
1774
 
1807
1775
  //#endregion
1808
1776
  //#region src/rules/no-nested-lazy-component-declarations.ts
1809
- const RULE_NAME$27 = "no-nested-lazy-component-declarations";
1777
+ const RULE_NAME$28 = "no-nested-lazy-component-declarations";
1810
1778
  var no_nested_lazy_component_declarations_default = createRule({
1811
1779
  meta: {
1812
1780
  type: "problem",
@@ -1814,11 +1782,11 @@ var no_nested_lazy_component_declarations_default = createRule({
1814
1782
  messages: { default: "Do not declare lazy components inside other components. Instead, always declare them at the top level of your module." },
1815
1783
  schema: []
1816
1784
  },
1817
- name: RULE_NAME$27,
1818
- create: create$27,
1785
+ name: RULE_NAME$28,
1786
+ create: create$28,
1819
1787
  defaultOptions: []
1820
1788
  });
1821
- function create$27(context) {
1789
+ function create$28(context) {
1822
1790
  const hint = core.ComponentDetectionHint.None;
1823
1791
  const collector = core.useComponentCollector(context, { hint });
1824
1792
  const collectorLegacy = core.useComponentCollectorLegacy(context);
@@ -1845,49 +1813,9 @@ function create$27(context) {
1845
1813
  });
1846
1814
  }
1847
1815
 
1848
- //#endregion
1849
- //#region src/rules/no-prop-types.ts
1850
- const RULE_NAME$26 = "no-prop-types";
1851
- var no_prop_types_default = createRule({
1852
- meta: {
1853
- type: "problem",
1854
- docs: { description: "Disallows 'propTypes' in favor of TypeScript or another type-checking solution." },
1855
- messages: { default: "[Deprecated] Use TypeScript or another type-checking solution instead." },
1856
- schema: []
1857
- },
1858
- name: RULE_NAME$26,
1859
- create: create$26,
1860
- defaultOptions: []
1861
- });
1862
- function create$26(context) {
1863
- if (!context.sourceCode.text.includes("propTypes")) return {};
1864
- return {
1865
- AssignmentExpression(node) {
1866
- if (node.operator !== "=" || node.left.type !== AST_NODE_TYPES.MemberExpression) return;
1867
- const { object, property } = node.left;
1868
- if (object.type !== AST_NODE_TYPES.Identifier) return;
1869
- if (property.type !== AST_NODE_TYPES.Identifier || property.name !== "propTypes") return;
1870
- if (!core.isComponentNameLoose(object.name)) return;
1871
- const variableNode = getVariableDefinitionNode(findVariable(object.name, context.sourceCode.getScope(node)), 0);
1872
- if (variableNode != null && (ast.isFunction(variableNode) || core.isClassComponent(variableNode))) context.report({
1873
- messageId: "default",
1874
- node: property
1875
- });
1876
- },
1877
- PropertyDefinition(node) {
1878
- if (!core.isClassComponent(node.parent.parent)) return;
1879
- if (!node.static || node.key.type !== AST_NODE_TYPES.Identifier || node.key.name !== "propTypes") return;
1880
- context.report({
1881
- messageId: "default",
1882
- node
1883
- });
1884
- }
1885
- };
1886
- }
1887
-
1888
1816
  //#endregion
1889
1817
  //#region src/rules/no-redundant-should-component-update.ts
1890
- const RULE_NAME$25 = "no-redundant-should-component-update";
1818
+ const RULE_NAME$27 = "no-redundant-should-component-update";
1891
1819
  function isShouldComponentUpdate(node) {
1892
1820
  return ast.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
1893
1821
  }
@@ -1898,11 +1826,11 @@ var no_redundant_should_component_update_default = createRule({
1898
1826
  messages: { default: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'." },
1899
1827
  schema: []
1900
1828
  },
1901
- name: RULE_NAME$25,
1902
- create: create$25,
1829
+ name: RULE_NAME$27,
1830
+ create: create$27,
1903
1831
  defaultOptions: []
1904
1832
  });
1905
- function create$25(context) {
1833
+ function create$27(context) {
1906
1834
  if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
1907
1835
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
1908
1836
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -1920,7 +1848,7 @@ function create$25(context) {
1920
1848
 
1921
1849
  //#endregion
1922
1850
  //#region src/rules/no-set-state-in-component-did-mount.ts
1923
- const RULE_NAME$24 = "no-set-state-in-component-did-mount";
1851
+ const RULE_NAME$26 = "no-set-state-in-component-did-mount";
1924
1852
  var no_set_state_in_component_did_mount_default = createRule({
1925
1853
  meta: {
1926
1854
  type: "problem",
@@ -1928,11 +1856,11 @@ var no_set_state_in_component_did_mount_default = createRule({
1928
1856
  messages: { default: "Do not call `this.setState` in `componentDidMount` outside functions such as callbacks." },
1929
1857
  schema: []
1930
1858
  },
1931
- name: RULE_NAME$24,
1932
- create: create$24,
1859
+ name: RULE_NAME$26,
1860
+ create: create$26,
1933
1861
  defaultOptions: []
1934
1862
  });
1935
- function create$24(context) {
1863
+ function create$26(context) {
1936
1864
  if (!context.sourceCode.text.includes("componentDidMount")) return {};
1937
1865
  return { CallExpression(node) {
1938
1866
  if (!core.isThisSetState(node)) return;
@@ -1950,7 +1878,7 @@ function create$24(context) {
1950
1878
 
1951
1879
  //#endregion
1952
1880
  //#region src/rules/no-set-state-in-component-did-update.ts
1953
- const RULE_NAME$23 = "no-set-state-in-component-did-update";
1881
+ const RULE_NAME$25 = "no-set-state-in-component-did-update";
1954
1882
  var no_set_state_in_component_did_update_default = createRule({
1955
1883
  meta: {
1956
1884
  type: "problem",
@@ -1958,11 +1886,11 @@ var no_set_state_in_component_did_update_default = createRule({
1958
1886
  messages: { default: "Do not call `this.setState` in `componentDidUpdate` outside functions such as callbacks." },
1959
1887
  schema: []
1960
1888
  },
1961
- name: RULE_NAME$23,
1962
- create: create$23,
1889
+ name: RULE_NAME$25,
1890
+ create: create$25,
1963
1891
  defaultOptions: []
1964
1892
  });
1965
- function create$23(context) {
1893
+ function create$25(context) {
1966
1894
  if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
1967
1895
  return { CallExpression(node) {
1968
1896
  if (!core.isThisSetState(node)) return;
@@ -1980,7 +1908,7 @@ function create$23(context) {
1980
1908
 
1981
1909
  //#endregion
1982
1910
  //#region src/rules/no-set-state-in-component-will-update.ts
1983
- const RULE_NAME$22 = "no-set-state-in-component-will-update";
1911
+ const RULE_NAME$24 = "no-set-state-in-component-will-update";
1984
1912
  var no_set_state_in_component_will_update_default = createRule({
1985
1913
  meta: {
1986
1914
  type: "problem",
@@ -1988,11 +1916,11 @@ var no_set_state_in_component_will_update_default = createRule({
1988
1916
  messages: { default: "Do not call `this.setState` in `componentWillUpdate` outside functions such as callbacks." },
1989
1917
  schema: []
1990
1918
  },
1991
- name: RULE_NAME$22,
1992
- create: create$22,
1919
+ name: RULE_NAME$24,
1920
+ create: create$24,
1993
1921
  defaultOptions: []
1994
1922
  });
1995
- function create$22(context) {
1923
+ function create$24(context) {
1996
1924
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
1997
1925
  return { CallExpression(node) {
1998
1926
  if (!core.isThisSetState(node)) return;
@@ -2008,67 +1936,9 @@ function create$22(context) {
2008
1936
  } };
2009
1937
  }
2010
1938
 
2011
- //#endregion
2012
- //#region src/rules/no-string-refs.ts
2013
- const RULE_NAME$21 = "no-string-refs";
2014
- var no_string_refs_default = createRule({
2015
- meta: {
2016
- type: "problem",
2017
- docs: { description: "Replaces string refs with callback refs." },
2018
- fixable: "code",
2019
- messages: { default: "[Deprecated] Use callback refs instead." },
2020
- schema: []
2021
- },
2022
- name: RULE_NAME$21,
2023
- create: create$21,
2024
- defaultOptions: []
2025
- });
2026
- function create$21(context) {
2027
- const state = { isWithinClassComponent: false };
2028
- function onClassBodyEnter(node) {
2029
- if (core.isClassComponent(node.parent)) state.isWithinClassComponent = true;
2030
- }
2031
- function onClassBodyExit() {
2032
- state.isWithinClassComponent = false;
2033
- }
2034
- return {
2035
- ClassBody: onClassBodyEnter,
2036
- "ClassBody:exit": onClassBodyExit,
2037
- JSXAttribute(node) {
2038
- if (node.name.name !== "ref") return;
2039
- const refName = getJsxAttributeValueText(context, node.value);
2040
- if (refName == null) return;
2041
- context.report({
2042
- messageId: "default",
2043
- node,
2044
- fix(fixer) {
2045
- if (node.value == null) return null;
2046
- if (!state.isWithinClassComponent) return null;
2047
- return fixer.replaceText(node.value, `{(ref) => { this.refs[${refName}] = ref; }}`);
2048
- }
2049
- });
2050
- }
2051
- };
2052
- }
2053
- /**
2054
- * Extracts the text content from a JSX attribute's value
2055
- * @param context The rule context
2056
- * @param node The JSX attribute value node
2057
- * @returns The text of the attribute value, or null if not a string-like value
2058
- */
2059
- function getJsxAttributeValueText(context, node) {
2060
- if (node == null) return null;
2061
- switch (true) {
2062
- case node.type === AST_NODE_TYPES.Literal && typeof node.value === "string": return context.sourceCode.getText(node);
2063
- case node.type === AST_NODE_TYPES.JSXExpressionContainer && node.expression.type === AST_NODE_TYPES.Literal && typeof node.expression.value === "string": return context.sourceCode.getText(node.expression);
2064
- case node.type === AST_NODE_TYPES.JSXExpressionContainer && node.expression.type === AST_NODE_TYPES.TemplateLiteral: return context.sourceCode.getText(node.expression);
2065
- default: return null;
2066
- }
2067
- }
2068
-
2069
1939
  //#endregion
2070
1940
  //#region src/rules/no-unnecessary-key.ts
2071
- const RULE_NAME$20 = "no-unnecessary-key";
1941
+ const RULE_NAME$23 = "no-unnecessary-key";
2072
1942
  var no_unnecessary_key_default = createRule({
2073
1943
  meta: {
2074
1944
  type: "problem",
@@ -2076,11 +1946,11 @@ var no_unnecessary_key_default = createRule({
2076
1946
  messages: { default: "Unnecessary `key` prop on this element. {{reason}}" },
2077
1947
  schema: []
2078
1948
  },
2079
- name: RULE_NAME$20,
2080
- create: create$20,
1949
+ name: RULE_NAME$23,
1950
+ create: create$23,
2081
1951
  defaultOptions: []
2082
1952
  });
2083
- function create$20(context) {
1953
+ function create$23(context) {
2084
1954
  if (!context.sourceCode.text.includes("key=")) return {};
2085
1955
  const jsxConfig = {
2086
1956
  ...core.getJsxConfigFromContext(context),
@@ -2129,7 +1999,7 @@ function isArrayMethodCallback(node) {
2129
1999
 
2130
2000
  //#endregion
2131
2001
  //#region src/rules/no-unnecessary-use-callback.ts
2132
- const RULE_NAME$19 = "no-unnecessary-use-callback";
2002
+ const RULE_NAME$22 = "no-unnecessary-use-callback";
2133
2003
  var no_unnecessary_use_callback_default = createRule({
2134
2004
  meta: {
2135
2005
  type: "problem",
@@ -2140,11 +2010,11 @@ var no_unnecessary_use_callback_default = createRule({
2140
2010
  },
2141
2011
  schema: []
2142
2012
  },
2143
- name: RULE_NAME$19,
2144
- create: create$19,
2013
+ name: RULE_NAME$22,
2014
+ create: create$22,
2145
2015
  defaultOptions: []
2146
2016
  });
2147
- function create$19(context) {
2017
+ function create$22(context) {
2148
2018
  if (!context.sourceCode.text.includes("useCallback")) return {};
2149
2019
  return { VariableDeclarator(node) {
2150
2020
  const { id, init } = node;
@@ -2206,7 +2076,7 @@ function checkForUsageInsideUseEffect$1(sourceCode, node) {
2206
2076
 
2207
2077
  //#endregion
2208
2078
  //#region src/rules/no-unnecessary-use-memo.ts
2209
- const RULE_NAME$18 = "no-unnecessary-use-memo";
2079
+ const RULE_NAME$21 = "no-unnecessary-use-memo";
2210
2080
  var no_unnecessary_use_memo_default = createRule({
2211
2081
  meta: {
2212
2082
  type: "problem",
@@ -2217,11 +2087,11 @@ var no_unnecessary_use_memo_default = createRule({
2217
2087
  },
2218
2088
  schema: []
2219
2089
  },
2220
- name: RULE_NAME$18,
2221
- create: create$18,
2090
+ name: RULE_NAME$21,
2091
+ create: create$21,
2222
2092
  defaultOptions: []
2223
2093
  });
2224
- function create$18(context) {
2094
+ function create$21(context) {
2225
2095
  if (!context.sourceCode.text.includes("useMemo")) return {};
2226
2096
  return { VariableDeclarator(node) {
2227
2097
  const { id, init } = node;
@@ -2287,7 +2157,7 @@ function checkForUsageInsideUseEffect(sourceCode, node) {
2287
2157
 
2288
2158
  //#endregion
2289
2159
  //#region src/rules/no-unnecessary-use-prefix.ts
2290
- const RULE_NAME$17 = "no-unnecessary-use-prefix";
2160
+ const RULE_NAME$20 = "no-unnecessary-use-prefix";
2291
2161
  const WELL_KNOWN_HOOKS = ["useMDXComponents"];
2292
2162
  function containsUseComments(context, node) {
2293
2163
  return context.sourceCode.getCommentsInside(node).some(({ value }) => /use\([\s\S]*?\)/u.test(value) || /use[A-Z0-9]\w*\([\s\S]*?\)/u.test(value));
@@ -2299,11 +2169,11 @@ var no_unnecessary_use_prefix_default = createRule({
2299
2169
  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." },
2300
2170
  schema: []
2301
2171
  },
2302
- name: RULE_NAME$17,
2303
- create: create$17,
2172
+ name: RULE_NAME$20,
2173
+ create: create$20,
2304
2174
  defaultOptions: []
2305
2175
  });
2306
- function create$17(context) {
2176
+ function create$20(context) {
2307
2177
  const { ctx, visitor } = core.useHookCollector(context);
2308
2178
  return defineRuleListener(visitor, { "Program:exit"(program) {
2309
2179
  for (const { id, name, node, hookCalls } of ctx.getAllHooks(program)) {
@@ -2323,7 +2193,7 @@ function create$17(context) {
2323
2193
 
2324
2194
  //#endregion
2325
2195
  //#region src/rules/no-unnecessary-use-ref.ts
2326
- const RULE_NAME$16 = "no-unnecessary-use-ref";
2196
+ const RULE_NAME$19 = "no-unnecessary-use-ref";
2327
2197
  var no_unnecessary_use_ref_default = createRule({
2328
2198
  meta: {
2329
2199
  type: "problem",
@@ -2331,11 +2201,11 @@ var no_unnecessary_use_ref_default = createRule({
2331
2201
  messages: { default: "Unnecessary use of 'useRef'. Instead, co-locate the value inside the effect that uses it." },
2332
2202
  schema: []
2333
2203
  },
2334
- name: RULE_NAME$16,
2335
- create: create$16,
2204
+ name: RULE_NAME$19,
2205
+ create: create$19,
2336
2206
  defaultOptions: []
2337
2207
  });
2338
- function create$16(context) {
2208
+ function create$19(context) {
2339
2209
  if (!context.sourceCode.text.includes("useRef")) return {};
2340
2210
  return { VariableDeclarator(node) {
2341
2211
  const { id, init } = node;
@@ -2361,7 +2231,7 @@ function create$16(context) {
2361
2231
 
2362
2232
  //#endregion
2363
2233
  //#region src/rules/no-unsafe-component-will-mount.ts
2364
- const RULE_NAME$15 = "no-unsafe-component-will-mount";
2234
+ const RULE_NAME$18 = "no-unsafe-component-will-mount";
2365
2235
  var no_unsafe_component_will_mount_default = createRule({
2366
2236
  meta: {
2367
2237
  type: "problem",
@@ -2369,11 +2239,11 @@ var no_unsafe_component_will_mount_default = createRule({
2369
2239
  messages: { default: "Do not use 'UNSAFE_componentWillMount'." },
2370
2240
  schema: []
2371
2241
  },
2372
- name: RULE_NAME$15,
2373
- create: create$15,
2242
+ name: RULE_NAME$18,
2243
+ create: create$18,
2374
2244
  defaultOptions: []
2375
2245
  });
2376
- function create$15(context) {
2246
+ function create$18(context) {
2377
2247
  if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
2378
2248
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
2379
2249
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -2389,7 +2259,7 @@ function create$15(context) {
2389
2259
 
2390
2260
  //#endregion
2391
2261
  //#region src/rules/no-unsafe-component-will-receive-props.ts
2392
- const RULE_NAME$14 = "no-unsafe-component-will-receive-props";
2262
+ const RULE_NAME$17 = "no-unsafe-component-will-receive-props";
2393
2263
  var no_unsafe_component_will_receive_props_default = createRule({
2394
2264
  meta: {
2395
2265
  type: "problem",
@@ -2397,11 +2267,11 @@ var no_unsafe_component_will_receive_props_default = createRule({
2397
2267
  messages: { default: "Do not use 'UNSAFE_componentWillReceiveProps'." },
2398
2268
  schema: []
2399
2269
  },
2400
- name: RULE_NAME$14,
2401
- create: create$14,
2270
+ name: RULE_NAME$17,
2271
+ create: create$17,
2402
2272
  defaultOptions: []
2403
2273
  });
2404
- function create$14(context) {
2274
+ function create$17(context) {
2405
2275
  if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) return {};
2406
2276
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
2407
2277
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -2417,7 +2287,7 @@ function create$14(context) {
2417
2287
 
2418
2288
  //#endregion
2419
2289
  //#region src/rules/no-unsafe-component-will-update.ts
2420
- const RULE_NAME$13 = "no-unsafe-component-will-update";
2290
+ const RULE_NAME$16 = "no-unsafe-component-will-update";
2421
2291
  var no_unsafe_component_will_update_default = createRule({
2422
2292
  meta: {
2423
2293
  type: "problem",
@@ -2425,11 +2295,11 @@ var no_unsafe_component_will_update_default = createRule({
2425
2295
  messages: { default: "Do not use 'UNSAFE_componentWillUpdate'." },
2426
2296
  schema: []
2427
2297
  },
2428
- name: RULE_NAME$13,
2429
- create: create$13,
2298
+ name: RULE_NAME$16,
2299
+ create: create$16,
2430
2300
  defaultOptions: []
2431
2301
  });
2432
- function create$13(context) {
2302
+ function create$16(context) {
2433
2303
  if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
2434
2304
  const { ctx, visitor } = core.useComponentCollectorLegacy(context);
2435
2305
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -2445,7 +2315,7 @@ function create$13(context) {
2445
2315
 
2446
2316
  //#endregion
2447
2317
  //#region src/rules/no-unstable-context-value.ts
2448
- const RULE_NAME$12 = "no-unstable-context-value";
2318
+ const RULE_NAME$15 = "no-unstable-context-value";
2449
2319
  var no_unstable_context_value_default = createRule({
2450
2320
  meta: {
2451
2321
  type: "problem",
@@ -2453,11 +2323,11 @@ var no_unstable_context_value_default = createRule({
2453
2323
  messages: { unstableContextValue: "A/an '{{type}}' passed as the value prop to the context provider should not be constructed. It will change on every render. {{suggestion}}" },
2454
2324
  schema: []
2455
2325
  },
2456
- name: RULE_NAME$12,
2457
- create: create$12,
2326
+ name: RULE_NAME$15,
2327
+ create: create$15,
2458
2328
  defaultOptions: []
2459
2329
  });
2460
- function create$12(context) {
2330
+ function create$15(context) {
2461
2331
  if (ast.getFileDirectives(context.sourceCode.ast).some((d) => d.directive === "use memo")) return {};
2462
2332
  const { version } = getSettingsFromContext(context);
2463
2333
  const isReact18OrBelow = compare(version, "19.0.0", "<");
@@ -2505,7 +2375,7 @@ function isContextName(name, isReact18OrBelow) {
2505
2375
 
2506
2376
  //#endregion
2507
2377
  //#region src/rules/no-unstable-default-props.ts
2508
- const RULE_NAME$11 = "no-unstable-default-props";
2378
+ const RULE_NAME$14 = "no-unstable-default-props";
2509
2379
  const defaultOptions$2 = [{ safeDefaultProps: [] }];
2510
2380
  const schema$1 = [{
2511
2381
  type: "object",
@@ -2522,8 +2392,8 @@ var no_unstable_default_props_default = createRule({
2522
2392
  messages: { default: "A/an '{{forbiddenType}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{forbiddenType}}'." },
2523
2393
  schema: schema$1
2524
2394
  },
2525
- name: RULE_NAME$11,
2526
- create: create$11,
2395
+ name: RULE_NAME$14,
2396
+ create: create$14,
2527
2397
  defaultOptions: defaultOptions$2
2528
2398
  });
2529
2399
  function extractIdentifier(node) {
@@ -2534,7 +2404,7 @@ function extractIdentifier(node) {
2534
2404
  }
2535
2405
  return null;
2536
2406
  }
2537
- function create$11(context, [options]) {
2407
+ function create$14(context, [options]) {
2538
2408
  if (ast.getFileDirectives(context.sourceCode.ast).some((d) => d.directive === "use memo")) return {};
2539
2409
  const { ctx, visitor } = core.useComponentCollector(context);
2540
2410
  const declarators = /* @__PURE__ */ new WeakMap();
@@ -2579,7 +2449,7 @@ function create$11(context, [options]) {
2579
2449
 
2580
2450
  //#endregion
2581
2451
  //#region src/rules/no-unused-class-component-members.ts
2582
- const RULE_NAME$10 = "no-unused-class-component-members";
2452
+ const RULE_NAME$13 = "no-unused-class-component-members";
2583
2453
  const LIFECYCLE_METHODS = new Set([
2584
2454
  "componentDidCatch",
2585
2455
  "componentDidMount",
@@ -2610,11 +2480,11 @@ var no_unused_class_component_members_default = createRule({
2610
2480
  messages: { default: "Unused method or property '{{methodName}}'' of class '{{className}}'." },
2611
2481
  schema: []
2612
2482
  },
2613
- name: RULE_NAME$10,
2614
- create: create$10,
2483
+ name: RULE_NAME$13,
2484
+ create: create$13,
2615
2485
  defaultOptions: []
2616
2486
  });
2617
- function create$10(context) {
2487
+ function create$13(context) {
2618
2488
  const classStack = [];
2619
2489
  const methodStack = [];
2620
2490
  const propertyDefs = /* @__PURE__ */ new WeakMap();
@@ -2695,7 +2565,7 @@ function create$10(context) {
2695
2565
 
2696
2566
  //#endregion
2697
2567
  //#region src/rules/no-unused-props.ts
2698
- const RULE_NAME$9 = "no-unused-props";
2568
+ const RULE_NAME$12 = "no-unused-props";
2699
2569
  var no_unused_props_default = createRule({
2700
2570
  meta: {
2701
2571
  type: "problem",
@@ -2703,11 +2573,11 @@ var no_unused_props_default = createRule({
2703
2573
  messages: { default: "Prop `{{name}}` is declared but never used" },
2704
2574
  schema: []
2705
2575
  },
2706
- name: RULE_NAME$9,
2707
- create: create$9,
2576
+ name: RULE_NAME$12,
2577
+ create: create$12,
2708
2578
  defaultOptions: []
2709
2579
  });
2710
- function create$9(context) {
2580
+ function create$12(context) {
2711
2581
  const services = ESLintUtils.getParserServices(context, false);
2712
2582
  const { ctx, visitor } = core.useComponentCollector(context);
2713
2583
  return defineRuleListener(visitor, { "Program:exit"(program) {
@@ -2805,7 +2675,7 @@ function reportUnusedProp(context, services, prop) {
2805
2675
 
2806
2676
  //#endregion
2807
2677
  //#region src/rules/no-unused-state.ts
2808
- const RULE_NAME$8 = "no-unused-state";
2678
+ const RULE_NAME$11 = "no-unused-state";
2809
2679
  function isKeyLiteral(node, key) {
2810
2680
  return match(key).with({ type: AST_NODE_TYPES.Literal }, constTrue).with({
2811
2681
  type: AST_NODE_TYPES.TemplateLiteral,
@@ -2819,11 +2689,11 @@ var no_unused_state_default = createRule({
2819
2689
  messages: { default: "Unused class component state in '{{className}}'" },
2820
2690
  schema: []
2821
2691
  },
2822
- name: RULE_NAME$8,
2823
- create: create$8,
2692
+ name: RULE_NAME$11,
2693
+ create: create$11,
2824
2694
  defaultOptions: []
2825
2695
  });
2826
- function create$8(context) {
2696
+ function create$11(context) {
2827
2697
  const classStack = [];
2828
2698
  const methodStack = [];
2829
2699
  const constructorStack = [];
@@ -2932,7 +2802,7 @@ function create$8(context) {
2932
2802
 
2933
2803
  //#endregion
2934
2804
  //#region src/rules/no-use-context.ts
2935
- const RULE_NAME$7 = "no-use-context";
2805
+ const RULE_NAME$10 = "no-use-context";
2936
2806
  var no_use_context_default = createRule({
2937
2807
  meta: {
2938
2808
  type: "problem",
@@ -2941,11 +2811,11 @@ var no_use_context_default = createRule({
2941
2811
  messages: { default: "In React 19, 'use' is preferred over 'useContext' because it is more flexible." },
2942
2812
  schema: []
2943
2813
  },
2944
- name: RULE_NAME$7,
2945
- create: create$7,
2814
+ name: RULE_NAME$10,
2815
+ create: create$10,
2946
2816
  defaultOptions: []
2947
2817
  });
2948
- function create$7(context) {
2818
+ function create$10(context) {
2949
2819
  if (!context.sourceCode.text.includes("useContext")) return {};
2950
2820
  const settings = getSettingsFromContext(context);
2951
2821
  if (compare(settings.version, "19.0.0", "<")) return {};
@@ -3010,7 +2880,7 @@ function getCorrelativeTokens(context, node) {
3010
2880
 
3011
2881
  //#endregion
3012
2882
  //#region src/rules/no-useless-forward-ref.ts
3013
- const RULE_NAME$6 = "no-useless-forward-ref";
2883
+ const RULE_NAME$9 = "no-useless-forward-ref";
3014
2884
  var no_useless_forward_ref_default = createRule({
3015
2885
  meta: {
3016
2886
  type: "problem",
@@ -3018,11 +2888,11 @@ var no_useless_forward_ref_default = createRule({
3018
2888
  messages: { default: "A 'forwardRef' is used with this component but no 'ref' parameter is set." },
3019
2889
  schema: []
3020
2890
  },
3021
- name: RULE_NAME$6,
3022
- create: create$6,
2891
+ name: RULE_NAME$9,
2892
+ create: create$9,
3023
2893
  defaultOptions: []
3024
2894
  });
3025
- function create$6(context) {
2895
+ function create$9(context) {
3026
2896
  return { CallExpression(node) {
3027
2897
  if (!core.isForwardRefCall(context, node)) return;
3028
2898
  const [component] = node.arguments;
@@ -3037,7 +2907,7 @@ function create$6(context) {
3037
2907
 
3038
2908
  //#endregion
3039
2909
  //#region src/rules/no-useless-fragment.ts
3040
- const RULE_NAME$5 = "no-useless-fragment";
2910
+ const RULE_NAME$8 = "no-useless-fragment";
3041
2911
  const defaultOptions$1 = [{
3042
2912
  allowEmptyFragment: false,
3043
2913
  allowExpressions: true
@@ -3065,11 +2935,11 @@ var no_useless_fragment_default = createRule({
3065
2935
  messages: { default: "A fragment {{reason}} is useless." },
3066
2936
  schema
3067
2937
  },
3068
- name: RULE_NAME$5,
3069
- create: create$5,
2938
+ name: RULE_NAME$8,
2939
+ create: create$8,
3070
2940
  defaultOptions: defaultOptions$1
3071
2941
  });
3072
- function create$5(context, [option]) {
2942
+ function create$8(context, [option]) {
3073
2943
  const { allowEmptyFragment = false, allowExpressions = true } = option;
3074
2944
  const jsxConfig = {
3075
2945
  ...core.getJsxConfigFromContext(context),
@@ -3177,7 +3047,7 @@ function trimLikeReact(text) {
3177
3047
 
3178
3048
  //#endregion
3179
3049
  //#region src/rules/prefer-destructuring-assignment.ts
3180
- const RULE_NAME$4 = "prefer-destructuring-assignment";
3050
+ const RULE_NAME$7 = "prefer-destructuring-assignment";
3181
3051
  var prefer_destructuring_assignment_default = createRule({
3182
3052
  meta: {
3183
3053
  type: "problem",
@@ -3185,11 +3055,11 @@ var prefer_destructuring_assignment_default = createRule({
3185
3055
  messages: { default: "Use destructuring assignment for component props." },
3186
3056
  schema: []
3187
3057
  },
3188
- name: RULE_NAME$4,
3189
- create: create$4,
3058
+ name: RULE_NAME$7,
3059
+ create: create$7,
3190
3060
  defaultOptions: []
3191
3061
  });
3192
- function create$4(context) {
3062
+ function create$7(context) {
3193
3063
  const { ctx, visitor } = core.useComponentCollector(context);
3194
3064
  return defineRuleListener(visitor, { "Program:exit"(program) {
3195
3065
  for (const component of ctx.getAllComponents(program)) {
@@ -3213,7 +3083,7 @@ function create$4(context) {
3213
3083
 
3214
3084
  //#endregion
3215
3085
  //#region src/rules/prefer-namespace-import.ts
3216
- const RULE_NAME$3 = "prefer-namespace-import";
3086
+ const RULE_NAME$6 = "prefer-namespace-import";
3217
3087
  var prefer_namespace_import_default = createRule({
3218
3088
  meta: {
3219
3089
  type: "problem",
@@ -3222,11 +3092,11 @@ var prefer_namespace_import_default = createRule({
3222
3092
  messages: { default: "Prefer importing React as 'import * as React from \"{{importSource}}\"';" },
3223
3093
  schema: []
3224
3094
  },
3225
- name: RULE_NAME$3,
3226
- create: create$3,
3095
+ name: RULE_NAME$6,
3096
+ create: create$6,
3227
3097
  defaultOptions: []
3228
3098
  });
3229
- function create$3(context) {
3099
+ function create$6(context) {
3230
3100
  const { importSource } = getSettingsFromContext(context);
3231
3101
  return { [`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
3232
3102
  const hasOtherSpecifiers = node.parent.specifiers.length > 1;
@@ -3250,7 +3120,7 @@ function create$3(context) {
3250
3120
 
3251
3121
  //#endregion
3252
3122
  //#region src/rules/prefer-read-only-props.ts
3253
- const RULE_NAME$2 = "prefer-read-only-props";
3123
+ const RULE_NAME$5 = "prefer-read-only-props";
3254
3124
  var prefer_read_only_props_default = createRule({
3255
3125
  meta: {
3256
3126
  type: "problem",
@@ -3258,11 +3128,11 @@ var prefer_read_only_props_default = createRule({
3258
3128
  messages: { default: "A function component's props should be read-only." },
3259
3129
  schema: []
3260
3130
  },
3261
- name: RULE_NAME$2,
3262
- create: create$2,
3131
+ name: RULE_NAME$5,
3132
+ create: create$5,
3263
3133
  defaultOptions: []
3264
3134
  });
3265
- function create$2(context) {
3135
+ function create$5(context) {
3266
3136
  const services = ESLintUtils.getParserServices(context, false);
3267
3137
  const checker = services.program.getTypeChecker();
3268
3138
  const { ctx, visitor } = core.useComponentCollector(context);
@@ -3303,7 +3173,7 @@ function isClassOrInterfaceReadonlyLoose(checker, type) {
3303
3173
 
3304
3174
  //#endregion
3305
3175
  //#region src/rules/prefer-use-state-lazy-initialization.ts
3306
- const RULE_NAME$1 = "prefer-use-state-lazy-initialization";
3176
+ const RULE_NAME$4 = "prefer-use-state-lazy-initialization";
3307
3177
  const ALLOW_LIST = [
3308
3178
  "Boolean",
3309
3179
  "String",
@@ -3316,11 +3186,11 @@ var prefer_use_state_lazy_initialization_default = createRule({
3316
3186
  messages: { default: "To prevent re-computation, consider using lazy initial state for useState calls that involve function calls. Ex: 'useState(() => getValue())'." },
3317
3187
  schema: []
3318
3188
  },
3319
- name: RULE_NAME$1,
3320
- create: create$1,
3189
+ name: RULE_NAME$4,
3190
+ create: create$4,
3321
3191
  defaultOptions: []
3322
3192
  });
3323
- function create$1(context) {
3193
+ function create$4(context) {
3324
3194
  return { CallExpression(node) {
3325
3195
  if (!core.isUseStateCall(node)) return;
3326
3196
  const [useStateInput] = node.arguments;
@@ -3347,9 +3217,41 @@ function create$1(context) {
3347
3217
  } };
3348
3218
  }
3349
3219
 
3220
+ //#endregion
3221
+ //#region src/rules-removed/no-default-props.ts
3222
+ const RULE_NAME$3 = "no-default-props";
3223
+ var no_default_props_default = createRule({
3224
+ meta: {
3225
+ type: "problem",
3226
+ docs: { description: "Disallows the 'defaultProps' property in favor of ES6 default parameters." },
3227
+ messages: { default: "[Deprecated] Use ES6 default parameters instead." },
3228
+ schema: []
3229
+ },
3230
+ name: RULE_NAME$3,
3231
+ create: create$3,
3232
+ defaultOptions: []
3233
+ });
3234
+ function create$3(context) {
3235
+ if (!context.sourceCode.text.includes("defaultProps")) return {};
3236
+ return { AssignmentExpression(node) {
3237
+ if (node.operator !== "=" || node.left.type !== AST_NODE_TYPES.MemberExpression) return;
3238
+ const { object, property } = node.left;
3239
+ if (object.type !== AST_NODE_TYPES.Identifier) return;
3240
+ if (property.type !== AST_NODE_TYPES.Identifier || property.name !== "defaultProps") return;
3241
+ if (!core.isComponentNameLoose(object.name)) return;
3242
+ const variableNode = getVariableDefinitionNode(findVariable(object.name, context.sourceCode.getScope(node)), 0);
3243
+ if (variableNode == null) return;
3244
+ if (!ast.isFunction(variableNode)) return;
3245
+ context.report({
3246
+ messageId: "default",
3247
+ node: property
3248
+ });
3249
+ } };
3250
+ }
3251
+
3350
3252
  //#endregion
3351
3253
  //#region src/rules-removed/no-forbidden-props.ts
3352
- const RULE_NAME = "no-forbidden-props";
3254
+ const RULE_NAME$2 = "no-forbidden-props";
3353
3255
  const defaultOptions = [{ forbid: [{ prop: "/_/" }] }];
3354
3256
  var no_forbidden_props_default = createRule({
3355
3257
  meta: {
@@ -3402,11 +3304,11 @@ var no_forbidden_props_default = createRule({
3402
3304
  } }
3403
3305
  }]
3404
3306
  },
3405
- name: RULE_NAME,
3406
- create,
3307
+ name: RULE_NAME$2,
3308
+ create: create$2,
3407
3309
  defaultOptions
3408
3310
  });
3409
- function create(context, [option]) {
3311
+ function create$2(context, [option]) {
3410
3312
  const { forbid } = option;
3411
3313
  return { JSXOpeningElement(node) {
3412
3314
  let nodeName = null;
@@ -3431,6 +3333,104 @@ function create(context, [option]) {
3431
3333
  } };
3432
3334
  }
3433
3335
 
3336
+ //#endregion
3337
+ //#region src/rules-removed/no-prop-types.ts
3338
+ const RULE_NAME$1 = "no-prop-types";
3339
+ var no_prop_types_default = createRule({
3340
+ meta: {
3341
+ type: "problem",
3342
+ docs: { description: "Disallows 'propTypes' in favor of TypeScript or another type-checking solution." },
3343
+ messages: { default: "[Deprecated] Use TypeScript or another type-checking solution instead." },
3344
+ schema: []
3345
+ },
3346
+ name: RULE_NAME$1,
3347
+ create: create$1,
3348
+ defaultOptions: []
3349
+ });
3350
+ function create$1(context) {
3351
+ if (!context.sourceCode.text.includes("propTypes")) return {};
3352
+ return {
3353
+ AssignmentExpression(node) {
3354
+ if (node.operator !== "=" || node.left.type !== AST_NODE_TYPES.MemberExpression) return;
3355
+ const { object, property } = node.left;
3356
+ if (object.type !== AST_NODE_TYPES.Identifier) return;
3357
+ if (property.type !== AST_NODE_TYPES.Identifier || property.name !== "propTypes") return;
3358
+ if (!core.isComponentNameLoose(object.name)) return;
3359
+ const variableNode = getVariableDefinitionNode(findVariable(object.name, context.sourceCode.getScope(node)), 0);
3360
+ if (variableNode != null && (ast.isFunction(variableNode) || core.isClassComponent(variableNode))) context.report({
3361
+ messageId: "default",
3362
+ node: property
3363
+ });
3364
+ },
3365
+ PropertyDefinition(node) {
3366
+ if (!core.isClassComponent(node.parent.parent)) return;
3367
+ if (!node.static || node.key.type !== AST_NODE_TYPES.Identifier || node.key.name !== "propTypes") return;
3368
+ context.report({
3369
+ messageId: "default",
3370
+ node
3371
+ });
3372
+ }
3373
+ };
3374
+ }
3375
+
3376
+ //#endregion
3377
+ //#region src/rules-removed/no-string-refs.ts
3378
+ const RULE_NAME = "no-string-refs";
3379
+ var no_string_refs_default = createRule({
3380
+ meta: {
3381
+ type: "problem",
3382
+ docs: { description: "Replaces string refs with callback refs." },
3383
+ fixable: "code",
3384
+ messages: { default: "[Deprecated] Use callback refs instead." },
3385
+ schema: []
3386
+ },
3387
+ name: RULE_NAME,
3388
+ create,
3389
+ defaultOptions: []
3390
+ });
3391
+ function create(context) {
3392
+ const state = { isWithinClassComponent: false };
3393
+ function onClassBodyEnter(node) {
3394
+ if (core.isClassComponent(node.parent)) state.isWithinClassComponent = true;
3395
+ }
3396
+ function onClassBodyExit() {
3397
+ state.isWithinClassComponent = false;
3398
+ }
3399
+ return {
3400
+ ClassBody: onClassBodyEnter,
3401
+ "ClassBody:exit": onClassBodyExit,
3402
+ JSXAttribute(node) {
3403
+ if (node.name.name !== "ref") return;
3404
+ const refName = getJsxAttributeValueText(context, node.value);
3405
+ if (refName == null) return;
3406
+ context.report({
3407
+ messageId: "default",
3408
+ node,
3409
+ fix(fixer) {
3410
+ if (node.value == null) return null;
3411
+ if (!state.isWithinClassComponent) return null;
3412
+ return fixer.replaceText(node.value, `{(ref) => { this.refs[${refName}] = ref; }}`);
3413
+ }
3414
+ });
3415
+ }
3416
+ };
3417
+ }
3418
+ /**
3419
+ * Extracts the text content from a JSX attribute's value
3420
+ * @param context The rule context
3421
+ * @param node The JSX attribute value node
3422
+ * @returns The text of the attribute value, or null if not a string-like value
3423
+ */
3424
+ function getJsxAttributeValueText(context, node) {
3425
+ if (node == null) return null;
3426
+ switch (true) {
3427
+ case node.type === AST_NODE_TYPES.Literal && typeof node.value === "string": return context.sourceCode.getText(node);
3428
+ case node.type === AST_NODE_TYPES.JSXExpressionContainer && node.expression.type === AST_NODE_TYPES.Literal && typeof node.expression.value === "string": return context.sourceCode.getText(node.expression);
3429
+ case node.type === AST_NODE_TYPES.JSXExpressionContainer && node.expression.type === AST_NODE_TYPES.TemplateLiteral: return context.sourceCode.getText(node.expression);
3430
+ default: return null;
3431
+ }
3432
+ }
3433
+
3434
3434
  //#endregion
3435
3435
  //#region src/plugin.ts
3436
3436
  const plugin = {
@@ -3464,7 +3464,6 @@ const plugin = {
3464
3464
  "no-component-will-update": no_component_will_update_default,
3465
3465
  "no-context-provider": no_context_provider_default,
3466
3466
  "no-create-ref": no_create_ref_default,
3467
- "no-default-props": no_default_props_default,
3468
3467
  "no-direct-mutation-state": no_direct_mutation_state_default,
3469
3468
  "no-duplicate-key": no_duplicate_key_default,
3470
3469
  "no-forward-ref": no_forward_ref_default,
@@ -3476,12 +3475,10 @@ const plugin = {
3476
3475
  "no-misused-capture-owner-stack": no_misused_capture_owner_stack_default,
3477
3476
  "no-nested-component-definitions": no_nested_component_definitions_default,
3478
3477
  "no-nested-lazy-component-declarations": no_nested_lazy_component_declarations_default,
3479
- "no-prop-types": no_prop_types_default,
3480
3478
  "no-redundant-should-component-update": no_redundant_should_component_update_default,
3481
3479
  "no-set-state-in-component-did-mount": no_set_state_in_component_did_mount_default,
3482
3480
  "no-set-state-in-component-did-update": no_set_state_in_component_did_update_default,
3483
3481
  "no-set-state-in-component-will-update": no_set_state_in_component_will_update_default,
3484
- "no-string-refs": no_string_refs_default,
3485
3482
  "no-unnecessary-key": no_unnecessary_key_default,
3486
3483
  "no-unnecessary-use-callback": no_unnecessary_use_callback_default,
3487
3484
  "no-unnecessary-use-memo": no_unnecessary_use_memo_default,
@@ -3502,7 +3499,10 @@ const plugin = {
3502
3499
  "prefer-namespace-import": prefer_namespace_import_default,
3503
3500
  "prefer-read-only-props": prefer_read_only_props_default,
3504
3501
  "prefer-use-state-lazy-initialization": prefer_use_state_lazy_initialization_default,
3505
- "no-forbidden-props": no_forbidden_props_default
3502
+ "no-default-props": no_default_props_default,
3503
+ "no-forbidden-props": no_forbidden_props_default,
3504
+ "no-prop-types": no_prop_types_default,
3505
+ "no-string-refs": no_string_refs_default
3506
3506
  }
3507
3507
  };
3508
3508
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "2.9.2",
3
+ "version": "2.9.3-next.0",
4
4
  "description": "A set of composable ESLint rules for for libraries and frameworks that use React as a UI runtime.",
5
5
  "keywords": [
6
6
  "react",
@@ -45,11 +45,11 @@
45
45
  "is-immutable-type": "^5.0.1",
46
46
  "ts-api-utils": "^2.4.0",
47
47
  "ts-pattern": "^5.9.0",
48
- "@eslint-react/ast": "2.9.2",
49
- "@eslint-react/core": "2.9.2",
50
- "@eslint-react/shared": "2.9.2",
51
- "@eslint-react/var": "2.9.2",
52
- "@eslint-react/eff": "2.9.2"
48
+ "@eslint-react/ast": "2.9.3-next.0",
49
+ "@eslint-react/core": "2.9.3-next.0",
50
+ "@eslint-react/shared": "2.9.3-next.0",
51
+ "@eslint-react/var": "2.9.3-next.0",
52
+ "@eslint-react/eff": "2.9.3-next.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/react": "^19.2.10",