eslint-plugin-react-x 1.43.2-next.1 → 1.45.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import { getDocsUrl, getSettingsFromContext, unsafeDecodeSettings, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
2
- import * as JSX8 from '@eslint-react/jsx';
2
+ import * as JSX9 from '@eslint-react/jsx';
3
3
  import { ESLintUtils } from '@typescript-eslint/utils';
4
+ import { JsxConfig, createReport, SEL } from '@eslint-react/kit';
4
5
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
5
6
  import * as VAR2 from '@eslint-react/var';
6
7
  import { match, isMatching, P } from 'ts-pattern';
7
- import { JsxConfig, createReport, SEL } from '@eslint-react/kit';
8
8
  import ts, { JsxEmit } from 'typescript';
9
9
  import * as AST8 from '@eslint-react/ast';
10
- import * as ER21 from '@eslint-react/core';
10
+ import * as ER22 from '@eslint-react/core';
11
11
  import { flow, getOrUpdate, constTrue, constFalse, _ } from '@eslint-react/eff';
12
12
  import { compare } from 'compare-versions';
13
13
  import { getConstrainedTypeAtLocation, isTypeReadonly } from '@typescript-eslint/type-utils';
@@ -52,7 +52,9 @@ var rules = {
52
52
  "react-x/no-forward-ref": "warn",
53
53
  "react-x/no-implicit-key": "warn",
54
54
  "react-x/no-missing-key": "error",
55
+ "react-x/no-misused-capture-owner-stack": "error",
55
56
  "react-x/no-nested-component-definitions": "error",
57
+ "react-x/no-nested-lazy-component-declarations": "warn",
56
58
  "react-x/no-prop-types": "error",
57
59
  "react-x/no-redundant-should-component-update": "error",
58
60
  "react-x/no-set-state-in-component-did-mount": "warn",
@@ -113,7 +115,7 @@ var settings3 = {
113
115
 
114
116
  // package.json
115
117
  var name4 = "eslint-plugin-react-x";
116
- var version = "1.43.2-next.1";
118
+ var version = "1.45.0-beta.3";
117
119
  var createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
118
120
 
119
121
  // src/rules/avoid-shorthand-boolean.ts
@@ -144,7 +146,7 @@ function create(context) {
144
146
  messageId: "avoidShorthandBoolean",
145
147
  node,
146
148
  data: {
147
- propName: JSX8.getAttributeName(node)
149
+ propName: JSX9.getAttributeName(node)
148
150
  },
149
151
  fix: (fixer) => fixer.insertTextAfter(node.name, `={true}`)
150
152
  });
@@ -152,8 +154,6 @@ function create(context) {
152
154
  }
153
155
  };
154
156
  }
155
-
156
- // src/rules/avoid-shorthand-fragment.ts
157
157
  var RULE_NAME2 = "avoid-shorthand-fragment";
158
158
  var RULE_FEATURES2 = [];
159
159
  var avoid_shorthand_fragment_default = createRule({
@@ -164,7 +164,7 @@ var avoid_shorthand_fragment_default = createRule({
164
164
  [Symbol.for("rule_features")]: RULE_FEATURES2
165
165
  },
166
166
  messages: {
167
- avoidShorthandFragment: "Avoid using shorthand fragment syntax. Use 'Fragment' component instead."
167
+ avoidShorthandFragment: "Avoid using shorthand fragment syntax. Use '{{jsxFragmentFactory}}' component instead."
168
168
  },
169
169
  schema: []
170
170
  },
@@ -173,11 +173,20 @@ var avoid_shorthand_fragment_default = createRule({
173
173
  defaultOptions: []
174
174
  });
175
175
  function create2(context) {
176
+ const jsxConfigFromContext = JsxConfig.getFromContext(context);
177
+ const jsxConfigFromAnnotation = JsxConfig.getFromAnnotation(context);
178
+ const jsxConfig = {
179
+ ...jsxConfigFromContext,
180
+ ...jsxConfigFromAnnotation
181
+ };
176
182
  return {
177
183
  JSXFragment(node) {
178
184
  context.report({
179
185
  messageId: "avoidShorthandFragment",
180
- node
186
+ node,
187
+ data: {
188
+ jsxFragmentFactory: jsxConfig.jsxFragmentFactory
189
+ }
181
190
  });
182
191
  }
183
192
  };
@@ -378,25 +387,25 @@ function create7(context) {
378
387
  const setStateEntries = [];
379
388
  return {
380
389
  CallExpression(node) {
381
- if (!ER21.isThisSetState(node)) {
390
+ if (!ER22.isThisSetState(node)) {
382
391
  return;
383
392
  }
384
393
  setStateEntries.push([node, false]);
385
394
  },
386
395
  "CallExpression:exit"(node) {
387
- if (!ER21.isThisSetState(node)) {
396
+ if (!ER22.isThisSetState(node)) {
388
397
  return;
389
398
  }
390
399
  setStateEntries.pop();
391
400
  },
392
401
  ClassDeclaration(node) {
393
- classEntries.push([node, ER21.isClassComponent(node)]);
402
+ classEntries.push([node, ER22.isClassComponent(node)]);
394
403
  },
395
404
  "ClassDeclaration:exit"() {
396
405
  classEntries.pop();
397
406
  },
398
407
  ClassExpression(node) {
399
- classEntries.push([node, ER21.isClassComponent(node)]);
408
+ classEntries.push([node, ER22.isClassComponent(node)]);
400
409
  },
401
410
  "ClassExpression:exit"() {
402
411
  classEntries.pop();
@@ -480,7 +489,7 @@ function isUsingReactChildren(context, node) {
480
489
  return true;
481
490
  }
482
491
  if (callee.object.type === AST_NODE_TYPES.MemberExpression && "name" in callee.object.object) {
483
- return ER21.isInitializedFromReact(callee.object.object.name, importSource, initialScope);
492
+ return ER22.isInitializedFromReact(callee.object.object.name, importSource, initialScope);
484
493
  }
485
494
  return false;
486
495
  }
@@ -546,7 +555,7 @@ function create8(context) {
546
555
  return node.type === AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
547
556
  }
548
557
  function isCreateOrCloneElementCall(node) {
549
- return ER21.isCreateElementCall(context, node) || ER21.isCloneElementCall(context, node);
558
+ return ER22.isCreateElementCall(context, node) || ER22.isCloneElementCall(context, node);
550
559
  }
551
560
  function getReportDescriptors(node) {
552
561
  switch (node.type) {
@@ -662,7 +671,7 @@ var no_children_count_default = createRule({
662
671
  function create9(context) {
663
672
  return {
664
673
  MemberExpression(node) {
665
- if (ER21.isChildrenCount(context, node)) {
674
+ if (ER22.isChildrenCount(context, node)) {
666
675
  context.report({
667
676
  messageId: "noChildrenCount",
668
677
  node: node.property
@@ -692,7 +701,7 @@ var no_children_for_each_default = createRule({
692
701
  function create10(context) {
693
702
  return {
694
703
  MemberExpression(node) {
695
- if (ER21.isChildrenForEach(context, node)) {
704
+ if (ER22.isChildrenForEach(context, node)) {
696
705
  context.report({
697
706
  messageId: "noChildrenForEach",
698
707
  node: node.property
@@ -722,7 +731,7 @@ var no_children_map_default = createRule({
722
731
  function create11(context) {
723
732
  return {
724
733
  MemberExpression(node) {
725
- if (ER21.isChildrenMap(context, node)) {
734
+ if (ER22.isChildrenMap(context, node)) {
726
735
  context.report({
727
736
  messageId: "noChildrenMap",
728
737
  node: node.property
@@ -752,7 +761,7 @@ var no_children_only_default = createRule({
752
761
  function create12(context) {
753
762
  return {
754
763
  MemberExpression(node) {
755
- if (ER21.isChildrenOnly(context, node)) {
764
+ if (ER22.isChildrenOnly(context, node)) {
756
765
  context.report({
757
766
  messageId: "noChildrenOnly",
758
767
  node: node.property
@@ -783,7 +792,7 @@ function create13(context) {
783
792
  return {
784
793
  JSXElement(node) {
785
794
  const attributes = node.openingElement.attributes;
786
- const childrenProp = JSX8.getAttribute("children", attributes, context.sourceCode.getScope(node));
795
+ const childrenProp = JSX9.getAttribute("children", attributes, context.sourceCode.getScope(node));
787
796
  if (childrenProp != null) {
788
797
  context.report({
789
798
  messageId: "noChildrenProp",
@@ -814,7 +823,7 @@ var no_children_to_array_default = createRule({
814
823
  function create14(context) {
815
824
  return {
816
825
  MemberExpression(node) {
817
- if (ER21.isChildrenToArray(context, node)) {
826
+ if (ER22.isChildrenToArray(context, node)) {
818
827
  context.report({
819
828
  messageId: "noChildrenToArray",
820
829
  node: node.property
@@ -829,11 +838,11 @@ var no_class_component_default = createRule({
829
838
  meta: {
830
839
  type: "problem",
831
840
  docs: {
832
- description: "Disallow class components.",
841
+ description: "Disallow class components except for error boundaries.",
833
842
  [Symbol.for("rule_features")]: RULE_FEATURES15
834
843
  },
835
844
  messages: {
836
- noClassComponent: "Do not use class components. Use function components instead."
845
+ noClassComponent: "Avoid using class components. Use function components instead."
837
846
  },
838
847
  schema: []
839
848
  },
@@ -843,13 +852,13 @@ var no_class_component_default = createRule({
843
852
  });
844
853
  function create15(context) {
845
854
  if (!context.sourceCode.text.includes("Component")) return {};
846
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
855
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
847
856
  return {
848
857
  ...listeners,
849
- "Program:exit"(node) {
850
- const components = ctx.getAllComponents(node);
858
+ "Program:exit"(program) {
859
+ const components = ctx.getAllComponents(program);
851
860
  for (const { name: name5 = "anonymous", node: component } of components.values()) {
852
- if (component.body.body.some((m) => ER21.isComponentDidCatch(m) || ER21.isGetDerivedStateFromError(m))) {
861
+ if (component.body.body.some((m) => ER22.isComponentDidCatch(m) || ER22.isGetDerivedStateFromError(m))) {
853
862
  continue;
854
863
  }
855
864
  context.report({
@@ -884,7 +893,7 @@ var no_clone_element_default = createRule({
884
893
  function create16(context) {
885
894
  return {
886
895
  CallExpression(node) {
887
- if (ER21.isCloneElementCall(context, node)) {
896
+ if (ER22.isCloneElementCall(context, node)) {
888
897
  context.report({
889
898
  messageId: "noCloneElement",
890
899
  node
@@ -1007,15 +1016,15 @@ var no_component_will_mount_default = createRule({
1007
1016
  });
1008
1017
  function create19(context) {
1009
1018
  if (!context.sourceCode.text.includes("componentWillMount")) return {};
1010
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
1019
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
1011
1020
  return {
1012
1021
  ...listeners,
1013
- "Program:exit"(node) {
1014
- const components = ctx.getAllComponents(node);
1022
+ "Program:exit"(program) {
1023
+ const components = ctx.getAllComponents(program);
1015
1024
  for (const { node: component } of components.values()) {
1016
1025
  const { body } = component.body;
1017
1026
  for (const member of body) {
1018
- if (ER21.isComponentWillMount(member)) {
1027
+ if (ER22.isComponentWillMount(member)) {
1019
1028
  context.report({
1020
1029
  messageId: "noComponentWillMount",
1021
1030
  node: member,
@@ -1055,15 +1064,15 @@ var no_component_will_receive_props_default = createRule({
1055
1064
  });
1056
1065
  function create20(context) {
1057
1066
  if (!context.sourceCode.text.includes("componentWillReceiveProps")) return {};
1058
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
1067
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
1059
1068
  return {
1060
1069
  ...listeners,
1061
- "Program:exit"(node) {
1062
- const components = ctx.getAllComponents(node);
1070
+ "Program:exit"(program) {
1071
+ const components = ctx.getAllComponents(program);
1063
1072
  for (const { node: component } of components.values()) {
1064
1073
  const { body } = component.body;
1065
1074
  for (const member of body) {
1066
- if (ER21.isComponentWillReceiveProps(member)) {
1075
+ if (ER22.isComponentWillReceiveProps(member)) {
1067
1076
  context.report({
1068
1077
  messageId: "noComponentWillReceiveProps",
1069
1078
  node: member,
@@ -1103,15 +1112,15 @@ var no_component_will_update_default = createRule({
1103
1112
  });
1104
1113
  function create21(context) {
1105
1114
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
1106
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
1115
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
1107
1116
  return {
1108
1117
  ...listeners,
1109
- "Program:exit"(node) {
1110
- const components = ctx.getAllComponents(node);
1118
+ "Program:exit"(program) {
1119
+ const components = ctx.getAllComponents(program);
1111
1120
  for (const { node: component } of components.values()) {
1112
1121
  const { body } = component.body;
1113
1122
  for (const member of body) {
1114
- if (ER21.isComponentWillUpdate(member)) {
1123
+ if (ER22.isComponentWillUpdate(member)) {
1115
1124
  context.report({
1116
1125
  messageId: "noComponentWillUpdate",
1117
1126
  node: member,
@@ -1155,7 +1164,7 @@ function create22(context) {
1155
1164
  if (compare(version2, "19.0.0", "<")) return {};
1156
1165
  return {
1157
1166
  JSXElement(node) {
1158
- const fullName = JSX8.getElementType(node);
1167
+ const fullName = JSX9.getElementType(node);
1159
1168
  const parts = fullName.split(".");
1160
1169
  const selfName = parts.pop();
1161
1170
  const contextFullName = parts.join(".");
@@ -1166,7 +1175,7 @@ function create22(context) {
1166
1175
  messageId: "noContextProvider",
1167
1176
  node,
1168
1177
  fix(fixer) {
1169
- if (!ER21.isComponentNameLoose(contextSelfName)) return null;
1178
+ if (!ER22.isComponentNameLoose(contextSelfName)) return null;
1170
1179
  const openingElement = node.openingElement;
1171
1180
  const closingElement = node.closingElement;
1172
1181
  if (closingElement == null) {
@@ -1202,7 +1211,7 @@ var no_create_ref_default = createRule({
1202
1211
  function create23(context) {
1203
1212
  return {
1204
1213
  CallExpression(node) {
1205
- if (ER21.isCreateRefCall(context, node) && AST8.findParentNode(node, ER21.isClassComponent) == null) {
1214
+ if (ER22.isCreateRefCall(context, node) && AST8.findParentNode(node, ER22.isClassComponent) == null) {
1206
1215
  context.report({ messageId: "noCreateRef", node });
1207
1216
  }
1208
1217
  }
@@ -1240,17 +1249,17 @@ function create24(context) {
1240
1249
  if (property.type !== AST_NODE_TYPES.Identifier || property.name !== "defaultProps") {
1241
1250
  return;
1242
1251
  }
1243
- if (!ER21.isComponentNameLoose(object.name)) {
1252
+ if (!ER22.isComponentNameLoose(object.name)) {
1244
1253
  return;
1245
1254
  }
1246
1255
  const variable = VAR2.findVariable(object.name, context.sourceCode.getScope(node));
1247
1256
  const variableNode = VAR2.getVariableInitNode(variable, 0);
1248
1257
  if (variableNode == null) return;
1249
- if (!AST8.isFunction(variableNode) && !ER21.isClassComponent(variableNode)) return;
1258
+ if (!AST8.isFunction(variableNode) && !ER22.isClassComponent(variableNode)) return;
1250
1259
  context.report({ messageId: "noDefaultProps", node: property });
1251
1260
  },
1252
1261
  PropertyDefinition(node) {
1253
- if (!ER21.isClassComponent(node.parent.parent)) {
1262
+ if (!ER22.isClassComponent(node.parent.parent)) {
1254
1263
  return;
1255
1264
  }
1256
1265
  if (!node.static || node.key.type !== AST_NODE_TYPES.Identifier || node.key.name !== "defaultProps") {
@@ -1284,7 +1293,7 @@ var no_direct_mutation_state_default = createRule({
1284
1293
  function create25(context) {
1285
1294
  return {
1286
1295
  AssignmentExpression(node) {
1287
- if (!ER21.isAssignmentToThisState(node)) return;
1296
+ if (!ER22.isAssignmentToThisState(node)) return;
1288
1297
  const parentClass = AST8.findParentNode(
1289
1298
  node,
1290
1299
  AST8.isOneOf([
@@ -1293,7 +1302,7 @@ function create25(context) {
1293
1302
  ])
1294
1303
  );
1295
1304
  if (parentClass == null) return;
1296
- if (ER21.isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST8.findParentNode(node, isConstructorFunction)) {
1305
+ if (ER22.isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST8.findParentNode(node, isConstructorFunction)) {
1297
1306
  context.report({
1298
1307
  messageId: "noDirectMutationState",
1299
1308
  node
@@ -1415,7 +1424,7 @@ function create27(context) {
1415
1424
  }
1416
1425
  return {
1417
1426
  CallExpression(node) {
1418
- if (!ER21.isForwardRefCall(context, node)) {
1427
+ if (!ER22.isForwardRefCall(context, node)) {
1419
1428
  return;
1420
1429
  }
1421
1430
  context.report({
@@ -1517,7 +1526,7 @@ function create28(context) {
1517
1526
  return {
1518
1527
  JSXOpeningElement(node) {
1519
1528
  const initialScope = context.sourceCode.getScope(node);
1520
- const keyPropFound = JSX8.getAttribute("key", node.attributes, initialScope);
1529
+ const keyPropFound = JSX9.getAttribute("key", node.attributes, initialScope);
1521
1530
  const keyPropOnElement = node.attributes.some(
1522
1531
  (n) => n.type === AST_NODE_TYPES.JSXAttribute && n.name.type === AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
1523
1532
  );
@@ -1705,21 +1714,21 @@ function create30(context) {
1705
1714
  const {
1706
1715
  ctx,
1707
1716
  listeners
1708
- } = ER21.useComponentCollector(
1717
+ } = ER22.useComponentCollector(
1709
1718
  context,
1710
1719
  {
1711
1720
  collectDisplayName: true,
1712
1721
  collectHookCalls: false,
1713
- hint: ER21.DEFAULT_COMPONENT_DETECTION_HINT
1722
+ hint: ER22.DEFAULT_COMPONENT_DETECTION_HINT
1714
1723
  }
1715
1724
  );
1716
1725
  return {
1717
1726
  ...listeners,
1718
- "Program:exit"(node) {
1719
- const components = ctx.getAllComponents(node);
1720
- for (const { node: node2, displayName, flag } of components.values()) {
1721
- const isMemoOrForwardRef = (flag & (ER21.ComponentFlag.ForwardRef | ER21.ComponentFlag.Memo)) > 0n;
1722
- if (AST8.getFunctionIdentifier(node2) != null) {
1727
+ "Program:exit"(program) {
1728
+ const components = ctx.getAllComponents(program);
1729
+ for (const { node, displayName, flag } of components.values()) {
1730
+ const isMemoOrForwardRef = (flag & (ER22.ComponentFlag.ForwardRef | ER22.ComponentFlag.Memo)) > 0n;
1731
+ if (AST8.getFunctionIdentifier(node) != null) {
1723
1732
  continue;
1724
1733
  }
1725
1734
  if (!isMemoOrForwardRef) {
@@ -1728,7 +1737,7 @@ function create30(context) {
1728
1737
  if (displayName == null) {
1729
1738
  context.report({
1730
1739
  messageId: "noMissingComponentDisplayName",
1731
- node: node2
1740
+ node
1732
1741
  });
1733
1742
  }
1734
1743
  }
@@ -1759,12 +1768,12 @@ function create31(context) {
1759
1768
  const displayNameAssignments = [];
1760
1769
  return {
1761
1770
  CallExpression(node) {
1762
- if (!ER21.isCreateContextCall(context, node)) return;
1771
+ if (!ER22.isCreateContextCall(context, node)) return;
1763
1772
  createCalls.push(node);
1764
1773
  },
1765
1774
  "Program:exit"() {
1766
1775
  for (const call of createCalls) {
1767
- const id = ER21.getInstanceId(call);
1776
+ const id = ER22.getInstanceId(call);
1768
1777
  if (id == null) {
1769
1778
  context.report({
1770
1779
  messageId: "noMissingContextDisplayName",
@@ -1776,7 +1785,7 @@ function create31(context) {
1776
1785
  const left = node.left;
1777
1786
  if (left.type !== AST_NODE_TYPES.MemberExpression) return false;
1778
1787
  const object = left.object;
1779
- return ER21.isInstanceIdEqual(context, id, object);
1788
+ return ER22.isInstanceIdEqual(context, id, object);
1780
1789
  });
1781
1790
  if (!hasDisplayNameAssignment) {
1782
1791
  context.report({
@@ -1817,7 +1826,7 @@ function create32(context) {
1817
1826
  switch (node.type) {
1818
1827
  case AST_NODE_TYPES.JSXElement: {
1819
1828
  const initialScope = context.sourceCode.getScope(node);
1820
- if (!JSX8.hasAttribute("key", node.openingElement.attributes, initialScope)) {
1829
+ if (!JSX9.hasAttribute("key", node.openingElement.attributes, initialScope)) {
1821
1830
  return {
1822
1831
  messageId: "missingKey",
1823
1832
  node
@@ -1874,7 +1883,7 @@ function create32(context) {
1874
1883
  }
1875
1884
  const initialScope = context.sourceCode.getScope(node);
1876
1885
  for (const element of elements) {
1877
- if (!JSX8.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1886
+ if (!JSX9.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1878
1887
  report({
1879
1888
  messageId: "missingKey",
1880
1889
  node: element
@@ -1883,7 +1892,7 @@ function create32(context) {
1883
1892
  }
1884
1893
  },
1885
1894
  CallExpression(node) {
1886
- state.isWithinChildrenToArray ||= ER21.isChildrenToArrayCall(context, node);
1895
+ state.isWithinChildrenToArray ||= ER22.isChildrenToArrayCall(context, node);
1887
1896
  if (state.isWithinChildrenToArray) return;
1888
1897
  const callback = match(node).when(AST8.isArrayMapCall, (n) => n.arguments[0]).when(AST8.isArrayFromCall, (n) => n.arguments[1]).otherwise(() => null);
1889
1898
  if (!AST8.isFunction(callback)) return;
@@ -1895,7 +1904,7 @@ function create32(context) {
1895
1904
  report(checkExpression(body));
1896
1905
  },
1897
1906
  "CallExpression:exit"(node) {
1898
- if (!ER21.isChildrenToArrayCall(context, node)) {
1907
+ if (!ER22.isChildrenToArrayCall(context, node)) {
1899
1908
  return;
1900
1909
  }
1901
1910
  state.isWithinChildrenToArray = false;
@@ -1913,17 +1922,22 @@ function create32(context) {
1913
1922
  }
1914
1923
  };
1915
1924
  }
1916
- var RULE_NAME33 = "no-nested-component-definitions";
1917
- var RULE_FEATURES33 = [];
1918
- var no_nested_component_definitions_default = createRule({
1925
+ var RULE_NAME33 = "no-misused-capture-owner-stack";
1926
+ var RULE_FEATURES33 = [
1927
+ "EXP"
1928
+ ];
1929
+ var no_misused_capture_owner_stack_default = createRule({
1919
1930
  meta: {
1920
1931
  type: "problem",
1921
1932
  docs: {
1922
- description: "Disallow nesting component definitions inside other components.",
1933
+ description: "Prevents incorrect usage of `captureOwnerStack`.",
1923
1934
  [Symbol.for("rule_features")]: RULE_FEATURES33
1924
1935
  },
1936
+ fixable: "code",
1925
1937
  messages: {
1926
- noNestedComponentDefinitions: "Do not nest component definitions inside other components or props. {{suggestion}}"
1938
+ useNamespaceImport: "Don't use named imports of 'captureOwnerStack' in files that are bundled for development and production. Use a namespace import instead.",
1939
+ // eslint-disable-next-line perfectionist/sort-objects
1940
+ missingDevelopmentOnlyCheck: `Don't call 'captureOwnerStack' directly. Use 'if (process.env.NODE_ENV !== "production") {...}' to conditionally access it.`
1927
1941
  },
1928
1942
  schema: []
1929
1943
  },
@@ -1932,30 +1946,81 @@ var no_nested_component_definitions_default = createRule({
1932
1946
  defaultOptions: []
1933
1947
  });
1934
1948
  function create33(context) {
1935
- const hint = ER21.ComponentDetectionHint.SkipArrayMapArgument | ER21.ComponentDetectionHint.SkipNullLiteral | ER21.ComponentDetectionHint.SkipUndefined | ER21.ComponentDetectionHint.SkipBooleanLiteral | ER21.ComponentDetectionHint.SkipStringLiteral | ER21.ComponentDetectionHint.SkipNumberLiteral | ER21.ComponentDetectionHint.StrictLogical | ER21.ComponentDetectionHint.StrictConditional;
1936
- const collector = ER21.useComponentCollector(context, { hint });
1937
- const collectorLegacy = ER21.useComponentCollectorLegacy();
1949
+ if (!context.sourceCode.text.includes("captureOwnerStack")) return {};
1950
+ const { importSource } = getSettingsFromContext(context);
1951
+ return {
1952
+ CallExpression(node) {
1953
+ if (!ER22.isCaptureOwnerStackCall(context, node)) return;
1954
+ if (AST8.findParentNode(node, isDevelopmentOnlyCheck) == null) {
1955
+ context.report({
1956
+ messageId: "missingDevelopmentOnlyCheck",
1957
+ node
1958
+ });
1959
+ }
1960
+ },
1961
+ ImportDeclaration(node) {
1962
+ if (node.source.value !== importSource) return;
1963
+ for (const specifier of node.specifiers) {
1964
+ if (specifier.type !== AST_NODE_TYPES.ImportSpecifier) continue;
1965
+ if (specifier.imported.type !== AST_NODE_TYPES.Identifier) continue;
1966
+ if (specifier.imported.name === "captureOwnerStack") {
1967
+ context.report({
1968
+ messageId: "useNamespaceImport",
1969
+ node: specifier
1970
+ });
1971
+ }
1972
+ }
1973
+ }
1974
+ };
1975
+ }
1976
+ function isDevelopmentOnlyCheck(node) {
1977
+ if (node.type !== AST_NODE_TYPES.IfStatement) return false;
1978
+ if (AST8.isProcessEnvNodeEnvCompare(node.test, "!==", "production")) return true;
1979
+ return false;
1980
+ }
1981
+ var RULE_NAME34 = "no-nested-component-definitions";
1982
+ var RULE_FEATURES34 = [];
1983
+ var no_nested_component_definitions_default = createRule({
1984
+ meta: {
1985
+ type: "problem",
1986
+ docs: {
1987
+ description: "Disallow nesting component definitions inside other components.",
1988
+ [Symbol.for("rule_features")]: RULE_FEATURES34
1989
+ },
1990
+ messages: {
1991
+ noNestedComponentDefinitions: "Do not nest component definitions inside other components or props. {{suggestion}}"
1992
+ },
1993
+ schema: []
1994
+ },
1995
+ name: RULE_NAME34,
1996
+ create: create34,
1997
+ defaultOptions: []
1998
+ });
1999
+ function create34(context) {
2000
+ const hint = ER22.ComponentDetectionHint.SkipArrayMapArgument | ER22.ComponentDetectionHint.SkipNullLiteral | ER22.ComponentDetectionHint.SkipUndefined | ER22.ComponentDetectionHint.SkipBooleanLiteral | ER22.ComponentDetectionHint.SkipStringLiteral | ER22.ComponentDetectionHint.SkipNumberLiteral | ER22.ComponentDetectionHint.StrictLogical | ER22.ComponentDetectionHint.StrictConditional;
2001
+ const collector = ER22.useComponentCollector(context, { hint });
2002
+ const collectorLegacy = ER22.useComponentCollectorLegacy();
1938
2003
  return {
1939
2004
  ...collector.listeners,
1940
2005
  ...collectorLegacy.listeners,
1941
- "Program:exit"(node) {
2006
+ "Program:exit"(program) {
1942
2007
  const functionComponents = [
1943
- ...collector.ctx.getAllComponents(node).values()
2008
+ ...collector.ctx.getAllComponents(program).values()
1944
2009
  ];
1945
2010
  const classComponents = [
1946
- ...collectorLegacy.ctx.getAllComponents(node).values()
2011
+ ...collectorLegacy.ctx.getAllComponents(program).values()
1947
2012
  ];
1948
- const isFunctionComponent = (node2) => {
1949
- return AST8.isFunction(node2) && functionComponents.some((component) => component.node === node2);
2013
+ const isFunctionComponent = (node) => {
2014
+ return AST8.isFunction(node) && functionComponents.some((component) => component.node === node);
1950
2015
  };
1951
- const isClassComponent12 = (node2) => {
1952
- return AST8.isClass(node2) && classComponents.some((component) => component.node === node2);
2016
+ const isClassComponent12 = (node) => {
2017
+ return AST8.isClass(node) && classComponents.some((component) => component.node === node);
1953
2018
  };
1954
2019
  for (const { name: name5, node: component } of functionComponents) {
1955
2020
  if (name5 == null) continue;
1956
- if (ER21.isDirectValueOfRenderPropertyLoose(component)) continue;
2021
+ if (ER22.isDirectValueOfRenderPropertyLoose(component)) continue;
1957
2022
  if (isInsideJSXAttributeValue(component)) {
1958
- if (!ER21.isDeclaredInRenderPropLoose(component)) {
2023
+ if (!ER22.isDeclaredInRenderPropLoose(component)) {
1959
2024
  context.report({
1960
2025
  messageId: "noNestedComponentDefinitions",
1961
2026
  node: component,
@@ -1979,7 +2044,7 @@ function create33(context) {
1979
2044
  continue;
1980
2045
  }
1981
2046
  const parentComponent = AST8.findParentNode(component, isFunctionComponent);
1982
- if (parentComponent != null && !ER21.isDirectValueOfRenderPropertyLoose(parentComponent)) {
2047
+ if (parentComponent != null && !ER22.isDirectValueOfRenderPropertyLoose(parentComponent)) {
1983
2048
  context.report({
1984
2049
  messageId: "noNestedComponentDefinitions",
1985
2050
  node: component,
@@ -1990,7 +2055,7 @@ function create33(context) {
1990
2055
  });
1991
2056
  continue;
1992
2057
  }
1993
- if (ER21.isInsideRenderMethod(component)) {
2058
+ if (ER22.isInsideRenderMethod(component)) {
1994
2059
  context.report({
1995
2060
  messageId: "noNestedComponentDefinitions",
1996
2061
  node: component,
@@ -2018,34 +2083,97 @@ function create33(context) {
2018
2083
  };
2019
2084
  }
2020
2085
  function isInsideJSXAttributeValue(node) {
2021
- return node.parent.type === AST_NODE_TYPES.JSXAttribute || JSX8.findParentAttribute(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer) != null;
2086
+ return node.parent.type === AST_NODE_TYPES.JSXAttribute || JSX9.findParentAttribute(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer) != null;
2022
2087
  }
2023
2088
  function isInsideCreateElementProps(context, node) {
2024
- const call = AST8.findParentNode(node, ER21.isCreateElementCall(context));
2089
+ const call = AST8.findParentNode(node, ER22.isCreateElementCall(context));
2025
2090
  if (call == null) return false;
2026
2091
  const prop = AST8.findParentNode(node, AST8.is(AST_NODE_TYPES.ObjectExpression));
2027
2092
  if (prop == null) return false;
2028
2093
  return prop === call.arguments[1];
2029
2094
  }
2030
- var RULE_NAME34 = "no-prop-types";
2031
- var RULE_FEATURES34 = [];
2095
+ var RULE_NAME35 = "no-nested-component-definitions";
2096
+ var RULE_FEATURES35 = [];
2097
+ var no_nested_lazy_component_declarations_default = createRule({
2098
+ meta: {
2099
+ type: "problem",
2100
+ docs: {
2101
+ description: "Disallow nesting lazy component declarations inside other components.",
2102
+ [Symbol.for("rule_features")]: RULE_FEATURES35
2103
+ },
2104
+ messages: {
2105
+ noNestedComponentDefinitions: "Do not declare lazy components inside other components. Instead, always declare them at the top level of your module."
2106
+ },
2107
+ schema: []
2108
+ },
2109
+ name: RULE_NAME35,
2110
+ create: create35,
2111
+ defaultOptions: []
2112
+ });
2113
+ function create35(context) {
2114
+ const hint = ER22.ComponentDetectionHint.None;
2115
+ const collector = ER22.useComponentCollector(context, { hint });
2116
+ const collectorLegacy = ER22.useComponentCollectorLegacy();
2117
+ const lazyComponentDeclarations = /* @__PURE__ */ new Set();
2118
+ return {
2119
+ ...collector.listeners,
2120
+ ...collectorLegacy.listeners,
2121
+ ImportExpression(node) {
2122
+ const lazyCall = AST8.findParentNode(node, (n) => ER22.isLazyCall(context, n));
2123
+ if (lazyCall != null) {
2124
+ lazyComponentDeclarations.add(lazyCall);
2125
+ }
2126
+ },
2127
+ "Program:exit"(program) {
2128
+ const functionComponents = [
2129
+ ...collector.ctx.getAllComponents(program).values()
2130
+ ];
2131
+ const classComponents = [
2132
+ ...collectorLegacy.ctx.getAllComponents(program).values()
2133
+ ];
2134
+ for (const lazy of lazyComponentDeclarations) {
2135
+ const significantParent = AST8.findParentNode(lazy, (n) => {
2136
+ if (JSX9.isJSX(n)) return true;
2137
+ if (n.type === AST_NODE_TYPES.CallExpression) {
2138
+ return ER22.isReactHookCall(n) || ER22.isCreateElementCall(context, n) || ER22.isCreateContextCall(context, n);
2139
+ }
2140
+ if (AST8.isFunction(n)) {
2141
+ return functionComponents.some((c) => c.node === n);
2142
+ }
2143
+ if (AST8.isClass(n)) {
2144
+ return classComponents.some((c) => c.node === n);
2145
+ }
2146
+ return false;
2147
+ });
2148
+ if (significantParent != null) {
2149
+ context.report({
2150
+ messageId: "noNestedComponentDefinitions",
2151
+ node: lazy
2152
+ });
2153
+ }
2154
+ }
2155
+ }
2156
+ };
2157
+ }
2158
+ var RULE_NAME36 = "no-prop-types";
2159
+ var RULE_FEATURES36 = [];
2032
2160
  var no_prop_types_default = createRule({
2033
2161
  meta: {
2034
2162
  type: "problem",
2035
2163
  docs: {
2036
2164
  description: "Disallow `propTypes` in favor of TypeScript or another type-checking solution.",
2037
- [Symbol.for("rule_features")]: RULE_FEATURES34
2165
+ [Symbol.for("rule_features")]: RULE_FEATURES36
2038
2166
  },
2039
2167
  messages: {
2040
2168
  noPropTypes: "[Deprecated] Use TypeScript or another type-checking solution instead."
2041
2169
  },
2042
2170
  schema: []
2043
2171
  },
2044
- name: RULE_NAME34,
2045
- create: create34,
2172
+ name: RULE_NAME36,
2173
+ create: create36,
2046
2174
  defaultOptions: []
2047
2175
  });
2048
- function create34(context) {
2176
+ function create36(context) {
2049
2177
  if (!context.sourceCode.text.includes("propTypes")) {
2050
2178
  return {};
2051
2179
  }
@@ -2061,17 +2189,17 @@ function create34(context) {
2061
2189
  if (property.type !== AST_NODE_TYPES.Identifier || property.name !== "propTypes") {
2062
2190
  return;
2063
2191
  }
2064
- if (!ER21.isComponentNameLoose(object.name)) {
2192
+ if (!ER22.isComponentNameLoose(object.name)) {
2065
2193
  return;
2066
2194
  }
2067
2195
  const variable = VAR2.findVariable(object.name, context.sourceCode.getScope(node));
2068
2196
  const variableNode = VAR2.getVariableInitNode(variable, 0);
2069
- if (variableNode != null && (AST8.isFunction(variableNode) || ER21.isClassComponent(variableNode))) {
2197
+ if (variableNode != null && (AST8.isFunction(variableNode) || ER22.isClassComponent(variableNode))) {
2070
2198
  context.report({ messageId: "noPropTypes", node: property });
2071
2199
  }
2072
2200
  },
2073
2201
  PropertyDefinition(node) {
2074
- if (!ER21.isClassComponent(node.parent.parent)) {
2202
+ if (!ER22.isClassComponent(node.parent.parent)) {
2075
2203
  return;
2076
2204
  }
2077
2205
  if (!node.static || node.key.type !== AST_NODE_TYPES.Identifier || node.key.name !== "propTypes") {
@@ -2081,8 +2209,8 @@ function create34(context) {
2081
2209
  }
2082
2210
  };
2083
2211
  }
2084
- var RULE_NAME35 = "no-redundant-should-component-update";
2085
- var RULE_FEATURES35 = [];
2212
+ var RULE_NAME37 = "no-redundant-should-component-update";
2213
+ var RULE_FEATURES37 = [];
2086
2214
  function isShouldComponentUpdate(node) {
2087
2215
  return AST8.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
2088
2216
  }
@@ -2091,26 +2219,26 @@ var no_redundant_should_component_update_default = createRule({
2091
2219
  type: "problem",
2092
2220
  docs: {
2093
2221
  description: "Disallow `shouldComponentUpdate` when extending `React.PureComponent`.",
2094
- [Symbol.for("rule_features")]: RULE_FEATURES35
2222
+ [Symbol.for("rule_features")]: RULE_FEATURES37
2095
2223
  },
2096
2224
  messages: {
2097
2225
  noRedundantShouldComponentUpdate: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'."
2098
2226
  },
2099
2227
  schema: []
2100
2228
  },
2101
- name: RULE_NAME35,
2102
- create: create35,
2229
+ name: RULE_NAME37,
2230
+ create: create37,
2103
2231
  defaultOptions: []
2104
2232
  });
2105
- function create35(context) {
2233
+ function create37(context) {
2106
2234
  if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
2107
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
2235
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
2108
2236
  return {
2109
2237
  ...listeners,
2110
- "Program:exit"(node) {
2111
- const components = ctx.getAllComponents(node);
2238
+ "Program:exit"(program) {
2239
+ const components = ctx.getAllComponents(program);
2112
2240
  for (const { name: name5 = "PureComponent", node: component, flag } of components.values()) {
2113
- if ((flag & ER21.ComponentFlag.PureComponent) === 0n) {
2241
+ if ((flag & ER22.ComponentFlag.PureComponent) === 0n) {
2114
2242
  continue;
2115
2243
  }
2116
2244
  const { body } = component.body;
@@ -2129,33 +2257,33 @@ function create35(context) {
2129
2257
  }
2130
2258
  };
2131
2259
  }
2132
- var RULE_NAME36 = "no-set-state-in-component-did-mount";
2133
- var RULE_FEATURES36 = [];
2260
+ var RULE_NAME38 = "no-set-state-in-component-did-mount";
2261
+ var RULE_FEATURES38 = [];
2134
2262
  var no_set_state_in_component_did_mount_default = createRule({
2135
2263
  meta: {
2136
2264
  type: "problem",
2137
2265
  docs: {
2138
2266
  description: "Disallow calling `this.setState` in `componentDidMount` outside of functions, such as callbacks.",
2139
- [Symbol.for("rule_features")]: RULE_FEATURES36
2267
+ [Symbol.for("rule_features")]: RULE_FEATURES38
2140
2268
  },
2141
2269
  messages: {
2142
2270
  noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions, such as callbacks."
2143
2271
  },
2144
2272
  schema: []
2145
2273
  },
2146
- name: RULE_NAME36,
2147
- create: create36,
2274
+ name: RULE_NAME38,
2275
+ create: create38,
2148
2276
  defaultOptions: []
2149
2277
  });
2150
- function create36(context) {
2278
+ function create38(context) {
2151
2279
  if (!context.sourceCode.text.includes("componentDidMount")) return {};
2152
2280
  return {
2153
2281
  CallExpression(node) {
2154
- if (!ER21.isThisSetState(node)) {
2282
+ if (!ER22.isThisSetState(node)) {
2155
2283
  return;
2156
2284
  }
2157
- const clazz = AST8.findParentNode(node, ER21.isClassComponent);
2158
- const method = AST8.findParentNode(node, (n) => n === clazz || ER21.isComponentDidMount(n));
2285
+ const clazz = AST8.findParentNode(node, ER22.isClassComponent);
2286
+ const method = AST8.findParentNode(node, (n) => n === clazz || ER22.isComponentDidMount(n));
2159
2287
  if (clazz == null || method == null || method === clazz) return;
2160
2288
  const methodScope = context.sourceCode.getScope(method);
2161
2289
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2168,33 +2296,33 @@ function create36(context) {
2168
2296
  }
2169
2297
  };
2170
2298
  }
2171
- var RULE_NAME37 = "no-set-state-in-component-did-update";
2172
- var RULE_FEATURES37 = [];
2299
+ var RULE_NAME39 = "no-set-state-in-component-did-update";
2300
+ var RULE_FEATURES39 = [];
2173
2301
  var no_set_state_in_component_did_update_default = createRule({
2174
2302
  meta: {
2175
2303
  type: "problem",
2176
2304
  docs: {
2177
- description: "Disallows calling `this.setState` in `componentDidUpdate` outside of functions, such as callbacks.",
2178
- [Symbol.for("rule_features")]: RULE_FEATURES37
2305
+ description: "Disallow calling `this.setState` in `componentDidUpdate` outside of functions, such as callbacks.",
2306
+ [Symbol.for("rule_features")]: RULE_FEATURES39
2179
2307
  },
2180
2308
  messages: {
2181
2309
  noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions, such as callbacks."
2182
2310
  },
2183
2311
  schema: []
2184
2312
  },
2185
- name: RULE_NAME37,
2186
- create: create37,
2313
+ name: RULE_NAME39,
2314
+ create: create39,
2187
2315
  defaultOptions: []
2188
2316
  });
2189
- function create37(context) {
2317
+ function create39(context) {
2190
2318
  if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
2191
2319
  return {
2192
2320
  CallExpression(node) {
2193
- if (!ER21.isThisSetState(node)) {
2321
+ if (!ER22.isThisSetState(node)) {
2194
2322
  return;
2195
2323
  }
2196
- const clazz = AST8.findParentNode(node, ER21.isClassComponent);
2197
- const method = AST8.findParentNode(node, (n) => n === clazz || ER21.isComponentDidUpdate(n));
2324
+ const clazz = AST8.findParentNode(node, ER22.isClassComponent);
2325
+ const method = AST8.findParentNode(node, (n) => n === clazz || ER22.isComponentDidUpdate(n));
2198
2326
  if (clazz == null || method == null || method === clazz) return;
2199
2327
  const methodScope = context.sourceCode.getScope(method);
2200
2328
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2207,33 +2335,33 @@ function create37(context) {
2207
2335
  }
2208
2336
  };
2209
2337
  }
2210
- var RULE_NAME38 = "no-set-state-in-component-will-update";
2211
- var RULE_FEATURES38 = [];
2338
+ var RULE_NAME40 = "no-set-state-in-component-will-update";
2339
+ var RULE_FEATURES40 = [];
2212
2340
  var no_set_state_in_component_will_update_default = createRule({
2213
2341
  meta: {
2214
2342
  type: "problem",
2215
2343
  docs: {
2216
2344
  description: "Disallows calling `this.setState` in `componentWillUpdate` outside of functions, such as callbacks.",
2217
- [Symbol.for("rule_features")]: RULE_FEATURES38
2345
+ [Symbol.for("rule_features")]: RULE_FEATURES40
2218
2346
  },
2219
2347
  messages: {
2220
2348
  noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions, such as callbacks."
2221
2349
  },
2222
2350
  schema: []
2223
2351
  },
2224
- name: RULE_NAME38,
2225
- create: create38,
2352
+ name: RULE_NAME40,
2353
+ create: create40,
2226
2354
  defaultOptions: []
2227
2355
  });
2228
- function create38(context) {
2356
+ function create40(context) {
2229
2357
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
2230
2358
  return {
2231
2359
  CallExpression(node) {
2232
- if (!ER21.isThisSetState(node)) {
2360
+ if (!ER22.isThisSetState(node)) {
2233
2361
  return;
2234
2362
  }
2235
- const clazz = AST8.findParentNode(node, ER21.isClassComponent);
2236
- const method = AST8.findParentNode(node, (n) => n === clazz || ER21.isComponentWillUpdate(n));
2363
+ const clazz = AST8.findParentNode(node, ER22.isClassComponent);
2364
+ const method = AST8.findParentNode(node, (n) => n === clazz || ER22.isComponentWillUpdate(n));
2237
2365
  if (clazz == null || method == null || method === clazz) return;
2238
2366
  const methodScope = context.sourceCode.getScope(method);
2239
2367
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2246,8 +2374,8 @@ function create38(context) {
2246
2374
  }
2247
2375
  };
2248
2376
  }
2249
- var RULE_NAME39 = "no-string-refs";
2250
- var RULE_FEATURES39 = [
2377
+ var RULE_NAME41 = "no-string-refs";
2378
+ var RULE_FEATURES41 = [
2251
2379
  "MOD"
2252
2380
  ];
2253
2381
  var no_string_refs_default = createRule({
@@ -2255,7 +2383,7 @@ var no_string_refs_default = createRule({
2255
2383
  type: "problem",
2256
2384
  docs: {
2257
2385
  description: "Replaces string refs with callback refs.",
2258
- [Symbol.for("rule_features")]: RULE_FEATURES39
2386
+ [Symbol.for("rule_features")]: RULE_FEATURES41
2259
2387
  },
2260
2388
  fixable: "code",
2261
2389
  messages: {
@@ -2263,16 +2391,16 @@ var no_string_refs_default = createRule({
2263
2391
  },
2264
2392
  schema: []
2265
2393
  },
2266
- name: RULE_NAME39,
2267
- create: create39,
2394
+ name: RULE_NAME41,
2395
+ create: create41,
2268
2396
  defaultOptions: []
2269
2397
  });
2270
- function create39(context) {
2398
+ function create41(context) {
2271
2399
  const state = {
2272
2400
  isWithinClassComponent: false
2273
2401
  };
2274
2402
  function onClassBodyEnter(node) {
2275
- if (ER21.isClassComponent(node.parent)) {
2403
+ if (ER22.isClassComponent(node.parent)) {
2276
2404
  state.isWithinClassComponent = true;
2277
2405
  }
2278
2406
  }
@@ -2311,8 +2439,8 @@ function getAttributeValueText(context, node) {
2311
2439
  return null;
2312
2440
  }
2313
2441
  }
2314
- var RULE_NAME40 = "no-unsafe-component-will-mount";
2315
- var RULE_FEATURES40 = [];
2442
+ var RULE_NAME42 = "no-unsafe-component-will-mount";
2443
+ var RULE_FEATURES42 = [];
2316
2444
  function isUnsafeComponentWillMount(node) {
2317
2445
  return AST8.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillMount";
2318
2446
  }
@@ -2321,24 +2449,24 @@ var no_unsafe_component_will_mount_default = createRule({
2321
2449
  type: "problem",
2322
2450
  docs: {
2323
2451
  description: "Warns the usage of `UNSAFE_componentWillMount` in class components.",
2324
- [Symbol.for("rule_features")]: RULE_FEATURES40
2452
+ [Symbol.for("rule_features")]: RULE_FEATURES42
2325
2453
  },
2326
2454
  messages: {
2327
2455
  noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'."
2328
2456
  },
2329
2457
  schema: []
2330
2458
  },
2331
- name: RULE_NAME40,
2332
- create: create40,
2459
+ name: RULE_NAME42,
2460
+ create: create42,
2333
2461
  defaultOptions: []
2334
2462
  });
2335
- function create40(context) {
2463
+ function create42(context) {
2336
2464
  if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
2337
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
2465
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
2338
2466
  return {
2339
2467
  ...listeners,
2340
- "Program:exit"(node) {
2341
- const components = ctx.getAllComponents(node);
2468
+ "Program:exit"(program) {
2469
+ const components = ctx.getAllComponents(program);
2342
2470
  for (const { node: component } of components.values()) {
2343
2471
  const { body } = component.body;
2344
2472
  for (const member of body) {
@@ -2353,8 +2481,8 @@ function create40(context) {
2353
2481
  }
2354
2482
  };
2355
2483
  }
2356
- var RULE_NAME41 = "no-unsafe-component-will-receive-props";
2357
- var RULE_FEATURES41 = [];
2484
+ var RULE_NAME43 = "no-unsafe-component-will-receive-props";
2485
+ var RULE_FEATURES43 = [];
2358
2486
  function isUnsafeComponentWillReceiveProps(node) {
2359
2487
  return AST8.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillReceiveProps";
2360
2488
  }
@@ -2363,26 +2491,26 @@ var no_unsafe_component_will_receive_props_default = createRule({
2363
2491
  type: "problem",
2364
2492
  docs: {
2365
2493
  description: "Warns the usage of `UNSAFE_componentWillReceiveProps` in class components.",
2366
- [Symbol.for("rule_features")]: RULE_FEATURES41
2494
+ [Symbol.for("rule_features")]: RULE_FEATURES43
2367
2495
  },
2368
2496
  messages: {
2369
2497
  noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'."
2370
2498
  },
2371
2499
  schema: []
2372
2500
  },
2373
- name: RULE_NAME41,
2374
- create: create41,
2501
+ name: RULE_NAME43,
2502
+ create: create43,
2375
2503
  defaultOptions: []
2376
2504
  });
2377
- function create41(context) {
2505
+ function create43(context) {
2378
2506
  if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) {
2379
2507
  return {};
2380
2508
  }
2381
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
2509
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
2382
2510
  return {
2383
2511
  ...listeners,
2384
- "Program:exit"(node) {
2385
- const components = ctx.getAllComponents(node);
2512
+ "Program:exit"(program) {
2513
+ const components = ctx.getAllComponents(program);
2386
2514
  for (const { node: component } of components.values()) {
2387
2515
  const { body } = component.body;
2388
2516
  for (const member of body) {
@@ -2397,8 +2525,8 @@ function create41(context) {
2397
2525
  }
2398
2526
  };
2399
2527
  }
2400
- var RULE_NAME42 = "no-unsafe-component-will-update";
2401
- var RULE_FEATURES42 = [];
2528
+ var RULE_NAME44 = "no-unsafe-component-will-update";
2529
+ var RULE_FEATURES44 = [];
2402
2530
  function isUnsafeComponentWillUpdate(node) {
2403
2531
  return AST8.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillUpdate";
2404
2532
  }
@@ -2407,24 +2535,24 @@ var no_unsafe_component_will_update_default = createRule({
2407
2535
  type: "problem",
2408
2536
  docs: {
2409
2537
  description: "Warns the usage of `UNSAFE_componentWillUpdate` in class components.",
2410
- [Symbol.for("rule_features")]: RULE_FEATURES42
2538
+ [Symbol.for("rule_features")]: RULE_FEATURES44
2411
2539
  },
2412
2540
  messages: {
2413
2541
  noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'."
2414
2542
  },
2415
2543
  schema: []
2416
2544
  },
2417
- name: RULE_NAME42,
2418
- create: create42,
2545
+ name: RULE_NAME44,
2546
+ create: create44,
2419
2547
  defaultOptions: []
2420
2548
  });
2421
- function create42(context) {
2549
+ function create44(context) {
2422
2550
  if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
2423
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
2551
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
2424
2552
  return {
2425
2553
  ...listeners,
2426
- "Program:exit"(node) {
2427
- const components = ctx.getAllComponents(node);
2554
+ "Program:exit"(program) {
2555
+ const components = ctx.getAllComponents(program);
2428
2556
  for (const { node: component } of components.values()) {
2429
2557
  const { body } = component.body;
2430
2558
  for (const member of body) {
@@ -2439,33 +2567,33 @@ function create42(context) {
2439
2567
  }
2440
2568
  };
2441
2569
  }
2442
- var RULE_NAME43 = "no-unstable-context-value";
2443
- var RULE_FEATURES43 = [];
2570
+ var RULE_NAME45 = "no-unstable-context-value";
2571
+ var RULE_FEATURES45 = [];
2444
2572
  var no_unstable_context_value_default = createRule({
2445
2573
  meta: {
2446
2574
  type: "problem",
2447
2575
  docs: {
2448
2576
  description: "Prevents non-stable values (i.e. object literals) from being used as a value for `Context.Provider`.",
2449
- [Symbol.for("rule_features")]: RULE_FEATURES43
2577
+ [Symbol.for("rule_features")]: RULE_FEATURES45
2450
2578
  },
2451
2579
  messages: {
2452
2580
  unstableContextValue: "A/an '{{type}}' passed as the value prop to the context provider should not be constructed. It will change on every render. {{suggestion}}"
2453
2581
  },
2454
2582
  schema: []
2455
2583
  },
2456
- name: RULE_NAME43,
2457
- create: create43,
2584
+ name: RULE_NAME45,
2585
+ create: create45,
2458
2586
  defaultOptions: []
2459
2587
  });
2460
- function create43(context) {
2588
+ function create45(context) {
2461
2589
  const { version: version2 } = getSettingsFromContext(context);
2462
2590
  const isReact18OrBelow = compare(version2, "19.0.0", "<");
2463
- const { ctx, listeners } = ER21.useComponentCollector(context);
2591
+ const { ctx, listeners } = ER22.useComponentCollector(context);
2464
2592
  const constructions = /* @__PURE__ */ new Map();
2465
2593
  return {
2466
2594
  ...listeners,
2467
2595
  JSXOpeningElement(node) {
2468
- const fullName = JSX8.getElementType(node.parent);
2596
+ const fullName = JSX9.getElementType(node.parent);
2469
2597
  const selfName = fullName.split(".").at(-1);
2470
2598
  if (selfName == null) return;
2471
2599
  if (!isContextName(selfName, isReact18OrBelow)) return;
@@ -2481,13 +2609,13 @@ function create43(context) {
2481
2609
  const initialScope = context.sourceCode.getScope(valueExpression);
2482
2610
  const construction = VAR2.getConstructionDetectionResult(valueExpression, initialScope);
2483
2611
  if (construction == null) return;
2484
- if (ER21.isReactHookCall(construction.node)) {
2612
+ if (ER22.isReactHookCall(construction.node)) {
2485
2613
  return;
2486
2614
  }
2487
2615
  getOrUpdate(constructions, functionEntry.node, () => []).push(construction);
2488
2616
  },
2489
- "Program:exit"(node) {
2490
- const components = ctx.getAllComponents(node).values();
2617
+ "Program:exit"(program) {
2618
+ const components = ctx.getAllComponents(program).values();
2491
2619
  for (const { node: component } of components) {
2492
2620
  for (const construction of constructions.get(component) ?? []) {
2493
2621
  const { kind, node: constructionNode } = construction;
@@ -2512,31 +2640,31 @@ function isContextName(name5, isReact18OrBelow) {
2512
2640
  }
2513
2641
  return false;
2514
2642
  }
2515
- var RULE_NAME44 = "no-unstable-default-props";
2516
- var RULE_FEATURES44 = [];
2643
+ var RULE_NAME46 = "no-unstable-default-props";
2644
+ var RULE_FEATURES46 = [];
2517
2645
  var no_unstable_default_props_default = createRule({
2518
2646
  meta: {
2519
2647
  type: "problem",
2520
2648
  docs: {
2521
2649
  description: "Prevents using referential-type values as default props in object destructuring.",
2522
- [Symbol.for("rule_features")]: RULE_FEATURES44
2650
+ [Symbol.for("rule_features")]: RULE_FEATURES46
2523
2651
  },
2524
2652
  messages: {
2525
2653
  noUnstableDefaultProps: "A/an '{{forbiddenType}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{forbiddenType}}'."
2526
2654
  },
2527
2655
  schema: []
2528
2656
  },
2529
- name: RULE_NAME44,
2530
- create: create44,
2657
+ name: RULE_NAME46,
2658
+ create: create46,
2531
2659
  defaultOptions: []
2532
2660
  });
2533
- function create44(context) {
2534
- const { ctx, listeners } = ER21.useComponentCollector(context);
2661
+ function create46(context) {
2662
+ const { ctx, listeners } = ER22.useComponentCollector(context);
2535
2663
  const declarators = /* @__PURE__ */ new Map();
2536
2664
  return {
2537
2665
  ...listeners,
2538
- "Program:exit"(node) {
2539
- const components = ctx.getAllComponents(node);
2666
+ "Program:exit"(program) {
2667
+ const components = ctx.getAllComponents(program);
2540
2668
  for (const { node: component } of components.values()) {
2541
2669
  const { params } = component;
2542
2670
  const [props] = params;
@@ -2561,7 +2689,7 @@ function create44(context) {
2561
2689
  if (construction == null) {
2562
2690
  continue;
2563
2691
  }
2564
- if (ER21.isReactHookCall(construction.node)) {
2692
+ if (ER22.isReactHookCall(construction.node)) {
2565
2693
  continue;
2566
2694
  }
2567
2695
  const forbiddenType = AST8.toReadableNodeType(right);
@@ -2586,8 +2714,8 @@ function create44(context) {
2586
2714
  }
2587
2715
  };
2588
2716
  }
2589
- var RULE_NAME45 = "no-unused-class-component-members";
2590
- var RULE_FEATURES45 = [];
2717
+ var RULE_NAME47 = "no-unused-class-component-members";
2718
+ var RULE_FEATURES47 = [];
2591
2719
  var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
2592
2720
  "componentDidCatch",
2593
2721
  "componentDidMount",
@@ -2613,25 +2741,25 @@ var no_unused_class_component_members_default = createRule({
2613
2741
  type: "problem",
2614
2742
  docs: {
2615
2743
  description: "Warns unused class component methods and properties.",
2616
- [Symbol.for("rule_features")]: RULE_FEATURES45
2744
+ [Symbol.for("rule_features")]: RULE_FEATURES47
2617
2745
  },
2618
2746
  messages: {
2619
2747
  noUnusedClassComponentMembers: "Unused method or property '{{methodName}}'' of class '{{className}}'."
2620
2748
  },
2621
2749
  schema: []
2622
2750
  },
2623
- name: RULE_NAME45,
2624
- create: create45,
2751
+ name: RULE_NAME47,
2752
+ create: create47,
2625
2753
  defaultOptions: []
2626
2754
  });
2627
- function create45(context) {
2755
+ function create47(context) {
2628
2756
  const classEntries = [];
2629
2757
  const methodEntries = [];
2630
2758
  const propertyDefs = /* @__PURE__ */ new WeakMap();
2631
2759
  const propertyUsages = /* @__PURE__ */ new WeakMap();
2632
2760
  function classEnter(node) {
2633
2761
  classEntries.push(node);
2634
- if (!ER21.isClassComponent(node)) {
2762
+ if (!ER22.isClassComponent(node)) {
2635
2763
  return;
2636
2764
  }
2637
2765
  propertyDefs.set(node, /* @__PURE__ */ new Set());
@@ -2639,7 +2767,7 @@ function create45(context) {
2639
2767
  }
2640
2768
  function classExit() {
2641
2769
  const currentClass = classEntries.pop();
2642
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2770
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2643
2771
  return;
2644
2772
  }
2645
2773
  const className = AST8.getClassIdentifier(currentClass)?.name;
@@ -2669,7 +2797,7 @@ function create45(context) {
2669
2797
  function methodEnter(node) {
2670
2798
  methodEntries.push(node);
2671
2799
  const currentClass = classEntries.at(-1);
2672
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2800
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2673
2801
  return;
2674
2802
  }
2675
2803
  if (node.static) {
@@ -2693,7 +2821,7 @@ function create45(context) {
2693
2821
  if (currentClass == null || currentMethod == null) {
2694
2822
  return;
2695
2823
  }
2696
- if (!ER21.isClassComponent(currentClass) || currentMethod.static) {
2824
+ if (!ER22.isClassComponent(currentClass) || currentMethod.static) {
2697
2825
  return;
2698
2826
  }
2699
2827
  if (!AST8.isThisExpression(node.object) || !isKeyLiteral2(node, node.property)) {
@@ -2718,7 +2846,7 @@ function create45(context) {
2718
2846
  if (currentClass == null || currentMethod == null) {
2719
2847
  return;
2720
2848
  }
2721
- if (!ER21.isClassComponent(currentClass) || currentMethod.static) {
2849
+ if (!ER22.isClassComponent(currentClass) || currentMethod.static) {
2722
2850
  return;
2723
2851
  }
2724
2852
  if (node.init != null && AST8.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern) {
@@ -2734,8 +2862,8 @@ function create45(context) {
2734
2862
  }
2735
2863
  };
2736
2864
  }
2737
- var RULE_NAME46 = "no-unused-state";
2738
- var RULE_FEATURES46 = [];
2865
+ var RULE_NAME48 = "no-unused-state";
2866
+ var RULE_FEATURES48 = [];
2739
2867
  function isKeyLiteral3(node, key) {
2740
2868
  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);
2741
2869
  }
@@ -2744,18 +2872,18 @@ var no_unused_state_default = createRule({
2744
2872
  type: "problem",
2745
2873
  docs: {
2746
2874
  description: "Warns unused class component state.",
2747
- [Symbol.for("rule_features")]: RULE_FEATURES46
2875
+ [Symbol.for("rule_features")]: RULE_FEATURES48
2748
2876
  },
2749
2877
  messages: {
2750
2878
  noUnusedState: "Unused class component state in '{{className}}'"
2751
2879
  },
2752
2880
  schema: []
2753
2881
  },
2754
- name: RULE_NAME46,
2755
- create: create46,
2882
+ name: RULE_NAME48,
2883
+ create: create48,
2756
2884
  defaultOptions: []
2757
2885
  });
2758
- function create46(context) {
2886
+ function create48(context) {
2759
2887
  const classEntries = [];
2760
2888
  const methodEntries = [];
2761
2889
  const constructorEntries = [];
@@ -2765,7 +2893,7 @@ function create46(context) {
2765
2893
  }
2766
2894
  function classExit() {
2767
2895
  const currentClass = classEntries.pop();
2768
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2896
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2769
2897
  return;
2770
2898
  }
2771
2899
  const className = AST8.getClassIdentifier(currentClass)?.name;
@@ -2784,11 +2912,11 @@ function create46(context) {
2784
2912
  function methodEnter(node) {
2785
2913
  methodEntries.push(node);
2786
2914
  const currentClass = classEntries.at(-1);
2787
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2915
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2788
2916
  return;
2789
2917
  }
2790
2918
  if (node.static) {
2791
- if (ER21.isGetDerivedStateFromProps(node) && isMatching({ params: [P.nonNullable, ...P.array()] })(node.value)) {
2919
+ if (ER22.isGetDerivedStateFromProps(node) && isMatching({ params: [P.nonNullable, ...P.array()] })(node.value)) {
2792
2920
  const defNode = stateDefs.get(currentClass)?.node;
2793
2921
  stateDefs.set(currentClass, { node: defNode, isUsed: true });
2794
2922
  }
@@ -2809,11 +2937,11 @@ function create46(context) {
2809
2937
  }
2810
2938
  return {
2811
2939
  AssignmentExpression(node) {
2812
- if (!ER21.isAssignmentToThisState(node)) {
2940
+ if (!ER22.isAssignmentToThisState(node)) {
2813
2941
  return;
2814
2942
  }
2815
2943
  const currentClass = classEntries.at(-1);
2816
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2944
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2817
2945
  return;
2818
2946
  }
2819
2947
  const currentConstructor = constructorEntries.at(-1);
@@ -2835,7 +2963,7 @@ function create46(context) {
2835
2963
  return;
2836
2964
  }
2837
2965
  const currentClass = classEntries.at(-1);
2838
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2966
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2839
2967
  return;
2840
2968
  }
2841
2969
  const currentMethod = methodEntries.at(-1);
@@ -2859,7 +2987,7 @@ function create46(context) {
2859
2987
  "PropertyDefinition:exit": methodExit,
2860
2988
  VariableDeclarator(node) {
2861
2989
  const currentClass = classEntries.at(-1);
2862
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2990
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2863
2991
  return;
2864
2992
  }
2865
2993
  const currentMethod = methodEntries.at(-1);
@@ -2889,8 +3017,8 @@ function create46(context) {
2889
3017
  }
2890
3018
  };
2891
3019
  }
2892
- var RULE_NAME47 = "no-use-context";
2893
- var RULE_FEATURES47 = [
3020
+ var RULE_NAME49 = "no-use-context";
3021
+ var RULE_FEATURES49 = [
2894
3022
  "MOD"
2895
3023
  ];
2896
3024
  var no_use_context_default = createRule({
@@ -2898,7 +3026,7 @@ var no_use_context_default = createRule({
2898
3026
  type: "problem",
2899
3027
  docs: {
2900
3028
  description: "Replaces usages of `useContext` with `use`.",
2901
- [Symbol.for("rule_features")]: RULE_FEATURES47
3029
+ [Symbol.for("rule_features")]: RULE_FEATURES49
2902
3030
  },
2903
3031
  fixable: "code",
2904
3032
  messages: {
@@ -2906,11 +3034,11 @@ var no_use_context_default = createRule({
2906
3034
  },
2907
3035
  schema: []
2908
3036
  },
2909
- name: RULE_NAME47,
2910
- create: create47,
3037
+ name: RULE_NAME49,
3038
+ create: create49,
2911
3039
  defaultOptions: []
2912
3040
  });
2913
- function create47(context) {
3041
+ function create49(context) {
2914
3042
  if (!context.sourceCode.text.includes("useContext")) return {};
2915
3043
  const settings4 = getSettingsFromContext(context);
2916
3044
  const useContextAlias = /* @__PURE__ */ new Set();
@@ -2919,10 +3047,10 @@ function create47(context) {
2919
3047
  }
2920
3048
  return {
2921
3049
  CallExpression(node) {
2922
- if (!ER21.isReactHookCall(node)) {
3050
+ if (!ER22.isReactHookCall(node)) {
2923
3051
  return;
2924
3052
  }
2925
- if (!ER21.isReactHookCallWithNameAlias(context, "useContext", [...useContextAlias])(node)) {
3053
+ if (!ER22.isReactHookCallWithNameAlias(context, "useContext", [...useContextAlias])(node)) {
2926
3054
  return;
2927
3055
  }
2928
3056
  context.report({
@@ -2988,28 +3116,28 @@ function getAssociatedTokens(context, node) {
2988
3116
  return tokens;
2989
3117
  }
2990
3118
  }
2991
- var RULE_NAME48 = "no-useless-forward-ref";
2992
- var RULE_FEATURES48 = [];
3119
+ var RULE_NAME50 = "no-useless-forward-ref";
3120
+ var RULE_FEATURES50 = [];
2993
3121
  var no_useless_forward_ref_default = createRule({
2994
3122
  meta: {
2995
3123
  type: "problem",
2996
3124
  docs: {
2997
3125
  description: "Disallow useless `forwardRef` calls on components that don't use `ref`s.",
2998
- [Symbol.for("rule_features")]: RULE_FEATURES48
3126
+ [Symbol.for("rule_features")]: RULE_FEATURES50
2999
3127
  },
3000
3128
  messages: {
3001
3129
  noUselessForwardRef: "A 'forwardRef' is used with this component but no 'ref' parameter is set."
3002
3130
  },
3003
3131
  schema: []
3004
3132
  },
3005
- name: RULE_NAME48,
3006
- create: create48,
3133
+ name: RULE_NAME50,
3134
+ create: create50,
3007
3135
  defaultOptions: []
3008
3136
  });
3009
- function create48(context) {
3137
+ function create50(context) {
3010
3138
  return {
3011
3139
  CallExpression(node) {
3012
- if (!ER21.isForwardRefCall(context, node)) {
3140
+ if (!ER22.isForwardRefCall(context, node)) {
3013
3141
  return;
3014
3142
  }
3015
3143
  const [component] = node.arguments;
@@ -3027,7 +3155,7 @@ function create48(context) {
3027
3155
  }
3028
3156
  };
3029
3157
  }
3030
- var RULE_NAME49 = "no-useless-fragment";
3158
+ var RULE_NAME51 = "no-useless-fragment";
3031
3159
  var defaultOptions = [{
3032
3160
  allowExpressions: true
3033
3161
  }];
@@ -3053,15 +3181,15 @@ var no_useless_fragment_default = createRule({
3053
3181
  }
3054
3182
  }]
3055
3183
  },
3056
- name: RULE_NAME49,
3057
- create: create49,
3184
+ name: RULE_NAME51,
3185
+ create: create51,
3058
3186
  defaultOptions
3059
3187
  });
3060
- function create49(context, [option]) {
3188
+ function create51(context, [option]) {
3061
3189
  const { allowExpressions = true } = option;
3062
3190
  return {
3063
3191
  JSXElement(node) {
3064
- if (!JSX8.isFragmentElement(node)) return;
3192
+ if (!JSX9.isFragmentElement(node)) return;
3065
3193
  checkNode(context, node, allowExpressions);
3066
3194
  },
3067
3195
  JSXFragment(node) {
@@ -3073,7 +3201,7 @@ function isWhiteSpace(node) {
3073
3201
  return typeof node.value === "string" && node.raw.trim() === "";
3074
3202
  }
3075
3203
  function isPaddingSpaces(node) {
3076
- return JSX8.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
3204
+ return JSX9.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
3077
3205
  }
3078
3206
  function trimLikeReact(text) {
3079
3207
  const leadingSpaces = /^\s*/.exec(text)?.[0] ?? "";
@@ -3084,10 +3212,10 @@ function trimLikeReact(text) {
3084
3212
  }
3085
3213
  function checkNode(context, node, allowExpressions) {
3086
3214
  const initialScope = context.sourceCode.getScope(node);
3087
- if (JSX8.isKeyedElement(node, initialScope)) {
3215
+ if (JSX9.isKeyedElement(node, initialScope)) {
3088
3216
  return;
3089
3217
  }
3090
- if (JSX8.isHostElement(node.parent)) {
3218
+ if (JSX9.isHostElement(node.parent)) {
3091
3219
  context.report({
3092
3220
  messageId: "uselessFragment",
3093
3221
  node,
@@ -3111,7 +3239,7 @@ function checkNode(context, node, allowExpressions) {
3111
3239
  const isChildElement = AST8.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(node.parent);
3112
3240
  switch (true) {
3113
3241
  // <Foo content={<>ee eeee eeee ...</>} />
3114
- case (allowExpressions && !isChildElement && node.children.length === 1 && JSX8.isJsxText(node.children.at(0))): {
3242
+ case (allowExpressions && !isChildElement && node.children.length === 1 && JSX9.isJsxText(node.children.at(0))): {
3115
3243
  return;
3116
3244
  }
3117
3245
  // <Foo><>hello, world</></Foo>
@@ -3167,18 +3295,18 @@ function getFix2(context, node) {
3167
3295
  }
3168
3296
  function canFix(node) {
3169
3297
  if (node.parent.type === AST_NODE_TYPES.JSXElement || node.parent.type === AST_NODE_TYPES.JSXFragment) {
3170
- return JSX8.isHostElement(node.parent);
3298
+ return JSX9.isHostElement(node.parent);
3171
3299
  }
3172
3300
  if (node.children.length === 0) {
3173
3301
  return false;
3174
3302
  }
3175
- if (node.children.some((child) => JSX8.isJsxText(child) && !isWhiteSpace(child) || AST8.is(AST_NODE_TYPES.JSXExpressionContainer)(child))) {
3303
+ if (node.children.some((child) => JSX9.isJsxText(child) && !isWhiteSpace(child) || AST8.is(AST_NODE_TYPES.JSXExpressionContainer)(child))) {
3176
3304
  return false;
3177
3305
  }
3178
3306
  return true;
3179
3307
  }
3180
- var RULE_NAME50 = "prefer-destructuring-assignment";
3181
- var RULE_FEATURES49 = [];
3308
+ var RULE_NAME52 = "prefer-destructuring-assignment";
3309
+ var RULE_FEATURES51 = [];
3182
3310
  function isMemberExpressionWithObjectName(node) {
3183
3311
  return node.object.type === AST_NODE_TYPES.Identifier && "name" in node.object;
3184
3312
  }
@@ -3187,19 +3315,19 @@ var prefer_destructuring_assignment_default = createRule({
3187
3315
  type: "problem",
3188
3316
  docs: {
3189
3317
  description: "Enforces destructuring assignment for component props and context.",
3190
- [Symbol.for("rule_features")]: RULE_FEATURES49
3318
+ [Symbol.for("rule_features")]: RULE_FEATURES51
3191
3319
  },
3192
3320
  messages: {
3193
3321
  preferDestructuringAssignment: "Use destructuring assignment for {{name}}."
3194
3322
  },
3195
3323
  schema: []
3196
3324
  },
3197
- name: RULE_NAME50,
3198
- create: create50,
3325
+ name: RULE_NAME52,
3326
+ create: create52,
3199
3327
  defaultOptions: []
3200
3328
  });
3201
- function create50(context) {
3202
- const { ctx, listeners } = ER21.useComponentCollector(context);
3329
+ function create52(context) {
3330
+ const { ctx, listeners } = ER22.useComponentCollector(context);
3203
3331
  const memberExpressionWithNames = [];
3204
3332
  return {
3205
3333
  ...listeners,
@@ -3209,16 +3337,16 @@ function create50(context) {
3209
3337
  memberExpressionWithNames.push([scope, node]);
3210
3338
  }
3211
3339
  },
3212
- "Program:exit"(node) {
3340
+ "Program:exit"(program) {
3213
3341
  const components = [
3214
- ...ctx.getAllComponents(node).values()
3342
+ ...ctx.getAllComponents(program).values()
3215
3343
  ];
3216
3344
  function isFunctionComponent(block) {
3217
3345
  if (!AST8.isFunction(block)) {
3218
3346
  return false;
3219
3347
  }
3220
3348
  const id = AST8.getFunctionIdentifier(block);
3221
- return id != null && ER21.isComponentNameLoose(id.name) && components.some((component) => component.node === block);
3349
+ return id != null && ER22.isComponentNameLoose(id.name) && components.some((component) => component.node === block);
3222
3350
  }
3223
3351
  for (const [initialScope, memberExpression] of memberExpressionWithNames) {
3224
3352
  let scope = initialScope;
@@ -3235,7 +3363,7 @@ function create50(context) {
3235
3363
  continue;
3236
3364
  }
3237
3365
  const [props, ctx2] = component.params;
3238
- const isMatch = (node2) => node2 != null && node2.type === AST_NODE_TYPES.Identifier && node2.name === memberExpression.object.name;
3366
+ const isMatch = (node) => node != null && node.type === AST_NODE_TYPES.Identifier && node.name === memberExpression.object.name;
3239
3367
  if (isMatch(props)) {
3240
3368
  context.report({
3241
3369
  messageId: "preferDestructuringAssignment",
@@ -3258,8 +3386,8 @@ function create50(context) {
3258
3386
  }
3259
3387
  };
3260
3388
  }
3261
- var RULE_NAME51 = "prefer-react-namespace-import";
3262
- var RULE_FEATURES50 = [
3389
+ var RULE_NAME53 = "prefer-react-namespace-import";
3390
+ var RULE_FEATURES52 = [
3263
3391
  "FIX"
3264
3392
  ];
3265
3393
  var prefer_react_namespace_import_default = createRule({
@@ -3267,7 +3395,7 @@ var prefer_react_namespace_import_default = createRule({
3267
3395
  type: "problem",
3268
3396
  docs: {
3269
3397
  description: "Enforces React is imported via a namespace import.",
3270
- [Symbol.for("rule_features")]: RULE_FEATURES50
3398
+ [Symbol.for("rule_features")]: RULE_FEATURES52
3271
3399
  },
3272
3400
  fixable: "code",
3273
3401
  messages: {
@@ -3275,11 +3403,11 @@ var prefer_react_namespace_import_default = createRule({
3275
3403
  },
3276
3404
  schema: []
3277
3405
  },
3278
- name: RULE_NAME51,
3279
- create: create51,
3406
+ name: RULE_NAME53,
3407
+ create: create53,
3280
3408
  defaultOptions: []
3281
3409
  });
3282
- function create51(context) {
3410
+ function create53(context) {
3283
3411
  const { importSource } = getSettingsFromContext(context);
3284
3412
  return {
3285
3413
  [`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
@@ -3314,8 +3442,8 @@ function create51(context) {
3314
3442
  }
3315
3443
  };
3316
3444
  }
3317
- var RULE_NAME52 = "prefer-read-only-props";
3318
- var RULE_FEATURES51 = [
3445
+ var RULE_NAME54 = "prefer-read-only-props";
3446
+ var RULE_FEATURES53 = [
3319
3447
  "TSC",
3320
3448
  "EXP"
3321
3449
  ];
@@ -3324,24 +3452,24 @@ var prefer_read_only_props_default = createRule({
3324
3452
  type: "problem",
3325
3453
  docs: {
3326
3454
  description: "Enforces read-only props in components.",
3327
- [Symbol.for("rule_features")]: RULE_FEATURES51
3455
+ [Symbol.for("rule_features")]: RULE_FEATURES53
3328
3456
  },
3329
3457
  messages: {
3330
3458
  preferReadOnlyProps: "A function component's props should be read-only."
3331
3459
  },
3332
3460
  schema: []
3333
3461
  },
3334
- name: RULE_NAME52,
3335
- create: create52,
3462
+ name: RULE_NAME54,
3463
+ create: create54,
3336
3464
  defaultOptions: []
3337
3465
  });
3338
- function create52(context) {
3466
+ function create54(context) {
3339
3467
  const services = ESLintUtils.getParserServices(context, false);
3340
- const { ctx, listeners } = ER21.useComponentCollector(context);
3468
+ const { ctx, listeners } = ER22.useComponentCollector(context);
3341
3469
  return {
3342
3470
  ...listeners,
3343
- "Program:exit"(node) {
3344
- const components = ctx.getAllComponents(node);
3471
+ "Program:exit"(program) {
3472
+ const components = ctx.getAllComponents(program);
3345
3473
  for (const [, component] of components) {
3346
3474
  const [props] = component.node.params;
3347
3475
  if (props == null) {
@@ -3365,8 +3493,8 @@ function isTypeReadonlyLoose(services, type) {
3365
3493
  return true;
3366
3494
  }
3367
3495
  }
3368
- var RULE_NAME53 = "prefer-shorthand-boolean";
3369
- var RULE_FEATURES52 = [
3496
+ var RULE_NAME55 = "prefer-shorthand-boolean";
3497
+ var RULE_FEATURES54 = [
3370
3498
  "FIX"
3371
3499
  ];
3372
3500
  var prefer_shorthand_boolean_default = createRule({
@@ -3374,7 +3502,7 @@ var prefer_shorthand_boolean_default = createRule({
3374
3502
  type: "problem",
3375
3503
  docs: {
3376
3504
  description: "Enforces shorthand syntax for boolean attributes.",
3377
- [Symbol.for("rule_features")]: RULE_FEATURES52
3505
+ [Symbol.for("rule_features")]: RULE_FEATURES54
3378
3506
  },
3379
3507
  fixable: "code",
3380
3508
  messages: {
@@ -3382,15 +3510,15 @@ var prefer_shorthand_boolean_default = createRule({
3382
3510
  },
3383
3511
  schema: []
3384
3512
  },
3385
- name: RULE_NAME53,
3386
- create: create53,
3513
+ name: RULE_NAME55,
3514
+ create: create55,
3387
3515
  defaultOptions: []
3388
3516
  });
3389
- function create53(context) {
3517
+ function create55(context) {
3390
3518
  return {
3391
3519
  JSXAttribute(node) {
3392
3520
  const { value } = node;
3393
- const propName = JSX8.getAttributeName(node);
3521
+ const propName = JSX9.getAttributeName(node);
3394
3522
  const hasValueTrue = value?.type === AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === AST_NODE_TYPES.Literal && value.expression.value === true;
3395
3523
  if (!hasValueTrue) {
3396
3524
  return;
@@ -3406,8 +3534,8 @@ function create53(context) {
3406
3534
  }
3407
3535
  };
3408
3536
  }
3409
- var RULE_NAME54 = "prefer-shorthand-fragment";
3410
- var RULE_FEATURES53 = [
3537
+ var RULE_NAME56 = "prefer-shorthand-fragment";
3538
+ var RULE_FEATURES55 = [
3411
3539
  "FIX"
3412
3540
  ];
3413
3541
  var prefer_shorthand_fragment_default = createRule({
@@ -3415,7 +3543,7 @@ var prefer_shorthand_fragment_default = createRule({
3415
3543
  type: "problem",
3416
3544
  docs: {
3417
3545
  description: "Enforces shorthand syntax for fragments.",
3418
- [Symbol.for("rule_features")]: RULE_FEATURES53
3546
+ [Symbol.for("rule_features")]: RULE_FEATURES55
3419
3547
  },
3420
3548
  fixable: "code",
3421
3549
  messages: {
@@ -3423,14 +3551,14 @@ var prefer_shorthand_fragment_default = createRule({
3423
3551
  },
3424
3552
  schema: []
3425
3553
  },
3426
- name: RULE_NAME54,
3427
- create: create54,
3554
+ name: RULE_NAME56,
3555
+ create: create56,
3428
3556
  defaultOptions: []
3429
3557
  });
3430
- function create54(context) {
3558
+ function create56(context) {
3431
3559
  return {
3432
3560
  JSXElement(node) {
3433
- if (!JSX8.isFragmentElement(node)) return;
3561
+ if (!JSX9.isFragmentElement(node)) return;
3434
3562
  const hasAttributes = node.openingElement.attributes.length > 0;
3435
3563
  if (hasAttributes) {
3436
3564
  return;
@@ -3488,7 +3616,9 @@ var plugin = {
3488
3616
  "no-missing-component-display-name": no_missing_component_display_name_default,
3489
3617
  "no-missing-context-display-name": no_missing_context_display_name_default,
3490
3618
  "no-missing-key": no_missing_key_default,
3619
+ "no-misused-capture-owner-stack": no_misused_capture_owner_stack_default,
3491
3620
  "no-nested-component-definitions": no_nested_component_definitions_default,
3621
+ "no-nested-lazy-component-declarations": no_nested_lazy_component_declarations_default,
3492
3622
  "no-prop-types": no_prop_types_default,
3493
3623
  "no-redundant-should-component-update": no_redundant_should_component_update_default,
3494
3624
  "no-set-state-in-component-did-mount": no_set_state_in_component_did_mount_default,