eslint-plugin-react-x 1.43.2-next.2 → 1.45.0-next.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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var shared = require('@eslint-react/shared');
4
- var JSX8 = require('@eslint-react/jsx');
4
+ var JSX9 = require('@eslint-react/jsx');
5
5
  var utils = require('@typescript-eslint/utils');
6
6
  var kit = require('@eslint-react/kit');
7
7
  var types = require('@typescript-eslint/types');
@@ -9,7 +9,7 @@ var VAR2 = require('@eslint-react/var');
9
9
  var tsPattern = require('ts-pattern');
10
10
  var ts = require('typescript');
11
11
  var AST8 = require('@eslint-react/ast');
12
- var ER21 = require('@eslint-react/core');
12
+ var ER22 = require('@eslint-react/core');
13
13
  var eff = require('@eslint-react/eff');
14
14
  var compareVersions = require('compare-versions');
15
15
  var typeUtils = require('@typescript-eslint/type-utils');
@@ -36,11 +36,11 @@ function _interopNamespace(e) {
36
36
  return Object.freeze(n);
37
37
  }
38
38
 
39
- var JSX8__namespace = /*#__PURE__*/_interopNamespace(JSX8);
39
+ var JSX9__namespace = /*#__PURE__*/_interopNamespace(JSX9);
40
40
  var VAR2__namespace = /*#__PURE__*/_interopNamespace(VAR2);
41
41
  var ts__default = /*#__PURE__*/_interopDefault(ts);
42
42
  var AST8__namespace = /*#__PURE__*/_interopNamespace(AST8);
43
- var ER21__namespace = /*#__PURE__*/_interopNamespace(ER21);
43
+ var ER22__namespace = /*#__PURE__*/_interopNamespace(ER22);
44
44
 
45
45
  var __defProp = Object.defineProperty;
46
46
  var __export = (target, all) => {
@@ -80,7 +80,9 @@ var rules = {
80
80
  "react-x/no-forward-ref": "warn",
81
81
  "react-x/no-implicit-key": "warn",
82
82
  "react-x/no-missing-key": "error",
83
+ "react-x/no-misused-capture-owner-stack": "error",
83
84
  "react-x/no-nested-component-definitions": "error",
85
+ "react-x/no-nested-lazy-component-declarations": "warn",
84
86
  "react-x/no-prop-types": "error",
85
87
  "react-x/no-redundant-should-component-update": "error",
86
88
  "react-x/no-set-state-in-component-did-mount": "warn",
@@ -141,7 +143,7 @@ var settings3 = {
141
143
 
142
144
  // package.json
143
145
  var name4 = "eslint-plugin-react-x";
144
- var version = "1.43.2-next.2";
146
+ var version = "1.45.0-next.3";
145
147
  var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("x"));
146
148
 
147
149
  // src/rules/avoid-shorthand-boolean.ts
@@ -172,7 +174,7 @@ function create(context) {
172
174
  messageId: "avoidShorthandBoolean",
173
175
  node,
174
176
  data: {
175
- propName: JSX8__namespace.getAttributeName(node)
177
+ propName: JSX9__namespace.getAttributeName(node)
176
178
  },
177
179
  fix: (fixer) => fixer.insertTextAfter(node.name, `={true}`)
178
180
  });
@@ -413,25 +415,25 @@ function create7(context) {
413
415
  const setStateEntries = [];
414
416
  return {
415
417
  CallExpression(node) {
416
- if (!ER21__namespace.isThisSetState(node)) {
418
+ if (!ER22__namespace.isThisSetState(node)) {
417
419
  return;
418
420
  }
419
421
  setStateEntries.push([node, false]);
420
422
  },
421
423
  "CallExpression:exit"(node) {
422
- if (!ER21__namespace.isThisSetState(node)) {
424
+ if (!ER22__namespace.isThisSetState(node)) {
423
425
  return;
424
426
  }
425
427
  setStateEntries.pop();
426
428
  },
427
429
  ClassDeclaration(node) {
428
- classEntries.push([node, ER21__namespace.isClassComponent(node)]);
430
+ classEntries.push([node, ER22__namespace.isClassComponent(node)]);
429
431
  },
430
432
  "ClassDeclaration:exit"() {
431
433
  classEntries.pop();
432
434
  },
433
435
  ClassExpression(node) {
434
- classEntries.push([node, ER21__namespace.isClassComponent(node)]);
436
+ classEntries.push([node, ER22__namespace.isClassComponent(node)]);
435
437
  },
436
438
  "ClassExpression:exit"() {
437
439
  classEntries.pop();
@@ -515,7 +517,7 @@ function isUsingReactChildren(context, node) {
515
517
  return true;
516
518
  }
517
519
  if (callee.object.type === types.AST_NODE_TYPES.MemberExpression && "name" in callee.object.object) {
518
- return ER21__namespace.isInitializedFromReact(callee.object.object.name, importSource, initialScope);
520
+ return ER22__namespace.isInitializedFromReact(callee.object.object.name, importSource, initialScope);
519
521
  }
520
522
  return false;
521
523
  }
@@ -581,7 +583,7 @@ function create8(context) {
581
583
  return node.type === types.AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
582
584
  }
583
585
  function isCreateOrCloneElementCall(node) {
584
- return ER21__namespace.isCreateElementCall(context, node) || ER21__namespace.isCloneElementCall(context, node);
586
+ return ER22__namespace.isCreateElementCall(context, node) || ER22__namespace.isCloneElementCall(context, node);
585
587
  }
586
588
  function getReportDescriptors(node) {
587
589
  switch (node.type) {
@@ -697,7 +699,7 @@ var no_children_count_default = createRule({
697
699
  function create9(context) {
698
700
  return {
699
701
  MemberExpression(node) {
700
- if (ER21__namespace.isChildrenCount(context, node)) {
702
+ if (ER22__namespace.isChildrenCount(context, node)) {
701
703
  context.report({
702
704
  messageId: "noChildrenCount",
703
705
  node: node.property
@@ -727,7 +729,7 @@ var no_children_for_each_default = createRule({
727
729
  function create10(context) {
728
730
  return {
729
731
  MemberExpression(node) {
730
- if (ER21__namespace.isChildrenForEach(context, node)) {
732
+ if (ER22__namespace.isChildrenForEach(context, node)) {
731
733
  context.report({
732
734
  messageId: "noChildrenForEach",
733
735
  node: node.property
@@ -757,7 +759,7 @@ var no_children_map_default = createRule({
757
759
  function create11(context) {
758
760
  return {
759
761
  MemberExpression(node) {
760
- if (ER21__namespace.isChildrenMap(context, node)) {
762
+ if (ER22__namespace.isChildrenMap(context, node)) {
761
763
  context.report({
762
764
  messageId: "noChildrenMap",
763
765
  node: node.property
@@ -787,7 +789,7 @@ var no_children_only_default = createRule({
787
789
  function create12(context) {
788
790
  return {
789
791
  MemberExpression(node) {
790
- if (ER21__namespace.isChildrenOnly(context, node)) {
792
+ if (ER22__namespace.isChildrenOnly(context, node)) {
791
793
  context.report({
792
794
  messageId: "noChildrenOnly",
793
795
  node: node.property
@@ -818,7 +820,7 @@ function create13(context) {
818
820
  return {
819
821
  JSXElement(node) {
820
822
  const attributes = node.openingElement.attributes;
821
- const childrenProp = JSX8__namespace.getAttribute("children", attributes, context.sourceCode.getScope(node));
823
+ const childrenProp = JSX9__namespace.getAttribute("children", attributes, context.sourceCode.getScope(node));
822
824
  if (childrenProp != null) {
823
825
  context.report({
824
826
  messageId: "noChildrenProp",
@@ -849,7 +851,7 @@ var no_children_to_array_default = createRule({
849
851
  function create14(context) {
850
852
  return {
851
853
  MemberExpression(node) {
852
- if (ER21__namespace.isChildrenToArray(context, node)) {
854
+ if (ER22__namespace.isChildrenToArray(context, node)) {
853
855
  context.report({
854
856
  messageId: "noChildrenToArray",
855
857
  node: node.property
@@ -878,13 +880,13 @@ var no_class_component_default = createRule({
878
880
  });
879
881
  function create15(context) {
880
882
  if (!context.sourceCode.text.includes("Component")) return {};
881
- const { ctx, listeners } = ER21__namespace.useComponentCollectorLegacy();
883
+ const { ctx, listeners } = ER22__namespace.useComponentCollectorLegacy();
882
884
  return {
883
885
  ...listeners,
884
- "Program:exit"(node) {
885
- const components = ctx.getAllComponents(node);
886
+ "Program:exit"(program) {
887
+ const components = ctx.getAllComponents(program);
886
888
  for (const { name: name5 = "anonymous", node: component } of components.values()) {
887
- if (component.body.body.some((m) => ER21__namespace.isComponentDidCatch(m) || ER21__namespace.isGetDerivedStateFromError(m))) {
889
+ if (component.body.body.some((m) => ER22__namespace.isComponentDidCatch(m) || ER22__namespace.isGetDerivedStateFromError(m))) {
888
890
  continue;
889
891
  }
890
892
  context.report({
@@ -919,7 +921,7 @@ var no_clone_element_default = createRule({
919
921
  function create16(context) {
920
922
  return {
921
923
  CallExpression(node) {
922
- if (ER21__namespace.isCloneElementCall(context, node)) {
924
+ if (ER22__namespace.isCloneElementCall(context, node)) {
923
925
  context.report({
924
926
  messageId: "noCloneElement",
925
927
  node
@@ -1042,15 +1044,15 @@ var no_component_will_mount_default = createRule({
1042
1044
  });
1043
1045
  function create19(context) {
1044
1046
  if (!context.sourceCode.text.includes("componentWillMount")) return {};
1045
- const { ctx, listeners } = ER21__namespace.useComponentCollectorLegacy();
1047
+ const { ctx, listeners } = ER22__namespace.useComponentCollectorLegacy();
1046
1048
  return {
1047
1049
  ...listeners,
1048
- "Program:exit"(node) {
1049
- const components = ctx.getAllComponents(node);
1050
+ "Program:exit"(program) {
1051
+ const components = ctx.getAllComponents(program);
1050
1052
  for (const { node: component } of components.values()) {
1051
1053
  const { body } = component.body;
1052
1054
  for (const member of body) {
1053
- if (ER21__namespace.isComponentWillMount(member)) {
1055
+ if (ER22__namespace.isComponentWillMount(member)) {
1054
1056
  context.report({
1055
1057
  messageId: "noComponentWillMount",
1056
1058
  node: member,
@@ -1090,15 +1092,15 @@ var no_component_will_receive_props_default = createRule({
1090
1092
  });
1091
1093
  function create20(context) {
1092
1094
  if (!context.sourceCode.text.includes("componentWillReceiveProps")) return {};
1093
- const { ctx, listeners } = ER21__namespace.useComponentCollectorLegacy();
1095
+ const { ctx, listeners } = ER22__namespace.useComponentCollectorLegacy();
1094
1096
  return {
1095
1097
  ...listeners,
1096
- "Program:exit"(node) {
1097
- const components = ctx.getAllComponents(node);
1098
+ "Program:exit"(program) {
1099
+ const components = ctx.getAllComponents(program);
1098
1100
  for (const { node: component } of components.values()) {
1099
1101
  const { body } = component.body;
1100
1102
  for (const member of body) {
1101
- if (ER21__namespace.isComponentWillReceiveProps(member)) {
1103
+ if (ER22__namespace.isComponentWillReceiveProps(member)) {
1102
1104
  context.report({
1103
1105
  messageId: "noComponentWillReceiveProps",
1104
1106
  node: member,
@@ -1138,15 +1140,15 @@ var no_component_will_update_default = createRule({
1138
1140
  });
1139
1141
  function create21(context) {
1140
1142
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
1141
- const { ctx, listeners } = ER21__namespace.useComponentCollectorLegacy();
1143
+ const { ctx, listeners } = ER22__namespace.useComponentCollectorLegacy();
1142
1144
  return {
1143
1145
  ...listeners,
1144
- "Program:exit"(node) {
1145
- const components = ctx.getAllComponents(node);
1146
+ "Program:exit"(program) {
1147
+ const components = ctx.getAllComponents(program);
1146
1148
  for (const { node: component } of components.values()) {
1147
1149
  const { body } = component.body;
1148
1150
  for (const member of body) {
1149
- if (ER21__namespace.isComponentWillUpdate(member)) {
1151
+ if (ER22__namespace.isComponentWillUpdate(member)) {
1150
1152
  context.report({
1151
1153
  messageId: "noComponentWillUpdate",
1152
1154
  node: member,
@@ -1190,7 +1192,7 @@ function create22(context) {
1190
1192
  if (compareVersions.compare(version2, "19.0.0", "<")) return {};
1191
1193
  return {
1192
1194
  JSXElement(node) {
1193
- const fullName = JSX8__namespace.getElementType(node);
1195
+ const fullName = JSX9__namespace.getElementType(node);
1194
1196
  const parts = fullName.split(".");
1195
1197
  const selfName = parts.pop();
1196
1198
  const contextFullName = parts.join(".");
@@ -1201,7 +1203,7 @@ function create22(context) {
1201
1203
  messageId: "noContextProvider",
1202
1204
  node,
1203
1205
  fix(fixer) {
1204
- if (!ER21__namespace.isComponentNameLoose(contextSelfName)) return null;
1206
+ if (!ER22__namespace.isComponentNameLoose(contextSelfName)) return null;
1205
1207
  const openingElement = node.openingElement;
1206
1208
  const closingElement = node.closingElement;
1207
1209
  if (closingElement == null) {
@@ -1237,7 +1239,7 @@ var no_create_ref_default = createRule({
1237
1239
  function create23(context) {
1238
1240
  return {
1239
1241
  CallExpression(node) {
1240
- if (ER21__namespace.isCreateRefCall(context, node) && AST8__namespace.findParentNode(node, ER21__namespace.isClassComponent) == null) {
1242
+ if (ER22__namespace.isCreateRefCall(context, node) && AST8__namespace.findParentNode(node, ER22__namespace.isClassComponent) == null) {
1241
1243
  context.report({ messageId: "noCreateRef", node });
1242
1244
  }
1243
1245
  }
@@ -1275,17 +1277,17 @@ function create24(context) {
1275
1277
  if (property.type !== types.AST_NODE_TYPES.Identifier || property.name !== "defaultProps") {
1276
1278
  return;
1277
1279
  }
1278
- if (!ER21__namespace.isComponentNameLoose(object.name)) {
1280
+ if (!ER22__namespace.isComponentNameLoose(object.name)) {
1279
1281
  return;
1280
1282
  }
1281
1283
  const variable = VAR2__namespace.findVariable(object.name, context.sourceCode.getScope(node));
1282
1284
  const variableNode = VAR2__namespace.getVariableInitNode(variable, 0);
1283
1285
  if (variableNode == null) return;
1284
- if (!AST8__namespace.isFunction(variableNode) && !ER21__namespace.isClassComponent(variableNode)) return;
1286
+ if (!AST8__namespace.isFunction(variableNode) && !ER22__namespace.isClassComponent(variableNode)) return;
1285
1287
  context.report({ messageId: "noDefaultProps", node: property });
1286
1288
  },
1287
1289
  PropertyDefinition(node) {
1288
- if (!ER21__namespace.isClassComponent(node.parent.parent)) {
1290
+ if (!ER22__namespace.isClassComponent(node.parent.parent)) {
1289
1291
  return;
1290
1292
  }
1291
1293
  if (!node.static || node.key.type !== types.AST_NODE_TYPES.Identifier || node.key.name !== "defaultProps") {
@@ -1319,7 +1321,7 @@ var no_direct_mutation_state_default = createRule({
1319
1321
  function create25(context) {
1320
1322
  return {
1321
1323
  AssignmentExpression(node) {
1322
- if (!ER21__namespace.isAssignmentToThisState(node)) return;
1324
+ if (!ER22__namespace.isAssignmentToThisState(node)) return;
1323
1325
  const parentClass = AST8__namespace.findParentNode(
1324
1326
  node,
1325
1327
  AST8__namespace.isOneOf([
@@ -1328,7 +1330,7 @@ function create25(context) {
1328
1330
  ])
1329
1331
  );
1330
1332
  if (parentClass == null) return;
1331
- if (ER21__namespace.isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST8__namespace.findParentNode(node, isConstructorFunction)) {
1333
+ if (ER22__namespace.isClassComponent(parentClass) && context.sourceCode.getScope(node).block !== AST8__namespace.findParentNode(node, isConstructorFunction)) {
1332
1334
  context.report({
1333
1335
  messageId: "noDirectMutationState",
1334
1336
  node
@@ -1450,7 +1452,7 @@ function create27(context) {
1450
1452
  }
1451
1453
  return {
1452
1454
  CallExpression(node) {
1453
- if (!ER21__namespace.isForwardRefCall(context, node)) {
1455
+ if (!ER22__namespace.isForwardRefCall(context, node)) {
1454
1456
  return;
1455
1457
  }
1456
1458
  context.report({
@@ -1552,7 +1554,7 @@ function create28(context) {
1552
1554
  return {
1553
1555
  JSXOpeningElement(node) {
1554
1556
  const initialScope = context.sourceCode.getScope(node);
1555
- const keyPropFound = JSX8__namespace.getAttribute("key", node.attributes, initialScope);
1557
+ const keyPropFound = JSX9__namespace.getAttribute("key", node.attributes, initialScope);
1556
1558
  const keyPropOnElement = node.attributes.some(
1557
1559
  (n) => n.type === types.AST_NODE_TYPES.JSXAttribute && n.name.type === types.AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
1558
1560
  );
@@ -1740,21 +1742,21 @@ function create30(context) {
1740
1742
  const {
1741
1743
  ctx,
1742
1744
  listeners
1743
- } = ER21__namespace.useComponentCollector(
1745
+ } = ER22__namespace.useComponentCollector(
1744
1746
  context,
1745
1747
  {
1746
1748
  collectDisplayName: true,
1747
1749
  collectHookCalls: false,
1748
- hint: ER21__namespace.DEFAULT_COMPONENT_DETECTION_HINT
1750
+ hint: ER22__namespace.DEFAULT_COMPONENT_DETECTION_HINT
1749
1751
  }
1750
1752
  );
1751
1753
  return {
1752
1754
  ...listeners,
1753
- "Program:exit"(node) {
1754
- const components = ctx.getAllComponents(node);
1755
- for (const { node: node2, displayName, flag } of components.values()) {
1756
- const isMemoOrForwardRef = (flag & (ER21__namespace.ComponentFlag.ForwardRef | ER21__namespace.ComponentFlag.Memo)) > 0n;
1757
- if (AST8__namespace.getFunctionIdentifier(node2) != null) {
1755
+ "Program:exit"(program) {
1756
+ const components = ctx.getAllComponents(program);
1757
+ for (const { node, displayName, flag } of components.values()) {
1758
+ const isMemoOrForwardRef = (flag & (ER22__namespace.ComponentFlag.ForwardRef | ER22__namespace.ComponentFlag.Memo)) > 0n;
1759
+ if (AST8__namespace.getFunctionIdentifier(node) != null) {
1758
1760
  continue;
1759
1761
  }
1760
1762
  if (!isMemoOrForwardRef) {
@@ -1763,7 +1765,7 @@ function create30(context) {
1763
1765
  if (displayName == null) {
1764
1766
  context.report({
1765
1767
  messageId: "noMissingComponentDisplayName",
1766
- node: node2
1768
+ node
1767
1769
  });
1768
1770
  }
1769
1771
  }
@@ -1794,12 +1796,12 @@ function create31(context) {
1794
1796
  const displayNameAssignments = [];
1795
1797
  return {
1796
1798
  CallExpression(node) {
1797
- if (!ER21__namespace.isCreateContextCall(context, node)) return;
1799
+ if (!ER22__namespace.isCreateContextCall(context, node)) return;
1798
1800
  createCalls.push(node);
1799
1801
  },
1800
1802
  "Program:exit"() {
1801
1803
  for (const call of createCalls) {
1802
- const id = ER21__namespace.getInstanceId(call);
1804
+ const id = ER22__namespace.getInstanceId(call);
1803
1805
  if (id == null) {
1804
1806
  context.report({
1805
1807
  messageId: "noMissingContextDisplayName",
@@ -1811,7 +1813,7 @@ function create31(context) {
1811
1813
  const left = node.left;
1812
1814
  if (left.type !== types.AST_NODE_TYPES.MemberExpression) return false;
1813
1815
  const object = left.object;
1814
- return ER21__namespace.isInstanceIdEqual(context, id, object);
1816
+ return ER22__namespace.isInstanceIdEqual(context, id, object);
1815
1817
  });
1816
1818
  if (!hasDisplayNameAssignment) {
1817
1819
  context.report({
@@ -1852,7 +1854,7 @@ function create32(context) {
1852
1854
  switch (node.type) {
1853
1855
  case types.AST_NODE_TYPES.JSXElement: {
1854
1856
  const initialScope = context.sourceCode.getScope(node);
1855
- if (!JSX8__namespace.hasAttribute("key", node.openingElement.attributes, initialScope)) {
1857
+ if (!JSX9__namespace.hasAttribute("key", node.openingElement.attributes, initialScope)) {
1856
1858
  return {
1857
1859
  messageId: "missingKey",
1858
1860
  node
@@ -1909,7 +1911,7 @@ function create32(context) {
1909
1911
  }
1910
1912
  const initialScope = context.sourceCode.getScope(node);
1911
1913
  for (const element of elements) {
1912
- if (!JSX8__namespace.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1914
+ if (!JSX9__namespace.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1913
1915
  report({
1914
1916
  messageId: "missingKey",
1915
1917
  node: element
@@ -1918,7 +1920,7 @@ function create32(context) {
1918
1920
  }
1919
1921
  },
1920
1922
  CallExpression(node) {
1921
- state.isWithinChildrenToArray ||= ER21__namespace.isChildrenToArrayCall(context, node);
1923
+ state.isWithinChildrenToArray ||= ER22__namespace.isChildrenToArrayCall(context, node);
1922
1924
  if (state.isWithinChildrenToArray) return;
1923
1925
  const callback = tsPattern.match(node).when(AST8__namespace.isArrayMapCall, (n) => n.arguments[0]).when(AST8__namespace.isArrayFromCall, (n) => n.arguments[1]).otherwise(() => null);
1924
1926
  if (!AST8__namespace.isFunction(callback)) return;
@@ -1930,7 +1932,7 @@ function create32(context) {
1930
1932
  report(checkExpression(body));
1931
1933
  },
1932
1934
  "CallExpression:exit"(node) {
1933
- if (!ER21__namespace.isChildrenToArrayCall(context, node)) {
1935
+ if (!ER22__namespace.isChildrenToArrayCall(context, node)) {
1934
1936
  return;
1935
1937
  }
1936
1938
  state.isWithinChildrenToArray = false;
@@ -1948,17 +1950,22 @@ function create32(context) {
1948
1950
  }
1949
1951
  };
1950
1952
  }
1951
- var RULE_NAME33 = "no-nested-component-definitions";
1952
- var RULE_FEATURES33 = [];
1953
- var no_nested_component_definitions_default = createRule({
1953
+ var RULE_NAME33 = "no-misused-capture-owner-stack";
1954
+ var RULE_FEATURES33 = [
1955
+ "EXP"
1956
+ ];
1957
+ var no_misused_capture_owner_stack_default = createRule({
1954
1958
  meta: {
1955
1959
  type: "problem",
1956
1960
  docs: {
1957
- description: "Disallow nesting component definitions inside other components.",
1961
+ description: "Prevents incorrect usage of `captureOwnerStack`.",
1958
1962
  [Symbol.for("rule_features")]: RULE_FEATURES33
1959
1963
  },
1964
+ fixable: "code",
1960
1965
  messages: {
1961
- noNestedComponentDefinitions: "Do not nest component definitions inside other components or props. {{suggestion}}"
1966
+ useNamespaceImport: "Don't use named imports of 'captureOwnerStack' in files that are bundled for development and production. Use a namespace import instead.",
1967
+ // eslint-disable-next-line perfectionist/sort-objects
1968
+ missingDevelopmentOnlyCheck: `Don't call 'captureOwnerStack' directly. Use 'if (process.env.NODE_ENV !== "production") {...}' to conditionally access it.`
1962
1969
  },
1963
1970
  schema: []
1964
1971
  },
@@ -1967,30 +1974,81 @@ var no_nested_component_definitions_default = createRule({
1967
1974
  defaultOptions: []
1968
1975
  });
1969
1976
  function create33(context) {
1970
- const hint = ER21__namespace.ComponentDetectionHint.SkipArrayMapArgument | ER21__namespace.ComponentDetectionHint.SkipNullLiteral | ER21__namespace.ComponentDetectionHint.SkipUndefined | ER21__namespace.ComponentDetectionHint.SkipBooleanLiteral | ER21__namespace.ComponentDetectionHint.SkipStringLiteral | ER21__namespace.ComponentDetectionHint.SkipNumberLiteral | ER21__namespace.ComponentDetectionHint.StrictLogical | ER21__namespace.ComponentDetectionHint.StrictConditional;
1971
- const collector = ER21__namespace.useComponentCollector(context, { hint });
1972
- const collectorLegacy = ER21__namespace.useComponentCollectorLegacy();
1977
+ if (!context.sourceCode.text.includes("captureOwnerStack")) return {};
1978
+ const { importSource } = shared.getSettingsFromContext(context);
1979
+ return {
1980
+ CallExpression(node) {
1981
+ if (!ER22__namespace.isCaptureOwnerStackCall(context, node)) return;
1982
+ if (AST8__namespace.findParentNode(node, isDevelopmentOnlyCheck) == null) {
1983
+ context.report({
1984
+ messageId: "missingDevelopmentOnlyCheck",
1985
+ node
1986
+ });
1987
+ }
1988
+ },
1989
+ ImportDeclaration(node) {
1990
+ if (node.source.value !== importSource) return;
1991
+ for (const specifier of node.specifiers) {
1992
+ if (specifier.type !== types.AST_NODE_TYPES.ImportSpecifier) continue;
1993
+ if (specifier.imported.type !== types.AST_NODE_TYPES.Identifier) continue;
1994
+ if (specifier.imported.name === "captureOwnerStack") {
1995
+ context.report({
1996
+ messageId: "useNamespaceImport",
1997
+ node: specifier
1998
+ });
1999
+ }
2000
+ }
2001
+ }
2002
+ };
2003
+ }
2004
+ function isDevelopmentOnlyCheck(node) {
2005
+ if (node.type !== types.AST_NODE_TYPES.IfStatement) return false;
2006
+ if (AST8__namespace.isProcessEnvNodeEnvCompare(node.test, "!==", "production")) return true;
2007
+ return false;
2008
+ }
2009
+ var RULE_NAME34 = "no-nested-component-definitions";
2010
+ var RULE_FEATURES34 = [];
2011
+ var no_nested_component_definitions_default = createRule({
2012
+ meta: {
2013
+ type: "problem",
2014
+ docs: {
2015
+ description: "Disallow nesting component definitions inside other components.",
2016
+ [Symbol.for("rule_features")]: RULE_FEATURES34
2017
+ },
2018
+ messages: {
2019
+ noNestedComponentDefinitions: "Do not nest component definitions inside other components or props. {{suggestion}}"
2020
+ },
2021
+ schema: []
2022
+ },
2023
+ name: RULE_NAME34,
2024
+ create: create34,
2025
+ defaultOptions: []
2026
+ });
2027
+ function create34(context) {
2028
+ const hint = ER22__namespace.ComponentDetectionHint.SkipArrayMapArgument | ER22__namespace.ComponentDetectionHint.SkipNullLiteral | ER22__namespace.ComponentDetectionHint.SkipUndefined | ER22__namespace.ComponentDetectionHint.SkipBooleanLiteral | ER22__namespace.ComponentDetectionHint.SkipStringLiteral | ER22__namespace.ComponentDetectionHint.SkipNumberLiteral | ER22__namespace.ComponentDetectionHint.StrictLogical | ER22__namespace.ComponentDetectionHint.StrictConditional;
2029
+ const collector = ER22__namespace.useComponentCollector(context, { hint });
2030
+ const collectorLegacy = ER22__namespace.useComponentCollectorLegacy();
1973
2031
  return {
1974
2032
  ...collector.listeners,
1975
2033
  ...collectorLegacy.listeners,
1976
- "Program:exit"(node) {
2034
+ "Program:exit"(program) {
1977
2035
  const functionComponents = [
1978
- ...collector.ctx.getAllComponents(node).values()
2036
+ ...collector.ctx.getAllComponents(program).values()
1979
2037
  ];
1980
2038
  const classComponents = [
1981
- ...collectorLegacy.ctx.getAllComponents(node).values()
2039
+ ...collectorLegacy.ctx.getAllComponents(program).values()
1982
2040
  ];
1983
- const isFunctionComponent = (node2) => {
1984
- return AST8__namespace.isFunction(node2) && functionComponents.some((component) => component.node === node2);
2041
+ const isFunctionComponent = (node) => {
2042
+ return AST8__namespace.isFunction(node) && functionComponents.some((component) => component.node === node);
1985
2043
  };
1986
- const isClassComponent12 = (node2) => {
1987
- return AST8__namespace.isClass(node2) && classComponents.some((component) => component.node === node2);
2044
+ const isClassComponent12 = (node) => {
2045
+ return AST8__namespace.isClass(node) && classComponents.some((component) => component.node === node);
1988
2046
  };
1989
2047
  for (const { name: name5, node: component } of functionComponents) {
1990
2048
  if (name5 == null) continue;
1991
- if (ER21__namespace.isDirectValueOfRenderPropertyLoose(component)) continue;
2049
+ if (ER22__namespace.isDirectValueOfRenderPropertyLoose(component)) continue;
1992
2050
  if (isInsideJSXAttributeValue(component)) {
1993
- if (!ER21__namespace.isDeclaredInRenderPropLoose(component)) {
2051
+ if (!ER22__namespace.isDeclaredInRenderPropLoose(component)) {
1994
2052
  context.report({
1995
2053
  messageId: "noNestedComponentDefinitions",
1996
2054
  node: component,
@@ -2014,7 +2072,7 @@ function create33(context) {
2014
2072
  continue;
2015
2073
  }
2016
2074
  const parentComponent = AST8__namespace.findParentNode(component, isFunctionComponent);
2017
- if (parentComponent != null && !ER21__namespace.isDirectValueOfRenderPropertyLoose(parentComponent)) {
2075
+ if (parentComponent != null && !ER22__namespace.isDirectValueOfRenderPropertyLoose(parentComponent)) {
2018
2076
  context.report({
2019
2077
  messageId: "noNestedComponentDefinitions",
2020
2078
  node: component,
@@ -2025,7 +2083,7 @@ function create33(context) {
2025
2083
  });
2026
2084
  continue;
2027
2085
  }
2028
- if (ER21__namespace.isInsideRenderMethod(component)) {
2086
+ if (ER22__namespace.isInsideRenderMethod(component)) {
2029
2087
  context.report({
2030
2088
  messageId: "noNestedComponentDefinitions",
2031
2089
  node: component,
@@ -2053,34 +2111,97 @@ function create33(context) {
2053
2111
  };
2054
2112
  }
2055
2113
  function isInsideJSXAttributeValue(node) {
2056
- return node.parent.type === types.AST_NODE_TYPES.JSXAttribute || JSX8__namespace.findParentAttribute(node, (n) => n.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer) != null;
2114
+ return node.parent.type === types.AST_NODE_TYPES.JSXAttribute || JSX9__namespace.findParentAttribute(node, (n) => n.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer) != null;
2057
2115
  }
2058
2116
  function isInsideCreateElementProps(context, node) {
2059
- const call = AST8__namespace.findParentNode(node, ER21__namespace.isCreateElementCall(context));
2117
+ const call = AST8__namespace.findParentNode(node, ER22__namespace.isCreateElementCall(context));
2060
2118
  if (call == null) return false;
2061
2119
  const prop = AST8__namespace.findParentNode(node, AST8__namespace.is(types.AST_NODE_TYPES.ObjectExpression));
2062
2120
  if (prop == null) return false;
2063
2121
  return prop === call.arguments[1];
2064
2122
  }
2065
- var RULE_NAME34 = "no-prop-types";
2066
- var RULE_FEATURES34 = [];
2123
+ var RULE_NAME35 = "no-nested-component-definitions";
2124
+ var RULE_FEATURES35 = [];
2125
+ var no_nested_lazy_component_declarations_default = createRule({
2126
+ meta: {
2127
+ type: "problem",
2128
+ docs: {
2129
+ description: "Disallow nesting lazy component declarations inside other components.",
2130
+ [Symbol.for("rule_features")]: RULE_FEATURES35
2131
+ },
2132
+ messages: {
2133
+ noNestedComponentDefinitions: "Do not declare lazy components inside other components. Instead, always declare them at the top level of your module."
2134
+ },
2135
+ schema: []
2136
+ },
2137
+ name: RULE_NAME35,
2138
+ create: create35,
2139
+ defaultOptions: []
2140
+ });
2141
+ function create35(context) {
2142
+ const hint = ER22__namespace.ComponentDetectionHint.None;
2143
+ const collector = ER22__namespace.useComponentCollector(context, { hint });
2144
+ const collectorLegacy = ER22__namespace.useComponentCollectorLegacy();
2145
+ const lazyComponentDeclarations = /* @__PURE__ */ new Set();
2146
+ return {
2147
+ ...collector.listeners,
2148
+ ...collectorLegacy.listeners,
2149
+ ImportExpression(node) {
2150
+ const lazyCall = AST8__namespace.findParentNode(node, (n) => ER22__namespace.isLazyCall(context, n));
2151
+ if (lazyCall != null) {
2152
+ lazyComponentDeclarations.add(lazyCall);
2153
+ }
2154
+ },
2155
+ "Program:exit"(program) {
2156
+ const functionComponents = [
2157
+ ...collector.ctx.getAllComponents(program).values()
2158
+ ];
2159
+ const classComponents = [
2160
+ ...collectorLegacy.ctx.getAllComponents(program).values()
2161
+ ];
2162
+ for (const lazy of lazyComponentDeclarations) {
2163
+ const significantParent = AST8__namespace.findParentNode(lazy, (n) => {
2164
+ if (JSX9__namespace.isJSX(n)) return true;
2165
+ if (n.type === types.AST_NODE_TYPES.CallExpression) {
2166
+ return ER22__namespace.isReactHookCall(n) || ER22__namespace.isCreateElementCall(context, n) || ER22__namespace.isCreateContextCall(context, n);
2167
+ }
2168
+ if (AST8__namespace.isFunction(n)) {
2169
+ return functionComponents.some((c) => c.node === n);
2170
+ }
2171
+ if (AST8__namespace.isClass(n)) {
2172
+ return classComponents.some((c) => c.node === n);
2173
+ }
2174
+ return false;
2175
+ });
2176
+ if (significantParent != null) {
2177
+ context.report({
2178
+ messageId: "noNestedComponentDefinitions",
2179
+ node: lazy
2180
+ });
2181
+ }
2182
+ }
2183
+ }
2184
+ };
2185
+ }
2186
+ var RULE_NAME36 = "no-prop-types";
2187
+ var RULE_FEATURES36 = [];
2067
2188
  var no_prop_types_default = createRule({
2068
2189
  meta: {
2069
2190
  type: "problem",
2070
2191
  docs: {
2071
2192
  description: "Disallow `propTypes` in favor of TypeScript or another type-checking solution.",
2072
- [Symbol.for("rule_features")]: RULE_FEATURES34
2193
+ [Symbol.for("rule_features")]: RULE_FEATURES36
2073
2194
  },
2074
2195
  messages: {
2075
2196
  noPropTypes: "[Deprecated] Use TypeScript or another type-checking solution instead."
2076
2197
  },
2077
2198
  schema: []
2078
2199
  },
2079
- name: RULE_NAME34,
2080
- create: create34,
2200
+ name: RULE_NAME36,
2201
+ create: create36,
2081
2202
  defaultOptions: []
2082
2203
  });
2083
- function create34(context) {
2204
+ function create36(context) {
2084
2205
  if (!context.sourceCode.text.includes("propTypes")) {
2085
2206
  return {};
2086
2207
  }
@@ -2096,17 +2217,17 @@ function create34(context) {
2096
2217
  if (property.type !== types.AST_NODE_TYPES.Identifier || property.name !== "propTypes") {
2097
2218
  return;
2098
2219
  }
2099
- if (!ER21__namespace.isComponentNameLoose(object.name)) {
2220
+ if (!ER22__namespace.isComponentNameLoose(object.name)) {
2100
2221
  return;
2101
2222
  }
2102
2223
  const variable = VAR2__namespace.findVariable(object.name, context.sourceCode.getScope(node));
2103
2224
  const variableNode = VAR2__namespace.getVariableInitNode(variable, 0);
2104
- if (variableNode != null && (AST8__namespace.isFunction(variableNode) || ER21__namespace.isClassComponent(variableNode))) {
2225
+ if (variableNode != null && (AST8__namespace.isFunction(variableNode) || ER22__namespace.isClassComponent(variableNode))) {
2105
2226
  context.report({ messageId: "noPropTypes", node: property });
2106
2227
  }
2107
2228
  },
2108
2229
  PropertyDefinition(node) {
2109
- if (!ER21__namespace.isClassComponent(node.parent.parent)) {
2230
+ if (!ER22__namespace.isClassComponent(node.parent.parent)) {
2110
2231
  return;
2111
2232
  }
2112
2233
  if (!node.static || node.key.type !== types.AST_NODE_TYPES.Identifier || node.key.name !== "propTypes") {
@@ -2116,8 +2237,8 @@ function create34(context) {
2116
2237
  }
2117
2238
  };
2118
2239
  }
2119
- var RULE_NAME35 = "no-redundant-should-component-update";
2120
- var RULE_FEATURES35 = [];
2240
+ var RULE_NAME37 = "no-redundant-should-component-update";
2241
+ var RULE_FEATURES37 = [];
2121
2242
  function isShouldComponentUpdate(node) {
2122
2243
  return AST8__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
2123
2244
  }
@@ -2126,26 +2247,26 @@ var no_redundant_should_component_update_default = createRule({
2126
2247
  type: "problem",
2127
2248
  docs: {
2128
2249
  description: "Disallow `shouldComponentUpdate` when extending `React.PureComponent`.",
2129
- [Symbol.for("rule_features")]: RULE_FEATURES35
2250
+ [Symbol.for("rule_features")]: RULE_FEATURES37
2130
2251
  },
2131
2252
  messages: {
2132
2253
  noRedundantShouldComponentUpdate: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'."
2133
2254
  },
2134
2255
  schema: []
2135
2256
  },
2136
- name: RULE_NAME35,
2137
- create: create35,
2257
+ name: RULE_NAME37,
2258
+ create: create37,
2138
2259
  defaultOptions: []
2139
2260
  });
2140
- function create35(context) {
2261
+ function create37(context) {
2141
2262
  if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
2142
- const { ctx, listeners } = ER21__namespace.useComponentCollectorLegacy();
2263
+ const { ctx, listeners } = ER22__namespace.useComponentCollectorLegacy();
2143
2264
  return {
2144
2265
  ...listeners,
2145
- "Program:exit"(node) {
2146
- const components = ctx.getAllComponents(node);
2266
+ "Program:exit"(program) {
2267
+ const components = ctx.getAllComponents(program);
2147
2268
  for (const { name: name5 = "PureComponent", node: component, flag } of components.values()) {
2148
- if ((flag & ER21__namespace.ComponentFlag.PureComponent) === 0n) {
2269
+ if ((flag & ER22__namespace.ComponentFlag.PureComponent) === 0n) {
2149
2270
  continue;
2150
2271
  }
2151
2272
  const { body } = component.body;
@@ -2164,33 +2285,33 @@ function create35(context) {
2164
2285
  }
2165
2286
  };
2166
2287
  }
2167
- var RULE_NAME36 = "no-set-state-in-component-did-mount";
2168
- var RULE_FEATURES36 = [];
2288
+ var RULE_NAME38 = "no-set-state-in-component-did-mount";
2289
+ var RULE_FEATURES38 = [];
2169
2290
  var no_set_state_in_component_did_mount_default = createRule({
2170
2291
  meta: {
2171
2292
  type: "problem",
2172
2293
  docs: {
2173
2294
  description: "Disallow calling `this.setState` in `componentDidMount` outside of functions, such as callbacks.",
2174
- [Symbol.for("rule_features")]: RULE_FEATURES36
2295
+ [Symbol.for("rule_features")]: RULE_FEATURES38
2175
2296
  },
2176
2297
  messages: {
2177
2298
  noSetStateInComponentDidMount: "Do not call `this.setState` in `componentDidMount` outside of functions, such as callbacks."
2178
2299
  },
2179
2300
  schema: []
2180
2301
  },
2181
- name: RULE_NAME36,
2182
- create: create36,
2302
+ name: RULE_NAME38,
2303
+ create: create38,
2183
2304
  defaultOptions: []
2184
2305
  });
2185
- function create36(context) {
2306
+ function create38(context) {
2186
2307
  if (!context.sourceCode.text.includes("componentDidMount")) return {};
2187
2308
  return {
2188
2309
  CallExpression(node) {
2189
- if (!ER21__namespace.isThisSetState(node)) {
2310
+ if (!ER22__namespace.isThisSetState(node)) {
2190
2311
  return;
2191
2312
  }
2192
- const clazz = AST8__namespace.findParentNode(node, ER21__namespace.isClassComponent);
2193
- const method = AST8__namespace.findParentNode(node, (n) => n === clazz || ER21__namespace.isComponentDidMount(n));
2313
+ const clazz = AST8__namespace.findParentNode(node, ER22__namespace.isClassComponent);
2314
+ const method = AST8__namespace.findParentNode(node, (n) => n === clazz || ER22__namespace.isComponentDidMount(n));
2194
2315
  if (clazz == null || method == null || method === clazz) return;
2195
2316
  const methodScope = context.sourceCode.getScope(method);
2196
2317
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2203,33 +2324,33 @@ function create36(context) {
2203
2324
  }
2204
2325
  };
2205
2326
  }
2206
- var RULE_NAME37 = "no-set-state-in-component-did-update";
2207
- var RULE_FEATURES37 = [];
2327
+ var RULE_NAME39 = "no-set-state-in-component-did-update";
2328
+ var RULE_FEATURES39 = [];
2208
2329
  var no_set_state_in_component_did_update_default = createRule({
2209
2330
  meta: {
2210
2331
  type: "problem",
2211
2332
  docs: {
2212
- description: "Disallows calling `this.setState` in `componentDidUpdate` outside of functions, such as callbacks.",
2213
- [Symbol.for("rule_features")]: RULE_FEATURES37
2333
+ description: "Disallow calling `this.setState` in `componentDidUpdate` outside of functions, such as callbacks.",
2334
+ [Symbol.for("rule_features")]: RULE_FEATURES39
2214
2335
  },
2215
2336
  messages: {
2216
2337
  noSetStateInComponentDidUpdate: "Do not call `this.setState` in `componentDidUpdate` outside of functions, such as callbacks."
2217
2338
  },
2218
2339
  schema: []
2219
2340
  },
2220
- name: RULE_NAME37,
2221
- create: create37,
2341
+ name: RULE_NAME39,
2342
+ create: create39,
2222
2343
  defaultOptions: []
2223
2344
  });
2224
- function create37(context) {
2345
+ function create39(context) {
2225
2346
  if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
2226
2347
  return {
2227
2348
  CallExpression(node) {
2228
- if (!ER21__namespace.isThisSetState(node)) {
2349
+ if (!ER22__namespace.isThisSetState(node)) {
2229
2350
  return;
2230
2351
  }
2231
- const clazz = AST8__namespace.findParentNode(node, ER21__namespace.isClassComponent);
2232
- const method = AST8__namespace.findParentNode(node, (n) => n === clazz || ER21__namespace.isComponentDidUpdate(n));
2352
+ const clazz = AST8__namespace.findParentNode(node, ER22__namespace.isClassComponent);
2353
+ const method = AST8__namespace.findParentNode(node, (n) => n === clazz || ER22__namespace.isComponentDidUpdate(n));
2233
2354
  if (clazz == null || method == null || method === clazz) return;
2234
2355
  const methodScope = context.sourceCode.getScope(method);
2235
2356
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2242,33 +2363,33 @@ function create37(context) {
2242
2363
  }
2243
2364
  };
2244
2365
  }
2245
- var RULE_NAME38 = "no-set-state-in-component-will-update";
2246
- var RULE_FEATURES38 = [];
2366
+ var RULE_NAME40 = "no-set-state-in-component-will-update";
2367
+ var RULE_FEATURES40 = [];
2247
2368
  var no_set_state_in_component_will_update_default = createRule({
2248
2369
  meta: {
2249
2370
  type: "problem",
2250
2371
  docs: {
2251
2372
  description: "Disallows calling `this.setState` in `componentWillUpdate` outside of functions, such as callbacks.",
2252
- [Symbol.for("rule_features")]: RULE_FEATURES38
2373
+ [Symbol.for("rule_features")]: RULE_FEATURES40
2253
2374
  },
2254
2375
  messages: {
2255
2376
  noSetStateInComponentWillUpdate: "Do not call `this.setState` in `componentWillUpdate` outside of functions, such as callbacks."
2256
2377
  },
2257
2378
  schema: []
2258
2379
  },
2259
- name: RULE_NAME38,
2260
- create: create38,
2380
+ name: RULE_NAME40,
2381
+ create: create40,
2261
2382
  defaultOptions: []
2262
2383
  });
2263
- function create38(context) {
2384
+ function create40(context) {
2264
2385
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
2265
2386
  return {
2266
2387
  CallExpression(node) {
2267
- if (!ER21__namespace.isThisSetState(node)) {
2388
+ if (!ER22__namespace.isThisSetState(node)) {
2268
2389
  return;
2269
2390
  }
2270
- const clazz = AST8__namespace.findParentNode(node, ER21__namespace.isClassComponent);
2271
- const method = AST8__namespace.findParentNode(node, (n) => n === clazz || ER21__namespace.isComponentWillUpdate(n));
2391
+ const clazz = AST8__namespace.findParentNode(node, ER22__namespace.isClassComponent);
2392
+ const method = AST8__namespace.findParentNode(node, (n) => n === clazz || ER22__namespace.isComponentWillUpdate(n));
2272
2393
  if (clazz == null || method == null || method === clazz) return;
2273
2394
  const methodScope = context.sourceCode.getScope(method);
2274
2395
  const upperScope = context.sourceCode.getScope(node).upper;
@@ -2281,8 +2402,8 @@ function create38(context) {
2281
2402
  }
2282
2403
  };
2283
2404
  }
2284
- var RULE_NAME39 = "no-string-refs";
2285
- var RULE_FEATURES39 = [
2405
+ var RULE_NAME41 = "no-string-refs";
2406
+ var RULE_FEATURES41 = [
2286
2407
  "MOD"
2287
2408
  ];
2288
2409
  var no_string_refs_default = createRule({
@@ -2290,7 +2411,7 @@ var no_string_refs_default = createRule({
2290
2411
  type: "problem",
2291
2412
  docs: {
2292
2413
  description: "Replaces string refs with callback refs.",
2293
- [Symbol.for("rule_features")]: RULE_FEATURES39
2414
+ [Symbol.for("rule_features")]: RULE_FEATURES41
2294
2415
  },
2295
2416
  fixable: "code",
2296
2417
  messages: {
@@ -2298,16 +2419,16 @@ var no_string_refs_default = createRule({
2298
2419
  },
2299
2420
  schema: []
2300
2421
  },
2301
- name: RULE_NAME39,
2302
- create: create39,
2422
+ name: RULE_NAME41,
2423
+ create: create41,
2303
2424
  defaultOptions: []
2304
2425
  });
2305
- function create39(context) {
2426
+ function create41(context) {
2306
2427
  const state = {
2307
2428
  isWithinClassComponent: false
2308
2429
  };
2309
2430
  function onClassBodyEnter(node) {
2310
- if (ER21__namespace.isClassComponent(node.parent)) {
2431
+ if (ER22__namespace.isClassComponent(node.parent)) {
2311
2432
  state.isWithinClassComponent = true;
2312
2433
  }
2313
2434
  }
@@ -2346,8 +2467,8 @@ function getAttributeValueText(context, node) {
2346
2467
  return null;
2347
2468
  }
2348
2469
  }
2349
- var RULE_NAME40 = "no-unsafe-component-will-mount";
2350
- var RULE_FEATURES40 = [];
2470
+ var RULE_NAME42 = "no-unsafe-component-will-mount";
2471
+ var RULE_FEATURES42 = [];
2351
2472
  function isUnsafeComponentWillMount(node) {
2352
2473
  return AST8__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillMount";
2353
2474
  }
@@ -2356,24 +2477,24 @@ var no_unsafe_component_will_mount_default = createRule({
2356
2477
  type: "problem",
2357
2478
  docs: {
2358
2479
  description: "Warns the usage of `UNSAFE_componentWillMount` in class components.",
2359
- [Symbol.for("rule_features")]: RULE_FEATURES40
2480
+ [Symbol.for("rule_features")]: RULE_FEATURES42
2360
2481
  },
2361
2482
  messages: {
2362
2483
  noUnsafeComponentWillMount: "Do not use 'UNSAFE_componentWillMount'."
2363
2484
  },
2364
2485
  schema: []
2365
2486
  },
2366
- name: RULE_NAME40,
2367
- create: create40,
2487
+ name: RULE_NAME42,
2488
+ create: create42,
2368
2489
  defaultOptions: []
2369
2490
  });
2370
- function create40(context) {
2491
+ function create42(context) {
2371
2492
  if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
2372
- const { ctx, listeners } = ER21__namespace.useComponentCollectorLegacy();
2493
+ const { ctx, listeners } = ER22__namespace.useComponentCollectorLegacy();
2373
2494
  return {
2374
2495
  ...listeners,
2375
- "Program:exit"(node) {
2376
- const components = ctx.getAllComponents(node);
2496
+ "Program:exit"(program) {
2497
+ const components = ctx.getAllComponents(program);
2377
2498
  for (const { node: component } of components.values()) {
2378
2499
  const { body } = component.body;
2379
2500
  for (const member of body) {
@@ -2388,8 +2509,8 @@ function create40(context) {
2388
2509
  }
2389
2510
  };
2390
2511
  }
2391
- var RULE_NAME41 = "no-unsafe-component-will-receive-props";
2392
- var RULE_FEATURES41 = [];
2512
+ var RULE_NAME43 = "no-unsafe-component-will-receive-props";
2513
+ var RULE_FEATURES43 = [];
2393
2514
  function isUnsafeComponentWillReceiveProps(node) {
2394
2515
  return AST8__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillReceiveProps";
2395
2516
  }
@@ -2398,26 +2519,26 @@ var no_unsafe_component_will_receive_props_default = createRule({
2398
2519
  type: "problem",
2399
2520
  docs: {
2400
2521
  description: "Warns the usage of `UNSAFE_componentWillReceiveProps` in class components.",
2401
- [Symbol.for("rule_features")]: RULE_FEATURES41
2522
+ [Symbol.for("rule_features")]: RULE_FEATURES43
2402
2523
  },
2403
2524
  messages: {
2404
2525
  noUnsafeComponentWillReceiveProps: "Do not use 'UNSAFE_componentWillReceiveProps'."
2405
2526
  },
2406
2527
  schema: []
2407
2528
  },
2408
- name: RULE_NAME41,
2409
- create: create41,
2529
+ name: RULE_NAME43,
2530
+ create: create43,
2410
2531
  defaultOptions: []
2411
2532
  });
2412
- function create41(context) {
2533
+ function create43(context) {
2413
2534
  if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) {
2414
2535
  return {};
2415
2536
  }
2416
- const { ctx, listeners } = ER21__namespace.useComponentCollectorLegacy();
2537
+ const { ctx, listeners } = ER22__namespace.useComponentCollectorLegacy();
2417
2538
  return {
2418
2539
  ...listeners,
2419
- "Program:exit"(node) {
2420
- const components = ctx.getAllComponents(node);
2540
+ "Program:exit"(program) {
2541
+ const components = ctx.getAllComponents(program);
2421
2542
  for (const { node: component } of components.values()) {
2422
2543
  const { body } = component.body;
2423
2544
  for (const member of body) {
@@ -2432,8 +2553,8 @@ function create41(context) {
2432
2553
  }
2433
2554
  };
2434
2555
  }
2435
- var RULE_NAME42 = "no-unsafe-component-will-update";
2436
- var RULE_FEATURES42 = [];
2556
+ var RULE_NAME44 = "no-unsafe-component-will-update";
2557
+ var RULE_FEATURES44 = [];
2437
2558
  function isUnsafeComponentWillUpdate(node) {
2438
2559
  return AST8__namespace.isMethodOrProperty(node) && node.key.type === types.AST_NODE_TYPES.Identifier && node.key.name === "UNSAFE_componentWillUpdate";
2439
2560
  }
@@ -2442,24 +2563,24 @@ var no_unsafe_component_will_update_default = createRule({
2442
2563
  type: "problem",
2443
2564
  docs: {
2444
2565
  description: "Warns the usage of `UNSAFE_componentWillUpdate` in class components.",
2445
- [Symbol.for("rule_features")]: RULE_FEATURES42
2566
+ [Symbol.for("rule_features")]: RULE_FEATURES44
2446
2567
  },
2447
2568
  messages: {
2448
2569
  noUnsafeComponentWillUpdate: "Do not use 'UNSAFE_componentWillUpdate'."
2449
2570
  },
2450
2571
  schema: []
2451
2572
  },
2452
- name: RULE_NAME42,
2453
- create: create42,
2573
+ name: RULE_NAME44,
2574
+ create: create44,
2454
2575
  defaultOptions: []
2455
2576
  });
2456
- function create42(context) {
2577
+ function create44(context) {
2457
2578
  if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
2458
- const { ctx, listeners } = ER21__namespace.useComponentCollectorLegacy();
2579
+ const { ctx, listeners } = ER22__namespace.useComponentCollectorLegacy();
2459
2580
  return {
2460
2581
  ...listeners,
2461
- "Program:exit"(node) {
2462
- const components = ctx.getAllComponents(node);
2582
+ "Program:exit"(program) {
2583
+ const components = ctx.getAllComponents(program);
2463
2584
  for (const { node: component } of components.values()) {
2464
2585
  const { body } = component.body;
2465
2586
  for (const member of body) {
@@ -2474,33 +2595,33 @@ function create42(context) {
2474
2595
  }
2475
2596
  };
2476
2597
  }
2477
- var RULE_NAME43 = "no-unstable-context-value";
2478
- var RULE_FEATURES43 = [];
2598
+ var RULE_NAME45 = "no-unstable-context-value";
2599
+ var RULE_FEATURES45 = [];
2479
2600
  var no_unstable_context_value_default = createRule({
2480
2601
  meta: {
2481
2602
  type: "problem",
2482
2603
  docs: {
2483
2604
  description: "Prevents non-stable values (i.e. object literals) from being used as a value for `Context.Provider`.",
2484
- [Symbol.for("rule_features")]: RULE_FEATURES43
2605
+ [Symbol.for("rule_features")]: RULE_FEATURES45
2485
2606
  },
2486
2607
  messages: {
2487
2608
  unstableContextValue: "A/an '{{type}}' passed as the value prop to the context provider should not be constructed. It will change on every render. {{suggestion}}"
2488
2609
  },
2489
2610
  schema: []
2490
2611
  },
2491
- name: RULE_NAME43,
2492
- create: create43,
2612
+ name: RULE_NAME45,
2613
+ create: create45,
2493
2614
  defaultOptions: []
2494
2615
  });
2495
- function create43(context) {
2616
+ function create45(context) {
2496
2617
  const { version: version2 } = shared.getSettingsFromContext(context);
2497
2618
  const isReact18OrBelow = compareVersions.compare(version2, "19.0.0", "<");
2498
- const { ctx, listeners } = ER21__namespace.useComponentCollector(context);
2619
+ const { ctx, listeners } = ER22__namespace.useComponentCollector(context);
2499
2620
  const constructions = /* @__PURE__ */ new Map();
2500
2621
  return {
2501
2622
  ...listeners,
2502
2623
  JSXOpeningElement(node) {
2503
- const fullName = JSX8__namespace.getElementType(node.parent);
2624
+ const fullName = JSX9__namespace.getElementType(node.parent);
2504
2625
  const selfName = fullName.split(".").at(-1);
2505
2626
  if (selfName == null) return;
2506
2627
  if (!isContextName(selfName, isReact18OrBelow)) return;
@@ -2516,13 +2637,13 @@ function create43(context) {
2516
2637
  const initialScope = context.sourceCode.getScope(valueExpression);
2517
2638
  const construction = VAR2__namespace.getConstructionDetectionResult(valueExpression, initialScope);
2518
2639
  if (construction == null) return;
2519
- if (ER21__namespace.isReactHookCall(construction.node)) {
2640
+ if (ER22__namespace.isReactHookCall(construction.node)) {
2520
2641
  return;
2521
2642
  }
2522
2643
  eff.getOrUpdate(constructions, functionEntry.node, () => []).push(construction);
2523
2644
  },
2524
- "Program:exit"(node) {
2525
- const components = ctx.getAllComponents(node).values();
2645
+ "Program:exit"(program) {
2646
+ const components = ctx.getAllComponents(program).values();
2526
2647
  for (const { node: component } of components) {
2527
2648
  for (const construction of constructions.get(component) ?? []) {
2528
2649
  const { kind, node: constructionNode } = construction;
@@ -2547,31 +2668,31 @@ function isContextName(name5, isReact18OrBelow) {
2547
2668
  }
2548
2669
  return false;
2549
2670
  }
2550
- var RULE_NAME44 = "no-unstable-default-props";
2551
- var RULE_FEATURES44 = [];
2671
+ var RULE_NAME46 = "no-unstable-default-props";
2672
+ var RULE_FEATURES46 = [];
2552
2673
  var no_unstable_default_props_default = createRule({
2553
2674
  meta: {
2554
2675
  type: "problem",
2555
2676
  docs: {
2556
2677
  description: "Prevents using referential-type values as default props in object destructuring.",
2557
- [Symbol.for("rule_features")]: RULE_FEATURES44
2678
+ [Symbol.for("rule_features")]: RULE_FEATURES46
2558
2679
  },
2559
2680
  messages: {
2560
2681
  noUnstableDefaultProps: "A/an '{{forbiddenType}}' as default prop. This could lead to potential infinite render loop in React. Use a variable instead of '{{forbiddenType}}'."
2561
2682
  },
2562
2683
  schema: []
2563
2684
  },
2564
- name: RULE_NAME44,
2565
- create: create44,
2685
+ name: RULE_NAME46,
2686
+ create: create46,
2566
2687
  defaultOptions: []
2567
2688
  });
2568
- function create44(context) {
2569
- const { ctx, listeners } = ER21__namespace.useComponentCollector(context);
2689
+ function create46(context) {
2690
+ const { ctx, listeners } = ER22__namespace.useComponentCollector(context);
2570
2691
  const declarators = /* @__PURE__ */ new Map();
2571
2692
  return {
2572
2693
  ...listeners,
2573
- "Program:exit"(node) {
2574
- const components = ctx.getAllComponents(node);
2694
+ "Program:exit"(program) {
2695
+ const components = ctx.getAllComponents(program);
2575
2696
  for (const { node: component } of components.values()) {
2576
2697
  const { params } = component;
2577
2698
  const [props] = params;
@@ -2596,7 +2717,7 @@ function create44(context) {
2596
2717
  if (construction == null) {
2597
2718
  continue;
2598
2719
  }
2599
- if (ER21__namespace.isReactHookCall(construction.node)) {
2720
+ if (ER22__namespace.isReactHookCall(construction.node)) {
2600
2721
  continue;
2601
2722
  }
2602
2723
  const forbiddenType = AST8__namespace.toReadableNodeType(right);
@@ -2621,8 +2742,8 @@ function create44(context) {
2621
2742
  }
2622
2743
  };
2623
2744
  }
2624
- var RULE_NAME45 = "no-unused-class-component-members";
2625
- var RULE_FEATURES45 = [];
2745
+ var RULE_NAME47 = "no-unused-class-component-members";
2746
+ var RULE_FEATURES47 = [];
2626
2747
  var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
2627
2748
  "componentDidCatch",
2628
2749
  "componentDidMount",
@@ -2648,25 +2769,25 @@ var no_unused_class_component_members_default = createRule({
2648
2769
  type: "problem",
2649
2770
  docs: {
2650
2771
  description: "Warns unused class component methods and properties.",
2651
- [Symbol.for("rule_features")]: RULE_FEATURES45
2772
+ [Symbol.for("rule_features")]: RULE_FEATURES47
2652
2773
  },
2653
2774
  messages: {
2654
2775
  noUnusedClassComponentMembers: "Unused method or property '{{methodName}}'' of class '{{className}}'."
2655
2776
  },
2656
2777
  schema: []
2657
2778
  },
2658
- name: RULE_NAME45,
2659
- create: create45,
2779
+ name: RULE_NAME47,
2780
+ create: create47,
2660
2781
  defaultOptions: []
2661
2782
  });
2662
- function create45(context) {
2783
+ function create47(context) {
2663
2784
  const classEntries = [];
2664
2785
  const methodEntries = [];
2665
2786
  const propertyDefs = /* @__PURE__ */ new WeakMap();
2666
2787
  const propertyUsages = /* @__PURE__ */ new WeakMap();
2667
2788
  function classEnter(node) {
2668
2789
  classEntries.push(node);
2669
- if (!ER21__namespace.isClassComponent(node)) {
2790
+ if (!ER22__namespace.isClassComponent(node)) {
2670
2791
  return;
2671
2792
  }
2672
2793
  propertyDefs.set(node, /* @__PURE__ */ new Set());
@@ -2674,7 +2795,7 @@ function create45(context) {
2674
2795
  }
2675
2796
  function classExit() {
2676
2797
  const currentClass = classEntries.pop();
2677
- if (currentClass == null || !ER21__namespace.isClassComponent(currentClass)) {
2798
+ if (currentClass == null || !ER22__namespace.isClassComponent(currentClass)) {
2678
2799
  return;
2679
2800
  }
2680
2801
  const className = AST8__namespace.getClassIdentifier(currentClass)?.name;
@@ -2704,7 +2825,7 @@ function create45(context) {
2704
2825
  function methodEnter(node) {
2705
2826
  methodEntries.push(node);
2706
2827
  const currentClass = classEntries.at(-1);
2707
- if (currentClass == null || !ER21__namespace.isClassComponent(currentClass)) {
2828
+ if (currentClass == null || !ER22__namespace.isClassComponent(currentClass)) {
2708
2829
  return;
2709
2830
  }
2710
2831
  if (node.static) {
@@ -2728,7 +2849,7 @@ function create45(context) {
2728
2849
  if (currentClass == null || currentMethod == null) {
2729
2850
  return;
2730
2851
  }
2731
- if (!ER21__namespace.isClassComponent(currentClass) || currentMethod.static) {
2852
+ if (!ER22__namespace.isClassComponent(currentClass) || currentMethod.static) {
2732
2853
  return;
2733
2854
  }
2734
2855
  if (!AST8__namespace.isThisExpression(node.object) || !isKeyLiteral2(node, node.property)) {
@@ -2753,7 +2874,7 @@ function create45(context) {
2753
2874
  if (currentClass == null || currentMethod == null) {
2754
2875
  return;
2755
2876
  }
2756
- if (!ER21__namespace.isClassComponent(currentClass) || currentMethod.static) {
2877
+ if (!ER22__namespace.isClassComponent(currentClass) || currentMethod.static) {
2757
2878
  return;
2758
2879
  }
2759
2880
  if (node.init != null && AST8__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern) {
@@ -2769,8 +2890,8 @@ function create45(context) {
2769
2890
  }
2770
2891
  };
2771
2892
  }
2772
- var RULE_NAME46 = "no-unused-state";
2773
- var RULE_FEATURES46 = [];
2893
+ var RULE_NAME48 = "no-unused-state";
2894
+ var RULE_FEATURES48 = [];
2774
2895
  function isKeyLiteral3(node, key) {
2775
2896
  return tsPattern.match(key).with({ type: types.AST_NODE_TYPES.Literal }, eff.constTrue).with({ type: types.AST_NODE_TYPES.TemplateLiteral, expressions: [] }, eff.constTrue).with({ type: types.AST_NODE_TYPES.Identifier }, () => !node.computed).otherwise(eff.constFalse);
2776
2897
  }
@@ -2779,18 +2900,18 @@ var no_unused_state_default = createRule({
2779
2900
  type: "problem",
2780
2901
  docs: {
2781
2902
  description: "Warns unused class component state.",
2782
- [Symbol.for("rule_features")]: RULE_FEATURES46
2903
+ [Symbol.for("rule_features")]: RULE_FEATURES48
2783
2904
  },
2784
2905
  messages: {
2785
2906
  noUnusedState: "Unused class component state in '{{className}}'"
2786
2907
  },
2787
2908
  schema: []
2788
2909
  },
2789
- name: RULE_NAME46,
2790
- create: create46,
2910
+ name: RULE_NAME48,
2911
+ create: create48,
2791
2912
  defaultOptions: []
2792
2913
  });
2793
- function create46(context) {
2914
+ function create48(context) {
2794
2915
  const classEntries = [];
2795
2916
  const methodEntries = [];
2796
2917
  const constructorEntries = [];
@@ -2800,7 +2921,7 @@ function create46(context) {
2800
2921
  }
2801
2922
  function classExit() {
2802
2923
  const currentClass = classEntries.pop();
2803
- if (currentClass == null || !ER21__namespace.isClassComponent(currentClass)) {
2924
+ if (currentClass == null || !ER22__namespace.isClassComponent(currentClass)) {
2804
2925
  return;
2805
2926
  }
2806
2927
  const className = AST8__namespace.getClassIdentifier(currentClass)?.name;
@@ -2819,11 +2940,11 @@ function create46(context) {
2819
2940
  function methodEnter(node) {
2820
2941
  methodEntries.push(node);
2821
2942
  const currentClass = classEntries.at(-1);
2822
- if (currentClass == null || !ER21__namespace.isClassComponent(currentClass)) {
2943
+ if (currentClass == null || !ER22__namespace.isClassComponent(currentClass)) {
2823
2944
  return;
2824
2945
  }
2825
2946
  if (node.static) {
2826
- if (ER21__namespace.isGetDerivedStateFromProps(node) && tsPattern.isMatching({ params: [tsPattern.P.nonNullable, ...tsPattern.P.array()] })(node.value)) {
2947
+ if (ER22__namespace.isGetDerivedStateFromProps(node) && tsPattern.isMatching({ params: [tsPattern.P.nonNullable, ...tsPattern.P.array()] })(node.value)) {
2827
2948
  const defNode = stateDefs.get(currentClass)?.node;
2828
2949
  stateDefs.set(currentClass, { node: defNode, isUsed: true });
2829
2950
  }
@@ -2844,11 +2965,11 @@ function create46(context) {
2844
2965
  }
2845
2966
  return {
2846
2967
  AssignmentExpression(node) {
2847
- if (!ER21__namespace.isAssignmentToThisState(node)) {
2968
+ if (!ER22__namespace.isAssignmentToThisState(node)) {
2848
2969
  return;
2849
2970
  }
2850
2971
  const currentClass = classEntries.at(-1);
2851
- if (currentClass == null || !ER21__namespace.isClassComponent(currentClass)) {
2972
+ if (currentClass == null || !ER22__namespace.isClassComponent(currentClass)) {
2852
2973
  return;
2853
2974
  }
2854
2975
  const currentConstructor = constructorEntries.at(-1);
@@ -2870,7 +2991,7 @@ function create46(context) {
2870
2991
  return;
2871
2992
  }
2872
2993
  const currentClass = classEntries.at(-1);
2873
- if (currentClass == null || !ER21__namespace.isClassComponent(currentClass)) {
2994
+ if (currentClass == null || !ER22__namespace.isClassComponent(currentClass)) {
2874
2995
  return;
2875
2996
  }
2876
2997
  const currentMethod = methodEntries.at(-1);
@@ -2894,7 +3015,7 @@ function create46(context) {
2894
3015
  "PropertyDefinition:exit": methodExit,
2895
3016
  VariableDeclarator(node) {
2896
3017
  const currentClass = classEntries.at(-1);
2897
- if (currentClass == null || !ER21__namespace.isClassComponent(currentClass)) {
3018
+ if (currentClass == null || !ER22__namespace.isClassComponent(currentClass)) {
2898
3019
  return;
2899
3020
  }
2900
3021
  const currentMethod = methodEntries.at(-1);
@@ -2924,8 +3045,8 @@ function create46(context) {
2924
3045
  }
2925
3046
  };
2926
3047
  }
2927
- var RULE_NAME47 = "no-use-context";
2928
- var RULE_FEATURES47 = [
3048
+ var RULE_NAME49 = "no-use-context";
3049
+ var RULE_FEATURES49 = [
2929
3050
  "MOD"
2930
3051
  ];
2931
3052
  var no_use_context_default = createRule({
@@ -2933,7 +3054,7 @@ var no_use_context_default = createRule({
2933
3054
  type: "problem",
2934
3055
  docs: {
2935
3056
  description: "Replaces usages of `useContext` with `use`.",
2936
- [Symbol.for("rule_features")]: RULE_FEATURES47
3057
+ [Symbol.for("rule_features")]: RULE_FEATURES49
2937
3058
  },
2938
3059
  fixable: "code",
2939
3060
  messages: {
@@ -2941,11 +3062,11 @@ var no_use_context_default = createRule({
2941
3062
  },
2942
3063
  schema: []
2943
3064
  },
2944
- name: RULE_NAME47,
2945
- create: create47,
3065
+ name: RULE_NAME49,
3066
+ create: create49,
2946
3067
  defaultOptions: []
2947
3068
  });
2948
- function create47(context) {
3069
+ function create49(context) {
2949
3070
  if (!context.sourceCode.text.includes("useContext")) return {};
2950
3071
  const settings4 = shared.getSettingsFromContext(context);
2951
3072
  const useContextAlias = /* @__PURE__ */ new Set();
@@ -2954,10 +3075,10 @@ function create47(context) {
2954
3075
  }
2955
3076
  return {
2956
3077
  CallExpression(node) {
2957
- if (!ER21__namespace.isReactHookCall(node)) {
3078
+ if (!ER22__namespace.isReactHookCall(node)) {
2958
3079
  return;
2959
3080
  }
2960
- if (!ER21__namespace.isReactHookCallWithNameAlias(context, "useContext", [...useContextAlias])(node)) {
3081
+ if (!ER22__namespace.isReactHookCallWithNameAlias(context, "useContext", [...useContextAlias])(node)) {
2961
3082
  return;
2962
3083
  }
2963
3084
  context.report({
@@ -3023,28 +3144,28 @@ function getAssociatedTokens(context, node) {
3023
3144
  return tokens;
3024
3145
  }
3025
3146
  }
3026
- var RULE_NAME48 = "no-useless-forward-ref";
3027
- var RULE_FEATURES48 = [];
3147
+ var RULE_NAME50 = "no-useless-forward-ref";
3148
+ var RULE_FEATURES50 = [];
3028
3149
  var no_useless_forward_ref_default = createRule({
3029
3150
  meta: {
3030
3151
  type: "problem",
3031
3152
  docs: {
3032
3153
  description: "Disallow useless `forwardRef` calls on components that don't use `ref`s.",
3033
- [Symbol.for("rule_features")]: RULE_FEATURES48
3154
+ [Symbol.for("rule_features")]: RULE_FEATURES50
3034
3155
  },
3035
3156
  messages: {
3036
3157
  noUselessForwardRef: "A 'forwardRef' is used with this component but no 'ref' parameter is set."
3037
3158
  },
3038
3159
  schema: []
3039
3160
  },
3040
- name: RULE_NAME48,
3041
- create: create48,
3161
+ name: RULE_NAME50,
3162
+ create: create50,
3042
3163
  defaultOptions: []
3043
3164
  });
3044
- function create48(context) {
3165
+ function create50(context) {
3045
3166
  return {
3046
3167
  CallExpression(node) {
3047
- if (!ER21__namespace.isForwardRefCall(context, node)) {
3168
+ if (!ER22__namespace.isForwardRefCall(context, node)) {
3048
3169
  return;
3049
3170
  }
3050
3171
  const [component] = node.arguments;
@@ -3062,7 +3183,7 @@ function create48(context) {
3062
3183
  }
3063
3184
  };
3064
3185
  }
3065
- var RULE_NAME49 = "no-useless-fragment";
3186
+ var RULE_NAME51 = "no-useless-fragment";
3066
3187
  var defaultOptions = [{
3067
3188
  allowExpressions: true
3068
3189
  }];
@@ -3088,15 +3209,15 @@ var no_useless_fragment_default = createRule({
3088
3209
  }
3089
3210
  }]
3090
3211
  },
3091
- name: RULE_NAME49,
3092
- create: create49,
3212
+ name: RULE_NAME51,
3213
+ create: create51,
3093
3214
  defaultOptions
3094
3215
  });
3095
- function create49(context, [option]) {
3216
+ function create51(context, [option]) {
3096
3217
  const { allowExpressions = true } = option;
3097
3218
  return {
3098
3219
  JSXElement(node) {
3099
- if (!JSX8__namespace.isFragmentElement(node)) return;
3220
+ if (!JSX9__namespace.isFragmentElement(node)) return;
3100
3221
  checkNode(context, node, allowExpressions);
3101
3222
  },
3102
3223
  JSXFragment(node) {
@@ -3108,7 +3229,7 @@ function isWhiteSpace(node) {
3108
3229
  return typeof node.value === "string" && node.raw.trim() === "";
3109
3230
  }
3110
3231
  function isPaddingSpaces(node) {
3111
- return JSX8__namespace.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
3232
+ return JSX9__namespace.isJsxText(node) && isWhiteSpace(node) && node.raw.includes("\n");
3112
3233
  }
3113
3234
  function trimLikeReact(text) {
3114
3235
  const leadingSpaces = /^\s*/.exec(text)?.[0] ?? "";
@@ -3119,10 +3240,10 @@ function trimLikeReact(text) {
3119
3240
  }
3120
3241
  function checkNode(context, node, allowExpressions) {
3121
3242
  const initialScope = context.sourceCode.getScope(node);
3122
- if (JSX8__namespace.isKeyedElement(node, initialScope)) {
3243
+ if (JSX9__namespace.isKeyedElement(node, initialScope)) {
3123
3244
  return;
3124
3245
  }
3125
- if (JSX8__namespace.isHostElement(node.parent)) {
3246
+ if (JSX9__namespace.isHostElement(node.parent)) {
3126
3247
  context.report({
3127
3248
  messageId: "uselessFragment",
3128
3249
  node,
@@ -3146,7 +3267,7 @@ function checkNode(context, node, allowExpressions) {
3146
3267
  const isChildElement = AST8__namespace.isOneOf([types.AST_NODE_TYPES.JSXElement, types.AST_NODE_TYPES.JSXFragment])(node.parent);
3147
3268
  switch (true) {
3148
3269
  // <Foo content={<>ee eeee eeee ...</>} />
3149
- case (allowExpressions && !isChildElement && node.children.length === 1 && JSX8__namespace.isJsxText(node.children.at(0))): {
3270
+ case (allowExpressions && !isChildElement && node.children.length === 1 && JSX9__namespace.isJsxText(node.children.at(0))): {
3150
3271
  return;
3151
3272
  }
3152
3273
  // <Foo><>hello, world</></Foo>
@@ -3202,18 +3323,18 @@ function getFix2(context, node) {
3202
3323
  }
3203
3324
  function canFix(node) {
3204
3325
  if (node.parent.type === types.AST_NODE_TYPES.JSXElement || node.parent.type === types.AST_NODE_TYPES.JSXFragment) {
3205
- return JSX8__namespace.isHostElement(node.parent);
3326
+ return JSX9__namespace.isHostElement(node.parent);
3206
3327
  }
3207
3328
  if (node.children.length === 0) {
3208
3329
  return false;
3209
3330
  }
3210
- if (node.children.some((child) => JSX8__namespace.isJsxText(child) && !isWhiteSpace(child) || AST8__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer)(child))) {
3331
+ if (node.children.some((child) => JSX9__namespace.isJsxText(child) && !isWhiteSpace(child) || AST8__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer)(child))) {
3211
3332
  return false;
3212
3333
  }
3213
3334
  return true;
3214
3335
  }
3215
- var RULE_NAME50 = "prefer-destructuring-assignment";
3216
- var RULE_FEATURES49 = [];
3336
+ var RULE_NAME52 = "prefer-destructuring-assignment";
3337
+ var RULE_FEATURES51 = [];
3217
3338
  function isMemberExpressionWithObjectName(node) {
3218
3339
  return node.object.type === types.AST_NODE_TYPES.Identifier && "name" in node.object;
3219
3340
  }
@@ -3222,19 +3343,19 @@ var prefer_destructuring_assignment_default = createRule({
3222
3343
  type: "problem",
3223
3344
  docs: {
3224
3345
  description: "Enforces destructuring assignment for component props and context.",
3225
- [Symbol.for("rule_features")]: RULE_FEATURES49
3346
+ [Symbol.for("rule_features")]: RULE_FEATURES51
3226
3347
  },
3227
3348
  messages: {
3228
3349
  preferDestructuringAssignment: "Use destructuring assignment for {{name}}."
3229
3350
  },
3230
3351
  schema: []
3231
3352
  },
3232
- name: RULE_NAME50,
3233
- create: create50,
3353
+ name: RULE_NAME52,
3354
+ create: create52,
3234
3355
  defaultOptions: []
3235
3356
  });
3236
- function create50(context) {
3237
- const { ctx, listeners } = ER21__namespace.useComponentCollector(context);
3357
+ function create52(context) {
3358
+ const { ctx, listeners } = ER22__namespace.useComponentCollector(context);
3238
3359
  const memberExpressionWithNames = [];
3239
3360
  return {
3240
3361
  ...listeners,
@@ -3244,16 +3365,16 @@ function create50(context) {
3244
3365
  memberExpressionWithNames.push([scope, node]);
3245
3366
  }
3246
3367
  },
3247
- "Program:exit"(node) {
3368
+ "Program:exit"(program) {
3248
3369
  const components = [
3249
- ...ctx.getAllComponents(node).values()
3370
+ ...ctx.getAllComponents(program).values()
3250
3371
  ];
3251
3372
  function isFunctionComponent(block) {
3252
3373
  if (!AST8__namespace.isFunction(block)) {
3253
3374
  return false;
3254
3375
  }
3255
3376
  const id = AST8__namespace.getFunctionIdentifier(block);
3256
- return id != null && ER21__namespace.isComponentNameLoose(id.name) && components.some((component) => component.node === block);
3377
+ return id != null && ER22__namespace.isComponentNameLoose(id.name) && components.some((component) => component.node === block);
3257
3378
  }
3258
3379
  for (const [initialScope, memberExpression] of memberExpressionWithNames) {
3259
3380
  let scope = initialScope;
@@ -3270,7 +3391,7 @@ function create50(context) {
3270
3391
  continue;
3271
3392
  }
3272
3393
  const [props, ctx2] = component.params;
3273
- const isMatch = (node2) => node2 != null && node2.type === types.AST_NODE_TYPES.Identifier && node2.name === memberExpression.object.name;
3394
+ const isMatch = (node) => node != null && node.type === types.AST_NODE_TYPES.Identifier && node.name === memberExpression.object.name;
3274
3395
  if (isMatch(props)) {
3275
3396
  context.report({
3276
3397
  messageId: "preferDestructuringAssignment",
@@ -3293,8 +3414,8 @@ function create50(context) {
3293
3414
  }
3294
3415
  };
3295
3416
  }
3296
- var RULE_NAME51 = "prefer-react-namespace-import";
3297
- var RULE_FEATURES50 = [
3417
+ var RULE_NAME53 = "prefer-react-namespace-import";
3418
+ var RULE_FEATURES52 = [
3298
3419
  "FIX"
3299
3420
  ];
3300
3421
  var prefer_react_namespace_import_default = createRule({
@@ -3302,7 +3423,7 @@ var prefer_react_namespace_import_default = createRule({
3302
3423
  type: "problem",
3303
3424
  docs: {
3304
3425
  description: "Enforces React is imported via a namespace import.",
3305
- [Symbol.for("rule_features")]: RULE_FEATURES50
3426
+ [Symbol.for("rule_features")]: RULE_FEATURES52
3306
3427
  },
3307
3428
  fixable: "code",
3308
3429
  messages: {
@@ -3310,11 +3431,11 @@ var prefer_react_namespace_import_default = createRule({
3310
3431
  },
3311
3432
  schema: []
3312
3433
  },
3313
- name: RULE_NAME51,
3314
- create: create51,
3434
+ name: RULE_NAME53,
3435
+ create: create53,
3315
3436
  defaultOptions: []
3316
3437
  });
3317
- function create51(context) {
3438
+ function create53(context) {
3318
3439
  const { importSource } = shared.getSettingsFromContext(context);
3319
3440
  return {
3320
3441
  [`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
@@ -3349,8 +3470,8 @@ function create51(context) {
3349
3470
  }
3350
3471
  };
3351
3472
  }
3352
- var RULE_NAME52 = "prefer-read-only-props";
3353
- var RULE_FEATURES51 = [
3473
+ var RULE_NAME54 = "prefer-read-only-props";
3474
+ var RULE_FEATURES53 = [
3354
3475
  "TSC",
3355
3476
  "EXP"
3356
3477
  ];
@@ -3359,24 +3480,24 @@ var prefer_read_only_props_default = createRule({
3359
3480
  type: "problem",
3360
3481
  docs: {
3361
3482
  description: "Enforces read-only props in components.",
3362
- [Symbol.for("rule_features")]: RULE_FEATURES51
3483
+ [Symbol.for("rule_features")]: RULE_FEATURES53
3363
3484
  },
3364
3485
  messages: {
3365
3486
  preferReadOnlyProps: "A function component's props should be read-only."
3366
3487
  },
3367
3488
  schema: []
3368
3489
  },
3369
- name: RULE_NAME52,
3370
- create: create52,
3490
+ name: RULE_NAME54,
3491
+ create: create54,
3371
3492
  defaultOptions: []
3372
3493
  });
3373
- function create52(context) {
3494
+ function create54(context) {
3374
3495
  const services = utils.ESLintUtils.getParserServices(context, false);
3375
- const { ctx, listeners } = ER21__namespace.useComponentCollector(context);
3496
+ const { ctx, listeners } = ER22__namespace.useComponentCollector(context);
3376
3497
  return {
3377
3498
  ...listeners,
3378
- "Program:exit"(node) {
3379
- const components = ctx.getAllComponents(node);
3499
+ "Program:exit"(program) {
3500
+ const components = ctx.getAllComponents(program);
3380
3501
  for (const [, component] of components) {
3381
3502
  const [props] = component.node.params;
3382
3503
  if (props == null) {
@@ -3400,8 +3521,8 @@ function isTypeReadonlyLoose(services, type) {
3400
3521
  return true;
3401
3522
  }
3402
3523
  }
3403
- var RULE_NAME53 = "prefer-shorthand-boolean";
3404
- var RULE_FEATURES52 = [
3524
+ var RULE_NAME55 = "prefer-shorthand-boolean";
3525
+ var RULE_FEATURES54 = [
3405
3526
  "FIX"
3406
3527
  ];
3407
3528
  var prefer_shorthand_boolean_default = createRule({
@@ -3409,7 +3530,7 @@ var prefer_shorthand_boolean_default = createRule({
3409
3530
  type: "problem",
3410
3531
  docs: {
3411
3532
  description: "Enforces shorthand syntax for boolean attributes.",
3412
- [Symbol.for("rule_features")]: RULE_FEATURES52
3533
+ [Symbol.for("rule_features")]: RULE_FEATURES54
3413
3534
  },
3414
3535
  fixable: "code",
3415
3536
  messages: {
@@ -3417,15 +3538,15 @@ var prefer_shorthand_boolean_default = createRule({
3417
3538
  },
3418
3539
  schema: []
3419
3540
  },
3420
- name: RULE_NAME53,
3421
- create: create53,
3541
+ name: RULE_NAME55,
3542
+ create: create55,
3422
3543
  defaultOptions: []
3423
3544
  });
3424
- function create53(context) {
3545
+ function create55(context) {
3425
3546
  return {
3426
3547
  JSXAttribute(node) {
3427
3548
  const { value } = node;
3428
- const propName = JSX8__namespace.getAttributeName(node);
3549
+ const propName = JSX9__namespace.getAttributeName(node);
3429
3550
  const hasValueTrue = value?.type === types.AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === types.AST_NODE_TYPES.Literal && value.expression.value === true;
3430
3551
  if (!hasValueTrue) {
3431
3552
  return;
@@ -3441,8 +3562,8 @@ function create53(context) {
3441
3562
  }
3442
3563
  };
3443
3564
  }
3444
- var RULE_NAME54 = "prefer-shorthand-fragment";
3445
- var RULE_FEATURES53 = [
3565
+ var RULE_NAME56 = "prefer-shorthand-fragment";
3566
+ var RULE_FEATURES55 = [
3446
3567
  "FIX"
3447
3568
  ];
3448
3569
  var prefer_shorthand_fragment_default = createRule({
@@ -3450,7 +3571,7 @@ var prefer_shorthand_fragment_default = createRule({
3450
3571
  type: "problem",
3451
3572
  docs: {
3452
3573
  description: "Enforces shorthand syntax for fragments.",
3453
- [Symbol.for("rule_features")]: RULE_FEATURES53
3574
+ [Symbol.for("rule_features")]: RULE_FEATURES55
3454
3575
  },
3455
3576
  fixable: "code",
3456
3577
  messages: {
@@ -3458,14 +3579,14 @@ var prefer_shorthand_fragment_default = createRule({
3458
3579
  },
3459
3580
  schema: []
3460
3581
  },
3461
- name: RULE_NAME54,
3462
- create: create54,
3582
+ name: RULE_NAME56,
3583
+ create: create56,
3463
3584
  defaultOptions: []
3464
3585
  });
3465
- function create54(context) {
3586
+ function create56(context) {
3466
3587
  return {
3467
3588
  JSXElement(node) {
3468
- if (!JSX8__namespace.isFragmentElement(node)) return;
3589
+ if (!JSX9__namespace.isFragmentElement(node)) return;
3469
3590
  const hasAttributes = node.openingElement.attributes.length > 0;
3470
3591
  if (hasAttributes) {
3471
3592
  return;
@@ -3523,7 +3644,9 @@ var plugin = {
3523
3644
  "no-missing-component-display-name": no_missing_component_display_name_default,
3524
3645
  "no-missing-context-display-name": no_missing_context_display_name_default,
3525
3646
  "no-missing-key": no_missing_key_default,
3647
+ "no-misused-capture-owner-stack": no_misused_capture_owner_stack_default,
3526
3648
  "no-nested-component-definitions": no_nested_component_definitions_default,
3649
+ "no-nested-lazy-component-declarations": no_nested_lazy_component_declarations_default,
3527
3650
  "no-prop-types": no_prop_types_default,
3528
3651
  "no-redundant-should-component-update": no_redundant_should_component_update_default,
3529
3652
  "no-set-state-in-component-did-mount": no_set_state_in_component_did_mount_default,