eslint-plugin-react-x 2.0.0-beta.2 → 2.0.0-beta.21

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/dist/index.d.ts +4 -0
  2. package/dist/index.js +382 -322
  3. package/package.json +15 -16
package/dist/index.js CHANGED
@@ -4,13 +4,12 @@ import { ESLintUtils } from '@typescript-eslint/utils';
4
4
  import * as AST13 from '@eslint-react/ast';
5
5
  import * as VAR5 from '@eslint-react/var';
6
6
  import { match, isMatching, P } from 'ts-pattern';
7
- import * as ER26 from '@eslint-react/core';
7
+ import * as ER27 from '@eslint-react/core';
8
8
  import { JsxConfig, Reporter, Selector, LanguagePreference } from '@eslint-react/kit';
9
9
  import { flow, identity, getOrElseUpdate, constTrue, constFalse, unit } from '@eslint-react/eff';
10
10
  import { compare } from 'compare-versions';
11
11
  import { getConstrainedTypeAtLocation, isTypeReadonly } from '@typescript-eslint/type-utils';
12
- import { unionTypeParts, isTypeFlagSet, isTrueLiteralType, isFalseLiteralType } from 'ts-api-utils';
13
- import ts from 'typescript';
12
+ import { unionConstituents } from 'ts-api-utils';
14
13
  import { getTypeImmutability, isUnknown, isImmutable, isReadonlyShallow, isReadonlyDeep } from 'is-immutable-type';
15
14
 
16
15
  var __defProp = Object.defineProperty;
@@ -28,10 +27,12 @@ __export(recommended_exports, {
28
27
  });
29
28
  var name = "react-x/recommended";
30
29
  var rules = {
31
- "react-x/jsx-key-before-spread": "warn",
32
30
  "react-x/jsx-no-comment-textnodes": "warn",
33
31
  "react-x/jsx-no-duplicate-props": "warn",
32
+ // "react-x/jsx-no-iife": "warn",
34
33
  // "react-x/jsx-no-undef": "error",
34
+ // "react-x/jsx-shorthand-boolean": "warn",
35
+ // "react-x/jsx-shorthand-fragment": "warn",
35
36
  "react-x/jsx-uses-react": "warn",
36
37
  "react-x/jsx-uses-vars": "warn",
37
38
  "react-x/no-access-state-in-setstate": "error",
@@ -44,6 +45,7 @@ var rules = {
44
45
  "react-x/no-children-to-array": "warn",
45
46
  // "react-x/no-class-component": "warn",
46
47
  "react-x/no-clone-element": "warn",
48
+ "react-x/no-comment-textnodes": "warn",
47
49
  "react-x/no-component-will-mount": "error",
48
50
  "react-x/no-component-will-receive-props": "error",
49
51
  "react-x/no-component-will-update": "error",
@@ -51,24 +53,24 @@ var rules = {
51
53
  "react-x/no-create-ref": "error",
52
54
  "react-x/no-default-props": "error",
53
55
  "react-x/no-direct-mutation-state": "error",
54
- // "react-x/prefer-destructuring-assignment": "warn",
55
- // "react-x/prefer-namespace-import": "warn",
56
- // "react-x/prefer-read-only-props": "error",
57
- "react-x/no-duplicate-key": "warn",
56
+ "react-x/no-duplicate-key": "error",
58
57
  "react-x/no-forward-ref": "warn",
59
58
  "react-x/no-implicit-key": "warn",
59
+ // "react-x/no-leaked-conditional-rendering": "warn",
60
60
  // "react-x/no-missing-component-display-name": "warn",
61
61
  // "react-x/no-missing-context-display-name": "warn",
62
62
  "react-x/no-missing-key": "error",
63
63
  // "react-x/no-misused-capture-owner-stack": "error",
64
64
  "react-x/no-nested-component-definitions": "error",
65
- "react-x/no-nested-lazy-component-declarations": "warn",
65
+ "react-x/no-nested-lazy-component-declarations": "error",
66
66
  "react-x/no-prop-types": "error",
67
67
  "react-x/no-redundant-should-component-update": "error",
68
68
  "react-x/no-set-state-in-component-did-mount": "warn",
69
69
  "react-x/no-set-state-in-component-did-update": "warn",
70
70
  "react-x/no-set-state-in-component-will-update": "warn",
71
71
  "react-x/no-string-refs": "error",
72
+ // "react-x/no-unnecessary-use-callback": "warn",
73
+ // "react-x/no-unnecessary-use-memo": "warn",
72
74
  "react-x/no-unnecessary-use-prefix": "warn",
73
75
  "react-x/no-unsafe-component-will-mount": "warn",
74
76
  "react-x/no-unsafe-component-will-receive-props": "warn",
@@ -76,9 +78,14 @@ var rules = {
76
78
  "react-x/no-unstable-context-value": "warn",
77
79
  "react-x/no-unstable-default-props": "warn",
78
80
  "react-x/no-unused-class-component-members": "warn",
81
+ // "react-x/no-unused-props": "warn",
79
82
  "react-x/no-unused-state": "warn",
80
83
  "react-x/no-use-context": "warn",
81
84
  "react-x/no-useless-forward-ref": "warn",
85
+ // "react-x/no-useless-fragment": "warn",
86
+ // "react-x/prefer-destructuring-assignment": "warn",
87
+ // "react-x/prefer-namespace-import": "warn",
88
+ // "react-x/prefer-read-only-props": "error",
82
89
  "react-x/prefer-use-state-lazy-initialization": "warn"
83
90
  };
84
91
  var settings = {
@@ -125,7 +132,7 @@ var settings3 = {
125
132
 
126
133
  // package.json
127
134
  var name4 = "eslint-plugin-react-x";
128
- var version = "2.0.0-beta.2";
135
+ var version = "2.0.0-beta.21";
129
136
  var createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
130
137
 
131
138
  // src/rules/jsx-key-before-spread.ts
@@ -370,7 +377,7 @@ function create6(context) {
370
377
  return {
371
378
  JSXAttribute(node) {
372
379
  const { value } = node;
373
- const propName = ER26.getAttributeName(context, node);
380
+ const propName = ER27.getAttributeName(context, node);
374
381
  switch (true) {
375
382
  case (policy === 1 && value?.type === AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === AST_NODE_TYPES.Literal && value.expression.value === true): {
376
383
  context.report({
@@ -436,7 +443,7 @@ function create7(context) {
436
443
  const { jsxFragmentFactory } = jsxConfig;
437
444
  return match(policy).with(1, () => ({
438
445
  JSXElement(node) {
439
- if (!ER26.isFragmentElement(context, node)) return;
446
+ if (!ER27.isFragmentElement(context, node)) return;
440
447
  const hasAttributes = node.openingElement.attributes.length > 0;
441
448
  if (hasAttributes) return;
442
449
  context.report({
@@ -596,25 +603,25 @@ function create10(context) {
596
603
  const setStateEntries = [];
597
604
  return {
598
605
  CallExpression(node) {
599
- if (!ER26.isThisSetState(node)) {
606
+ if (!ER27.isThisSetState(node)) {
600
607
  return;
601
608
  }
602
609
  setStateEntries.push([node, false]);
603
610
  },
604
611
  "CallExpression:exit"(node) {
605
- if (!ER26.isThisSetState(node)) {
612
+ if (!ER27.isThisSetState(node)) {
606
613
  return;
607
614
  }
608
615
  setStateEntries.pop();
609
616
  },
610
617
  ClassDeclaration(node) {
611
- classEntries.push([node, ER26.isClassComponent(node)]);
618
+ classEntries.push([node, ER27.isClassComponent(node)]);
612
619
  },
613
620
  "ClassDeclaration:exit"() {
614
621
  classEntries.pop();
615
622
  },
616
623
  ClassExpression(node) {
617
- classEntries.push([node, ER26.isClassComponent(node)]);
624
+ classEntries.push([node, ER27.isClassComponent(node)]);
618
625
  },
619
626
  "ClassExpression:exit"() {
620
627
  classEntries.pop();
@@ -698,7 +705,7 @@ function isUsingReactChildren(context, node) {
698
705
  return true;
699
706
  }
700
707
  if (callee.object.type === AST_NODE_TYPES.MemberExpression && "name" in callee.object.object) {
701
- return ER26.isInitializedFromReact(callee.object.object.name, importSource, initialScope);
708
+ return ER27.isInitializedFromReact(callee.object.object.name, importSource, initialScope);
702
709
  }
703
710
  return false;
704
711
  }
@@ -764,7 +771,7 @@ function create11(context) {
764
771
  return node.type === AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
765
772
  }
766
773
  function isCreateOrCloneElementCall(node) {
767
- return ER26.isCreateElementCall(context, node) || ER26.isCloneElementCall(context, node);
774
+ return ER27.isCreateElementCall(context, node) || ER27.isCloneElementCall(context, node);
768
775
  }
769
776
  function getReportDescriptors(node) {
770
777
  switch (node.type) {
@@ -880,7 +887,7 @@ var no_children_count_default = createRule({
880
887
  function create12(context) {
881
888
  return {
882
889
  MemberExpression(node) {
883
- if (ER26.isChildrenCount(context, node)) {
890
+ if (ER27.isChildrenCount(context, node)) {
884
891
  context.report({
885
892
  messageId: "noChildrenCount",
886
893
  node: node.property
@@ -910,7 +917,7 @@ var no_children_for_each_default = createRule({
910
917
  function create13(context) {
911
918
  return {
912
919
  MemberExpression(node) {
913
- if (ER26.isChildrenForEach(context, node)) {
920
+ if (ER27.isChildrenForEach(context, node)) {
914
921
  context.report({
915
922
  messageId: "noChildrenForEach",
916
923
  node: node.property
@@ -940,7 +947,7 @@ var no_children_map_default = createRule({
940
947
  function create14(context) {
941
948
  return {
942
949
  MemberExpression(node) {
943
- if (ER26.isChildrenMap(context, node)) {
950
+ if (ER27.isChildrenMap(context, node)) {
944
951
  context.report({
945
952
  messageId: "noChildrenMap",
946
953
  node: node.property
@@ -970,7 +977,7 @@ var no_children_only_default = createRule({
970
977
  function create15(context) {
971
978
  return {
972
979
  MemberExpression(node) {
973
- if (ER26.isChildrenOnly(context, node)) {
980
+ if (ER27.isChildrenOnly(context, node)) {
974
981
  context.report({
975
982
  messageId: "noChildrenOnly",
976
983
  node: node.property
@@ -1001,7 +1008,7 @@ function create16(context) {
1001
1008
  return {
1002
1009
  JSXElement(node) {
1003
1010
  const attributes = node.openingElement.attributes;
1004
- const childrenProp = ER26.getAttribute(context, "children", attributes, context.sourceCode.getScope(node));
1011
+ const childrenProp = ER27.getAttribute(context, "children", attributes, context.sourceCode.getScope(node));
1005
1012
  if (childrenProp != null) {
1006
1013
  context.report({
1007
1014
  messageId: "noChildrenProp",
@@ -1032,7 +1039,7 @@ var no_children_to_array_default = createRule({
1032
1039
  function create17(context) {
1033
1040
  return {
1034
1041
  MemberExpression(node) {
1035
- if (ER26.isChildrenToArray(context, node)) {
1042
+ if (ER27.isChildrenToArray(context, node)) {
1036
1043
  context.report({
1037
1044
  messageId: "noChildrenToArray",
1038
1045
  node: node.property
@@ -1061,13 +1068,13 @@ var no_class_component_default = createRule({
1061
1068
  });
1062
1069
  function create18(context) {
1063
1070
  if (!context.sourceCode.text.includes("Component")) return {};
1064
- const { ctx, listeners } = ER26.useComponentCollectorLegacy();
1071
+ const { ctx, listeners } = ER27.useComponentCollectorLegacy();
1065
1072
  return {
1066
1073
  ...listeners,
1067
1074
  "Program:exit"(program) {
1068
1075
  const components = ctx.getAllComponents(program);
1069
1076
  for (const { name: name5 = "anonymous", node: component } of components.values()) {
1070
- if (component.body.body.some((m) => ER26.isComponentDidCatch(m) || ER26.isGetDerivedStateFromError(m))) {
1077
+ if (component.body.body.some((m) => ER27.isComponentDidCatch(m) || ER27.isGetDerivedStateFromError(m))) {
1071
1078
  continue;
1072
1079
  }
1073
1080
  context.report({
@@ -1102,7 +1109,7 @@ var no_clone_element_default = createRule({
1102
1109
  function create19(context) {
1103
1110
  return {
1104
1111
  CallExpression(node) {
1105
- if (ER26.isCloneElementCall(context, node)) {
1112
+ if (ER27.isCloneElementCall(context, node)) {
1106
1113
  context.report({
1107
1114
  messageId: "noCloneElement",
1108
1115
  node
@@ -1134,7 +1141,7 @@ var no_component_will_mount_default = createRule({
1134
1141
  });
1135
1142
  function create20(context) {
1136
1143
  if (!context.sourceCode.text.includes("componentWillMount")) return {};
1137
- const { ctx, listeners } = ER26.useComponentCollectorLegacy();
1144
+ const { ctx, listeners } = ER27.useComponentCollectorLegacy();
1138
1145
  return {
1139
1146
  ...listeners,
1140
1147
  "Program:exit"(program) {
@@ -1142,7 +1149,7 @@ function create20(context) {
1142
1149
  for (const { node: component } of components.values()) {
1143
1150
  const { body } = component.body;
1144
1151
  for (const member of body) {
1145
- if (ER26.isComponentWillMount(member)) {
1152
+ if (ER27.isComponentWillMount(member)) {
1146
1153
  context.report({
1147
1154
  messageId: "noComponentWillMount",
1148
1155
  node: member,
@@ -1182,7 +1189,7 @@ var no_component_will_receive_props_default = createRule({
1182
1189
  });
1183
1190
  function create21(context) {
1184
1191
  if (!context.sourceCode.text.includes("componentWillReceiveProps")) return {};
1185
- const { ctx, listeners } = ER26.useComponentCollectorLegacy();
1192
+ const { ctx, listeners } = ER27.useComponentCollectorLegacy();
1186
1193
  return {
1187
1194
  ...listeners,
1188
1195
  "Program:exit"(program) {
@@ -1190,7 +1197,7 @@ function create21(context) {
1190
1197
  for (const { node: component } of components.values()) {
1191
1198
  const { body } = component.body;
1192
1199
  for (const member of body) {
1193
- if (ER26.isComponentWillReceiveProps(member)) {
1200
+ if (ER27.isComponentWillReceiveProps(member)) {
1194
1201
  context.report({
1195
1202
  messageId: "noComponentWillReceiveProps",
1196
1203
  node: member,
@@ -1230,7 +1237,7 @@ var no_component_will_update_default = createRule({
1230
1237
  });
1231
1238
  function create22(context) {
1232
1239
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
1233
- const { ctx, listeners } = ER26.useComponentCollectorLegacy();
1240
+ const { ctx, listeners } = ER27.useComponentCollectorLegacy();
1234
1241
  return {
1235
1242
  ...listeners,
1236
1243
  "Program:exit"(program) {
@@ -1238,7 +1245,7 @@ function create22(context) {
1238
1245
  for (const { node: component } of components.values()) {
1239
1246
  const { body } = component.body;
1240
1247
  for (const member of body) {
1241
- if (ER26.isComponentWillUpdate(member)) {
1248
+ if (ER27.isComponentWillUpdate(member)) {
1242
1249
  context.report({
1243
1250
  messageId: "noComponentWillUpdate",
1244
1251
  node: member,
@@ -1282,7 +1289,7 @@ function create23(context) {
1282
1289
  if (compare(version2, "19.0.0", "<")) return {};
1283
1290
  return {
1284
1291
  JSXElement(node) {
1285
- const fullName = ER26.getElementType(context, node);
1292
+ const fullName = ER27.getElementType(context, node);
1286
1293
  const parts = fullName.split(".");
1287
1294
  const selfName = parts.pop();
1288
1295
  const contextFullName = parts.join(".");
@@ -1293,7 +1300,7 @@ function create23(context) {
1293
1300
  messageId: "noContextProvider",
1294
1301
  node,
1295
1302
  fix(fixer) {
1296
- if (!ER26.isComponentNameLoose(contextSelfName)) return null;
1303
+ if (!ER27.isComponentNameLoose(contextSelfName)) return null;
1297
1304
  const openingElement = node.openingElement;
1298
1305
  const closingElement = node.closingElement;
1299
1306
  if (closingElement == null) {
@@ -1329,7 +1336,7 @@ var no_create_ref_default = createRule({
1329
1336
  function create24(context) {
1330
1337
  return {
1331
1338
  CallExpression(node) {
1332
- if (ER26.isCreateRefCall(context, node) && AST13.findParentNode(node, ER26.isClassComponent) == null) {
1339
+ if (ER27.isCreateRefCall(context, node) && AST13.findParentNode(node, ER27.isClassComponent) == null) {
1333
1340
  context.report({ messageId: "noCreateRef", node });
1334
1341
  }
1335
1342
  }
@@ -1367,7 +1374,7 @@ function create25(context) {
1367
1374
  if (property.type !== AST_NODE_TYPES.Identifier || property.name !== "defaultProps") {
1368
1375
  return;
1369
1376
  }
1370
- if (!ER26.isComponentNameLoose(object.name)) {
1377
+ if (!ER27.isComponentNameLoose(object.name)) {
1371
1378
  return;
1372
1379
  }
1373
1380
  const variable = VAR5.findVariable(object.name, context.sourceCode.getScope(node));
@@ -1402,7 +1409,7 @@ var no_direct_mutation_state_default = createRule({
1402
1409
  function create26(context) {
1403
1410
  return {
1404
1411
  AssignmentExpression(node) {
1405
- if (!ER26.isAssignmentToThisState(node)) return;
1412
+ if (!ER27.isAssignmentToThisState(node)) return;
1406
1413
  const parentClass = AST13.findParentNode(
1407
1414
  node,
1408
1415
  AST13.isOneOf([
@@ -1411,7 +1418,7 @@ function create26(context) {
1411
1418
  ])
1412
1419
  );
1413
1420
  if (parentClass == null) return;
1414
- if (ER26.isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST13.findParentNode(node, isConstructorFunction)) {
1421
+ if (ER27.isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST13.findParentNode(node, isConstructorFunction)) {
1415
1422
  context.report({
1416
1423
  messageId: "noDirectMutationState",
1417
1424
  node
@@ -1533,7 +1540,7 @@ function create28(context) {
1533
1540
  }
1534
1541
  return {
1535
1542
  CallExpression(node) {
1536
- if (!ER26.isForwardRefCall(context, node)) {
1543
+ if (!ER27.isForwardRefCall(context, node)) {
1537
1544
  return;
1538
1545
  }
1539
1546
  const id = AST13.getFunctionId(node);
@@ -1636,7 +1643,7 @@ function create29(context) {
1636
1643
  return {
1637
1644
  JSXOpeningElement(node) {
1638
1645
  const initialScope = context.sourceCode.getScope(node);
1639
- const keyProp = ER26.getAttribute(context, "key", node.attributes, initialScope);
1646
+ const keyProp = ER27.getAttribute(context, "key", node.attributes, initialScope);
1640
1647
  const isKeyPropOnElement = node.attributes.some(
1641
1648
  (n) => n.type === AST_NODE_TYPES.JSXAttribute && n.name.type === AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
1642
1649
  );
@@ -1650,84 +1657,6 @@ var RULE_NAME30 = "no-leaked-conditional-rendering";
1650
1657
  var RULE_FEATURES30 = [
1651
1658
  "TSC"
1652
1659
  ];
1653
- var tsHelpers = {
1654
- isAnyType: (type) => isTypeFlagSet(type, ts.TypeFlags.TypeParameter | ts.TypeFlags.Any),
1655
- isBigIntType: (type) => isTypeFlagSet(type, ts.TypeFlags.BigIntLike),
1656
- isBooleanType: (type) => isTypeFlagSet(type, ts.TypeFlags.BooleanLike),
1657
- isEnumType: (type) => isTypeFlagSet(type, ts.TypeFlags.EnumLike),
1658
- isFalsyBigIntType: (type) => type.isLiteral() && isMatching({ value: { base10Value: "0" } }, type),
1659
- isFalsyNumberType: (type) => type.isNumberLiteral() && type.value === 0,
1660
- isFalsyStringType: (type) => type.isStringLiteral() && type.value === "",
1661
- isNeverType: (type) => isTypeFlagSet(type, ts.TypeFlags.Never),
1662
- isNullishType: (type) => isTypeFlagSet(
1663
- type,
1664
- ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike
1665
- ),
1666
- isNumberType: (type) => isTypeFlagSet(type, ts.TypeFlags.NumberLike),
1667
- isObjectType: (type) => !isTypeFlagSet(
1668
- type,
1669
- ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike | ts.TypeFlags.BooleanLike | ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.TypeFlags.BigIntLike | ts.TypeFlags.TypeParameter | ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.Never
1670
- ),
1671
- isStringType: (type) => isTypeFlagSet(type, ts.TypeFlags.StringLike),
1672
- isTruthyBigIntType: (type) => type.isLiteral() && isMatching({ value: { base10Value: P.not("0") } }, type),
1673
- isTruthyNumberType: (type) => type.isNumberLiteral() && type.value !== 0,
1674
- isTruthyStringType: (type) => type.isStringLiteral() && type.value !== "",
1675
- isUnknownType: (type) => isTypeFlagSet(type, ts.TypeFlags.Unknown)
1676
- };
1677
- function inspectVariantTypes(types) {
1678
- const variantTypes = /* @__PURE__ */ new Set();
1679
- if (types.some(tsHelpers.isUnknownType)) {
1680
- variantTypes.add("unknown");
1681
- return variantTypes;
1682
- }
1683
- if (types.some(tsHelpers.isNullishType)) {
1684
- variantTypes.add("nullish");
1685
- }
1686
- const booleans = types.filter(tsHelpers.isBooleanType);
1687
- switch (true) {
1688
- case (booleans.length === 1 && booleans[0] != null): {
1689
- const first = booleans[0];
1690
- if (isTrueLiteralType(first)) {
1691
- variantTypes.add("truthy boolean");
1692
- } else if (isFalseLiteralType(first)) {
1693
- variantTypes.add("falsy boolean");
1694
- }
1695
- break;
1696
- }
1697
- case booleans.length === 2: {
1698
- variantTypes.add("boolean");
1699
- break;
1700
- }
1701
- }
1702
- const strings = types.filter(tsHelpers.isStringType);
1703
- if (strings.length > 0) {
1704
- const evaluated = match(strings).when((types2) => types2.every(tsHelpers.isTruthyStringType), () => "truthy string").when((types2) => types2.every(tsHelpers.isFalsyStringType), () => "falsy string").otherwise(() => "string");
1705
- variantTypes.add(evaluated);
1706
- }
1707
- const bigints = types.filter(tsHelpers.isBigIntType);
1708
- if (bigints.length > 0) {
1709
- const evaluated = match(bigints).when((types2) => types2.every(tsHelpers.isTruthyBigIntType), () => "truthy bigint").when((types2) => types2.every(tsHelpers.isFalsyBigIntType), () => "falsy bigint").otherwise(() => "bigint");
1710
- variantTypes.add(evaluated);
1711
- }
1712
- const numbers = types.filter(tsHelpers.isNumberType);
1713
- if (numbers.length > 0) {
1714
- const evaluated = match(numbers).when((types2) => types2.every(tsHelpers.isTruthyNumberType), () => "truthy number").when((types2) => types2.every(tsHelpers.isFalsyNumberType), () => "falsy number").otherwise(() => "number");
1715
- variantTypes.add(evaluated);
1716
- }
1717
- if (types.some(tsHelpers.isEnumType)) {
1718
- variantTypes.add("enum");
1719
- }
1720
- if (types.some(tsHelpers.isObjectType)) {
1721
- variantTypes.add("object");
1722
- }
1723
- if (types.some(tsHelpers.isAnyType)) {
1724
- variantTypes.add("any");
1725
- }
1726
- if (types.some(tsHelpers.isNeverType)) {
1727
- variantTypes.add("never");
1728
- }
1729
- return variantTypes;
1730
- }
1731
1660
  var no_leaked_conditional_rendering_default = createRule({
1732
1661
  meta: {
1733
1662
  type: "problem",
@@ -1780,7 +1709,7 @@ function create30(context) {
1780
1709
  };
1781
1710
  }
1782
1711
  const leftType = getConstrainedTypeAtLocation(services, left);
1783
- const leftTypeVariants = inspectVariantTypes(unionTypeParts(leftType));
1712
+ const leftTypeVariants = ER27.getTypeVariants(unionConstituents(leftType));
1784
1713
  const isLeftValid = Array.from(leftTypeVariants.values()).every((type) => allowedVariants.some((allowed) => allowed === type));
1785
1714
  if (isLeftValid) {
1786
1715
  return getReportDescriptor(right);
@@ -1825,12 +1754,12 @@ function create31(context) {
1825
1754
  const {
1826
1755
  ctx,
1827
1756
  listeners
1828
- } = ER26.useComponentCollector(
1757
+ } = ER27.useComponentCollector(
1829
1758
  context,
1830
1759
  {
1831
1760
  collectDisplayName: true,
1832
1761
  collectHookCalls: false,
1833
- hint: ER26.DEFAULT_COMPONENT_DETECTION_HINT
1762
+ hint: ER27.DEFAULT_COMPONENT_DETECTION_HINT
1834
1763
  }
1835
1764
  );
1836
1765
  return {
@@ -1838,7 +1767,7 @@ function create31(context) {
1838
1767
  "Program:exit"(program) {
1839
1768
  const components = ctx.getAllComponents(program);
1840
1769
  for (const { node, displayName, flag } of components.values()) {
1841
- const isMemoOrForwardRef = (flag & (ER26.ComponentFlag.ForwardRef | ER26.ComponentFlag.Memo)) > 0n;
1770
+ const isMemoOrForwardRef = (flag & (ER27.ComponentFlag.ForwardRef | ER27.ComponentFlag.Memo)) > 0n;
1842
1771
  if (AST13.getFunctionId(node) != null) {
1843
1772
  continue;
1844
1773
  }
@@ -1883,12 +1812,12 @@ function create32(context) {
1883
1812
  const displayNameAssignments = [];
1884
1813
  return {
1885
1814
  CallExpression(node) {
1886
- if (!ER26.isCreateContextCall(context, node)) return;
1815
+ if (!ER27.isCreateContextCall(context, node)) return;
1887
1816
  createCalls.push(node);
1888
1817
  },
1889
1818
  "Program:exit"() {
1890
1819
  for (const call of createCalls) {
1891
- const id = ER26.getInstanceId(call);
1820
+ const id = ER27.getInstanceId(call);
1892
1821
  if (id == null) {
1893
1822
  context.report({
1894
1823
  messageId: "noMissingContextDisplayName",
@@ -1900,7 +1829,7 @@ function create32(context) {
1900
1829
  const left = node.left;
1901
1830
  if (left.type !== AST_NODE_TYPES.MemberExpression) return false;
1902
1831
  const object = left.object;
1903
- return ER26.isInstanceIdEqual(context, id, object);
1832
+ return ER27.isInstanceIdEqual(context, id, object);
1904
1833
  });
1905
1834
  if (!hasDisplayNameAssignment) {
1906
1835
  const semi = LanguagePreference.defaultLanguagePreference.semicolons === "always" ? ";" : "";
@@ -1959,7 +1888,7 @@ function create33(context) {
1959
1888
  switch (node.type) {
1960
1889
  case AST_NODE_TYPES.JSXElement: {
1961
1890
  const initialScope = context.sourceCode.getScope(node);
1962
- if (!ER26.hasAttribute(context, "key", node.openingElement.attributes, initialScope)) {
1891
+ if (!ER27.hasAttribute(context, "key", node.openingElement.attributes, initialScope)) {
1963
1892
  return {
1964
1893
  messageId: "missingKey",
1965
1894
  node
@@ -2016,7 +1945,7 @@ function create33(context) {
2016
1945
  }
2017
1946
  const initialScope = context.sourceCode.getScope(node);
2018
1947
  for (const element of elements) {
2019
- if (!ER26.hasAttribute(context, "key", element.openingElement.attributes, initialScope)) {
1948
+ if (!ER27.hasAttribute(context, "key", element.openingElement.attributes, initialScope)) {
2020
1949
  report.send({
2021
1950
  messageId: "missingKey",
2022
1951
  node: element
@@ -2025,7 +1954,7 @@ function create33(context) {
2025
1954
  }
2026
1955
  },
2027
1956
  CallExpression(node) {
2028
- state.isWithinChildrenToArray ||= ER26.isChildrenToArrayCall(context, node);
1957
+ state.isWithinChildrenToArray ||= ER27.isChildrenToArrayCall(context, node);
2029
1958
  if (state.isWithinChildrenToArray) return;
2030
1959
  const callback = match(node).when(AST13.isArrayMapCall, (n) => n.arguments[0]).when(AST13.isArrayFromCall, (n) => n.arguments[1]).otherwise(() => null);
2031
1960
  if (!AST13.isFunction(callback)) return;
@@ -2037,7 +1966,7 @@ function create33(context) {
2037
1966
  report.send(checkExpression(body));
2038
1967
  },
2039
1968
  "CallExpression:exit"(node) {
2040
- if (!ER26.isChildrenToArrayCall(context, node)) {
1969
+ if (!ER27.isChildrenToArrayCall(context, node)) {
2041
1970
  return;
2042
1971
  }
2043
1972
  state.isWithinChildrenToArray = false;
@@ -2083,7 +2012,7 @@ function create34(context) {
2083
2012
  const { importSource } = getSettingsFromContext(context);
2084
2013
  return {
2085
2014
  CallExpression(node) {
2086
- if (!ER26.isCaptureOwnerStackCall(context, node)) return;
2015
+ if (!ER27.isCaptureOwnerStackCall(context, node)) return;
2087
2016
  if (AST13.findParentNode(node, isDevelopmentOnlyCheck) == null) {
2088
2017
  context.report({
2089
2018
  messageId: "missingDevelopmentOnlyCheck",
@@ -2130,9 +2059,9 @@ var no_nested_component_definitions_default = createRule({
2130
2059
  defaultOptions: []
2131
2060
  });
2132
2061
  function create35(context) {
2133
- const hint = ER26.ComponentDetectionHint.SkipArrayMapArgument | ER26.ComponentDetectionHint.SkipNullLiteral | ER26.ComponentDetectionHint.SkipUndefined | ER26.ComponentDetectionHint.SkipBooleanLiteral | ER26.ComponentDetectionHint.SkipStringLiteral | ER26.ComponentDetectionHint.SkipNumberLiteral | ER26.ComponentDetectionHint.StrictLogical | ER26.ComponentDetectionHint.StrictConditional;
2134
- const collector = ER26.useComponentCollector(context, { hint });
2135
- const collectorLegacy = ER26.useComponentCollectorLegacy();
2062
+ const hint = ER27.ComponentDetectionHint.SkipArrayMapArgument | ER27.ComponentDetectionHint.SkipNullLiteral | ER27.ComponentDetectionHint.SkipUndefined | ER27.ComponentDetectionHint.SkipBooleanLiteral | ER27.ComponentDetectionHint.SkipStringLiteral | ER27.ComponentDetectionHint.SkipNumberLiteral | ER27.ComponentDetectionHint.StrictLogical | ER27.ComponentDetectionHint.StrictConditional;
2063
+ const collector = ER27.useComponentCollector(context, { hint });
2064
+ const collectorLegacy = ER27.useComponentCollectorLegacy();
2136
2065
  return {
2137
2066
  ...collector.listeners,
2138
2067
  ...collectorLegacy.listeners,
@@ -2151,9 +2080,9 @@ function create35(context) {
2151
2080
  };
2152
2081
  for (const { name: name5, node: component } of functionComponents) {
2153
2082
  if (name5 == null) continue;
2154
- if (ER26.isDirectValueOfRenderPropertyLoose(component)) continue;
2083
+ if (ER27.isDirectValueOfRenderPropertyLoose(component)) continue;
2155
2084
  if (isInsideJSXAttributeValue(component)) {
2156
- if (!ER26.isDeclaredInRenderPropLoose(component)) {
2085
+ if (!ER27.isDeclaredInRenderPropLoose(component)) {
2157
2086
  context.report({
2158
2087
  messageId: "noNestedComponentDefinitions",
2159
2088
  node: component,
@@ -2177,7 +2106,7 @@ function create35(context) {
2177
2106
  continue;
2178
2107
  }
2179
2108
  const parentComponent = AST13.findParentNode(component, isFunctionComponent);
2180
- if (parentComponent != null && !ER26.isDirectValueOfRenderPropertyLoose(parentComponent)) {
2109
+ if (parentComponent != null && !ER27.isDirectValueOfRenderPropertyLoose(parentComponent)) {
2181
2110
  context.report({
2182
2111
  messageId: "noNestedComponentDefinitions",
2183
2112
  node: component,
@@ -2216,13 +2145,13 @@ function create35(context) {
2216
2145
  };
2217
2146
  }
2218
2147
  function isInsideJSXAttributeValue(node) {
2219
- return node.parent.type === AST_NODE_TYPES.JSXAttribute || ER26.findParentAttribute(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer) != null;
2148
+ return node.parent.type === AST_NODE_TYPES.JSXAttribute || ER27.findParentAttribute(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer) != null;
2220
2149
  }
2221
2150
  function isInsideRenderMethod(node) {
2222
- return AST13.findParentNode(node, (n) => ER26.isRenderLike(n) && ER26.isClassComponent(n.parent.parent)) != null;
2151
+ return AST13.findParentNode(node, (n) => ER27.isRenderLike(n) && ER27.isClassComponent(n.parent.parent)) != null;
2223
2152
  }
2224
2153
  function isInsideCreateElementProps(context, node) {
2225
- const call = AST13.findParentNode(node, ER26.isCreateElementCall(context));
2154
+ const call = AST13.findParentNode(node, ER27.isCreateElementCall(context));
2226
2155
  if (call == null) return false;
2227
2156
  const prop = AST13.findParentNode(node, AST13.is(AST_NODE_TYPES.ObjectExpression));
2228
2157
  if (prop == null) return false;
@@ -2247,15 +2176,15 @@ var no_nested_lazy_component_declarations_default = createRule({
2247
2176
  defaultOptions: []
2248
2177
  });
2249
2178
  function create36(context) {
2250
- const hint = ER26.ComponentDetectionHint.None;
2251
- const collector = ER26.useComponentCollector(context, { hint });
2252
- const collectorLegacy = ER26.useComponentCollectorLegacy();
2179
+ const hint = ER27.ComponentDetectionHint.None;
2180
+ const collector = ER27.useComponentCollector(context, { hint });
2181
+ const collectorLegacy = ER27.useComponentCollectorLegacy();
2253
2182
  const lazyComponentDeclarations = /* @__PURE__ */ new Set();
2254
2183
  return {
2255
2184
  ...collector.listeners,
2256
2185
  ...collectorLegacy.listeners,
2257
2186
  ImportExpression(node) {
2258
- const lazyCall = AST13.findParentNode(node, (n) => ER26.isLazyCall(context, n));
2187
+ const lazyCall = AST13.findParentNode(node, (n) => ER27.isLazyCall(context, n));
2259
2188
  if (lazyCall != null) {
2260
2189
  lazyComponentDeclarations.add(lazyCall);
2261
2190
  }
@@ -2271,7 +2200,7 @@ function create36(context) {
2271
2200
  const significantParent = AST13.findParentNode(lazy, (n) => {
2272
2201
  if (AST13.isJSX(n)) return true;
2273
2202
  if (n.type === AST_NODE_TYPES.CallExpression) {
2274
- return ER26.isReactHookCall(n) || ER26.isCreateElementCall(context, n) || ER26.isCreateContextCall(context, n);
2203
+ return ER27.isReactHookCall(n) || ER27.isCreateElementCall(context, n) || ER27.isCreateContextCall(context, n);
2275
2204
  }
2276
2205
  if (AST13.isFunction(n)) {
2277
2206
  return functionComponents.some((c) => c.node === n);
@@ -2325,17 +2254,17 @@ function create37(context) {
2325
2254
  if (property.type !== AST_NODE_TYPES.Identifier || property.name !== "propTypes") {
2326
2255
  return;
2327
2256
  }
2328
- if (!ER26.isComponentNameLoose(object.name)) {
2257
+ if (!ER27.isComponentNameLoose(object.name)) {
2329
2258
  return;
2330
2259
  }
2331
2260
  const variable = VAR5.findVariable(object.name, context.sourceCode.getScope(node));
2332
2261
  const variableNode = VAR5.getVariableInitNode(variable, 0);
2333
- if (variableNode != null && (AST13.isFunction(variableNode) || ER26.isClassComponent(variableNode))) {
2262
+ if (variableNode != null && (AST13.isFunction(variableNode) || ER27.isClassComponent(variableNode))) {
2334
2263
  context.report({ messageId: "noPropTypes", node: property });
2335
2264
  }
2336
2265
  },
2337
2266
  PropertyDefinition(node) {
2338
- if (!ER26.isClassComponent(node.parent.parent)) {
2267
+ if (!ER27.isClassComponent(node.parent.parent)) {
2339
2268
  return;
2340
2269
  }
2341
2270
  if (!node.static || node.key.type !== AST_NODE_TYPES.Identifier || node.key.name !== "propTypes") {
@@ -2368,13 +2297,13 @@ var no_redundant_should_component_update_default = createRule({
2368
2297
  });
2369
2298
  function create38(context) {
2370
2299
  if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
2371
- const { ctx, listeners } = ER26.useComponentCollectorLegacy();
2300
+ const { ctx, listeners } = ER27.useComponentCollectorLegacy();
2372
2301
  return {
2373
2302
  ...listeners,
2374
2303
  "Program:exit"(program) {
2375
2304
  const components = ctx.getAllComponents(program);
2376
2305
  for (const { name: name5 = "PureComponent", node: component, flag } of components.values()) {
2377
- if ((flag & ER26.ComponentFlag.PureComponent) === 0n) {
2306
+ if ((flag & ER27.ComponentFlag.PureComponent) === 0n) {
2378
2307
  continue;
2379
2308
  }
2380
2309
  const { body } = component.body;
@@ -2415,11 +2344,11 @@ function create39(context) {
2415
2344
  if (!context.sourceCode.text.includes("componentDidMount")) return {};
2416
2345
  return {
2417
2346
  CallExpression(node) {
2418
- if (!ER26.isThisSetState(node)) {
2347
+ if (!ER27.isThisSetState(node)) {
2419
2348
  return;
2420
2349
  }
2421
- const clazz = AST13.findParentNode(node, ER26.isClassComponent);
2422
- const method = AST13.findParentNode(node, (n) => n === clazz || ER26.isComponentDidMount(n));
2350
+ const clazz = AST13.findParentNode(node, ER27.isClassComponent);
2351
+ const method = AST13.findParentNode(node, (n) => n === clazz || ER27.isComponentDidMount(n));
2423
2352
  if (clazz == null || method == null || method === clazz) return;
2424
2353
  const methodScope = context.sourceCode.getScope(method);
2425
2354
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2454,11 +2383,11 @@ function create40(context) {
2454
2383
  if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
2455
2384
  return {
2456
2385
  CallExpression(node) {
2457
- if (!ER26.isThisSetState(node)) {
2386
+ if (!ER27.isThisSetState(node)) {
2458
2387
  return;
2459
2388
  }
2460
- const clazz = AST13.findParentNode(node, ER26.isClassComponent);
2461
- const method = AST13.findParentNode(node, (n) => n === clazz || ER26.isComponentDidUpdate(n));
2389
+ const clazz = AST13.findParentNode(node, ER27.isClassComponent);
2390
+ const method = AST13.findParentNode(node, (n) => n === clazz || ER27.isComponentDidUpdate(n));
2462
2391
  if (clazz == null || method == null || method === clazz) return;
2463
2392
  const methodScope = context.sourceCode.getScope(method);
2464
2393
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2493,11 +2422,11 @@ function create41(context) {
2493
2422
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
2494
2423
  return {
2495
2424
  CallExpression(node) {
2496
- if (!ER26.isThisSetState(node)) {
2425
+ if (!ER27.isThisSetState(node)) {
2497
2426
  return;
2498
2427
  }
2499
- const clazz = AST13.findParentNode(node, ER26.isClassComponent);
2500
- const method = AST13.findParentNode(node, (n) => n === clazz || ER26.isComponentWillUpdate(n));
2428
+ const clazz = AST13.findParentNode(node, ER27.isClassComponent);
2429
+ const method = AST13.findParentNode(node, (n) => n === clazz || ER27.isComponentWillUpdate(n));
2501
2430
  if (clazz == null || method == null || method === clazz) return;
2502
2431
  const methodScope = context.sourceCode.getScope(method);
2503
2432
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2536,7 +2465,7 @@ function create42(context) {
2536
2465
  isWithinClassComponent: false
2537
2466
  };
2538
2467
  function onClassBodyEnter(node) {
2539
- if (ER26.isClassComponent(node.parent)) {
2468
+ if (ER27.isClassComponent(node.parent)) {
2540
2469
  state.isWithinClassComponent = true;
2541
2470
  }
2542
2471
  }
@@ -2598,10 +2527,10 @@ var no_unnecessary_use_callback_default = createRule({
2598
2527
  function create43(context) {
2599
2528
  if (!context.sourceCode.text.includes("use")) return {};
2600
2529
  const alias = getSettingsFromContext(context).additionalHooks.useCallback ?? [];
2601
- const isUseCallbackCall = ER26.isReactHookCallWithNameAlias(context, "useCallback", alias);
2530
+ const isUseCallbackCall = ER27.isReactHookCallWithNameAlias(context, "useCallback", alias);
2602
2531
  return {
2603
2532
  CallExpression(node) {
2604
- if (!ER26.isReactHookCall(node)) {
2533
+ if (!ER27.isReactHookCall(node)) {
2605
2534
  return;
2606
2535
  }
2607
2536
  const initialScope = context.sourceCode.getScope(node);
@@ -2677,10 +2606,10 @@ var no_unnecessary_use_memo_default = createRule({
2677
2606
  function create44(context) {
2678
2607
  if (!context.sourceCode.text.includes("use")) return {};
2679
2608
  const alias = getSettingsFromContext(context).additionalHooks.useMemo ?? [];
2680
- const isUseMemoCall = ER26.isReactHookCallWithNameAlias(context, "useMemo", alias);
2609
+ const isUseMemoCall = ER27.isReactHookCallWithNameAlias(context, "useMemo", alias);
2681
2610
  return {
2682
2611
  CallExpression(node) {
2683
- if (!ER26.isReactHookCall(node)) {
2612
+ if (!ER27.isReactHookCall(node)) {
2684
2613
  return;
2685
2614
  }
2686
2615
  const initialScope = context.sourceCode.getScope(node);
@@ -2762,7 +2691,7 @@ var no_unnecessary_use_prefix_default = createRule({
2762
2691
  defaultOptions: []
2763
2692
  });
2764
2693
  function create45(context) {
2765
- const { ctx, listeners } = ER26.useHookCollector();
2694
+ const { ctx, listeners } = ER27.useHookCollector();
2766
2695
  return {
2767
2696
  ...listeners,
2768
2697
  "Program:exit"(program) {
@@ -2780,19 +2709,9 @@ function create45(context) {
2780
2709
  if (containsUseComments(context, node)) {
2781
2710
  continue;
2782
2711
  }
2783
- if (id != null) {
2784
- context.report({
2785
- messageId: "noUnnecessaryUsePrefix",
2786
- data: {
2787
- name: name5
2788
- },
2789
- loc: getPreferredLoc(context, id)
2790
- });
2791
- continue;
2792
- }
2793
2712
  context.report({
2794
2713
  messageId: "noUnnecessaryUsePrefix",
2795
- node,
2714
+ node: id ?? node,
2796
2715
  data: {
2797
2716
  name: name5
2798
2717
  }
@@ -2801,20 +2720,6 @@ function create45(context) {
2801
2720
  }
2802
2721
  };
2803
2722
  }
2804
- function getPreferredLoc(context, id) {
2805
- if (AST13.isMultiLine(id)) return id.loc;
2806
- if (!context.sourceCode.getText(id).startsWith("use")) return id.loc;
2807
- return {
2808
- end: {
2809
- column: id.loc.start.column + 3,
2810
- line: id.loc.start.line
2811
- },
2812
- start: {
2813
- column: id.loc.start.column,
2814
- line: id.loc.start.line
2815
- }
2816
- };
2817
- }
2818
2723
  var RULE_NAME46 = "no-unsafe-component-will-mount";
2819
2724
  var RULE_FEATURES46 = [];
2820
2725
  var no_unsafe_component_will_mount_default = createRule({
@@ -2835,7 +2740,7 @@ var no_unsafe_component_will_mount_default = createRule({
2835
2740
  });
2836
2741
  function create46(context) {
2837
2742
  if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
2838
- const { ctx, listeners } = ER26.useComponentCollectorLegacy();
2743
+ const { ctx, listeners } = ER27.useComponentCollectorLegacy();
2839
2744
  return {
2840
2745
  ...listeners,
2841
2746
  "Program:exit"(program) {
@@ -2843,7 +2748,7 @@ function create46(context) {
2843
2748
  for (const { node: component } of components.values()) {
2844
2749
  const { body } = component.body;
2845
2750
  for (const member of body) {
2846
- if (ER26.isUnsafeComponentWillMount(member)) {
2751
+ if (ER27.isUnsafeComponentWillMount(member)) {
2847
2752
  context.report({
2848
2753
  messageId: "noUnsafeComponentWillMount",
2849
2754
  node: member
@@ -2876,7 +2781,7 @@ function create47(context) {
2876
2781
  if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) {
2877
2782
  return {};
2878
2783
  }
2879
- const { ctx, listeners } = ER26.useComponentCollectorLegacy();
2784
+ const { ctx, listeners } = ER27.useComponentCollectorLegacy();
2880
2785
  return {
2881
2786
  ...listeners,
2882
2787
  "Program:exit"(program) {
@@ -2884,7 +2789,7 @@ function create47(context) {
2884
2789
  for (const { node: component } of components.values()) {
2885
2790
  const { body } = component.body;
2886
2791
  for (const member of body) {
2887
- if (ER26.isUnsafeComponentWillReceiveProps(member)) {
2792
+ if (ER27.isUnsafeComponentWillReceiveProps(member)) {
2888
2793
  context.report({
2889
2794
  messageId: "noUnsafeComponentWillReceiveProps",
2890
2795
  node: member
@@ -2915,7 +2820,7 @@ var no_unsafe_component_will_update_default = createRule({
2915
2820
  });
2916
2821
  function create48(context) {
2917
2822
  if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
2918
- const { ctx, listeners } = ER26.useComponentCollectorLegacy();
2823
+ const { ctx, listeners } = ER27.useComponentCollectorLegacy();
2919
2824
  return {
2920
2825
  ...listeners,
2921
2826
  "Program:exit"(program) {
@@ -2923,7 +2828,7 @@ function create48(context) {
2923
2828
  for (const { node: component } of components.values()) {
2924
2829
  const { body } = component.body;
2925
2830
  for (const member of body) {
2926
- if (ER26.isUnsafeComponentWillUpdate(member)) {
2831
+ if (ER27.isUnsafeComponentWillUpdate(member)) {
2927
2832
  context.report({
2928
2833
  messageId: "noUnsafeComponentWillUpdate",
2929
2834
  node: member
@@ -2955,12 +2860,12 @@ var no_unstable_context_value_default = createRule({
2955
2860
  function create49(context) {
2956
2861
  const { version: version2 } = getSettingsFromContext(context);
2957
2862
  const isReact18OrBelow = compare(version2, "19.0.0", "<");
2958
- const { ctx, listeners } = ER26.useComponentCollector(context);
2863
+ const { ctx, listeners } = ER27.useComponentCollector(context);
2959
2864
  const constructions = /* @__PURE__ */ new WeakMap();
2960
2865
  return {
2961
2866
  ...listeners,
2962
2867
  JSXOpeningElement(node) {
2963
- const fullName = ER26.getElementType(context, node.parent);
2868
+ const fullName = ER27.getElementType(context, node.parent);
2964
2869
  const selfName = fullName.split(".").at(-1);
2965
2870
  if (selfName == null) return;
2966
2871
  if (!isContextName(selfName, isReact18OrBelow)) return;
@@ -2976,7 +2881,7 @@ function create49(context) {
2976
2881
  const initialScope = context.sourceCode.getScope(valueExpression);
2977
2882
  const construction = VAR5.getConstruction(valueExpression, initialScope);
2978
2883
  if (construction == null) return;
2979
- if (ER26.isReactHookCall(construction.node)) {
2884
+ if (ER27.isReactHookCall(construction.node)) {
2980
2885
  return;
2981
2886
  }
2982
2887
  getOrElseUpdate(constructions, functionEntry.node, () => []).push(construction);
@@ -3026,7 +2931,7 @@ var no_unstable_default_props_default = createRule({
3026
2931
  defaultOptions: []
3027
2932
  });
3028
2933
  function create50(context) {
3029
- const { ctx, listeners } = ER26.useComponentCollector(context);
2934
+ const { ctx, listeners } = ER27.useComponentCollector(context);
3030
2935
  const declarators = /* @__PURE__ */ new WeakMap();
3031
2936
  return {
3032
2937
  ...listeners,
@@ -3056,7 +2961,7 @@ function create50(context) {
3056
2961
  if (construction == null) {
3057
2962
  continue;
3058
2963
  }
3059
- if (ER26.isReactHookCall(construction.node)) {
2964
+ if (ER27.isReactHookCall(construction.node)) {
3060
2965
  continue;
3061
2966
  }
3062
2967
  const forbiddenType = AST13.toDelimiterFormat(right);
@@ -3126,7 +3031,7 @@ function create51(context) {
3126
3031
  const propertyUsages = /* @__PURE__ */ new WeakMap();
3127
3032
  function classEnter(node) {
3128
3033
  classEntries.push(node);
3129
- if (!ER26.isClassComponent(node)) {
3034
+ if (!ER27.isClassComponent(node)) {
3130
3035
  return;
3131
3036
  }
3132
3037
  propertyDefs.set(node, /* @__PURE__ */ new Set());
@@ -3134,7 +3039,7 @@ function create51(context) {
3134
3039
  }
3135
3040
  function classExit() {
3136
3041
  const currentClass = classEntries.pop();
3137
- if (currentClass == null || !ER26.isClassComponent(currentClass)) {
3042
+ if (currentClass == null || !ER27.isClassComponent(currentClass)) {
3138
3043
  return;
3139
3044
  }
3140
3045
  const className = AST13.getClassId(currentClass)?.name;
@@ -3164,7 +3069,7 @@ function create51(context) {
3164
3069
  function methodEnter(node) {
3165
3070
  methodEntries.push(node);
3166
3071
  const currentClass = classEntries.at(-1);
3167
- if (currentClass == null || !ER26.isClassComponent(currentClass)) {
3072
+ if (currentClass == null || !ER27.isClassComponent(currentClass)) {
3168
3073
  return;
3169
3074
  }
3170
3075
  if (node.static) {
@@ -3188,7 +3093,7 @@ function create51(context) {
3188
3093
  if (currentClass == null || currentMethod == null) {
3189
3094
  return;
3190
3095
  }
3191
- if (!ER26.isClassComponent(currentClass) || currentMethod.static) {
3096
+ if (!ER27.isClassComponent(currentClass) || currentMethod.static) {
3192
3097
  return;
3193
3098
  }
3194
3099
  if (!AST13.isThisExpression(node.object) || !isKeyLiteral2(node, node.property)) {
@@ -3213,7 +3118,7 @@ function create51(context) {
3213
3118
  if (currentClass == null || currentMethod == null) {
3214
3119
  return;
3215
3120
  }
3216
- if (!ER26.isClassComponent(currentClass) || currentMethod.static) {
3121
+ if (!ER27.isClassComponent(currentClass) || currentMethod.static) {
3217
3122
  return;
3218
3123
  }
3219
3124
  if (node.init != null && AST13.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern) {
@@ -3229,8 +3134,162 @@ function create51(context) {
3229
3134
  }
3230
3135
  };
3231
3136
  }
3232
- var RULE_NAME52 = "no-unused-state";
3233
- var RULE_FEATURES52 = [];
3137
+ var RULE_NAME52 = "no-unused-props";
3138
+ var RULE_FEATURES52 = ["TSC", "EXP"];
3139
+ var no_unused_props_default = createRule({
3140
+ meta: {
3141
+ type: "problem",
3142
+ docs: {
3143
+ description: "Warns about unused component prop declarations.",
3144
+ [Symbol.for("rule_features")]: RULE_FEATURES52
3145
+ },
3146
+ messages: {
3147
+ noUnusedProps: "Prop `{{name}}` is declared but never used"
3148
+ },
3149
+ schema: []
3150
+ },
3151
+ name: RULE_NAME52,
3152
+ create: create52,
3153
+ defaultOptions: []
3154
+ });
3155
+ function create52(context) {
3156
+ const services = ESLintUtils.getParserServices(context, false);
3157
+ const { ctx, listeners } = ER27.useComponentCollector(context);
3158
+ return {
3159
+ ...listeners,
3160
+ "Program:exit"(program) {
3161
+ const checker = services.program.getTypeChecker();
3162
+ const components = ctx.getAllComponents(program);
3163
+ const totalDeclaredProps = /* @__PURE__ */ new Set();
3164
+ const totalUsedProps = /* @__PURE__ */ new Set();
3165
+ for (const [, component] of components) {
3166
+ const [props] = component.node.params;
3167
+ if (props == null) continue;
3168
+ const usedPropKeys = /* @__PURE__ */ new Set();
3169
+ const couldFindAllUsedPropKeys = collectUsedPropKeysOfParameter(context, usedPropKeys, props);
3170
+ if (!couldFindAllUsedPropKeys) {
3171
+ continue;
3172
+ }
3173
+ const tsNode = services.esTreeNodeToTSNodeMap.get(props);
3174
+ const declaredProps = checker.getTypeAtLocation(tsNode).getProperties();
3175
+ for (const declaredProp of declaredProps) {
3176
+ totalDeclaredProps.add(declaredProp);
3177
+ if (usedPropKeys.has(declaredProp.name)) {
3178
+ totalUsedProps.add(declaredProp);
3179
+ }
3180
+ }
3181
+ }
3182
+ const unusedProps = [...totalDeclaredProps].filter((x) => !totalUsedProps.has(x));
3183
+ for (const unusedProp of unusedProps) {
3184
+ reportUnusedProp(context, services, unusedProp);
3185
+ }
3186
+ }
3187
+ };
3188
+ }
3189
+ function collectUsedPropKeysOfParameter(context, usedPropKeys, parameter) {
3190
+ switch (parameter.type) {
3191
+ case AST_NODE_TYPES.Identifier: {
3192
+ return collectUsedPropKeysOfIdentifier(context, usedPropKeys, parameter);
3193
+ }
3194
+ case AST_NODE_TYPES.ObjectPattern: {
3195
+ return collectUsedPropKeysOfObjectPattern(context, usedPropKeys, parameter);
3196
+ }
3197
+ default: {
3198
+ return false;
3199
+ }
3200
+ }
3201
+ }
3202
+ function collectUsedPropKeysOfObjectPattern(context, usedPropKeys, objectPattern) {
3203
+ for (const property of objectPattern.properties) {
3204
+ switch (property.type) {
3205
+ case AST_NODE_TYPES.Property: {
3206
+ const key = getKeyOfExpression(property.key);
3207
+ if (key == null) return false;
3208
+ usedPropKeys.add(key);
3209
+ break;
3210
+ }
3211
+ case AST_NODE_TYPES.RestElement: {
3212
+ if (!collectUsedPropsOfRestElement(context, usedPropKeys, property)) {
3213
+ return false;
3214
+ }
3215
+ break;
3216
+ }
3217
+ }
3218
+ }
3219
+ return true;
3220
+ }
3221
+ function collectUsedPropsOfRestElement(context, usedPropKeys, restElement) {
3222
+ switch (restElement.argument.type) {
3223
+ case AST_NODE_TYPES.Identifier: {
3224
+ return collectUsedPropKeysOfIdentifier(context, usedPropKeys, restElement.argument);
3225
+ }
3226
+ default: {
3227
+ return false;
3228
+ }
3229
+ }
3230
+ }
3231
+ function collectUsedPropKeysOfIdentifier(context, usedPropKeys, identifier) {
3232
+ const scope = context.sourceCode.getScope(identifier);
3233
+ const variable = scope.variables.find((v) => v.name === identifier.name);
3234
+ if (variable == null) return false;
3235
+ for (const ref of variable.references) {
3236
+ if (ref.identifier === identifier) {
3237
+ continue;
3238
+ }
3239
+ if (!collectUsedPropKeysOfReference(context, usedPropKeys, identifier, ref)) {
3240
+ return false;
3241
+ }
3242
+ }
3243
+ return true;
3244
+ }
3245
+ function collectUsedPropKeysOfReference(context, usedPropKeys, identifier, ref) {
3246
+ const { parent } = ref.identifier;
3247
+ switch (parent.type) {
3248
+ case AST_NODE_TYPES.MemberExpression: {
3249
+ if (parent.object.type === AST_NODE_TYPES.Identifier && parent.object.name === identifier.name) {
3250
+ const key = getKeyOfExpression(parent.property);
3251
+ if (key == null) return false;
3252
+ usedPropKeys.add(key);
3253
+ return true;
3254
+ }
3255
+ break;
3256
+ }
3257
+ case AST_NODE_TYPES.VariableDeclarator: {
3258
+ if (parent.id.type === AST_NODE_TYPES.ObjectPattern && parent.init === ref.identifier) {
3259
+ return collectUsedPropKeysOfObjectPattern(context, usedPropKeys, parent.id);
3260
+ }
3261
+ break;
3262
+ }
3263
+ }
3264
+ return false;
3265
+ }
3266
+ function getKeyOfExpression(expr) {
3267
+ switch (expr.type) {
3268
+ case AST_NODE_TYPES.Identifier: {
3269
+ return expr.name;
3270
+ }
3271
+ case AST_NODE_TYPES.Literal: {
3272
+ if (typeof expr.value === "string") {
3273
+ return expr.value;
3274
+ }
3275
+ }
3276
+ }
3277
+ return null;
3278
+ }
3279
+ function reportUnusedProp(context, services, prop) {
3280
+ const declaration = prop.getDeclarations()?.[0];
3281
+ if (declaration == null) return;
3282
+ const declarationNode = services.tsNodeToESTreeNodeMap.get(declaration);
3283
+ if (declarationNode == null) return;
3284
+ const nodeToReport = declarationNode.type === AST_NODE_TYPES.TSPropertySignature ? declarationNode.key : declarationNode;
3285
+ context.report({
3286
+ messageId: "noUnusedProps",
3287
+ node: nodeToReport,
3288
+ data: { name: prop.name }
3289
+ });
3290
+ }
3291
+ var RULE_NAME53 = "no-unused-state";
3292
+ var RULE_FEATURES53 = [];
3234
3293
  function isKeyLiteral3(node, key) {
3235
3294
  return match(key).with({ type: AST_NODE_TYPES.Literal }, constTrue).with({ type: AST_NODE_TYPES.TemplateLiteral, expressions: [] }, constTrue).with({ type: AST_NODE_TYPES.Identifier }, () => !node.computed).otherwise(constFalse);
3236
3295
  }
@@ -3239,18 +3298,18 @@ var no_unused_state_default = createRule({
3239
3298
  type: "problem",
3240
3299
  docs: {
3241
3300
  description: "Warns unused class component state.",
3242
- [Symbol.for("rule_features")]: RULE_FEATURES52
3301
+ [Symbol.for("rule_features")]: RULE_FEATURES53
3243
3302
  },
3244
3303
  messages: {
3245
3304
  noUnusedState: "Unused class component state in '{{className}}'"
3246
3305
  },
3247
3306
  schema: []
3248
3307
  },
3249
- name: RULE_NAME52,
3250
- create: create52,
3308
+ name: RULE_NAME53,
3309
+ create: create53,
3251
3310
  defaultOptions: []
3252
3311
  });
3253
- function create52(context) {
3312
+ function create53(context) {
3254
3313
  const classEntries = [];
3255
3314
  const methodEntries = [];
3256
3315
  const constructorEntries = [];
@@ -3260,7 +3319,7 @@ function create52(context) {
3260
3319
  }
3261
3320
  function classExit() {
3262
3321
  const currentClass = classEntries.pop();
3263
- if (currentClass == null || !ER26.isClassComponent(currentClass)) {
3322
+ if (currentClass == null || !ER27.isClassComponent(currentClass)) {
3264
3323
  return;
3265
3324
  }
3266
3325
  const className = AST13.getClassId(currentClass)?.name;
@@ -3279,11 +3338,11 @@ function create52(context) {
3279
3338
  function methodEnter(node) {
3280
3339
  methodEntries.push(node);
3281
3340
  const currentClass = classEntries.at(-1);
3282
- if (currentClass == null || !ER26.isClassComponent(currentClass)) {
3341
+ if (currentClass == null || !ER27.isClassComponent(currentClass)) {
3283
3342
  return;
3284
3343
  }
3285
3344
  if (node.static) {
3286
- if (ER26.isGetDerivedStateFromProps(node) && isMatching({ params: [P.nonNullable, ...P.array()] })(node.value)) {
3345
+ if (ER27.isGetDerivedStateFromProps(node) && isMatching({ params: [P.nonNullable, ...P.array()] })(node.value)) {
3287
3346
  const defNode = stateDefs.get(currentClass)?.node;
3288
3347
  stateDefs.set(currentClass, { node: defNode, isUsed: true });
3289
3348
  }
@@ -3304,11 +3363,11 @@ function create52(context) {
3304
3363
  }
3305
3364
  return {
3306
3365
  AssignmentExpression(node) {
3307
- if (!ER26.isAssignmentToThisState(node)) {
3366
+ if (!ER27.isAssignmentToThisState(node)) {
3308
3367
  return;
3309
3368
  }
3310
3369
  const currentClass = classEntries.at(-1);
3311
- if (currentClass == null || !ER26.isClassComponent(currentClass)) {
3370
+ if (currentClass == null || !ER27.isClassComponent(currentClass)) {
3312
3371
  return;
3313
3372
  }
3314
3373
  const currentConstructor = constructorEntries.at(-1);
@@ -3330,7 +3389,7 @@ function create52(context) {
3330
3389
  return;
3331
3390
  }
3332
3391
  const currentClass = classEntries.at(-1);
3333
- if (currentClass == null || !ER26.isClassComponent(currentClass)) {
3392
+ if (currentClass == null || !ER27.isClassComponent(currentClass)) {
3334
3393
  return;
3335
3394
  }
3336
3395
  const currentMethod = methodEntries.at(-1);
@@ -3354,7 +3413,7 @@ function create52(context) {
3354
3413
  "PropertyDefinition:exit": methodExit,
3355
3414
  VariableDeclarator(node) {
3356
3415
  const currentClass = classEntries.at(-1);
3357
- if (currentClass == null || !ER26.isClassComponent(currentClass)) {
3416
+ if (currentClass == null || !ER27.isClassComponent(currentClass)) {
3358
3417
  return;
3359
3418
  }
3360
3419
  const currentMethod = methodEntries.at(-1);
@@ -3384,8 +3443,8 @@ function create52(context) {
3384
3443
  }
3385
3444
  };
3386
3445
  }
3387
- var RULE_NAME53 = "no-use-context";
3388
- var RULE_FEATURES53 = [
3446
+ var RULE_NAME54 = "no-use-context";
3447
+ var RULE_FEATURES54 = [
3389
3448
  "MOD"
3390
3449
  ];
3391
3450
  var no_use_context_default = createRule({
@@ -3393,7 +3452,7 @@ var no_use_context_default = createRule({
3393
3452
  type: "problem",
3394
3453
  docs: {
3395
3454
  description: "Replaces usages of `useContext` with `use`.",
3396
- [Symbol.for("rule_features")]: RULE_FEATURES53
3455
+ [Symbol.for("rule_features")]: RULE_FEATURES54
3397
3456
  },
3398
3457
  fixable: "code",
3399
3458
  messages: {
@@ -3401,11 +3460,11 @@ var no_use_context_default = createRule({
3401
3460
  },
3402
3461
  schema: []
3403
3462
  },
3404
- name: RULE_NAME53,
3405
- create: create53,
3463
+ name: RULE_NAME54,
3464
+ create: create54,
3406
3465
  defaultOptions: []
3407
3466
  });
3408
- function create53(context) {
3467
+ function create54(context) {
3409
3468
  if (!context.sourceCode.text.includes("useContext")) return {};
3410
3469
  const settings4 = getSettingsFromContext(context);
3411
3470
  if (compare(settings4.version, "19.0.0", "<")) {
@@ -3415,7 +3474,7 @@ function create53(context) {
3415
3474
  const hookCalls = /* @__PURE__ */ new Set();
3416
3475
  return {
3417
3476
  CallExpression(node) {
3418
- if (!ER26.isReactHookCall(node)) {
3477
+ if (!ER27.isReactHookCall(node)) {
3419
3478
  return;
3420
3479
  }
3421
3480
  hookCalls.add(node);
@@ -3454,7 +3513,7 @@ function create53(context) {
3454
3513
  }
3455
3514
  },
3456
3515
  "Program:exit"() {
3457
- const isUseContextCall = ER26.isReactHookCallWithNameAlias(context, "useContext", [...useContextNames]);
3516
+ const isUseContextCall = ER27.isReactHookCallWithNameAlias(context, "useContext", [...useContextNames]);
3458
3517
  for (const node of hookCalls) {
3459
3518
  if (!isUseContextCall(node)) {
3460
3519
  continue;
@@ -3488,28 +3547,28 @@ function getCorrelativeTokens(context, node) {
3488
3547
  }
3489
3548
  return tokens;
3490
3549
  }
3491
- var RULE_NAME54 = "no-useless-forward-ref";
3492
- var RULE_FEATURES54 = [];
3550
+ var RULE_NAME55 = "no-useless-forward-ref";
3551
+ var RULE_FEATURES55 = [];
3493
3552
  var no_useless_forward_ref_default = createRule({
3494
3553
  meta: {
3495
3554
  type: "problem",
3496
3555
  docs: {
3497
3556
  description: "Disallow useless `forwardRef` calls on components that don't use `ref`s.",
3498
- [Symbol.for("rule_features")]: RULE_FEATURES54
3557
+ [Symbol.for("rule_features")]: RULE_FEATURES55
3499
3558
  },
3500
3559
  messages: {
3501
3560
  noUselessForwardRef: "A 'forwardRef' is used with this component but no 'ref' parameter is set."
3502
3561
  },
3503
3562
  schema: []
3504
3563
  },
3505
- name: RULE_NAME54,
3506
- create: create54,
3564
+ name: RULE_NAME55,
3565
+ create: create55,
3507
3566
  defaultOptions: []
3508
3567
  });
3509
- function create54(context) {
3568
+ function create55(context) {
3510
3569
  return {
3511
3570
  CallExpression(node) {
3512
- if (!ER26.isForwardRefCall(context, node)) {
3571
+ if (!ER27.isForwardRefCall(context, node)) {
3513
3572
  return;
3514
3573
  }
3515
3574
  const [component] = node.arguments;
@@ -3527,7 +3586,7 @@ function create54(context) {
3527
3586
  }
3528
3587
  };
3529
3588
  }
3530
- var RULE_NAME55 = "no-useless-fragment";
3589
+ var RULE_NAME56 = "no-useless-fragment";
3531
3590
  var defaultOptions3 = [{
3532
3591
  allowExpressions: true
3533
3592
  }];
@@ -3553,15 +3612,15 @@ var no_useless_fragment_default = createRule({
3553
3612
  }
3554
3613
  }]
3555
3614
  },
3556
- name: RULE_NAME55,
3557
- create: create55,
3615
+ name: RULE_NAME56,
3616
+ create: create56,
3558
3617
  defaultOptions: defaultOptions3
3559
3618
  });
3560
- function create55(context, [option]) {
3619
+ function create56(context, [option]) {
3561
3620
  const { allowExpressions = true } = option;
3562
3621
  return {
3563
3622
  JSXElement(node) {
3564
- if (!ER26.isFragmentElement(context, node)) return;
3623
+ if (!ER27.isFragmentElement(context, node)) return;
3565
3624
  checkNode(context, node, allowExpressions);
3566
3625
  },
3567
3626
  JSXFragment(node) {
@@ -3573,7 +3632,7 @@ function isWhiteSpace(node) {
3573
3632
  return typeof node.value === "string" && node.raw.trim() === "";
3574
3633
  }
3575
3634
  function isPaddingSpaces(node) {
3576
- return ER26.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
3635
+ return ER27.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
3577
3636
  }
3578
3637
  function trimLikeReact(text) {
3579
3638
  const leadingSpaces = /^\s*/.exec(text)?.[0] ?? "";
@@ -3584,10 +3643,10 @@ function trimLikeReact(text) {
3584
3643
  }
3585
3644
  function checkNode(context, node, allowExpressions) {
3586
3645
  const initialScope = context.sourceCode.getScope(node);
3587
- if (ER26.isKeyedElement(context, node, initialScope)) {
3646
+ if (ER27.isKeyedElement(context, node, initialScope)) {
3588
3647
  return;
3589
3648
  }
3590
- if (ER26.isHostElement(context, node.parent)) {
3649
+ if (ER27.isHostElement(context, node.parent)) {
3591
3650
  context.report({
3592
3651
  messageId: "uselessFragment",
3593
3652
  node,
@@ -3611,7 +3670,7 @@ function checkNode(context, node, allowExpressions) {
3611
3670
  const isChildElement = AST13.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(node.parent);
3612
3671
  switch (true) {
3613
3672
  // <Foo content={<>ee eeee eeee ...</>} />
3614
- case (allowExpressions && !isChildElement && node.children.length === 1 && ER26.isJsxText(node.children.at(0))): {
3673
+ case (allowExpressions && !isChildElement && node.children.length === 1 && ER27.isJsxText(node.children.at(0))): {
3615
3674
  return;
3616
3675
  }
3617
3676
  // <Foo><>hello, world</></Foo>
@@ -3667,18 +3726,18 @@ function getFix2(context, node) {
3667
3726
  }
3668
3727
  function canFix(context, node) {
3669
3728
  if (node.parent.type === AST_NODE_TYPES.JSXElement || node.parent.type === AST_NODE_TYPES.JSXFragment) {
3670
- return ER26.isHostElement(context, node.parent);
3729
+ return ER27.isHostElement(context, node.parent);
3671
3730
  }
3672
3731
  if (node.children.length === 0) {
3673
3732
  return false;
3674
3733
  }
3675
- if (node.children.some((child) => ER26.isJsxText(child) && !isWhiteSpace(child) || AST13.is(AST_NODE_TYPES.JSXExpressionContainer)(child))) {
3734
+ if (node.children.some((child) => ER27.isJsxText(child) && !isWhiteSpace(child) || AST13.is(AST_NODE_TYPES.JSXExpressionContainer)(child))) {
3676
3735
  return false;
3677
3736
  }
3678
3737
  return true;
3679
3738
  }
3680
- var RULE_NAME56 = "prefer-destructuring-assignment";
3681
- var RULE_FEATURES55 = [];
3739
+ var RULE_NAME57 = "prefer-destructuring-assignment";
3740
+ var RULE_FEATURES56 = [];
3682
3741
  function isMemberExpressionWithObjectName(node) {
3683
3742
  return node.object.type === AST_NODE_TYPES.Identifier && "name" in node.object;
3684
3743
  }
@@ -3687,19 +3746,19 @@ var prefer_destructuring_assignment_default = createRule({
3687
3746
  type: "problem",
3688
3747
  docs: {
3689
3748
  description: "Enforces destructuring assignment for component props and context.",
3690
- [Symbol.for("rule_features")]: RULE_FEATURES55
3749
+ [Symbol.for("rule_features")]: RULE_FEATURES56
3691
3750
  },
3692
3751
  messages: {
3693
3752
  preferDestructuringAssignment: "Use destructuring assignment for {{name}}."
3694
3753
  },
3695
3754
  schema: []
3696
3755
  },
3697
- name: RULE_NAME56,
3698
- create: create56,
3756
+ name: RULE_NAME57,
3757
+ create: create57,
3699
3758
  defaultOptions: []
3700
3759
  });
3701
- function create56(context) {
3702
- const { ctx, listeners } = ER26.useComponentCollector(context);
3760
+ function create57(context) {
3761
+ const { ctx, listeners } = ER27.useComponentCollector(context);
3703
3762
  const memberExpressionWithNames = [];
3704
3763
  return {
3705
3764
  ...listeners,
@@ -3718,7 +3777,7 @@ function create56(context) {
3718
3777
  return false;
3719
3778
  }
3720
3779
  const id = AST13.getFunctionId(block);
3721
- return id != null && ER26.isComponentNameLoose(id.name) && components.some((component) => component.node === block);
3780
+ return id != null && ER27.isComponentNameLoose(id.name) && components.some((component) => component.node === block);
3722
3781
  }
3723
3782
  for (const [initialScope, memberExpression] of memberExpressionWithNames) {
3724
3783
  let scope = initialScope;
@@ -3758,8 +3817,8 @@ function create56(context) {
3758
3817
  }
3759
3818
  };
3760
3819
  }
3761
- var RULE_NAME57 = "prefer-namespace-import";
3762
- var RULE_FEATURES56 = [
3820
+ var RULE_NAME58 = "prefer-namespace-import";
3821
+ var RULE_FEATURES57 = [
3763
3822
  "FIX"
3764
3823
  ];
3765
3824
  var prefer_namespace_import_default = createRule({
@@ -3767,7 +3826,7 @@ var prefer_namespace_import_default = createRule({
3767
3826
  type: "problem",
3768
3827
  docs: {
3769
3828
  description: "Enforces React is imported via a namespace import.",
3770
- [Symbol.for("rule_features")]: RULE_FEATURES56
3829
+ [Symbol.for("rule_features")]: RULE_FEATURES57
3771
3830
  },
3772
3831
  fixable: "code",
3773
3832
  messages: {
@@ -3775,11 +3834,11 @@ var prefer_namespace_import_default = createRule({
3775
3834
  },
3776
3835
  schema: []
3777
3836
  },
3778
- name: RULE_NAME57,
3779
- create: create57,
3837
+ name: RULE_NAME58,
3838
+ create: create58,
3780
3839
  defaultOptions: []
3781
3840
  });
3782
- function create57(context) {
3841
+ function create58(context) {
3783
3842
  const { importSource } = getSettingsFromContext(context);
3784
3843
  return {
3785
3844
  [`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
@@ -3814,8 +3873,8 @@ function create57(context) {
3814
3873
  }
3815
3874
  };
3816
3875
  }
3817
- var RULE_NAME58 = "prefer-read-only-props";
3818
- var RULE_FEATURES57 = [
3876
+ var RULE_NAME59 = "prefer-read-only-props";
3877
+ var RULE_FEATURES58 = [
3819
3878
  "TSC",
3820
3879
  "EXP"
3821
3880
  ];
@@ -3824,20 +3883,20 @@ var prefer_read_only_props_default = createRule({
3824
3883
  type: "problem",
3825
3884
  docs: {
3826
3885
  description: "Enforces read-only props in components.",
3827
- [Symbol.for("rule_features")]: RULE_FEATURES57
3886
+ [Symbol.for("rule_features")]: RULE_FEATURES58
3828
3887
  },
3829
3888
  messages: {
3830
3889
  preferReadOnlyProps: "A function component's props should be read-only."
3831
3890
  },
3832
3891
  schema: []
3833
3892
  },
3834
- name: RULE_NAME58,
3835
- create: create58,
3893
+ name: RULE_NAME59,
3894
+ create: create59,
3836
3895
  defaultOptions: []
3837
3896
  });
3838
- function create58(context) {
3897
+ function create59(context) {
3839
3898
  const services = ESLintUtils.getParserServices(context, false);
3840
- const { ctx, listeners } = ER26.useComponentCollector(context);
3899
+ const { ctx, listeners } = ER27.useComponentCollector(context);
3841
3900
  return {
3842
3901
  ...listeners,
3843
3902
  "Program:exit"(program) {
@@ -3867,8 +3926,8 @@ function isTypeReadonlyLoose(services, type) {
3867
3926
  return true;
3868
3927
  }
3869
3928
  }
3870
- var RULE_NAME59 = "prefer-use-state-lazy-initialization";
3871
- var RULE_FEATURES58 = [
3929
+ var RULE_NAME60 = "prefer-use-state-lazy-initialization";
3930
+ var RULE_FEATURES59 = [
3872
3931
  "EXP"
3873
3932
  ];
3874
3933
  var ALLOW_LIST = [
@@ -3881,23 +3940,23 @@ var prefer_use_state_lazy_initialization_default = createRule({
3881
3940
  type: "problem",
3882
3941
  docs: {
3883
3942
  description: "Enforces function calls made inside `useState` to be wrapped in an `initializer function`.",
3884
- [Symbol.for("rule_features")]: RULE_FEATURES58
3943
+ [Symbol.for("rule_features")]: RULE_FEATURES59
3885
3944
  },
3886
3945
  messages: {
3887
3946
  preferUseStateLazyInitialization: "To prevent re-computation, consider using lazy initial state for useState calls that involve function calls. Ex: 'useState(() => getValue())'."
3888
3947
  },
3889
3948
  schema: []
3890
3949
  },
3891
- name: RULE_NAME59,
3892
- create: create59,
3950
+ name: RULE_NAME60,
3951
+ create: create60,
3893
3952
  defaultOptions: []
3894
3953
  });
3895
- function create59(context) {
3954
+ function create60(context) {
3896
3955
  const alias = getSettingsFromContext(context).additionalHooks.useState ?? [];
3897
- const isUseStateCall = ER26.isReactHookCallWithNameAlias(context, "useState", alias);
3956
+ const isUseStateCall = ER27.isReactHookCallWithNameAlias(context, "useState", alias);
3898
3957
  return {
3899
3958
  CallExpression(node) {
3900
- if (!ER26.isReactHookCall(node)) {
3959
+ if (!ER27.isReactHookCall(node)) {
3901
3960
  return;
3902
3961
  }
3903
3962
  if (!isUseStateCall(node)) {
@@ -3910,7 +3969,7 @@ function create59(context) {
3910
3969
  for (const expr of AST13.getNestedNewExpressions(useStateInput)) {
3911
3970
  if (!("name" in expr.callee)) continue;
3912
3971
  if (ALLOW_LIST.includes(expr.callee.name)) continue;
3913
- if (AST13.findParentNode(expr, (n) => ER26.isUseCall(context, n)) != null) continue;
3972
+ if (AST13.findParentNode(expr, (n) => ER27.isUseCall(context, n)) != null) continue;
3914
3973
  context.report({
3915
3974
  messageId: "preferUseStateLazyInitialization",
3916
3975
  node: expr
@@ -3918,9 +3977,9 @@ function create59(context) {
3918
3977
  }
3919
3978
  for (const expr of AST13.getNestedCallExpressions(useStateInput)) {
3920
3979
  if (!("name" in expr.callee)) continue;
3921
- if (ER26.isReactHookName(expr.callee.name)) continue;
3980
+ if (ER27.isReactHookName(expr.callee.name)) continue;
3922
3981
  if (ALLOW_LIST.includes(expr.callee.name)) continue;
3923
- if (AST13.findParentNode(expr, (n) => ER26.isUseCall(context, n)) != null) continue;
3982
+ if (AST13.findParentNode(expr, (n) => ER27.isUseCall(context, n)) != null) continue;
3924
3983
  context.report({
3925
3984
  messageId: "preferUseStateLazyInitialization",
3926
3985
  node: expr
@@ -3929,15 +3988,15 @@ function create59(context) {
3929
3988
  }
3930
3989
  };
3931
3990
  }
3932
- var RULE_NAME60 = "avoid-shorthand-boolean";
3933
- var RULE_FEATURES59 = [];
3991
+ var RULE_NAME61 = "avoid-shorthand-boolean";
3992
+ var RULE_FEATURES60 = [];
3934
3993
  var avoid_shorthand_boolean_default = createRule({
3935
3994
  meta: {
3936
3995
  type: "problem",
3937
3996
  deprecated: true,
3938
3997
  docs: {
3939
3998
  description: "Enforces explicit boolean values for boolean attributes.",
3940
- [Symbol.for("rule_features")]: RULE_FEATURES59
3999
+ [Symbol.for("rule_features")]: RULE_FEATURES60
3941
4000
  },
3942
4001
  fixable: "code",
3943
4002
  messages: {
@@ -3948,11 +4007,11 @@ var avoid_shorthand_boolean_default = createRule({
3948
4007
  ],
3949
4008
  schema: []
3950
4009
  },
3951
- name: RULE_NAME60,
3952
- create: create60,
4010
+ name: RULE_NAME61,
4011
+ create: create61,
3953
4012
  defaultOptions: []
3954
4013
  });
3955
- function create60(context) {
4014
+ function create61(context) {
3956
4015
  return {
3957
4016
  JSXAttribute(node) {
3958
4017
  if (node.value == null) {
@@ -3960,7 +4019,7 @@ function create60(context) {
3960
4019
  messageId: "avoidShorthandBoolean",
3961
4020
  node,
3962
4021
  data: {
3963
- propName: ER26.getAttributeName(context, node)
4022
+ propName: ER27.getAttributeName(context, node)
3964
4023
  },
3965
4024
  fix: (fixer) => fixer.insertTextAfter(node.name, `={true}`)
3966
4025
  });
@@ -3968,15 +4027,15 @@ function create60(context) {
3968
4027
  }
3969
4028
  };
3970
4029
  }
3971
- var RULE_NAME61 = "avoid-shorthand-fragment";
3972
- var RULE_FEATURES60 = [];
4030
+ var RULE_NAME62 = "avoid-shorthand-fragment";
4031
+ var RULE_FEATURES61 = [];
3973
4032
  var avoid_shorthand_fragment_default = createRule({
3974
4033
  meta: {
3975
4034
  type: "problem",
3976
4035
  deprecated: true,
3977
4036
  docs: {
3978
4037
  description: "Enforces explicit `<Fragment>` components instead of the shorthand `<>` or `</>` syntax.",
3979
- [Symbol.for("rule_features")]: RULE_FEATURES60
4038
+ [Symbol.for("rule_features")]: RULE_FEATURES61
3980
4039
  },
3981
4040
  messages: {
3982
4041
  avoidShorthandFragment: "Avoid using shorthand fragment syntax. Use '{{jsxFragmentFactory}}' component instead."
@@ -3986,11 +4045,11 @@ var avoid_shorthand_fragment_default = createRule({
3986
4045
  ],
3987
4046
  schema: []
3988
4047
  },
3989
- name: RULE_NAME61,
3990
- create: create61,
4048
+ name: RULE_NAME62,
4049
+ create: create62,
3991
4050
  defaultOptions: []
3992
4051
  });
3993
- function create61(context) {
4052
+ function create62(context) {
3994
4053
  const jsxConfigFromContext = JsxConfig.getFromContext(context);
3995
4054
  const jsxConfigFromAnnotation = JsxConfig.getFromAnnotation(context);
3996
4055
  const jsxConfig = {
@@ -4009,8 +4068,8 @@ function create61(context) {
4009
4068
  }
4010
4069
  };
4011
4070
  }
4012
- var RULE_NAME62 = "prefer-shorthand-boolean";
4013
- var RULE_FEATURES61 = [
4071
+ var RULE_NAME63 = "prefer-shorthand-boolean";
4072
+ var RULE_FEATURES62 = [
4014
4073
  "FIX"
4015
4074
  ];
4016
4075
  var prefer_shorthand_boolean_default = createRule({
@@ -4019,7 +4078,7 @@ var prefer_shorthand_boolean_default = createRule({
4019
4078
  deprecated: true,
4020
4079
  docs: {
4021
4080
  description: "Enforces shorthand syntax for boolean attributes.",
4022
- [Symbol.for("rule_features")]: RULE_FEATURES61
4081
+ [Symbol.for("rule_features")]: RULE_FEATURES62
4023
4082
  },
4024
4083
  fixable: "code",
4025
4084
  messages: {
@@ -4030,15 +4089,15 @@ var prefer_shorthand_boolean_default = createRule({
4030
4089
  ],
4031
4090
  schema: []
4032
4091
  },
4033
- name: RULE_NAME62,
4034
- create: create62,
4092
+ name: RULE_NAME63,
4093
+ create: create63,
4035
4094
  defaultOptions: []
4036
4095
  });
4037
- function create62(context) {
4096
+ function create63(context) {
4038
4097
  return {
4039
4098
  JSXAttribute(node) {
4040
4099
  const { value } = node;
4041
- const propName = ER26.getAttributeName(context, node);
4100
+ const propName = ER27.getAttributeName(context, node);
4042
4101
  const hasValueTrue = value?.type === AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === AST_NODE_TYPES.Literal && value.expression.value === true;
4043
4102
  if (!hasValueTrue) {
4044
4103
  return;
@@ -4054,8 +4113,8 @@ function create62(context) {
4054
4113
  }
4055
4114
  };
4056
4115
  }
4057
- var RULE_NAME63 = "prefer-shorthand-fragment";
4058
- var RULE_FEATURES62 = [
4116
+ var RULE_NAME64 = "prefer-shorthand-fragment";
4117
+ var RULE_FEATURES63 = [
4059
4118
  "FIX"
4060
4119
  ];
4061
4120
  var prefer_shorthand_fragment_default = createRule({
@@ -4064,7 +4123,7 @@ var prefer_shorthand_fragment_default = createRule({
4064
4123
  deprecated: true,
4065
4124
  docs: {
4066
4125
  description: "Enforces shorthand syntax for fragments.",
4067
- [Symbol.for("rule_features")]: RULE_FEATURES62
4126
+ [Symbol.for("rule_features")]: RULE_FEATURES63
4068
4127
  },
4069
4128
  fixable: "code",
4070
4129
  messages: {
@@ -4075,14 +4134,14 @@ var prefer_shorthand_fragment_default = createRule({
4075
4134
  ],
4076
4135
  schema: []
4077
4136
  },
4078
- name: RULE_NAME63,
4079
- create: create63,
4137
+ name: RULE_NAME64,
4138
+ create: create64,
4080
4139
  defaultOptions: []
4081
4140
  });
4082
- function create63(context) {
4141
+ function create64(context) {
4083
4142
  return {
4084
4143
  JSXElement(node) {
4085
- if (!ER26.isFragmentElement(context, node)) return;
4144
+ if (!ER27.isFragmentElement(context, node)) return;
4086
4145
  const hasAttributes = node.openingElement.attributes.length > 0;
4087
4146
  if (hasAttributes) {
4088
4147
  return;
@@ -4104,8 +4163,8 @@ function create63(context) {
4104
4163
  }
4105
4164
  };
4106
4165
  }
4107
- var RULE_NAME64 = "prefer-react-namespace-import";
4108
- var RULE_FEATURES63 = [
4166
+ var RULE_NAME65 = "prefer-react-namespace-import";
4167
+ var RULE_FEATURES64 = [
4109
4168
  "FIX"
4110
4169
  ];
4111
4170
  var prefer_react_namespace_import_default = createRule({
@@ -4114,7 +4173,7 @@ var prefer_react_namespace_import_default = createRule({
4114
4173
  deprecated: true,
4115
4174
  docs: {
4116
4175
  description: "Enforces React is imported via a namespace import.",
4117
- [Symbol.for("rule_features")]: RULE_FEATURES63
4176
+ [Symbol.for("rule_features")]: RULE_FEATURES64
4118
4177
  },
4119
4178
  fixable: "code",
4120
4179
  messages: {
@@ -4125,11 +4184,11 @@ var prefer_react_namespace_import_default = createRule({
4125
4184
  ],
4126
4185
  schema: []
4127
4186
  },
4128
- name: RULE_NAME64,
4129
- create: create64,
4187
+ name: RULE_NAME65,
4188
+ create: create65,
4130
4189
  defaultOptions: []
4131
4190
  });
4132
- function create64(context) {
4191
+ function create65(context) {
4133
4192
  const { importSource } = getSettingsFromContext(context);
4134
4193
  return {
4135
4194
  [`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
@@ -4164,15 +4223,15 @@ function create64(context) {
4164
4223
  }
4165
4224
  };
4166
4225
  }
4167
- var RULE_NAME65 = "no-comment-textnodes";
4168
- var RULE_FEATURES64 = [];
4226
+ var RULE_NAME66 = "no-comment-textnodes";
4227
+ var RULE_FEATURES65 = [];
4169
4228
  var no_comment_textnodes_default = createRule({
4170
4229
  meta: {
4171
4230
  type: "problem",
4172
4231
  deprecated: true,
4173
4232
  docs: {
4174
4233
  description: "Prevents comments from being inserted as text nodes.",
4175
- [Symbol.for("rule_features")]: RULE_FEATURES64
4234
+ [Symbol.for("rule_features")]: RULE_FEATURES65
4176
4235
  },
4177
4236
  messages: {
4178
4237
  noCommentTextnodes: "Possible misused comment in text node. Comments inside children section of tag should be placed inside braces."
@@ -4182,11 +4241,11 @@ var no_comment_textnodes_default = createRule({
4182
4241
  ],
4183
4242
  schema: []
4184
4243
  },
4185
- name: RULE_NAME65,
4186
- create: create65,
4244
+ name: RULE_NAME66,
4245
+ create: create66,
4187
4246
  defaultOptions: []
4188
4247
  });
4189
- function create65(context) {
4248
+ function create66(context) {
4190
4249
  function hasCommentLike(node) {
4191
4250
  if (AST13.isOneOf([AST_NODE_TYPES.JSXAttribute, AST_NODE_TYPES.JSXExpressionContainer])(node.parent)) {
4192
4251
  return false;
@@ -4214,8 +4273,8 @@ function create65(context) {
4214
4273
  Literal: visitorFunction
4215
4274
  };
4216
4275
  }
4217
- var RULE_NAME66 = "no-complex-conditional-rendering";
4218
- var RULE_FEATURES65 = [
4276
+ var RULE_NAME67 = "no-complex-conditional-rendering";
4277
+ var RULE_FEATURES66 = [
4219
4278
  "EXP"
4220
4279
  ];
4221
4280
  var no_complex_conditional_rendering_default = createRule({
@@ -4224,18 +4283,18 @@ var no_complex_conditional_rendering_default = createRule({
4224
4283
  deprecated: true,
4225
4284
  docs: {
4226
4285
  description: "Disallow complex conditional rendering in JSX expressions.",
4227
- [Symbol.for("rule_features")]: RULE_FEATURES65
4286
+ [Symbol.for("rule_features")]: RULE_FEATURES66
4228
4287
  },
4229
4288
  messages: {
4230
4289
  noComplexConditionalRendering: "Avoid complex conditional rendering. Extract the logic into separate elements or components."
4231
4290
  },
4232
4291
  schema: []
4233
4292
  },
4234
- name: RULE_NAME66,
4235
- create: create66,
4293
+ name: RULE_NAME67,
4294
+ create: create67,
4236
4295
  defaultOptions: []
4237
4296
  });
4238
- function create66(context) {
4297
+ function create67(context) {
4239
4298
  const visitorFunction = (node) => {
4240
4299
  const jsxExpContainer = node.parent?.parent;
4241
4300
  if (!AST13.is(AST_NODE_TYPES.JSXExpressionContainer)(jsxExpContainer)) {
@@ -4319,6 +4378,7 @@ var plugin = {
4319
4378
  "no-unstable-context-value": no_unstable_context_value_default,
4320
4379
  "no-unstable-default-props": no_unstable_default_props_default,
4321
4380
  "no-unused-class-component-members": no_unused_class_component_members_default,
4381
+ "no-unused-props": no_unused_props_default,
4322
4382
  "no-unused-state": no_unused_state_default,
4323
4383
  "no-use-context": no_use_context_default,
4324
4384
  "no-useless-forward-ref": no_useless_forward_ref_default,