eslint-plugin-react-x 1.43.2-next.2 → 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,5 +1,5 @@
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
4
  import { JsxConfig, createReport, SEL } from '@eslint-react/kit';
5
5
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
@@ -7,7 +7,7 @@ import * as VAR2 from '@eslint-react/var';
7
7
  import { match, isMatching, P } from 'ts-pattern';
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.2";
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
  });
@@ -385,25 +387,25 @@ function create7(context) {
385
387
  const setStateEntries = [];
386
388
  return {
387
389
  CallExpression(node) {
388
- if (!ER21.isThisSetState(node)) {
390
+ if (!ER22.isThisSetState(node)) {
389
391
  return;
390
392
  }
391
393
  setStateEntries.push([node, false]);
392
394
  },
393
395
  "CallExpression:exit"(node) {
394
- if (!ER21.isThisSetState(node)) {
396
+ if (!ER22.isThisSetState(node)) {
395
397
  return;
396
398
  }
397
399
  setStateEntries.pop();
398
400
  },
399
401
  ClassDeclaration(node) {
400
- classEntries.push([node, ER21.isClassComponent(node)]);
402
+ classEntries.push([node, ER22.isClassComponent(node)]);
401
403
  },
402
404
  "ClassDeclaration:exit"() {
403
405
  classEntries.pop();
404
406
  },
405
407
  ClassExpression(node) {
406
- classEntries.push([node, ER21.isClassComponent(node)]);
408
+ classEntries.push([node, ER22.isClassComponent(node)]);
407
409
  },
408
410
  "ClassExpression:exit"() {
409
411
  classEntries.pop();
@@ -487,7 +489,7 @@ function isUsingReactChildren(context, node) {
487
489
  return true;
488
490
  }
489
491
  if (callee.object.type === AST_NODE_TYPES.MemberExpression && "name" in callee.object.object) {
490
- return ER21.isInitializedFromReact(callee.object.object.name, importSource, initialScope);
492
+ return ER22.isInitializedFromReact(callee.object.object.name, importSource, initialScope);
491
493
  }
492
494
  return false;
493
495
  }
@@ -553,7 +555,7 @@ function create8(context) {
553
555
  return node.type === AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
554
556
  }
555
557
  function isCreateOrCloneElementCall(node) {
556
- return ER21.isCreateElementCall(context, node) || ER21.isCloneElementCall(context, node);
558
+ return ER22.isCreateElementCall(context, node) || ER22.isCloneElementCall(context, node);
557
559
  }
558
560
  function getReportDescriptors(node) {
559
561
  switch (node.type) {
@@ -669,7 +671,7 @@ var no_children_count_default = createRule({
669
671
  function create9(context) {
670
672
  return {
671
673
  MemberExpression(node) {
672
- if (ER21.isChildrenCount(context, node)) {
674
+ if (ER22.isChildrenCount(context, node)) {
673
675
  context.report({
674
676
  messageId: "noChildrenCount",
675
677
  node: node.property
@@ -699,7 +701,7 @@ var no_children_for_each_default = createRule({
699
701
  function create10(context) {
700
702
  return {
701
703
  MemberExpression(node) {
702
- if (ER21.isChildrenForEach(context, node)) {
704
+ if (ER22.isChildrenForEach(context, node)) {
703
705
  context.report({
704
706
  messageId: "noChildrenForEach",
705
707
  node: node.property
@@ -729,7 +731,7 @@ var no_children_map_default = createRule({
729
731
  function create11(context) {
730
732
  return {
731
733
  MemberExpression(node) {
732
- if (ER21.isChildrenMap(context, node)) {
734
+ if (ER22.isChildrenMap(context, node)) {
733
735
  context.report({
734
736
  messageId: "noChildrenMap",
735
737
  node: node.property
@@ -759,7 +761,7 @@ var no_children_only_default = createRule({
759
761
  function create12(context) {
760
762
  return {
761
763
  MemberExpression(node) {
762
- if (ER21.isChildrenOnly(context, node)) {
764
+ if (ER22.isChildrenOnly(context, node)) {
763
765
  context.report({
764
766
  messageId: "noChildrenOnly",
765
767
  node: node.property
@@ -790,7 +792,7 @@ function create13(context) {
790
792
  return {
791
793
  JSXElement(node) {
792
794
  const attributes = node.openingElement.attributes;
793
- const childrenProp = JSX8.getAttribute("children", attributes, context.sourceCode.getScope(node));
795
+ const childrenProp = JSX9.getAttribute("children", attributes, context.sourceCode.getScope(node));
794
796
  if (childrenProp != null) {
795
797
  context.report({
796
798
  messageId: "noChildrenProp",
@@ -821,7 +823,7 @@ var no_children_to_array_default = createRule({
821
823
  function create14(context) {
822
824
  return {
823
825
  MemberExpression(node) {
824
- if (ER21.isChildrenToArray(context, node)) {
826
+ if (ER22.isChildrenToArray(context, node)) {
825
827
  context.report({
826
828
  messageId: "noChildrenToArray",
827
829
  node: node.property
@@ -850,13 +852,13 @@ var no_class_component_default = createRule({
850
852
  });
851
853
  function create15(context) {
852
854
  if (!context.sourceCode.text.includes("Component")) return {};
853
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
855
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
854
856
  return {
855
857
  ...listeners,
856
- "Program:exit"(node) {
857
- const components = ctx.getAllComponents(node);
858
+ "Program:exit"(program) {
859
+ const components = ctx.getAllComponents(program);
858
860
  for (const { name: name5 = "anonymous", node: component } of components.values()) {
859
- 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))) {
860
862
  continue;
861
863
  }
862
864
  context.report({
@@ -891,7 +893,7 @@ var no_clone_element_default = createRule({
891
893
  function create16(context) {
892
894
  return {
893
895
  CallExpression(node) {
894
- if (ER21.isCloneElementCall(context, node)) {
896
+ if (ER22.isCloneElementCall(context, node)) {
895
897
  context.report({
896
898
  messageId: "noCloneElement",
897
899
  node
@@ -1014,15 +1016,15 @@ var no_component_will_mount_default = createRule({
1014
1016
  });
1015
1017
  function create19(context) {
1016
1018
  if (!context.sourceCode.text.includes("componentWillMount")) return {};
1017
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
1019
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
1018
1020
  return {
1019
1021
  ...listeners,
1020
- "Program:exit"(node) {
1021
- const components = ctx.getAllComponents(node);
1022
+ "Program:exit"(program) {
1023
+ const components = ctx.getAllComponents(program);
1022
1024
  for (const { node: component } of components.values()) {
1023
1025
  const { body } = component.body;
1024
1026
  for (const member of body) {
1025
- if (ER21.isComponentWillMount(member)) {
1027
+ if (ER22.isComponentWillMount(member)) {
1026
1028
  context.report({
1027
1029
  messageId: "noComponentWillMount",
1028
1030
  node: member,
@@ -1062,15 +1064,15 @@ var no_component_will_receive_props_default = createRule({
1062
1064
  });
1063
1065
  function create20(context) {
1064
1066
  if (!context.sourceCode.text.includes("componentWillReceiveProps")) return {};
1065
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
1067
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
1066
1068
  return {
1067
1069
  ...listeners,
1068
- "Program:exit"(node) {
1069
- const components = ctx.getAllComponents(node);
1070
+ "Program:exit"(program) {
1071
+ const components = ctx.getAllComponents(program);
1070
1072
  for (const { node: component } of components.values()) {
1071
1073
  const { body } = component.body;
1072
1074
  for (const member of body) {
1073
- if (ER21.isComponentWillReceiveProps(member)) {
1075
+ if (ER22.isComponentWillReceiveProps(member)) {
1074
1076
  context.report({
1075
1077
  messageId: "noComponentWillReceiveProps",
1076
1078
  node: member,
@@ -1110,15 +1112,15 @@ var no_component_will_update_default = createRule({
1110
1112
  });
1111
1113
  function create21(context) {
1112
1114
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
1113
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
1115
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
1114
1116
  return {
1115
1117
  ...listeners,
1116
- "Program:exit"(node) {
1117
- const components = ctx.getAllComponents(node);
1118
+ "Program:exit"(program) {
1119
+ const components = ctx.getAllComponents(program);
1118
1120
  for (const { node: component } of components.values()) {
1119
1121
  const { body } = component.body;
1120
1122
  for (const member of body) {
1121
- if (ER21.isComponentWillUpdate(member)) {
1123
+ if (ER22.isComponentWillUpdate(member)) {
1122
1124
  context.report({
1123
1125
  messageId: "noComponentWillUpdate",
1124
1126
  node: member,
@@ -1162,7 +1164,7 @@ function create22(context) {
1162
1164
  if (compare(version2, "19.0.0", "<")) return {};
1163
1165
  return {
1164
1166
  JSXElement(node) {
1165
- const fullName = JSX8.getElementType(node);
1167
+ const fullName = JSX9.getElementType(node);
1166
1168
  const parts = fullName.split(".");
1167
1169
  const selfName = parts.pop();
1168
1170
  const contextFullName = parts.join(".");
@@ -1173,7 +1175,7 @@ function create22(context) {
1173
1175
  messageId: "noContextProvider",
1174
1176
  node,
1175
1177
  fix(fixer) {
1176
- if (!ER21.isComponentNameLoose(contextSelfName)) return null;
1178
+ if (!ER22.isComponentNameLoose(contextSelfName)) return null;
1177
1179
  const openingElement = node.openingElement;
1178
1180
  const closingElement = node.closingElement;
1179
1181
  if (closingElement == null) {
@@ -1209,7 +1211,7 @@ var no_create_ref_default = createRule({
1209
1211
  function create23(context) {
1210
1212
  return {
1211
1213
  CallExpression(node) {
1212
- if (ER21.isCreateRefCall(context, node) && AST8.findParentNode(node, ER21.isClassComponent) == null) {
1214
+ if (ER22.isCreateRefCall(context, node) && AST8.findParentNode(node, ER22.isClassComponent) == null) {
1213
1215
  context.report({ messageId: "noCreateRef", node });
1214
1216
  }
1215
1217
  }
@@ -1247,17 +1249,17 @@ function create24(context) {
1247
1249
  if (property.type !== AST_NODE_TYPES.Identifier || property.name !== "defaultProps") {
1248
1250
  return;
1249
1251
  }
1250
- if (!ER21.isComponentNameLoose(object.name)) {
1252
+ if (!ER22.isComponentNameLoose(object.name)) {
1251
1253
  return;
1252
1254
  }
1253
1255
  const variable = VAR2.findVariable(object.name, context.sourceCode.getScope(node));
1254
1256
  const variableNode = VAR2.getVariableInitNode(variable, 0);
1255
1257
  if (variableNode == null) return;
1256
- if (!AST8.isFunction(variableNode) && !ER21.isClassComponent(variableNode)) return;
1258
+ if (!AST8.isFunction(variableNode) && !ER22.isClassComponent(variableNode)) return;
1257
1259
  context.report({ messageId: "noDefaultProps", node: property });
1258
1260
  },
1259
1261
  PropertyDefinition(node) {
1260
- if (!ER21.isClassComponent(node.parent.parent)) {
1262
+ if (!ER22.isClassComponent(node.parent.parent)) {
1261
1263
  return;
1262
1264
  }
1263
1265
  if (!node.static || node.key.type !== AST_NODE_TYPES.Identifier || node.key.name !== "defaultProps") {
@@ -1291,7 +1293,7 @@ var no_direct_mutation_state_default = createRule({
1291
1293
  function create25(context) {
1292
1294
  return {
1293
1295
  AssignmentExpression(node) {
1294
- if (!ER21.isAssignmentToThisState(node)) return;
1296
+ if (!ER22.isAssignmentToThisState(node)) return;
1295
1297
  const parentClass = AST8.findParentNode(
1296
1298
  node,
1297
1299
  AST8.isOneOf([
@@ -1300,7 +1302,7 @@ function create25(context) {
1300
1302
  ])
1301
1303
  );
1302
1304
  if (parentClass == null) return;
1303
- 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)) {
1304
1306
  context.report({
1305
1307
  messageId: "noDirectMutationState",
1306
1308
  node
@@ -1422,7 +1424,7 @@ function create27(context) {
1422
1424
  }
1423
1425
  return {
1424
1426
  CallExpression(node) {
1425
- if (!ER21.isForwardRefCall(context, node)) {
1427
+ if (!ER22.isForwardRefCall(context, node)) {
1426
1428
  return;
1427
1429
  }
1428
1430
  context.report({
@@ -1524,7 +1526,7 @@ function create28(context) {
1524
1526
  return {
1525
1527
  JSXOpeningElement(node) {
1526
1528
  const initialScope = context.sourceCode.getScope(node);
1527
- const keyPropFound = JSX8.getAttribute("key", node.attributes, initialScope);
1529
+ const keyPropFound = JSX9.getAttribute("key", node.attributes, initialScope);
1528
1530
  const keyPropOnElement = node.attributes.some(
1529
1531
  (n) => n.type === AST_NODE_TYPES.JSXAttribute && n.name.type === AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
1530
1532
  );
@@ -1712,21 +1714,21 @@ function create30(context) {
1712
1714
  const {
1713
1715
  ctx,
1714
1716
  listeners
1715
- } = ER21.useComponentCollector(
1717
+ } = ER22.useComponentCollector(
1716
1718
  context,
1717
1719
  {
1718
1720
  collectDisplayName: true,
1719
1721
  collectHookCalls: false,
1720
- hint: ER21.DEFAULT_COMPONENT_DETECTION_HINT
1722
+ hint: ER22.DEFAULT_COMPONENT_DETECTION_HINT
1721
1723
  }
1722
1724
  );
1723
1725
  return {
1724
1726
  ...listeners,
1725
- "Program:exit"(node) {
1726
- const components = ctx.getAllComponents(node);
1727
- for (const { node: node2, displayName, flag } of components.values()) {
1728
- const isMemoOrForwardRef = (flag & (ER21.ComponentFlag.ForwardRef | ER21.ComponentFlag.Memo)) > 0n;
1729
- 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) {
1730
1732
  continue;
1731
1733
  }
1732
1734
  if (!isMemoOrForwardRef) {
@@ -1735,7 +1737,7 @@ function create30(context) {
1735
1737
  if (displayName == null) {
1736
1738
  context.report({
1737
1739
  messageId: "noMissingComponentDisplayName",
1738
- node: node2
1740
+ node
1739
1741
  });
1740
1742
  }
1741
1743
  }
@@ -1766,12 +1768,12 @@ function create31(context) {
1766
1768
  const displayNameAssignments = [];
1767
1769
  return {
1768
1770
  CallExpression(node) {
1769
- if (!ER21.isCreateContextCall(context, node)) return;
1771
+ if (!ER22.isCreateContextCall(context, node)) return;
1770
1772
  createCalls.push(node);
1771
1773
  },
1772
1774
  "Program:exit"() {
1773
1775
  for (const call of createCalls) {
1774
- const id = ER21.getInstanceId(call);
1776
+ const id = ER22.getInstanceId(call);
1775
1777
  if (id == null) {
1776
1778
  context.report({
1777
1779
  messageId: "noMissingContextDisplayName",
@@ -1783,7 +1785,7 @@ function create31(context) {
1783
1785
  const left = node.left;
1784
1786
  if (left.type !== AST_NODE_TYPES.MemberExpression) return false;
1785
1787
  const object = left.object;
1786
- return ER21.isInstanceIdEqual(context, id, object);
1788
+ return ER22.isInstanceIdEqual(context, id, object);
1787
1789
  });
1788
1790
  if (!hasDisplayNameAssignment) {
1789
1791
  context.report({
@@ -1824,7 +1826,7 @@ function create32(context) {
1824
1826
  switch (node.type) {
1825
1827
  case AST_NODE_TYPES.JSXElement: {
1826
1828
  const initialScope = context.sourceCode.getScope(node);
1827
- if (!JSX8.hasAttribute("key", node.openingElement.attributes, initialScope)) {
1829
+ if (!JSX9.hasAttribute("key", node.openingElement.attributes, initialScope)) {
1828
1830
  return {
1829
1831
  messageId: "missingKey",
1830
1832
  node
@@ -1881,7 +1883,7 @@ function create32(context) {
1881
1883
  }
1882
1884
  const initialScope = context.sourceCode.getScope(node);
1883
1885
  for (const element of elements) {
1884
- if (!JSX8.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1886
+ if (!JSX9.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1885
1887
  report({
1886
1888
  messageId: "missingKey",
1887
1889
  node: element
@@ -1890,7 +1892,7 @@ function create32(context) {
1890
1892
  }
1891
1893
  },
1892
1894
  CallExpression(node) {
1893
- state.isWithinChildrenToArray ||= ER21.isChildrenToArrayCall(context, node);
1895
+ state.isWithinChildrenToArray ||= ER22.isChildrenToArrayCall(context, node);
1894
1896
  if (state.isWithinChildrenToArray) return;
1895
1897
  const callback = match(node).when(AST8.isArrayMapCall, (n) => n.arguments[0]).when(AST8.isArrayFromCall, (n) => n.arguments[1]).otherwise(() => null);
1896
1898
  if (!AST8.isFunction(callback)) return;
@@ -1902,7 +1904,7 @@ function create32(context) {
1902
1904
  report(checkExpression(body));
1903
1905
  },
1904
1906
  "CallExpression:exit"(node) {
1905
- if (!ER21.isChildrenToArrayCall(context, node)) {
1907
+ if (!ER22.isChildrenToArrayCall(context, node)) {
1906
1908
  return;
1907
1909
  }
1908
1910
  state.isWithinChildrenToArray = false;
@@ -1920,17 +1922,22 @@ function create32(context) {
1920
1922
  }
1921
1923
  };
1922
1924
  }
1923
- var RULE_NAME33 = "no-nested-component-definitions";
1924
- var RULE_FEATURES33 = [];
1925
- 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({
1926
1930
  meta: {
1927
1931
  type: "problem",
1928
1932
  docs: {
1929
- description: "Disallow nesting component definitions inside other components.",
1933
+ description: "Prevents incorrect usage of `captureOwnerStack`.",
1930
1934
  [Symbol.for("rule_features")]: RULE_FEATURES33
1931
1935
  },
1936
+ fixable: "code",
1932
1937
  messages: {
1933
- 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.`
1934
1941
  },
1935
1942
  schema: []
1936
1943
  },
@@ -1939,30 +1946,81 @@ var no_nested_component_definitions_default = createRule({
1939
1946
  defaultOptions: []
1940
1947
  });
1941
1948
  function create33(context) {
1942
- 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;
1943
- const collector = ER21.useComponentCollector(context, { hint });
1944
- 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();
1945
2003
  return {
1946
2004
  ...collector.listeners,
1947
2005
  ...collectorLegacy.listeners,
1948
- "Program:exit"(node) {
2006
+ "Program:exit"(program) {
1949
2007
  const functionComponents = [
1950
- ...collector.ctx.getAllComponents(node).values()
2008
+ ...collector.ctx.getAllComponents(program).values()
1951
2009
  ];
1952
2010
  const classComponents = [
1953
- ...collectorLegacy.ctx.getAllComponents(node).values()
2011
+ ...collectorLegacy.ctx.getAllComponents(program).values()
1954
2012
  ];
1955
- const isFunctionComponent = (node2) => {
1956
- 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);
1957
2015
  };
1958
- const isClassComponent12 = (node2) => {
1959
- 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);
1960
2018
  };
1961
2019
  for (const { name: name5, node: component } of functionComponents) {
1962
2020
  if (name5 == null) continue;
1963
- if (ER21.isDirectValueOfRenderPropertyLoose(component)) continue;
2021
+ if (ER22.isDirectValueOfRenderPropertyLoose(component)) continue;
1964
2022
  if (isInsideJSXAttributeValue(component)) {
1965
- if (!ER21.isDeclaredInRenderPropLoose(component)) {
2023
+ if (!ER22.isDeclaredInRenderPropLoose(component)) {
1966
2024
  context.report({
1967
2025
  messageId: "noNestedComponentDefinitions",
1968
2026
  node: component,
@@ -1986,7 +2044,7 @@ function create33(context) {
1986
2044
  continue;
1987
2045
  }
1988
2046
  const parentComponent = AST8.findParentNode(component, isFunctionComponent);
1989
- if (parentComponent != null && !ER21.isDirectValueOfRenderPropertyLoose(parentComponent)) {
2047
+ if (parentComponent != null && !ER22.isDirectValueOfRenderPropertyLoose(parentComponent)) {
1990
2048
  context.report({
1991
2049
  messageId: "noNestedComponentDefinitions",
1992
2050
  node: component,
@@ -1997,7 +2055,7 @@ function create33(context) {
1997
2055
  });
1998
2056
  continue;
1999
2057
  }
2000
- if (ER21.isInsideRenderMethod(component)) {
2058
+ if (ER22.isInsideRenderMethod(component)) {
2001
2059
  context.report({
2002
2060
  messageId: "noNestedComponentDefinitions",
2003
2061
  node: component,
@@ -2025,34 +2083,97 @@ function create33(context) {
2025
2083
  };
2026
2084
  }
2027
2085
  function isInsideJSXAttributeValue(node) {
2028
- 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;
2029
2087
  }
2030
2088
  function isInsideCreateElementProps(context, node) {
2031
- const call = AST8.findParentNode(node, ER21.isCreateElementCall(context));
2089
+ const call = AST8.findParentNode(node, ER22.isCreateElementCall(context));
2032
2090
  if (call == null) return false;
2033
2091
  const prop = AST8.findParentNode(node, AST8.is(AST_NODE_TYPES.ObjectExpression));
2034
2092
  if (prop == null) return false;
2035
2093
  return prop === call.arguments[1];
2036
2094
  }
2037
- var RULE_NAME34 = "no-prop-types";
2038
- 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 = [];
2039
2160
  var no_prop_types_default = createRule({
2040
2161
  meta: {
2041
2162
  type: "problem",
2042
2163
  docs: {
2043
2164
  description: "Disallow `propTypes` in favor of TypeScript or another type-checking solution.",
2044
- [Symbol.for("rule_features")]: RULE_FEATURES34
2165
+ [Symbol.for("rule_features")]: RULE_FEATURES36
2045
2166
  },
2046
2167
  messages: {
2047
2168
  noPropTypes: "[Deprecated] Use TypeScript or another type-checking solution instead."
2048
2169
  },
2049
2170
  schema: []
2050
2171
  },
2051
- name: RULE_NAME34,
2052
- create: create34,
2172
+ name: RULE_NAME36,
2173
+ create: create36,
2053
2174
  defaultOptions: []
2054
2175
  });
2055
- function create34(context) {
2176
+ function create36(context) {
2056
2177
  if (!context.sourceCode.text.includes("propTypes")) {
2057
2178
  return {};
2058
2179
  }
@@ -2068,17 +2189,17 @@ function create34(context) {
2068
2189
  if (property.type !== AST_NODE_TYPES.Identifier || property.name !== "propTypes") {
2069
2190
  return;
2070
2191
  }
2071
- if (!ER21.isComponentNameLoose(object.name)) {
2192
+ if (!ER22.isComponentNameLoose(object.name)) {
2072
2193
  return;
2073
2194
  }
2074
2195
  const variable = VAR2.findVariable(object.name, context.sourceCode.getScope(node));
2075
2196
  const variableNode = VAR2.getVariableInitNode(variable, 0);
2076
- if (variableNode != null && (AST8.isFunction(variableNode) || ER21.isClassComponent(variableNode))) {
2197
+ if (variableNode != null && (AST8.isFunction(variableNode) || ER22.isClassComponent(variableNode))) {
2077
2198
  context.report({ messageId: "noPropTypes", node: property });
2078
2199
  }
2079
2200
  },
2080
2201
  PropertyDefinition(node) {
2081
- if (!ER21.isClassComponent(node.parent.parent)) {
2202
+ if (!ER22.isClassComponent(node.parent.parent)) {
2082
2203
  return;
2083
2204
  }
2084
2205
  if (!node.static || node.key.type !== AST_NODE_TYPES.Identifier || node.key.name !== "propTypes") {
@@ -2088,8 +2209,8 @@ function create34(context) {
2088
2209
  }
2089
2210
  };
2090
2211
  }
2091
- var RULE_NAME35 = "no-redundant-should-component-update";
2092
- var RULE_FEATURES35 = [];
2212
+ var RULE_NAME37 = "no-redundant-should-component-update";
2213
+ var RULE_FEATURES37 = [];
2093
2214
  function isShouldComponentUpdate(node) {
2094
2215
  return AST8.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
2095
2216
  }
@@ -2098,26 +2219,26 @@ var no_redundant_should_component_update_default = createRule({
2098
2219
  type: "problem",
2099
2220
  docs: {
2100
2221
  description: "Disallow `shouldComponentUpdate` when extending `React.PureComponent`.",
2101
- [Symbol.for("rule_features")]: RULE_FEATURES35
2222
+ [Symbol.for("rule_features")]: RULE_FEATURES37
2102
2223
  },
2103
2224
  messages: {
2104
2225
  noRedundantShouldComponentUpdate: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'."
2105
2226
  },
2106
2227
  schema: []
2107
2228
  },
2108
- name: RULE_NAME35,
2109
- create: create35,
2229
+ name: RULE_NAME37,
2230
+ create: create37,
2110
2231
  defaultOptions: []
2111
2232
  });
2112
- function create35(context) {
2233
+ function create37(context) {
2113
2234
  if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
2114
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
2235
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
2115
2236
  return {
2116
2237
  ...listeners,
2117
- "Program:exit"(node) {
2118
- const components = ctx.getAllComponents(node);
2238
+ "Program:exit"(program) {
2239
+ const components = ctx.getAllComponents(program);
2119
2240
  for (const { name: name5 = "PureComponent", node: component, flag } of components.values()) {
2120
- if ((flag & ER21.ComponentFlag.PureComponent) === 0n) {
2241
+ if ((flag & ER22.ComponentFlag.PureComponent) === 0n) {
2121
2242
  continue;
2122
2243
  }
2123
2244
  const { body } = component.body;
@@ -2136,33 +2257,33 @@ function create35(context) {
2136
2257
  }
2137
2258
  };
2138
2259
  }
2139
- var RULE_NAME36 = "no-set-state-in-component-did-mount";
2140
- var RULE_FEATURES36 = [];
2260
+ var RULE_NAME38 = "no-set-state-in-component-did-mount";
2261
+ var RULE_FEATURES38 = [];
2141
2262
  var no_set_state_in_component_did_mount_default = createRule({
2142
2263
  meta: {
2143
2264
  type: "problem",
2144
2265
  docs: {
2145
2266
  description: "Disallow calling `this.setState` in `componentDidMount` outside of functions, such as callbacks.",
2146
- [Symbol.for("rule_features")]: RULE_FEATURES36
2267
+ [Symbol.for("rule_features")]: RULE_FEATURES38
2147
2268
  },
2148
2269
  messages: {
2149
2270
  noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions, such as callbacks."
2150
2271
  },
2151
2272
  schema: []
2152
2273
  },
2153
- name: RULE_NAME36,
2154
- create: create36,
2274
+ name: RULE_NAME38,
2275
+ create: create38,
2155
2276
  defaultOptions: []
2156
2277
  });
2157
- function create36(context) {
2278
+ function create38(context) {
2158
2279
  if (!context.sourceCode.text.includes("componentDidMount")) return {};
2159
2280
  return {
2160
2281
  CallExpression(node) {
2161
- if (!ER21.isThisSetState(node)) {
2282
+ if (!ER22.isThisSetState(node)) {
2162
2283
  return;
2163
2284
  }
2164
- const clazz = AST8.findParentNode(node, ER21.isClassComponent);
2165
- 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));
2166
2287
  if (clazz == null || method == null || method === clazz) return;
2167
2288
  const methodScope = context.sourceCode.getScope(method);
2168
2289
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2175,33 +2296,33 @@ function create36(context) {
2175
2296
  }
2176
2297
  };
2177
2298
  }
2178
- var RULE_NAME37 = "no-set-state-in-component-did-update";
2179
- var RULE_FEATURES37 = [];
2299
+ var RULE_NAME39 = "no-set-state-in-component-did-update";
2300
+ var RULE_FEATURES39 = [];
2180
2301
  var no_set_state_in_component_did_update_default = createRule({
2181
2302
  meta: {
2182
2303
  type: "problem",
2183
2304
  docs: {
2184
- description: "Disallows calling `this.setState` in `componentDidUpdate` outside of functions, such as callbacks.",
2185
- [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
2186
2307
  },
2187
2308
  messages: {
2188
2309
  noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions, such as callbacks."
2189
2310
  },
2190
2311
  schema: []
2191
2312
  },
2192
- name: RULE_NAME37,
2193
- create: create37,
2313
+ name: RULE_NAME39,
2314
+ create: create39,
2194
2315
  defaultOptions: []
2195
2316
  });
2196
- function create37(context) {
2317
+ function create39(context) {
2197
2318
  if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
2198
2319
  return {
2199
2320
  CallExpression(node) {
2200
- if (!ER21.isThisSetState(node)) {
2321
+ if (!ER22.isThisSetState(node)) {
2201
2322
  return;
2202
2323
  }
2203
- const clazz = AST8.findParentNode(node, ER21.isClassComponent);
2204
- 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));
2205
2326
  if (clazz == null || method == null || method === clazz) return;
2206
2327
  const methodScope = context.sourceCode.getScope(method);
2207
2328
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2214,33 +2335,33 @@ function create37(context) {
2214
2335
  }
2215
2336
  };
2216
2337
  }
2217
- var RULE_NAME38 = "no-set-state-in-component-will-update";
2218
- var RULE_FEATURES38 = [];
2338
+ var RULE_NAME40 = "no-set-state-in-component-will-update";
2339
+ var RULE_FEATURES40 = [];
2219
2340
  var no_set_state_in_component_will_update_default = createRule({
2220
2341
  meta: {
2221
2342
  type: "problem",
2222
2343
  docs: {
2223
2344
  description: "Disallows calling `this.setState` in `componentWillUpdate` outside of functions, such as callbacks.",
2224
- [Symbol.for("rule_features")]: RULE_FEATURES38
2345
+ [Symbol.for("rule_features")]: RULE_FEATURES40
2225
2346
  },
2226
2347
  messages: {
2227
2348
  noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions, such as callbacks."
2228
2349
  },
2229
2350
  schema: []
2230
2351
  },
2231
- name: RULE_NAME38,
2232
- create: create38,
2352
+ name: RULE_NAME40,
2353
+ create: create40,
2233
2354
  defaultOptions: []
2234
2355
  });
2235
- function create38(context) {
2356
+ function create40(context) {
2236
2357
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
2237
2358
  return {
2238
2359
  CallExpression(node) {
2239
- if (!ER21.isThisSetState(node)) {
2360
+ if (!ER22.isThisSetState(node)) {
2240
2361
  return;
2241
2362
  }
2242
- const clazz = AST8.findParentNode(node, ER21.isClassComponent);
2243
- 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));
2244
2365
  if (clazz == null || method == null || method === clazz) return;
2245
2366
  const methodScope = context.sourceCode.getScope(method);
2246
2367
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2253,8 +2374,8 @@ function create38(context) {
2253
2374
  }
2254
2375
  };
2255
2376
  }
2256
- var RULE_NAME39 = "no-string-refs";
2257
- var RULE_FEATURES39 = [
2377
+ var RULE_NAME41 = "no-string-refs";
2378
+ var RULE_FEATURES41 = [
2258
2379
  "MOD"
2259
2380
  ];
2260
2381
  var no_string_refs_default = createRule({
@@ -2262,7 +2383,7 @@ var no_string_refs_default = createRule({
2262
2383
  type: "problem",
2263
2384
  docs: {
2264
2385
  description: "Replaces string refs with callback refs.",
2265
- [Symbol.for("rule_features")]: RULE_FEATURES39
2386
+ [Symbol.for("rule_features")]: RULE_FEATURES41
2266
2387
  },
2267
2388
  fixable: "code",
2268
2389
  messages: {
@@ -2270,16 +2391,16 @@ var no_string_refs_default = createRule({
2270
2391
  },
2271
2392
  schema: []
2272
2393
  },
2273
- name: RULE_NAME39,
2274
- create: create39,
2394
+ name: RULE_NAME41,
2395
+ create: create41,
2275
2396
  defaultOptions: []
2276
2397
  });
2277
- function create39(context) {
2398
+ function create41(context) {
2278
2399
  const state = {
2279
2400
  isWithinClassComponent: false
2280
2401
  };
2281
2402
  function onClassBodyEnter(node) {
2282
- if (ER21.isClassComponent(node.parent)) {
2403
+ if (ER22.isClassComponent(node.parent)) {
2283
2404
  state.isWithinClassComponent = true;
2284
2405
  }
2285
2406
  }
@@ -2318,8 +2439,8 @@ function getAttributeValueText(context, node) {
2318
2439
  return null;
2319
2440
  }
2320
2441
  }
2321
- var RULE_NAME40 = "no-unsafe-component-will-mount";
2322
- var RULE_FEATURES40 = [];
2442
+ var RULE_NAME42 = "no-unsafe-component-will-mount";
2443
+ var RULE_FEATURES42 = [];
2323
2444
  function isUnsafeComponentWillMount(node) {
2324
2445
  return AST8.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillMount";
2325
2446
  }
@@ -2328,24 +2449,24 @@ var no_unsafe_component_will_mount_default = createRule({
2328
2449
  type: "problem",
2329
2450
  docs: {
2330
2451
  description: "Warns the usage of `UNSAFE_componentWillMount` in class components.",
2331
- [Symbol.for("rule_features")]: RULE_FEATURES40
2452
+ [Symbol.for("rule_features")]: RULE_FEATURES42
2332
2453
  },
2333
2454
  messages: {
2334
2455
  noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'."
2335
2456
  },
2336
2457
  schema: []
2337
2458
  },
2338
- name: RULE_NAME40,
2339
- create: create40,
2459
+ name: RULE_NAME42,
2460
+ create: create42,
2340
2461
  defaultOptions: []
2341
2462
  });
2342
- function create40(context) {
2463
+ function create42(context) {
2343
2464
  if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
2344
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
2465
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
2345
2466
  return {
2346
2467
  ...listeners,
2347
- "Program:exit"(node) {
2348
- const components = ctx.getAllComponents(node);
2468
+ "Program:exit"(program) {
2469
+ const components = ctx.getAllComponents(program);
2349
2470
  for (const { node: component } of components.values()) {
2350
2471
  const { body } = component.body;
2351
2472
  for (const member of body) {
@@ -2360,8 +2481,8 @@ function create40(context) {
2360
2481
  }
2361
2482
  };
2362
2483
  }
2363
- var RULE_NAME41 = "no-unsafe-component-will-receive-props";
2364
- var RULE_FEATURES41 = [];
2484
+ var RULE_NAME43 = "no-unsafe-component-will-receive-props";
2485
+ var RULE_FEATURES43 = [];
2365
2486
  function isUnsafeComponentWillReceiveProps(node) {
2366
2487
  return AST8.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillReceiveProps";
2367
2488
  }
@@ -2370,26 +2491,26 @@ var no_unsafe_component_will_receive_props_default = createRule({
2370
2491
  type: "problem",
2371
2492
  docs: {
2372
2493
  description: "Warns the usage of `UNSAFE_componentWillReceiveProps` in class components.",
2373
- [Symbol.for("rule_features")]: RULE_FEATURES41
2494
+ [Symbol.for("rule_features")]: RULE_FEATURES43
2374
2495
  },
2375
2496
  messages: {
2376
2497
  noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'."
2377
2498
  },
2378
2499
  schema: []
2379
2500
  },
2380
- name: RULE_NAME41,
2381
- create: create41,
2501
+ name: RULE_NAME43,
2502
+ create: create43,
2382
2503
  defaultOptions: []
2383
2504
  });
2384
- function create41(context) {
2505
+ function create43(context) {
2385
2506
  if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) {
2386
2507
  return {};
2387
2508
  }
2388
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
2509
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
2389
2510
  return {
2390
2511
  ...listeners,
2391
- "Program:exit"(node) {
2392
- const components = ctx.getAllComponents(node);
2512
+ "Program:exit"(program) {
2513
+ const components = ctx.getAllComponents(program);
2393
2514
  for (const { node: component } of components.values()) {
2394
2515
  const { body } = component.body;
2395
2516
  for (const member of body) {
@@ -2404,8 +2525,8 @@ function create41(context) {
2404
2525
  }
2405
2526
  };
2406
2527
  }
2407
- var RULE_NAME42 = "no-unsafe-component-will-update";
2408
- var RULE_FEATURES42 = [];
2528
+ var RULE_NAME44 = "no-unsafe-component-will-update";
2529
+ var RULE_FEATURES44 = [];
2409
2530
  function isUnsafeComponentWillUpdate(node) {
2410
2531
  return AST8.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillUpdate";
2411
2532
  }
@@ -2414,24 +2535,24 @@ var no_unsafe_component_will_update_default = createRule({
2414
2535
  type: "problem",
2415
2536
  docs: {
2416
2537
  description: "Warns the usage of `UNSAFE_componentWillUpdate` in class components.",
2417
- [Symbol.for("rule_features")]: RULE_FEATURES42
2538
+ [Symbol.for("rule_features")]: RULE_FEATURES44
2418
2539
  },
2419
2540
  messages: {
2420
2541
  noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'."
2421
2542
  },
2422
2543
  schema: []
2423
2544
  },
2424
- name: RULE_NAME42,
2425
- create: create42,
2545
+ name: RULE_NAME44,
2546
+ create: create44,
2426
2547
  defaultOptions: []
2427
2548
  });
2428
- function create42(context) {
2549
+ function create44(context) {
2429
2550
  if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
2430
- const { ctx, listeners } = ER21.useComponentCollectorLegacy();
2551
+ const { ctx, listeners } = ER22.useComponentCollectorLegacy();
2431
2552
  return {
2432
2553
  ...listeners,
2433
- "Program:exit"(node) {
2434
- const components = ctx.getAllComponents(node);
2554
+ "Program:exit"(program) {
2555
+ const components = ctx.getAllComponents(program);
2435
2556
  for (const { node: component } of components.values()) {
2436
2557
  const { body } = component.body;
2437
2558
  for (const member of body) {
@@ -2446,33 +2567,33 @@ function create42(context) {
2446
2567
  }
2447
2568
  };
2448
2569
  }
2449
- var RULE_NAME43 = "no-unstable-context-value";
2450
- var RULE_FEATURES43 = [];
2570
+ var RULE_NAME45 = "no-unstable-context-value";
2571
+ var RULE_FEATURES45 = [];
2451
2572
  var no_unstable_context_value_default = createRule({
2452
2573
  meta: {
2453
2574
  type: "problem",
2454
2575
  docs: {
2455
2576
  description: "Prevents non-stable values (i.e. object literals) from being used as a value for `Context.Provider`.",
2456
- [Symbol.for("rule_features")]: RULE_FEATURES43
2577
+ [Symbol.for("rule_features")]: RULE_FEATURES45
2457
2578
  },
2458
2579
  messages: {
2459
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}}"
2460
2581
  },
2461
2582
  schema: []
2462
2583
  },
2463
- name: RULE_NAME43,
2464
- create: create43,
2584
+ name: RULE_NAME45,
2585
+ create: create45,
2465
2586
  defaultOptions: []
2466
2587
  });
2467
- function create43(context) {
2588
+ function create45(context) {
2468
2589
  const { version: version2 } = getSettingsFromContext(context);
2469
2590
  const isReact18OrBelow = compare(version2, "19.0.0", "<");
2470
- const { ctx, listeners } = ER21.useComponentCollector(context);
2591
+ const { ctx, listeners } = ER22.useComponentCollector(context);
2471
2592
  const constructions = /* @__PURE__ */ new Map();
2472
2593
  return {
2473
2594
  ...listeners,
2474
2595
  JSXOpeningElement(node) {
2475
- const fullName = JSX8.getElementType(node.parent);
2596
+ const fullName = JSX9.getElementType(node.parent);
2476
2597
  const selfName = fullName.split(".").at(-1);
2477
2598
  if (selfName == null) return;
2478
2599
  if (!isContextName(selfName, isReact18OrBelow)) return;
@@ -2488,13 +2609,13 @@ function create43(context) {
2488
2609
  const initialScope = context.sourceCode.getScope(valueExpression);
2489
2610
  const construction = VAR2.getConstructionDetectionResult(valueExpression, initialScope);
2490
2611
  if (construction == null) return;
2491
- if (ER21.isReactHookCall(construction.node)) {
2612
+ if (ER22.isReactHookCall(construction.node)) {
2492
2613
  return;
2493
2614
  }
2494
2615
  getOrUpdate(constructions, functionEntry.node, () => []).push(construction);
2495
2616
  },
2496
- "Program:exit"(node) {
2497
- const components = ctx.getAllComponents(node).values();
2617
+ "Program:exit"(program) {
2618
+ const components = ctx.getAllComponents(program).values();
2498
2619
  for (const { node: component } of components) {
2499
2620
  for (const construction of constructions.get(component) ?? []) {
2500
2621
  const { kind, node: constructionNode } = construction;
@@ -2519,31 +2640,31 @@ function isContextName(name5, isReact18OrBelow) {
2519
2640
  }
2520
2641
  return false;
2521
2642
  }
2522
- var RULE_NAME44 = "no-unstable-default-props";
2523
- var RULE_FEATURES44 = [];
2643
+ var RULE_NAME46 = "no-unstable-default-props";
2644
+ var RULE_FEATURES46 = [];
2524
2645
  var no_unstable_default_props_default = createRule({
2525
2646
  meta: {
2526
2647
  type: "problem",
2527
2648
  docs: {
2528
2649
  description: "Prevents using referential-type values as default props in object destructuring.",
2529
- [Symbol.for("rule_features")]: RULE_FEATURES44
2650
+ [Symbol.for("rule_features")]: RULE_FEATURES46
2530
2651
  },
2531
2652
  messages: {
2532
2653
  noUnstableDefaultProps: "A/an '{{forbiddenType}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{forbiddenType}}'."
2533
2654
  },
2534
2655
  schema: []
2535
2656
  },
2536
- name: RULE_NAME44,
2537
- create: create44,
2657
+ name: RULE_NAME46,
2658
+ create: create46,
2538
2659
  defaultOptions: []
2539
2660
  });
2540
- function create44(context) {
2541
- const { ctx, listeners } = ER21.useComponentCollector(context);
2661
+ function create46(context) {
2662
+ const { ctx, listeners } = ER22.useComponentCollector(context);
2542
2663
  const declarators = /* @__PURE__ */ new Map();
2543
2664
  return {
2544
2665
  ...listeners,
2545
- "Program:exit"(node) {
2546
- const components = ctx.getAllComponents(node);
2666
+ "Program:exit"(program) {
2667
+ const components = ctx.getAllComponents(program);
2547
2668
  for (const { node: component } of components.values()) {
2548
2669
  const { params } = component;
2549
2670
  const [props] = params;
@@ -2568,7 +2689,7 @@ function create44(context) {
2568
2689
  if (construction == null) {
2569
2690
  continue;
2570
2691
  }
2571
- if (ER21.isReactHookCall(construction.node)) {
2692
+ if (ER22.isReactHookCall(construction.node)) {
2572
2693
  continue;
2573
2694
  }
2574
2695
  const forbiddenType = AST8.toReadableNodeType(right);
@@ -2593,8 +2714,8 @@ function create44(context) {
2593
2714
  }
2594
2715
  };
2595
2716
  }
2596
- var RULE_NAME45 = "no-unused-class-component-members";
2597
- var RULE_FEATURES45 = [];
2717
+ var RULE_NAME47 = "no-unused-class-component-members";
2718
+ var RULE_FEATURES47 = [];
2598
2719
  var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
2599
2720
  "componentDidCatch",
2600
2721
  "componentDidMount",
@@ -2620,25 +2741,25 @@ var no_unused_class_component_members_default = createRule({
2620
2741
  type: "problem",
2621
2742
  docs: {
2622
2743
  description: "Warns unused class component methods and properties.",
2623
- [Symbol.for("rule_features")]: RULE_FEATURES45
2744
+ [Symbol.for("rule_features")]: RULE_FEATURES47
2624
2745
  },
2625
2746
  messages: {
2626
2747
  noUnusedClassComponentMembers: "Unused method or property '{{methodName}}'' of class '{{className}}'."
2627
2748
  },
2628
2749
  schema: []
2629
2750
  },
2630
- name: RULE_NAME45,
2631
- create: create45,
2751
+ name: RULE_NAME47,
2752
+ create: create47,
2632
2753
  defaultOptions: []
2633
2754
  });
2634
- function create45(context) {
2755
+ function create47(context) {
2635
2756
  const classEntries = [];
2636
2757
  const methodEntries = [];
2637
2758
  const propertyDefs = /* @__PURE__ */ new WeakMap();
2638
2759
  const propertyUsages = /* @__PURE__ */ new WeakMap();
2639
2760
  function classEnter(node) {
2640
2761
  classEntries.push(node);
2641
- if (!ER21.isClassComponent(node)) {
2762
+ if (!ER22.isClassComponent(node)) {
2642
2763
  return;
2643
2764
  }
2644
2765
  propertyDefs.set(node, /* @__PURE__ */ new Set());
@@ -2646,7 +2767,7 @@ function create45(context) {
2646
2767
  }
2647
2768
  function classExit() {
2648
2769
  const currentClass = classEntries.pop();
2649
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2770
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2650
2771
  return;
2651
2772
  }
2652
2773
  const className = AST8.getClassIdentifier(currentClass)?.name;
@@ -2676,7 +2797,7 @@ function create45(context) {
2676
2797
  function methodEnter(node) {
2677
2798
  methodEntries.push(node);
2678
2799
  const currentClass = classEntries.at(-1);
2679
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2800
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2680
2801
  return;
2681
2802
  }
2682
2803
  if (node.static) {
@@ -2700,7 +2821,7 @@ function create45(context) {
2700
2821
  if (currentClass == null || currentMethod == null) {
2701
2822
  return;
2702
2823
  }
2703
- if (!ER21.isClassComponent(currentClass) || currentMethod.static) {
2824
+ if (!ER22.isClassComponent(currentClass) || currentMethod.static) {
2704
2825
  return;
2705
2826
  }
2706
2827
  if (!AST8.isThisExpression(node.object) || !isKeyLiteral2(node, node.property)) {
@@ -2725,7 +2846,7 @@ function create45(context) {
2725
2846
  if (currentClass == null || currentMethod == null) {
2726
2847
  return;
2727
2848
  }
2728
- if (!ER21.isClassComponent(currentClass) || currentMethod.static) {
2849
+ if (!ER22.isClassComponent(currentClass) || currentMethod.static) {
2729
2850
  return;
2730
2851
  }
2731
2852
  if (node.init != null && AST8.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern) {
@@ -2741,8 +2862,8 @@ function create45(context) {
2741
2862
  }
2742
2863
  };
2743
2864
  }
2744
- var RULE_NAME46 = "no-unused-state";
2745
- var RULE_FEATURES46 = [];
2865
+ var RULE_NAME48 = "no-unused-state";
2866
+ var RULE_FEATURES48 = [];
2746
2867
  function isKeyLiteral3(node, key) {
2747
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);
2748
2869
  }
@@ -2751,18 +2872,18 @@ var no_unused_state_default = createRule({
2751
2872
  type: "problem",
2752
2873
  docs: {
2753
2874
  description: "Warns unused class component state.",
2754
- [Symbol.for("rule_features")]: RULE_FEATURES46
2875
+ [Symbol.for("rule_features")]: RULE_FEATURES48
2755
2876
  },
2756
2877
  messages: {
2757
2878
  noUnusedState: "Unused class component state in '{{className}}'"
2758
2879
  },
2759
2880
  schema: []
2760
2881
  },
2761
- name: RULE_NAME46,
2762
- create: create46,
2882
+ name: RULE_NAME48,
2883
+ create: create48,
2763
2884
  defaultOptions: []
2764
2885
  });
2765
- function create46(context) {
2886
+ function create48(context) {
2766
2887
  const classEntries = [];
2767
2888
  const methodEntries = [];
2768
2889
  const constructorEntries = [];
@@ -2772,7 +2893,7 @@ function create46(context) {
2772
2893
  }
2773
2894
  function classExit() {
2774
2895
  const currentClass = classEntries.pop();
2775
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2896
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2776
2897
  return;
2777
2898
  }
2778
2899
  const className = AST8.getClassIdentifier(currentClass)?.name;
@@ -2791,11 +2912,11 @@ function create46(context) {
2791
2912
  function methodEnter(node) {
2792
2913
  methodEntries.push(node);
2793
2914
  const currentClass = classEntries.at(-1);
2794
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2915
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2795
2916
  return;
2796
2917
  }
2797
2918
  if (node.static) {
2798
- 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)) {
2799
2920
  const defNode = stateDefs.get(currentClass)?.node;
2800
2921
  stateDefs.set(currentClass, { node: defNode, isUsed: true });
2801
2922
  }
@@ -2816,11 +2937,11 @@ function create46(context) {
2816
2937
  }
2817
2938
  return {
2818
2939
  AssignmentExpression(node) {
2819
- if (!ER21.isAssignmentToThisState(node)) {
2940
+ if (!ER22.isAssignmentToThisState(node)) {
2820
2941
  return;
2821
2942
  }
2822
2943
  const currentClass = classEntries.at(-1);
2823
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2944
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2824
2945
  return;
2825
2946
  }
2826
2947
  const currentConstructor = constructorEntries.at(-1);
@@ -2842,7 +2963,7 @@ function create46(context) {
2842
2963
  return;
2843
2964
  }
2844
2965
  const currentClass = classEntries.at(-1);
2845
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2966
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2846
2967
  return;
2847
2968
  }
2848
2969
  const currentMethod = methodEntries.at(-1);
@@ -2866,7 +2987,7 @@ function create46(context) {
2866
2987
  "PropertyDefinition:exit": methodExit,
2867
2988
  VariableDeclarator(node) {
2868
2989
  const currentClass = classEntries.at(-1);
2869
- if (currentClass == null || !ER21.isClassComponent(currentClass)) {
2990
+ if (currentClass == null || !ER22.isClassComponent(currentClass)) {
2870
2991
  return;
2871
2992
  }
2872
2993
  const currentMethod = methodEntries.at(-1);
@@ -2896,8 +3017,8 @@ function create46(context) {
2896
3017
  }
2897
3018
  };
2898
3019
  }
2899
- var RULE_NAME47 = "no-use-context";
2900
- var RULE_FEATURES47 = [
3020
+ var RULE_NAME49 = "no-use-context";
3021
+ var RULE_FEATURES49 = [
2901
3022
  "MOD"
2902
3023
  ];
2903
3024
  var no_use_context_default = createRule({
@@ -2905,7 +3026,7 @@ var no_use_context_default = createRule({
2905
3026
  type: "problem",
2906
3027
  docs: {
2907
3028
  description: "Replaces usages of `useContext` with `use`.",
2908
- [Symbol.for("rule_features")]: RULE_FEATURES47
3029
+ [Symbol.for("rule_features")]: RULE_FEATURES49
2909
3030
  },
2910
3031
  fixable: "code",
2911
3032
  messages: {
@@ -2913,11 +3034,11 @@ var no_use_context_default = createRule({
2913
3034
  },
2914
3035
  schema: []
2915
3036
  },
2916
- name: RULE_NAME47,
2917
- create: create47,
3037
+ name: RULE_NAME49,
3038
+ create: create49,
2918
3039
  defaultOptions: []
2919
3040
  });
2920
- function create47(context) {
3041
+ function create49(context) {
2921
3042
  if (!context.sourceCode.text.includes("useContext")) return {};
2922
3043
  const settings4 = getSettingsFromContext(context);
2923
3044
  const useContextAlias = /* @__PURE__ */ new Set();
@@ -2926,10 +3047,10 @@ function create47(context) {
2926
3047
  }
2927
3048
  return {
2928
3049
  CallExpression(node) {
2929
- if (!ER21.isReactHookCall(node)) {
3050
+ if (!ER22.isReactHookCall(node)) {
2930
3051
  return;
2931
3052
  }
2932
- if (!ER21.isReactHookCallWithNameAlias(context, "useContext", [...useContextAlias])(node)) {
3053
+ if (!ER22.isReactHookCallWithNameAlias(context, "useContext", [...useContextAlias])(node)) {
2933
3054
  return;
2934
3055
  }
2935
3056
  context.report({
@@ -2995,28 +3116,28 @@ function getAssociatedTokens(context, node) {
2995
3116
  return tokens;
2996
3117
  }
2997
3118
  }
2998
- var RULE_NAME48 = "no-useless-forward-ref";
2999
- var RULE_FEATURES48 = [];
3119
+ var RULE_NAME50 = "no-useless-forward-ref";
3120
+ var RULE_FEATURES50 = [];
3000
3121
  var no_useless_forward_ref_default = createRule({
3001
3122
  meta: {
3002
3123
  type: "problem",
3003
3124
  docs: {
3004
3125
  description: "Disallow useless `forwardRef` calls on components that don't use `ref`s.",
3005
- [Symbol.for("rule_features")]: RULE_FEATURES48
3126
+ [Symbol.for("rule_features")]: RULE_FEATURES50
3006
3127
  },
3007
3128
  messages: {
3008
3129
  noUselessForwardRef: "A 'forwardRef' is used with this component but no 'ref' parameter is set."
3009
3130
  },
3010
3131
  schema: []
3011
3132
  },
3012
- name: RULE_NAME48,
3013
- create: create48,
3133
+ name: RULE_NAME50,
3134
+ create: create50,
3014
3135
  defaultOptions: []
3015
3136
  });
3016
- function create48(context) {
3137
+ function create50(context) {
3017
3138
  return {
3018
3139
  CallExpression(node) {
3019
- if (!ER21.isForwardRefCall(context, node)) {
3140
+ if (!ER22.isForwardRefCall(context, node)) {
3020
3141
  return;
3021
3142
  }
3022
3143
  const [component] = node.arguments;
@@ -3034,7 +3155,7 @@ function create48(context) {
3034
3155
  }
3035
3156
  };
3036
3157
  }
3037
- var RULE_NAME49 = "no-useless-fragment";
3158
+ var RULE_NAME51 = "no-useless-fragment";
3038
3159
  var defaultOptions = [{
3039
3160
  allowExpressions: true
3040
3161
  }];
@@ -3060,15 +3181,15 @@ var no_useless_fragment_default = createRule({
3060
3181
  }
3061
3182
  }]
3062
3183
  },
3063
- name: RULE_NAME49,
3064
- create: create49,
3184
+ name: RULE_NAME51,
3185
+ create: create51,
3065
3186
  defaultOptions
3066
3187
  });
3067
- function create49(context, [option]) {
3188
+ function create51(context, [option]) {
3068
3189
  const { allowExpressions = true } = option;
3069
3190
  return {
3070
3191
  JSXElement(node) {
3071
- if (!JSX8.isFragmentElement(node)) return;
3192
+ if (!JSX9.isFragmentElement(node)) return;
3072
3193
  checkNode(context, node, allowExpressions);
3073
3194
  },
3074
3195
  JSXFragment(node) {
@@ -3080,7 +3201,7 @@ function isWhiteSpace(node) {
3080
3201
  return typeof node.value === "string" && node.raw.trim() === "";
3081
3202
  }
3082
3203
  function isPaddingSpaces(node) {
3083
- return JSX8.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
3204
+ return JSX9.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
3084
3205
  }
3085
3206
  function trimLikeReact(text) {
3086
3207
  const leadingSpaces = /^\s*/.exec(text)?.[0] ?? "";
@@ -3091,10 +3212,10 @@ function trimLikeReact(text) {
3091
3212
  }
3092
3213
  function checkNode(context, node, allowExpressions) {
3093
3214
  const initialScope = context.sourceCode.getScope(node);
3094
- if (JSX8.isKeyedElement(node, initialScope)) {
3215
+ if (JSX9.isKeyedElement(node, initialScope)) {
3095
3216
  return;
3096
3217
  }
3097
- if (JSX8.isHostElement(node.parent)) {
3218
+ if (JSX9.isHostElement(node.parent)) {
3098
3219
  context.report({
3099
3220
  messageId: "uselessFragment",
3100
3221
  node,
@@ -3118,7 +3239,7 @@ function checkNode(context, node, allowExpressions) {
3118
3239
  const isChildElement = AST8.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(node.parent);
3119
3240
  switch (true) {
3120
3241
  // <Foo content={<>ee eeee eeee ...</>} />
3121
- 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))): {
3122
3243
  return;
3123
3244
  }
3124
3245
  // <Foo><>hello, world</></Foo>
@@ -3174,18 +3295,18 @@ function getFix2(context, node) {
3174
3295
  }
3175
3296
  function canFix(node) {
3176
3297
  if (node.parent.type === AST_NODE_TYPES.JSXElement || node.parent.type === AST_NODE_TYPES.JSXFragment) {
3177
- return JSX8.isHostElement(node.parent);
3298
+ return JSX9.isHostElement(node.parent);
3178
3299
  }
3179
3300
  if (node.children.length === 0) {
3180
3301
  return false;
3181
3302
  }
3182
- 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))) {
3183
3304
  return false;
3184
3305
  }
3185
3306
  return true;
3186
3307
  }
3187
- var RULE_NAME50 = "prefer-destructuring-assignment";
3188
- var RULE_FEATURES49 = [];
3308
+ var RULE_NAME52 = "prefer-destructuring-assignment";
3309
+ var RULE_FEATURES51 = [];
3189
3310
  function isMemberExpressionWithObjectName(node) {
3190
3311
  return node.object.type === AST_NODE_TYPES.Identifier && "name" in node.object;
3191
3312
  }
@@ -3194,19 +3315,19 @@ var prefer_destructuring_assignment_default = createRule({
3194
3315
  type: "problem",
3195
3316
  docs: {
3196
3317
  description: "Enforces destructuring assignment for component props and context.",
3197
- [Symbol.for("rule_features")]: RULE_FEATURES49
3318
+ [Symbol.for("rule_features")]: RULE_FEATURES51
3198
3319
  },
3199
3320
  messages: {
3200
3321
  preferDestructuringAssignment: "Use destructuring assignment for {{name}}."
3201
3322
  },
3202
3323
  schema: []
3203
3324
  },
3204
- name: RULE_NAME50,
3205
- create: create50,
3325
+ name: RULE_NAME52,
3326
+ create: create52,
3206
3327
  defaultOptions: []
3207
3328
  });
3208
- function create50(context) {
3209
- const { ctx, listeners } = ER21.useComponentCollector(context);
3329
+ function create52(context) {
3330
+ const { ctx, listeners } = ER22.useComponentCollector(context);
3210
3331
  const memberExpressionWithNames = [];
3211
3332
  return {
3212
3333
  ...listeners,
@@ -3216,16 +3337,16 @@ function create50(context) {
3216
3337
  memberExpressionWithNames.push([scope, node]);
3217
3338
  }
3218
3339
  },
3219
- "Program:exit"(node) {
3340
+ "Program:exit"(program) {
3220
3341
  const components = [
3221
- ...ctx.getAllComponents(node).values()
3342
+ ...ctx.getAllComponents(program).values()
3222
3343
  ];
3223
3344
  function isFunctionComponent(block) {
3224
3345
  if (!AST8.isFunction(block)) {
3225
3346
  return false;
3226
3347
  }
3227
3348
  const id = AST8.getFunctionIdentifier(block);
3228
- 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);
3229
3350
  }
3230
3351
  for (const [initialScope, memberExpression] of memberExpressionWithNames) {
3231
3352
  let scope = initialScope;
@@ -3242,7 +3363,7 @@ function create50(context) {
3242
3363
  continue;
3243
3364
  }
3244
3365
  const [props, ctx2] = component.params;
3245
- 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;
3246
3367
  if (isMatch(props)) {
3247
3368
  context.report({
3248
3369
  messageId: "preferDestructuringAssignment",
@@ -3265,8 +3386,8 @@ function create50(context) {
3265
3386
  }
3266
3387
  };
3267
3388
  }
3268
- var RULE_NAME51 = "prefer-react-namespace-import";
3269
- var RULE_FEATURES50 = [
3389
+ var RULE_NAME53 = "prefer-react-namespace-import";
3390
+ var RULE_FEATURES52 = [
3270
3391
  "FIX"
3271
3392
  ];
3272
3393
  var prefer_react_namespace_import_default = createRule({
@@ -3274,7 +3395,7 @@ var prefer_react_namespace_import_default = createRule({
3274
3395
  type: "problem",
3275
3396
  docs: {
3276
3397
  description: "Enforces React is imported via a namespace import.",
3277
- [Symbol.for("rule_features")]: RULE_FEATURES50
3398
+ [Symbol.for("rule_features")]: RULE_FEATURES52
3278
3399
  },
3279
3400
  fixable: "code",
3280
3401
  messages: {
@@ -3282,11 +3403,11 @@ var prefer_react_namespace_import_default = createRule({
3282
3403
  },
3283
3404
  schema: []
3284
3405
  },
3285
- name: RULE_NAME51,
3286
- create: create51,
3406
+ name: RULE_NAME53,
3407
+ create: create53,
3287
3408
  defaultOptions: []
3288
3409
  });
3289
- function create51(context) {
3410
+ function create53(context) {
3290
3411
  const { importSource } = getSettingsFromContext(context);
3291
3412
  return {
3292
3413
  [`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
@@ -3321,8 +3442,8 @@ function create51(context) {
3321
3442
  }
3322
3443
  };
3323
3444
  }
3324
- var RULE_NAME52 = "prefer-read-only-props";
3325
- var RULE_FEATURES51 = [
3445
+ var RULE_NAME54 = "prefer-read-only-props";
3446
+ var RULE_FEATURES53 = [
3326
3447
  "TSC",
3327
3448
  "EXP"
3328
3449
  ];
@@ -3331,24 +3452,24 @@ var prefer_read_only_props_default = createRule({
3331
3452
  type: "problem",
3332
3453
  docs: {
3333
3454
  description: "Enforces read-only props in components.",
3334
- [Symbol.for("rule_features")]: RULE_FEATURES51
3455
+ [Symbol.for("rule_features")]: RULE_FEATURES53
3335
3456
  },
3336
3457
  messages: {
3337
3458
  preferReadOnlyProps: "A function component's props should be read-only."
3338
3459
  },
3339
3460
  schema: []
3340
3461
  },
3341
- name: RULE_NAME52,
3342
- create: create52,
3462
+ name: RULE_NAME54,
3463
+ create: create54,
3343
3464
  defaultOptions: []
3344
3465
  });
3345
- function create52(context) {
3466
+ function create54(context) {
3346
3467
  const services = ESLintUtils.getParserServices(context, false);
3347
- const { ctx, listeners } = ER21.useComponentCollector(context);
3468
+ const { ctx, listeners } = ER22.useComponentCollector(context);
3348
3469
  return {
3349
3470
  ...listeners,
3350
- "Program:exit"(node) {
3351
- const components = ctx.getAllComponents(node);
3471
+ "Program:exit"(program) {
3472
+ const components = ctx.getAllComponents(program);
3352
3473
  for (const [, component] of components) {
3353
3474
  const [props] = component.node.params;
3354
3475
  if (props == null) {
@@ -3372,8 +3493,8 @@ function isTypeReadonlyLoose(services, type) {
3372
3493
  return true;
3373
3494
  }
3374
3495
  }
3375
- var RULE_NAME53 = "prefer-shorthand-boolean";
3376
- var RULE_FEATURES52 = [
3496
+ var RULE_NAME55 = "prefer-shorthand-boolean";
3497
+ var RULE_FEATURES54 = [
3377
3498
  "FIX"
3378
3499
  ];
3379
3500
  var prefer_shorthand_boolean_default = createRule({
@@ -3381,7 +3502,7 @@ var prefer_shorthand_boolean_default = createRule({
3381
3502
  type: "problem",
3382
3503
  docs: {
3383
3504
  description: "Enforces shorthand syntax for boolean attributes.",
3384
- [Symbol.for("rule_features")]: RULE_FEATURES52
3505
+ [Symbol.for("rule_features")]: RULE_FEATURES54
3385
3506
  },
3386
3507
  fixable: "code",
3387
3508
  messages: {
@@ -3389,15 +3510,15 @@ var prefer_shorthand_boolean_default = createRule({
3389
3510
  },
3390
3511
  schema: []
3391
3512
  },
3392
- name: RULE_NAME53,
3393
- create: create53,
3513
+ name: RULE_NAME55,
3514
+ create: create55,
3394
3515
  defaultOptions: []
3395
3516
  });
3396
- function create53(context) {
3517
+ function create55(context) {
3397
3518
  return {
3398
3519
  JSXAttribute(node) {
3399
3520
  const { value } = node;
3400
- const propName = JSX8.getAttributeName(node);
3521
+ const propName = JSX9.getAttributeName(node);
3401
3522
  const hasValueTrue = value?.type === AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === AST_NODE_TYPES.Literal && value.expression.value === true;
3402
3523
  if (!hasValueTrue) {
3403
3524
  return;
@@ -3413,8 +3534,8 @@ function create53(context) {
3413
3534
  }
3414
3535
  };
3415
3536
  }
3416
- var RULE_NAME54 = "prefer-shorthand-fragment";
3417
- var RULE_FEATURES53 = [
3537
+ var RULE_NAME56 = "prefer-shorthand-fragment";
3538
+ var RULE_FEATURES55 = [
3418
3539
  "FIX"
3419
3540
  ];
3420
3541
  var prefer_shorthand_fragment_default = createRule({
@@ -3422,7 +3543,7 @@ var prefer_shorthand_fragment_default = createRule({
3422
3543
  type: "problem",
3423
3544
  docs: {
3424
3545
  description: "Enforces shorthand syntax for fragments.",
3425
- [Symbol.for("rule_features")]: RULE_FEATURES53
3546
+ [Symbol.for("rule_features")]: RULE_FEATURES55
3426
3547
  },
3427
3548
  fixable: "code",
3428
3549
  messages: {
@@ -3430,14 +3551,14 @@ var prefer_shorthand_fragment_default = createRule({
3430
3551
  },
3431
3552
  schema: []
3432
3553
  },
3433
- name: RULE_NAME54,
3434
- create: create54,
3554
+ name: RULE_NAME56,
3555
+ create: create56,
3435
3556
  defaultOptions: []
3436
3557
  });
3437
- function create54(context) {
3558
+ function create56(context) {
3438
3559
  return {
3439
3560
  JSXElement(node) {
3440
- if (!JSX8.isFragmentElement(node)) return;
3561
+ if (!JSX9.isFragmentElement(node)) return;
3441
3562
  const hasAttributes = node.openingElement.attributes.length > 0;
3442
3563
  if (hasAttributes) {
3443
3564
  return;
@@ -3495,7 +3616,9 @@ var plugin = {
3495
3616
  "no-missing-component-display-name": no_missing_component_display_name_default,
3496
3617
  "no-missing-context-display-name": no_missing_context_display_name_default,
3497
3618
  "no-missing-key": no_missing_key_default,
3619
+ "no-misused-capture-owner-stack": no_misused_capture_owner_stack_default,
3498
3620
  "no-nested-component-definitions": no_nested_component_definitions_default,
3621
+ "no-nested-lazy-component-declarations": no_nested_lazy_component_declarations_default,
3499
3622
  "no-prop-types": no_prop_types_default,
3500
3623
  "no-redundant-should-component-update": no_redundant_should_component_update_default,
3501
3624
  "no-set-state-in-component-did-mount": no_set_state_in_component_did_mount_default,