eslint-plugin-react-x 2.3.2-beta.1 → 2.3.2-beta.2

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 +226 -226
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -9,10 +9,10 @@ import { findVariable, getChildScopes, getObjectType, getVariableDefinitionNode
9
9
  import { ComponentDetectionHint, ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit, findParentJsxAttribute, getInstanceId, getJsxAttribute, getJsxAttributeName, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, isAssignmentToThisState, isCaptureOwnerStackCall, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUpdate, isCreateContextCall, isCreateElementCall, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRefCall, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInstanceIdEqual, isJsxFragmentElement, isJsxHostElement, isJsxText, isLazyCall, isReactHookCall, isReactHookName, isRenderMethodLike, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseCall, isUseCallbackCall, isUseContextCall, isUseMemoCall, isUseStateCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector } from "@eslint-react/core";
10
10
  import { constFalse, constTrue, flow, getOrElseUpdate, identity, unit } from "@eslint-react/eff";
11
11
  import { compare } from "compare-versions";
12
- import { camelCase } from "string-ts";
13
12
  import { getConstrainedTypeAtLocation, isTypeReadonly } from "@typescript-eslint/type-utils";
14
13
  import { getStaticValue } from "@typescript-eslint/utils/ast-utils";
15
14
  import { getTypeImmutability, isImmutable, isReadonlyDeep, isReadonlyShallow, isUnknown } from "is-immutable-type";
15
+ import { camelCase } from "string-ts";
16
16
 
17
17
  //#region rolldown:runtime
18
18
  var __defProp = Object.defineProperty;
@@ -28,7 +28,7 @@ var __export = (all) => {
28
28
  //#endregion
29
29
  //#region package.json
30
30
  var name$6 = "eslint-plugin-react-x";
31
- var version = "2.3.2-beta.1";
31
+ var version = "2.3.2-beta.2";
32
32
 
33
33
  //#endregion
34
34
  //#region src/utils/create-rule.ts
@@ -1314,94 +1314,9 @@ function create$35(context) {
1314
1314
  };
1315
1315
  }
1316
1316
 
1317
- //#endregion
1318
- //#region src/rules/no-forbidden-props.ts
1319
- const RULE_NAME$34 = "no-forbidden-props";
1320
- const messageId = camelCase(RULE_NAME$34);
1321
- const defaultOptions$1 = [{ forbid: [{ prop: "/_/" }] }];
1322
- var no_forbidden_props_default = createRule({
1323
- meta: {
1324
- type: "problem",
1325
- defaultOptions: [...defaultOptions$1],
1326
- deprecated: {
1327
- deprecatedSince: "2.3.2",
1328
- message: "This rule is deprecated and will be removed in future versions.",
1329
- replacedBy: [{ rule: {
1330
- name: "no-restricted-syntax",
1331
- url: "https://eslint.org/docs/latest/rules/no-restricted-syntax"
1332
- } }]
1333
- },
1334
- docs: { description: "Disallow certain props on components." },
1335
- messages: { [messageId]: "Prop \"{{name}}\" is forbidden." },
1336
- schema: [{
1337
- type: "object",
1338
- additionalProperties: false,
1339
- properties: { forbid: {
1340
- type: "array",
1341
- items: { anyOf: [
1342
- { type: "string" },
1343
- {
1344
- type: "object",
1345
- additionalProperties: false,
1346
- properties: {
1347
- excludedNodes: {
1348
- type: "array",
1349
- items: { type: "string" },
1350
- uniqueItems: true
1351
- },
1352
- prop: { type: "string" }
1353
- },
1354
- required: ["prop"]
1355
- },
1356
- {
1357
- type: "object",
1358
- additionalProperties: false,
1359
- properties: {
1360
- includedNodes: {
1361
- type: "array",
1362
- items: { type: "string" },
1363
- uniqueItems: true
1364
- },
1365
- prop: { type: "string" }
1366
- },
1367
- required: ["prop"]
1368
- }
1369
- ] }
1370
- } }
1371
- }]
1372
- },
1373
- name: RULE_NAME$34,
1374
- create: create$34,
1375
- defaultOptions: defaultOptions$1
1376
- });
1377
- function create$34(context, [option]) {
1378
- const { forbid = [{ prop: "/_/" }] } = option;
1379
- return { JSXOpeningElement(node) {
1380
- let nodeName = null;
1381
- if (node.name.type === AST_NODE_TYPES.JSXIdentifier) nodeName = node.name.name;
1382
- else if (node.name.type === AST_NODE_TYPES.JSXNamespacedName) nodeName = node.name.name.name;
1383
- for (const attr of node.attributes) {
1384
- if (attr.type === AST_NODE_TYPES.JSXSpreadAttribute) continue;
1385
- const name$7 = attr.name.name;
1386
- if (typeof name$7 !== "string") continue;
1387
- for (const forbiddenPropItem of forbid) {
1388
- if (typeof forbiddenPropItem !== "string" && nodeName != null) {
1389
- if ("excludedNodes" in forbiddenPropItem && forbiddenPropItem.excludedNodes.includes(nodeName)) continue;
1390
- if ("includedNodes" in forbiddenPropItem && !forbiddenPropItem.includedNodes.includes(nodeName)) continue;
1391
- }
1392
- if (toRegExp(typeof forbiddenPropItem === "string" ? forbiddenPropItem : forbiddenPropItem.prop).test(name$7)) context.report({
1393
- messageId,
1394
- node: attr,
1395
- data: { name: name$7 }
1396
- });
1397
- }
1398
- }
1399
- } };
1400
- }
1401
-
1402
1317
  //#endregion
1403
1318
  //#region src/rules/no-forward-ref.ts
1404
- const RULE_NAME$33 = "no-forward-ref";
1319
+ const RULE_NAME$34 = "no-forward-ref";
1405
1320
  const RULE_FEATURES$32 = ["MOD"];
1406
1321
  var no_forward_ref_default = createRule({
1407
1322
  meta: {
@@ -1414,11 +1329,11 @@ var no_forward_ref_default = createRule({
1414
1329
  messages: { noForwardRef: "In React 19, 'forwardRef' is no longer necessary. Pass 'ref' as a prop instead." },
1415
1330
  schema: []
1416
1331
  },
1417
- name: RULE_NAME$33,
1418
- create: create$33,
1332
+ name: RULE_NAME$34,
1333
+ create: create$34,
1419
1334
  defaultOptions: []
1420
1335
  });
1421
- function create$33(context) {
1336
+ function create$34(context) {
1422
1337
  if (!context.sourceCode.text.includes("forwardRef")) return {};
1423
1338
  const { version: version$1 } = getSettingsFromContext(context);
1424
1339
  if (compare(version$1, "19.0.0", "<")) return {};
@@ -1513,7 +1428,7 @@ function getComponentPropsFixes(context, fixer, node, typeArguments) {
1513
1428
 
1514
1429
  //#endregion
1515
1430
  //#region src/rules/no-implicit-key.ts
1516
- const RULE_NAME$32 = "no-implicit-key";
1431
+ const RULE_NAME$33 = "no-implicit-key";
1517
1432
  const RULE_FEATURES$31 = ["EXP"];
1518
1433
  var no_implicit_key_default = createRule({
1519
1434
  meta: {
@@ -1525,11 +1440,11 @@ var no_implicit_key_default = createRule({
1525
1440
  messages: { noImplicitKey: "Do not use implicit 'key' props." },
1526
1441
  schema: []
1527
1442
  },
1528
- name: RULE_NAME$32,
1529
- create: create$32,
1443
+ name: RULE_NAME$33,
1444
+ create: create$33,
1530
1445
  defaultOptions: []
1531
1446
  });
1532
- function create$32(context) {
1447
+ function create$33(context) {
1533
1448
  return { JSXOpeningElement(node) {
1534
1449
  const keyProp = getJsxAttribute(context, node.parent)("key");
1535
1450
  const isKeyPropOnElement = node.attributes.some((n) => n.type === AST_NODE_TYPES.JSXAttribute && n.name.type === AST_NODE_TYPES.JSXIdentifier && n.name.name === "key");
@@ -1542,7 +1457,7 @@ function create$32(context) {
1542
1457
 
1543
1458
  //#endregion
1544
1459
  //#region src/rules/no-leaked-conditional-rendering.ts
1545
- const RULE_NAME$31 = "no-leaked-conditional-rendering";
1460
+ const RULE_NAME$32 = "no-leaked-conditional-rendering";
1546
1461
  const RULE_FEATURES$30 = ["TSC"];
1547
1462
  var no_leaked_conditional_rendering_default = createRule({
1548
1463
  meta: {
@@ -1554,11 +1469,11 @@ var no_leaked_conditional_rendering_default = createRule({
1554
1469
  messages: { noLeakedConditionalRendering: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes." },
1555
1470
  schema: []
1556
1471
  },
1557
- name: RULE_NAME$31,
1558
- create: create$31,
1472
+ name: RULE_NAME$32,
1473
+ create: create$32,
1559
1474
  defaultOptions: []
1560
1475
  });
1561
- function create$31(context) {
1476
+ function create$32(context) {
1562
1477
  if (!context.sourceCode.text.includes("&&")) return {};
1563
1478
  const { version: version$1 } = getSettingsFromContext(context);
1564
1479
  const allowedVariants = [
@@ -1614,7 +1529,7 @@ function create$31(context) {
1614
1529
 
1615
1530
  //#endregion
1616
1531
  //#region src/rules/no-missing-component-display-name.ts
1617
- const RULE_NAME$30 = "no-missing-component-display-name";
1532
+ const RULE_NAME$31 = "no-missing-component-display-name";
1618
1533
  const RULE_FEATURES$29 = [];
1619
1534
  var no_missing_component_display_name_default = createRule({
1620
1535
  meta: {
@@ -1626,11 +1541,11 @@ var no_missing_component_display_name_default = createRule({
1626
1541
  messages: { noMissingComponentDisplayName: "Add missing 'displayName' for component." },
1627
1542
  schema: []
1628
1543
  },
1629
- name: RULE_NAME$30,
1630
- create: create$30,
1544
+ name: RULE_NAME$31,
1545
+ create: create$31,
1631
1546
  defaultOptions: []
1632
1547
  });
1633
- function create$30(context) {
1548
+ function create$31(context) {
1634
1549
  if (!context.sourceCode.text.includes("memo") && !context.sourceCode.text.includes("forwardRef")) return {};
1635
1550
  const { ctx, listeners } = useComponentCollector(context, {
1636
1551
  collectDisplayName: true,
@@ -1659,7 +1574,7 @@ function create$30(context) {
1659
1574
 
1660
1575
  //#endregion
1661
1576
  //#region src/rules/no-missing-context-display-name.ts
1662
- const RULE_NAME$29 = "no-missing-context-display-name";
1577
+ const RULE_NAME$30 = "no-missing-context-display-name";
1663
1578
  const RULE_FEATURES$28 = ["FIX"];
1664
1579
  var no_missing_context_display_name_default = createRule({
1665
1580
  meta: {
@@ -1672,11 +1587,11 @@ var no_missing_context_display_name_default = createRule({
1672
1587
  messages: { noMissingContextDisplayName: "Add missing 'displayName' for context." },
1673
1588
  schema: []
1674
1589
  },
1675
- name: RULE_NAME$29,
1676
- create: create$29,
1590
+ name: RULE_NAME$30,
1591
+ create: create$30,
1677
1592
  defaultOptions: []
1678
1593
  });
1679
- function create$29(context) {
1594
+ function create$30(context) {
1680
1595
  if (!context.sourceCode.text.includes("createContext")) return {};
1681
1596
  const createCalls = [];
1682
1597
  const displayNameAssignments = [];
@@ -1728,7 +1643,7 @@ function create$29(context) {
1728
1643
 
1729
1644
  //#endregion
1730
1645
  //#region src/rules/no-missing-key.ts
1731
- const RULE_NAME$28 = "no-missing-key";
1646
+ const RULE_NAME$29 = "no-missing-key";
1732
1647
  const RULE_FEATURES$27 = [];
1733
1648
  var no_missing_key_default = createRule({
1734
1649
  meta: {
@@ -1743,11 +1658,11 @@ var no_missing_key_default = createRule({
1743
1658
  },
1744
1659
  schema: []
1745
1660
  },
1746
- name: RULE_NAME$28,
1747
- create: create$28,
1661
+ name: RULE_NAME$29,
1662
+ create: create$29,
1748
1663
  defaultOptions: []
1749
1664
  });
1750
- function create$28(context) {
1665
+ function create$29(context) {
1751
1666
  const state = { isWithinChildrenToArray: false };
1752
1667
  function checkIteratorElement(node) {
1753
1668
  switch (node.type) {
@@ -1825,7 +1740,7 @@ function create$28(context) {
1825
1740
 
1826
1741
  //#endregion
1827
1742
  //#region src/rules/no-misused-capture-owner-stack.ts
1828
- const RULE_NAME$27 = "no-misused-capture-owner-stack";
1743
+ const RULE_NAME$28 = "no-misused-capture-owner-stack";
1829
1744
  const RULE_FEATURES$26 = ["EXP"];
1830
1745
  var no_misused_capture_owner_stack_default = createRule({
1831
1746
  meta: {
@@ -1841,11 +1756,11 @@ var no_misused_capture_owner_stack_default = createRule({
1841
1756
  },
1842
1757
  schema: []
1843
1758
  },
1844
- name: RULE_NAME$27,
1845
- create: create$27,
1759
+ name: RULE_NAME$28,
1760
+ create: create$28,
1846
1761
  defaultOptions: []
1847
1762
  });
1848
- function create$27(context) {
1763
+ function create$28(context) {
1849
1764
  if (!context.sourceCode.text.includes("captureOwnerStack")) return {};
1850
1765
  const { importSource } = getSettingsFromContext(context);
1851
1766
  return {
@@ -1877,7 +1792,7 @@ function isDevelopmentOnlyCheck(node) {
1877
1792
 
1878
1793
  //#endregion
1879
1794
  //#region src/rules/no-nested-component-definitions.ts
1880
- const RULE_NAME$26 = "no-nested-component-definitions";
1795
+ const RULE_NAME$27 = "no-nested-component-definitions";
1881
1796
  const RULE_FEATURES$25 = [];
1882
1797
  var no_nested_component_definitions_default = createRule({
1883
1798
  meta: {
@@ -1889,11 +1804,11 @@ var no_nested_component_definitions_default = createRule({
1889
1804
  messages: { noNestedComponentDefinitions: "Do not nest component definitions inside other components or props. {{suggestion}}" },
1890
1805
  schema: []
1891
1806
  },
1892
- name: RULE_NAME$26,
1893
- create: create$26,
1807
+ name: RULE_NAME$27,
1808
+ create: create$27,
1894
1809
  defaultOptions: []
1895
1810
  });
1896
- function create$26(context) {
1811
+ function create$27(context) {
1897
1812
  const collector = useComponentCollector(context, { hint: ComponentDetectionHint.SkipArrayMapArgument | ComponentDetectionHint.SkipNullLiteral | ComponentDetectionHint.SkipUndefined | ComponentDetectionHint.SkipBooleanLiteral | ComponentDetectionHint.SkipStringLiteral | ComponentDetectionHint.SkipNumberLiteral | ComponentDetectionHint.StrictLogical | ComponentDetectionHint.StrictConditional });
1898
1813
  const collectorLegacy = useComponentCollectorLegacy();
1899
1814
  return {
@@ -2001,7 +1916,7 @@ function isInsideCreateElementProps(context, node) {
2001
1916
 
2002
1917
  //#endregion
2003
1918
  //#region src/rules/no-nested-lazy-component-declarations.ts
2004
- const RULE_NAME$25 = "no-nested-lazy-component-declarations";
1919
+ const RULE_NAME$26 = "no-nested-lazy-component-declarations";
2005
1920
  const RULE_FEATURES$24 = [];
2006
1921
  var no_nested_lazy_component_declarations_default = createRule({
2007
1922
  meta: {
@@ -2013,11 +1928,11 @@ var no_nested_lazy_component_declarations_default = createRule({
2013
1928
  messages: { noNestedLazyComponentDeclarations: "Do not declare lazy components inside other components. Instead, always declare them at the top level of your module." },
2014
1929
  schema: []
2015
1930
  },
2016
- name: RULE_NAME$25,
2017
- create: create$25,
1931
+ name: RULE_NAME$26,
1932
+ create: create$26,
2018
1933
  defaultOptions: []
2019
1934
  });
2020
- function create$25(context) {
1935
+ function create$26(context) {
2021
1936
  const hint = ComponentDetectionHint.None;
2022
1937
  const collector = useComponentCollector(context, { hint });
2023
1938
  const collectorLegacy = useComponentCollectorLegacy();
@@ -2048,7 +1963,7 @@ function create$25(context) {
2048
1963
 
2049
1964
  //#endregion
2050
1965
  //#region src/rules/no-prop-types.ts
2051
- const RULE_NAME$24 = "no-prop-types";
1966
+ const RULE_NAME$25 = "no-prop-types";
2052
1967
  const RULE_FEATURES$23 = [];
2053
1968
  var no_prop_types_default = createRule({
2054
1969
  meta: {
@@ -2060,11 +1975,11 @@ var no_prop_types_default = createRule({
2060
1975
  messages: { noPropTypes: "[Deprecated] Use TypeScript or another type-checking solution instead." },
2061
1976
  schema: []
2062
1977
  },
2063
- name: RULE_NAME$24,
2064
- create: create$24,
1978
+ name: RULE_NAME$25,
1979
+ create: create$25,
2065
1980
  defaultOptions: []
2066
1981
  });
2067
- function create$24(context) {
1982
+ function create$25(context) {
2068
1983
  if (!context.sourceCode.text.includes("propTypes")) return {};
2069
1984
  return {
2070
1985
  AssignmentExpression(node) {
@@ -2092,7 +2007,7 @@ function create$24(context) {
2092
2007
 
2093
2008
  //#endregion
2094
2009
  //#region src/rules/no-redundant-should-component-update.ts
2095
- const RULE_NAME$23 = "no-redundant-should-component-update";
2010
+ const RULE_NAME$24 = "no-redundant-should-component-update";
2096
2011
  const RULE_FEATURES$22 = [];
2097
2012
  function isShouldComponentUpdate(node) {
2098
2013
  return AST.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
@@ -2107,11 +2022,11 @@ var no_redundant_should_component_update_default = createRule({
2107
2022
  messages: { noRedundantShouldComponentUpdate: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'." },
2108
2023
  schema: []
2109
2024
  },
2110
- name: RULE_NAME$23,
2111
- create: create$23,
2025
+ name: RULE_NAME$24,
2026
+ create: create$24,
2112
2027
  defaultOptions: []
2113
2028
  });
2114
- function create$23(context) {
2029
+ function create$24(context) {
2115
2030
  if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
2116
2031
  const { ctx, listeners } = useComponentCollectorLegacy();
2117
2032
  return {
@@ -2133,7 +2048,7 @@ function create$23(context) {
2133
2048
 
2134
2049
  //#endregion
2135
2050
  //#region src/rules/no-set-state-in-component-did-mount.ts
2136
- const RULE_NAME$22 = "no-set-state-in-component-did-mount";
2051
+ const RULE_NAME$23 = "no-set-state-in-component-did-mount";
2137
2052
  const RULE_FEATURES$21 = [];
2138
2053
  var no_set_state_in_component_did_mount_default = createRule({
2139
2054
  meta: {
@@ -2145,11 +2060,11 @@ var no_set_state_in_component_did_mount_default = createRule({
2145
2060
  messages: { noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions, such as callbacks." },
2146
2061
  schema: []
2147
2062
  },
2148
- name: RULE_NAME$22,
2149
- create: create$22,
2063
+ name: RULE_NAME$23,
2064
+ create: create$23,
2150
2065
  defaultOptions: []
2151
2066
  });
2152
- function create$22(context) {
2067
+ function create$23(context) {
2153
2068
  if (!context.sourceCode.text.includes("componentDidMount")) return {};
2154
2069
  return { CallExpression(node) {
2155
2070
  if (!isThisSetState(node)) return;
@@ -2167,7 +2082,7 @@ function create$22(context) {
2167
2082
 
2168
2083
  //#endregion
2169
2084
  //#region src/rules/no-set-state-in-component-did-update.ts
2170
- const RULE_NAME$21 = "no-set-state-in-component-did-update";
2085
+ const RULE_NAME$22 = "no-set-state-in-component-did-update";
2171
2086
  const RULE_FEATURES$20 = [];
2172
2087
  var no_set_state_in_component_did_update_default = createRule({
2173
2088
  meta: {
@@ -2179,11 +2094,11 @@ var no_set_state_in_component_did_update_default = createRule({
2179
2094
  messages: { noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions, such as callbacks." },
2180
2095
  schema: []
2181
2096
  },
2182
- name: RULE_NAME$21,
2183
- create: create$21,
2097
+ name: RULE_NAME$22,
2098
+ create: create$22,
2184
2099
  defaultOptions: []
2185
2100
  });
2186
- function create$21(context) {
2101
+ function create$22(context) {
2187
2102
  if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
2188
2103
  return { CallExpression(node) {
2189
2104
  if (!isThisSetState(node)) return;
@@ -2201,7 +2116,7 @@ function create$21(context) {
2201
2116
 
2202
2117
  //#endregion
2203
2118
  //#region src/rules/no-set-state-in-component-will-update.ts
2204
- const RULE_NAME$20 = "no-set-state-in-component-will-update";
2119
+ const RULE_NAME$21 = "no-set-state-in-component-will-update";
2205
2120
  const RULE_FEATURES$19 = [];
2206
2121
  var no_set_state_in_component_will_update_default = createRule({
2207
2122
  meta: {
@@ -2213,11 +2128,11 @@ var no_set_state_in_component_will_update_default = createRule({
2213
2128
  messages: { noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions, such as callbacks." },
2214
2129
  schema: []
2215
2130
  },
2216
- name: RULE_NAME$20,
2217
- create: create$20,
2131
+ name: RULE_NAME$21,
2132
+ create: create$21,
2218
2133
  defaultOptions: []
2219
2134
  });
2220
- function create$20(context) {
2135
+ function create$21(context) {
2221
2136
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
2222
2137
  return { CallExpression(node) {
2223
2138
  if (!isThisSetState(node)) return;
@@ -2235,7 +2150,7 @@ function create$20(context) {
2235
2150
 
2236
2151
  //#endregion
2237
2152
  //#region src/rules/no-string-refs.ts
2238
- const RULE_NAME$19 = "no-string-refs";
2153
+ const RULE_NAME$20 = "no-string-refs";
2239
2154
  const RULE_FEATURES$18 = ["MOD"];
2240
2155
  var no_string_refs_default = createRule({
2241
2156
  meta: {
@@ -2248,11 +2163,11 @@ var no_string_refs_default = createRule({
2248
2163
  messages: { noStringRefs: "[Deprecated] Use callback refs instead." },
2249
2164
  schema: []
2250
2165
  },
2251
- name: RULE_NAME$19,
2252
- create: create$19,
2166
+ name: RULE_NAME$20,
2167
+ create: create$20,
2253
2168
  defaultOptions: []
2254
2169
  });
2255
- function create$19(context) {
2170
+ function create$20(context) {
2256
2171
  const state = { isWithinClassComponent: false };
2257
2172
  function onClassBodyEnter(node) {
2258
2173
  if (isClassComponent(node.parent)) state.isWithinClassComponent = true;
@@ -2297,7 +2212,7 @@ function getJsxAttributeValueText(context, node) {
2297
2212
 
2298
2213
  //#endregion
2299
2214
  //#region src/rules/no-unnecessary-key.ts
2300
- const RULE_NAME$18 = "no-unnecessary-key";
2215
+ const RULE_NAME$19 = "no-unnecessary-key";
2301
2216
  const RULE_FEATURES$17 = ["EXP"];
2302
2217
  var no_unnecessary_key_default = createRule({
2303
2218
  meta: {
@@ -2309,11 +2224,11 @@ var no_unnecessary_key_default = createRule({
2309
2224
  messages: { noUnnecessaryKey: "Unnecessary `key` prop on this element. The `key` should be on the top-level element returned from the array." },
2310
2225
  schema: []
2311
2226
  },
2312
- name: RULE_NAME$18,
2313
- create: create$18,
2227
+ name: RULE_NAME$19,
2228
+ create: create$19,
2314
2229
  defaultOptions: []
2315
2230
  });
2316
- function create$18(context) {
2231
+ function create$19(context) {
2317
2232
  if (!context.sourceCode.text.includes("key=")) return {};
2318
2233
  return { JSXAttribute(node) {
2319
2234
  if (node.name.name !== "key") return;
@@ -2345,7 +2260,7 @@ function isMapCallback(node) {
2345
2260
 
2346
2261
  //#endregion
2347
2262
  //#region src/rules/no-unnecessary-use-callback.ts
2348
- const RULE_NAME$17 = "no-unnecessary-use-callback";
2263
+ const RULE_NAME$18 = "no-unnecessary-use-callback";
2349
2264
  const RULE_FEATURES$16 = ["EXP"];
2350
2265
  var no_unnecessary_use_callback_default = createRule({
2351
2266
  meta: {
@@ -2357,11 +2272,11 @@ var no_unnecessary_use_callback_default = createRule({
2357
2272
  messages: { noUnnecessaryUseCallback: "An 'useCallback' with empty deps and no references to the component scope may be unnecessary." },
2358
2273
  schema: []
2359
2274
  },
2360
- name: RULE_NAME$17,
2361
- create: create$17,
2275
+ name: RULE_NAME$18,
2276
+ create: create$18,
2362
2277
  defaultOptions: []
2363
2278
  });
2364
- function create$17(context) {
2279
+ function create$18(context) {
2365
2280
  if (!context.sourceCode.text.includes("useCallback")) return {};
2366
2281
  return { CallExpression(node) {
2367
2282
  if (!isUseCallbackCall(node)) return;
@@ -2393,7 +2308,7 @@ function create$17(context) {
2393
2308
 
2394
2309
  //#endregion
2395
2310
  //#region src/rules/no-unnecessary-use-memo.ts
2396
- const RULE_NAME$16 = "no-unnecessary-use-memo";
2311
+ const RULE_NAME$17 = "no-unnecessary-use-memo";
2397
2312
  const RULE_FEATURES$15 = ["EXP"];
2398
2313
  var no_unnecessary_use_memo_default = createRule({
2399
2314
  meta: {
@@ -2405,11 +2320,11 @@ var no_unnecessary_use_memo_default = createRule({
2405
2320
  messages: { noUnnecessaryUseMemo: "An 'useMemo' with empty deps and no references to the component scope may be unnecessary." },
2406
2321
  schema: []
2407
2322
  },
2408
- name: RULE_NAME$16,
2409
- create: create$16,
2323
+ name: RULE_NAME$17,
2324
+ create: create$17,
2410
2325
  defaultOptions: []
2411
2326
  });
2412
- function create$16(context) {
2327
+ function create$17(context) {
2413
2328
  if (!context.sourceCode.text.includes("useMemo")) return {};
2414
2329
  return { CallExpression(node) {
2415
2330
  const initialScope = context.sourceCode.getScope(node);
@@ -2442,7 +2357,7 @@ function create$16(context) {
2442
2357
 
2443
2358
  //#endregion
2444
2359
  //#region src/rules/no-unnecessary-use-prefix.ts
2445
- const RULE_NAME$15 = "no-unnecessary-use-prefix";
2360
+ const RULE_NAME$16 = "no-unnecessary-use-prefix";
2446
2361
  const RULE_FEATURES$14 = ["EXP"];
2447
2362
  const WELL_KNOWN_HOOKS = ["useMDXComponents"];
2448
2363
  function containsUseComments(context, node) {
@@ -2458,11 +2373,11 @@ var no_unnecessary_use_prefix_default = createRule({
2458
2373
  messages: { noUnnecessaryUsePrefix: "If your function doesn't call any Hooks, avoid the 'use' prefix. Instead, write it as a regular function without the 'use' prefix." },
2459
2374
  schema: []
2460
2375
  },
2461
- name: RULE_NAME$15,
2462
- create: create$15,
2376
+ name: RULE_NAME$16,
2377
+ create: create$16,
2463
2378
  defaultOptions: []
2464
2379
  });
2465
- function create$15(context) {
2380
+ function create$16(context) {
2466
2381
  const { ctx, listeners } = useHookCollector();
2467
2382
  return {
2468
2383
  ...listeners,
@@ -2486,7 +2401,7 @@ function create$15(context) {
2486
2401
 
2487
2402
  //#endregion
2488
2403
  //#region src/rules/no-unsafe-component-will-mount.ts
2489
- const RULE_NAME$14 = "no-unsafe-component-will-mount";
2404
+ const RULE_NAME$15 = "no-unsafe-component-will-mount";
2490
2405
  const RULE_FEATURES$13 = [];
2491
2406
  var no_unsafe_component_will_mount_default = createRule({
2492
2407
  meta: {
@@ -2498,11 +2413,11 @@ var no_unsafe_component_will_mount_default = createRule({
2498
2413
  messages: { noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'." },
2499
2414
  schema: []
2500
2415
  },
2501
- name: RULE_NAME$14,
2502
- create: create$14,
2416
+ name: RULE_NAME$15,
2417
+ create: create$15,
2503
2418
  defaultOptions: []
2504
2419
  });
2505
- function create$14(context) {
2420
+ function create$15(context) {
2506
2421
  if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
2507
2422
  const { ctx, listeners } = useComponentCollectorLegacy();
2508
2423
  return {
@@ -2522,7 +2437,7 @@ function create$14(context) {
2522
2437
 
2523
2438
  //#endregion
2524
2439
  //#region src/rules/no-unsafe-component-will-receive-props.ts
2525
- const RULE_NAME$13 = "no-unsafe-component-will-receive-props";
2440
+ const RULE_NAME$14 = "no-unsafe-component-will-receive-props";
2526
2441
  const RULE_FEATURES$12 = [];
2527
2442
  var no_unsafe_component_will_receive_props_default = createRule({
2528
2443
  meta: {
@@ -2534,11 +2449,11 @@ var no_unsafe_component_will_receive_props_default = createRule({
2534
2449
  messages: { noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'." },
2535
2450
  schema: []
2536
2451
  },
2537
- name: RULE_NAME$13,
2538
- create: create$13,
2452
+ name: RULE_NAME$14,
2453
+ create: create$14,
2539
2454
  defaultOptions: []
2540
2455
  });
2541
- function create$13(context) {
2456
+ function create$14(context) {
2542
2457
  if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) return {};
2543
2458
  const { ctx, listeners } = useComponentCollectorLegacy();
2544
2459
  return {
@@ -2558,7 +2473,7 @@ function create$13(context) {
2558
2473
 
2559
2474
  //#endregion
2560
2475
  //#region src/rules/no-unsafe-component-will-update.ts
2561
- const RULE_NAME$12 = "no-unsafe-component-will-update";
2476
+ const RULE_NAME$13 = "no-unsafe-component-will-update";
2562
2477
  const RULE_FEATURES$11 = [];
2563
2478
  var no_unsafe_component_will_update_default = createRule({
2564
2479
  meta: {
@@ -2570,11 +2485,11 @@ var no_unsafe_component_will_update_default = createRule({
2570
2485
  messages: { noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'." },
2571
2486
  schema: []
2572
2487
  },
2573
- name: RULE_NAME$12,
2574
- create: create$12,
2488
+ name: RULE_NAME$13,
2489
+ create: create$13,
2575
2490
  defaultOptions: []
2576
2491
  });
2577
- function create$12(context) {
2492
+ function create$13(context) {
2578
2493
  if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
2579
2494
  const { ctx, listeners } = useComponentCollectorLegacy();
2580
2495
  return {
@@ -2594,7 +2509,7 @@ function create$12(context) {
2594
2509
 
2595
2510
  //#endregion
2596
2511
  //#region src/rules/no-unstable-context-value.ts
2597
- const RULE_NAME$11 = "no-unstable-context-value";
2512
+ const RULE_NAME$12 = "no-unstable-context-value";
2598
2513
  const RULE_FEATURES$10 = [];
2599
2514
  var no_unstable_context_value_default = createRule({
2600
2515
  meta: {
@@ -2606,11 +2521,11 @@ var no_unstable_context_value_default = createRule({
2606
2521
  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}}" },
2607
2522
  schema: []
2608
2523
  },
2609
- name: RULE_NAME$11,
2610
- create: create$11,
2524
+ name: RULE_NAME$12,
2525
+ create: create$12,
2611
2526
  defaultOptions: []
2612
2527
  });
2613
- function create$11(context) {
2528
+ function create$12(context) {
2614
2529
  const { version: version$1 } = getSettingsFromContext(context);
2615
2530
  const isReact18OrBelow = compare(version$1, "19.0.0", "<");
2616
2531
  const { ctx, listeners } = useComponentCollector(context);
@@ -2658,7 +2573,7 @@ function isContextName(name$7, isReact18OrBelow) {
2658
2573
 
2659
2574
  //#endregion
2660
2575
  //#region src/rules/no-unstable-default-props.ts
2661
- const RULE_NAME$10 = "no-unstable-default-props";
2576
+ const RULE_NAME$11 = "no-unstable-default-props";
2662
2577
  const RULE_FEATURES$9 = [];
2663
2578
  var no_unstable_default_props_default = createRule({
2664
2579
  meta: {
@@ -2670,11 +2585,11 @@ var no_unstable_default_props_default = createRule({
2670
2585
  messages: { noUnstableDefaultProps: "A/an '{{forbiddenType}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{forbiddenType}}'." },
2671
2586
  schema: []
2672
2587
  },
2673
- name: RULE_NAME$10,
2674
- create: create$10,
2588
+ name: RULE_NAME$11,
2589
+ create: create$11,
2675
2590
  defaultOptions: []
2676
2591
  });
2677
- function create$10(context) {
2592
+ function create$11(context) {
2678
2593
  const { ctx, listeners } = useComponentCollector(context);
2679
2594
  const declarators = /* @__PURE__ */ new WeakMap();
2680
2595
  return {
@@ -2714,7 +2629,7 @@ function create$10(context) {
2714
2629
 
2715
2630
  //#endregion
2716
2631
  //#region src/rules/no-unused-class-component-members.ts
2717
- const RULE_NAME$9 = "no-unused-class-component-members";
2632
+ const RULE_NAME$10 = "no-unused-class-component-members";
2718
2633
  const RULE_FEATURES$8 = [];
2719
2634
  const LIFECYCLE_METHODS = new Set([
2720
2635
  "componentDidCatch",
@@ -2749,11 +2664,11 @@ var no_unused_class_component_members_default = createRule({
2749
2664
  messages: { noUnusedClassComponentMembers: "Unused method or property '{{methodName}}'' of class '{{className}}'." },
2750
2665
  schema: []
2751
2666
  },
2752
- name: RULE_NAME$9,
2753
- create: create$9,
2667
+ name: RULE_NAME$10,
2668
+ create: create$10,
2754
2669
  defaultOptions: []
2755
2670
  });
2756
- function create$9(context) {
2671
+ function create$10(context) {
2757
2672
  const classStack = [];
2758
2673
  const methodStack = [];
2759
2674
  const propertyDefs = /* @__PURE__ */ new WeakMap();
@@ -2834,7 +2749,7 @@ function create$9(context) {
2834
2749
 
2835
2750
  //#endregion
2836
2751
  //#region src/rules/no-unused-props.ts
2837
- const RULE_NAME$8 = "no-unused-props";
2752
+ const RULE_NAME$9 = "no-unused-props";
2838
2753
  const RULE_FEATURES$7 = ["TSC", "EXP"];
2839
2754
  var no_unused_props_default = createRule({
2840
2755
  meta: {
@@ -2846,11 +2761,11 @@ var no_unused_props_default = createRule({
2846
2761
  messages: { noUnusedProps: "Prop `{{name}}` is declared but never used" },
2847
2762
  schema: []
2848
2763
  },
2849
- name: RULE_NAME$8,
2850
- create: create$8,
2764
+ name: RULE_NAME$9,
2765
+ create: create$9,
2851
2766
  defaultOptions: []
2852
2767
  });
2853
- function create$8(context) {
2768
+ function create$9(context) {
2854
2769
  const services = ESLintUtils.getParserServices(context, false);
2855
2770
  const { ctx, listeners } = useComponentCollector(context);
2856
2771
  return {
@@ -2952,7 +2867,7 @@ function reportUnusedProp(context, services, prop) {
2952
2867
 
2953
2868
  //#endregion
2954
2869
  //#region src/rules/no-unused-state.ts
2955
- const RULE_NAME$7 = "no-unused-state";
2870
+ const RULE_NAME$8 = "no-unused-state";
2956
2871
  const RULE_FEATURES$6 = [];
2957
2872
  function isKeyLiteral(node, key) {
2958
2873
  return match(key).with({ type: AST_NODE_TYPES.Literal }, constTrue).with({
@@ -2970,11 +2885,11 @@ var no_unused_state_default = createRule({
2970
2885
  messages: { noUnusedState: "Unused class component state in '{{className}}'" },
2971
2886
  schema: []
2972
2887
  },
2973
- name: RULE_NAME$7,
2974
- create: create$7,
2888
+ name: RULE_NAME$8,
2889
+ create: create$8,
2975
2890
  defaultOptions: []
2976
2891
  });
2977
- function create$7(context) {
2892
+ function create$8(context) {
2978
2893
  const classStack = [];
2979
2894
  const methodStack = [];
2980
2895
  const constructorStack = [];
@@ -3083,7 +2998,7 @@ function create$7(context) {
3083
2998
 
3084
2999
  //#endregion
3085
3000
  //#region src/rules/no-use-context.ts
3086
- const RULE_NAME$6 = "no-use-context";
3001
+ const RULE_NAME$7 = "no-use-context";
3087
3002
  const RULE_FEATURES$5 = ["MOD"];
3088
3003
  var no_use_context_default = createRule({
3089
3004
  meta: {
@@ -3096,11 +3011,11 @@ var no_use_context_default = createRule({
3096
3011
  messages: { noUseContext: "In React 19, 'use' is preferred over 'useContext' because it is more flexible." },
3097
3012
  schema: []
3098
3013
  },
3099
- name: RULE_NAME$6,
3100
- create: create$6,
3014
+ name: RULE_NAME$7,
3015
+ create: create$7,
3101
3016
  defaultOptions: []
3102
3017
  });
3103
- function create$6(context) {
3018
+ function create$7(context) {
3104
3019
  if (!context.sourceCode.text.includes("useContext")) return {};
3105
3020
  const settings$6 = getSettingsFromContext(context);
3106
3021
  if (compare(settings$6.version, "19.0.0", "<")) return {};
@@ -3165,7 +3080,7 @@ function getCorrelativeTokens(context, node) {
3165
3080
 
3166
3081
  //#endregion
3167
3082
  //#region src/rules/no-useless-forward-ref.ts
3168
- const RULE_NAME$5 = "no-useless-forward-ref";
3083
+ const RULE_NAME$6 = "no-useless-forward-ref";
3169
3084
  const RULE_FEATURES$4 = [];
3170
3085
  var no_useless_forward_ref_default = createRule({
3171
3086
  meta: {
@@ -3177,11 +3092,11 @@ var no_useless_forward_ref_default = createRule({
3177
3092
  messages: { noUselessForwardRef: "A 'forwardRef' is used with this component but no 'ref' parameter is set." },
3178
3093
  schema: []
3179
3094
  },
3180
- name: RULE_NAME$5,
3181
- create: create$5,
3095
+ name: RULE_NAME$6,
3096
+ create: create$6,
3182
3097
  defaultOptions: []
3183
3098
  });
3184
- function create$5(context) {
3099
+ function create$6(context) {
3185
3100
  return { CallExpression(node) {
3186
3101
  if (!isForwardRefCall(context, node)) return;
3187
3102
  const [component] = node.arguments;
@@ -3196,12 +3111,12 @@ function create$5(context) {
3196
3111
 
3197
3112
  //#endregion
3198
3113
  //#region src/rules/no-useless-fragment.ts
3199
- const RULE_NAME$4 = "no-useless-fragment";
3200
- const defaultOptions = [{ allowExpressions: true }];
3114
+ const RULE_NAME$5 = "no-useless-fragment";
3115
+ const defaultOptions$1 = [{ allowExpressions: true }];
3201
3116
  var no_useless_fragment_default = createRule({
3202
3117
  meta: {
3203
3118
  type: "problem",
3204
- defaultOptions: [...defaultOptions],
3119
+ defaultOptions: [...defaultOptions$1],
3205
3120
  docs: { description: "Disallow useless fragment elements." },
3206
3121
  fixable: "code",
3207
3122
  messages: { uselessFragment: "A fragment {{reason}} is useless." },
@@ -3214,11 +3129,11 @@ var no_useless_fragment_default = createRule({
3214
3129
  } }
3215
3130
  }]
3216
3131
  },
3217
- name: RULE_NAME$4,
3218
- create: create$4,
3219
- defaultOptions
3132
+ name: RULE_NAME$5,
3133
+ create: create$5,
3134
+ defaultOptions: defaultOptions$1
3220
3135
  });
3221
- function create$4(context, [option]) {
3136
+ function create$5(context, [option]) {
3222
3137
  const { allowExpressions = true } = option;
3223
3138
  return {
3224
3139
  JSXElement(node) {
@@ -3321,7 +3236,7 @@ function canFix(context, node) {
3321
3236
 
3322
3237
  //#endregion
3323
3238
  //#region src/rules/prefer-destructuring-assignment.ts
3324
- const RULE_NAME$3 = "prefer-destructuring-assignment";
3239
+ const RULE_NAME$4 = "prefer-destructuring-assignment";
3325
3240
  const RULE_FEATURES$3 = [];
3326
3241
  function isMemberExpressionWithObjectName(node) {
3327
3242
  return node.object.type === AST_NODE_TYPES.Identifier && "name" in node.object;
@@ -3336,11 +3251,11 @@ var prefer_destructuring_assignment_default = createRule({
3336
3251
  messages: { preferDestructuringAssignment: "Use destructuring assignment for {{name}}." },
3337
3252
  schema: []
3338
3253
  },
3339
- name: RULE_NAME$3,
3340
- create: create$3,
3254
+ name: RULE_NAME$4,
3255
+ create: create$4,
3341
3256
  defaultOptions: []
3342
3257
  });
3343
- function create$3(context) {
3258
+ function create$4(context) {
3344
3259
  const { ctx, listeners } = useComponentCollector(context);
3345
3260
  const memberExpressionWithNames = [];
3346
3261
  return {
@@ -3387,7 +3302,7 @@ function create$3(context) {
3387
3302
 
3388
3303
  //#endregion
3389
3304
  //#region src/rules/prefer-namespace-import.ts
3390
- const RULE_NAME$2 = "prefer-namespace-import";
3305
+ const RULE_NAME$3 = "prefer-namespace-import";
3391
3306
  const RULE_FEATURES$2 = ["FIX"];
3392
3307
  var prefer_namespace_import_default = createRule({
3393
3308
  meta: {
@@ -3400,11 +3315,11 @@ var prefer_namespace_import_default = createRule({
3400
3315
  messages: { preferNamespaceImport: "Prefer importing React as 'import * as React from \"{{importSource}}\"';" },
3401
3316
  schema: []
3402
3317
  },
3403
- name: RULE_NAME$2,
3404
- create: create$2,
3318
+ name: RULE_NAME$3,
3319
+ create: create$3,
3405
3320
  defaultOptions: []
3406
3321
  });
3407
- function create$2(context) {
3322
+ function create$3(context) {
3408
3323
  const { importSource } = getSettingsFromContext(context);
3409
3324
  return { [`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
3410
3325
  const hasOtherSpecifiers = node.parent.specifiers.length > 1;
@@ -3428,7 +3343,7 @@ function create$2(context) {
3428
3343
 
3429
3344
  //#endregion
3430
3345
  //#region src/rules/prefer-read-only-props.ts
3431
- const RULE_NAME$1 = "prefer-read-only-props";
3346
+ const RULE_NAME$2 = "prefer-read-only-props";
3432
3347
  const RULE_FEATURES$1 = ["TSC", "EXP"];
3433
3348
  var prefer_read_only_props_default = createRule({
3434
3349
  meta: {
@@ -3440,11 +3355,11 @@ var prefer_read_only_props_default = createRule({
3440
3355
  messages: { preferReadOnlyProps: "A function component's props should be read-only." },
3441
3356
  schema: []
3442
3357
  },
3443
- name: RULE_NAME$1,
3444
- create: create$1,
3358
+ name: RULE_NAME$2,
3359
+ create: create$2,
3445
3360
  defaultOptions: []
3446
3361
  });
3447
- function create$1(context) {
3362
+ function create$2(context) {
3448
3363
  const services = ESLintUtils.getParserServices(context, false);
3449
3364
  const { ctx, listeners } = useComponentCollector(context);
3450
3365
  return {
@@ -3477,7 +3392,7 @@ function isTypeReadonlyLoose(services, type) {
3477
3392
 
3478
3393
  //#endregion
3479
3394
  //#region src/rules/prefer-use-state-lazy-initialization.ts
3480
- const RULE_NAME = "prefer-use-state-lazy-initialization";
3395
+ const RULE_NAME$1 = "prefer-use-state-lazy-initialization";
3481
3396
  const RULE_FEATURES = ["EXP"];
3482
3397
  const ALLOW_LIST = [
3483
3398
  "Boolean",
@@ -3494,11 +3409,11 @@ var prefer_use_state_lazy_initialization_default = createRule({
3494
3409
  messages: { preferUseStateLazyInitialization: "To prevent re-computation, consider using lazy initial state for useState calls that involve function calls. Ex: 'useState(() => getValue())'." },
3495
3410
  schema: []
3496
3411
  },
3497
- name: RULE_NAME,
3498
- create,
3412
+ name: RULE_NAME$1,
3413
+ create: create$1,
3499
3414
  defaultOptions: []
3500
3415
  });
3501
- function create(context) {
3416
+ function create$1(context) {
3502
3417
  return { CallExpression(node) {
3503
3418
  if (!isUseStateCall(node)) return;
3504
3419
  const [useStateInput] = node.arguments;
@@ -3525,6 +3440,91 @@ function create(context) {
3525
3440
  } };
3526
3441
  }
3527
3442
 
3443
+ //#endregion
3444
+ //#region src/rules-removed/no-forbidden-props.ts
3445
+ const RULE_NAME = "no-forbidden-props";
3446
+ const messageId = camelCase(RULE_NAME);
3447
+ const defaultOptions = [{ forbid: [{ prop: "/_/" }] }];
3448
+ var no_forbidden_props_default = createRule({
3449
+ meta: {
3450
+ type: "problem",
3451
+ defaultOptions: [...defaultOptions],
3452
+ deprecated: {
3453
+ deprecatedSince: "2.3.2",
3454
+ message: "This rule is deprecated and will be removed in future versions.",
3455
+ replacedBy: [{ rule: {
3456
+ name: "no-restricted-syntax",
3457
+ url: "https://eslint.org/docs/latest/rules/no-restricted-syntax"
3458
+ } }]
3459
+ },
3460
+ docs: { description: "Disallow certain props on components." },
3461
+ messages: { [messageId]: "Prop \"{{name}}\" is forbidden." },
3462
+ schema: [{
3463
+ type: "object",
3464
+ additionalProperties: false,
3465
+ properties: { forbid: {
3466
+ type: "array",
3467
+ items: { anyOf: [
3468
+ { type: "string" },
3469
+ {
3470
+ type: "object",
3471
+ additionalProperties: false,
3472
+ properties: {
3473
+ excludedNodes: {
3474
+ type: "array",
3475
+ items: { type: "string" },
3476
+ uniqueItems: true
3477
+ },
3478
+ prop: { type: "string" }
3479
+ },
3480
+ required: ["prop"]
3481
+ },
3482
+ {
3483
+ type: "object",
3484
+ additionalProperties: false,
3485
+ properties: {
3486
+ includedNodes: {
3487
+ type: "array",
3488
+ items: { type: "string" },
3489
+ uniqueItems: true
3490
+ },
3491
+ prop: { type: "string" }
3492
+ },
3493
+ required: ["prop"]
3494
+ }
3495
+ ] }
3496
+ } }
3497
+ }]
3498
+ },
3499
+ name: RULE_NAME,
3500
+ create,
3501
+ defaultOptions
3502
+ });
3503
+ function create(context, [option]) {
3504
+ const { forbid = [{ prop: "/_/" }] } = option;
3505
+ return { JSXOpeningElement(node) {
3506
+ let nodeName = null;
3507
+ if (node.name.type === AST_NODE_TYPES.JSXIdentifier) nodeName = node.name.name;
3508
+ else if (node.name.type === AST_NODE_TYPES.JSXNamespacedName) nodeName = node.name.name.name;
3509
+ for (const attr of node.attributes) {
3510
+ if (attr.type === AST_NODE_TYPES.JSXSpreadAttribute) continue;
3511
+ const name$7 = attr.name.name;
3512
+ if (typeof name$7 !== "string") continue;
3513
+ for (const forbiddenPropItem of forbid) {
3514
+ if (typeof forbiddenPropItem !== "string" && nodeName != null) {
3515
+ if ("excludedNodes" in forbiddenPropItem && forbiddenPropItem.excludedNodes.includes(nodeName)) continue;
3516
+ if ("includedNodes" in forbiddenPropItem && !forbiddenPropItem.includedNodes.includes(nodeName)) continue;
3517
+ }
3518
+ if (toRegExp(typeof forbiddenPropItem === "string" ? forbiddenPropItem : forbiddenPropItem.prop).test(name$7)) context.report({
3519
+ messageId,
3520
+ node: attr,
3521
+ data: { name: name$7 }
3522
+ });
3523
+ }
3524
+ }
3525
+ } };
3526
+ }
3527
+
3528
3528
  //#endregion
3529
3529
  //#region src/plugin.ts
3530
3530
  const plugin = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "2.3.2-beta.1",
3
+ "version": "2.3.2-beta.2",
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",
@@ -46,11 +46,11 @@
46
46
  "string-ts": "^2.2.1",
47
47
  "ts-api-utils": "^2.1.0",
48
48
  "ts-pattern": "^5.9.0",
49
- "@eslint-react/ast": "2.3.2-beta.1",
50
- "@eslint-react/core": "2.3.2-beta.1",
51
- "@eslint-react/shared": "2.3.2-beta.1",
52
- "@eslint-react/eff": "2.3.2-beta.1",
53
- "@eslint-react/var": "2.3.2-beta.1"
49
+ "@eslint-react/ast": "2.3.2-beta.2",
50
+ "@eslint-react/core": "2.3.2-beta.2",
51
+ "@eslint-react/eff": "2.3.2-beta.2",
52
+ "@eslint-react/shared": "2.3.2-beta.2",
53
+ "@eslint-react/var": "2.3.2-beta.2"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/react": "^19.2.2",