eslint-plugin-react-x 4.2.5-beta.0 → 5.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +170 -352
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -4,12 +4,11 @@ import * as core from "@eslint-react/core";
4
4
  import { isUseRefCall } from "@eslint-react/core";
5
5
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
6
6
  import { ESLintUtils } from "@typescript-eslint/utils";
7
- import { P, isMatching, match } from "ts-pattern";
8
- import ts from "typescript";
9
7
  import { JsxDetectionHint, findParentAttribute, getElementFullType, hasAttribute, isJsxLike } from "@eslint-react/jsx";
10
8
  import { computeObjectType, findEnclosingAssignmentTarget, isAssignmentTargetEqual, resolve } from "@eslint-react/var";
11
9
  import { DefinitionType } from "@typescript-eslint/scope-manager";
12
10
  import { findVariable, getStaticValue, isIdentifier, isVariableDeclarator } from "@typescript-eslint/utils/ast-utils";
11
+ import { P, isMatching, match } from "ts-pattern";
13
12
  import { compare } from "compare-versions";
14
13
  import { getConstrainedTypeAtLocation } from "@typescript-eslint/type-utils";
15
14
  import { unionConstituents } from "ts-api-utils";
@@ -68,7 +67,6 @@ const conflictingRules$1 = [
68
67
  "react/no-find-dom-node",
69
68
  "react/no-namespace",
70
69
  "react/no-object-type-as-default-prop",
71
- "react/no-redundant-should-component-update",
72
70
  "react/no-render-return-value",
73
71
  "react/no-string-refs",
74
72
  "react/no-unknown-property",
@@ -145,7 +143,7 @@ const rules$7 = {
145
143
  //#endregion
146
144
  //#region package.json
147
145
  var name$6 = "eslint-plugin-react-x";
148
- var version = "4.2.5-beta.0";
146
+ var version = "5.0.0-beta.0";
149
147
 
150
148
  //#endregion
151
149
  //#region src/utils/create-rule.ts
@@ -154,155 +152,9 @@ function getDocsUrl(ruleName) {
154
152
  }
155
153
  const createRule = ESLintUtils.RuleCreator(getDocsUrl);
156
154
 
157
- //#endregion
158
- //#region src/utils/type-is.ts
159
- function isFlagSet(allFlags, flag) {
160
- return (allFlags & flag) !== 0;
161
- }
162
- function isFlagSetOnObject(obj, flag) {
163
- return isFlagSet(obj.flags, flag);
164
- }
165
- const isTypeFlagSet = isFlagSetOnObject;
166
- function isBooleanLiteralType(type) {
167
- return isTypeFlagSet(type, ts.TypeFlags.BooleanLiteral);
168
- }
169
- /** @internal */
170
- const isFalseLiteralType = (type) => isBooleanLiteralType(type) && type.intrinsicName === "false";
171
- /** @internal */
172
- const isTrueLiteralType = (type) => isBooleanLiteralType(type) && type.intrinsicName === "true";
173
- /** @internal */
174
- const isAnyType = (type) => isTypeFlagSet(type, ts.TypeFlags.TypeParameter | ts.TypeFlags.Any);
175
- /** @internal */
176
- const isBigIntType = (type) => isTypeFlagSet(type, ts.TypeFlags.BigIntLike);
177
- /** @internal */
178
- const isBooleanType = (type) => isTypeFlagSet(type, ts.TypeFlags.BooleanLike);
179
- /** @internal */
180
- const isEnumType = (type) => isTypeFlagSet(type, ts.TypeFlags.EnumLike);
181
- /** @internal */
182
- const isFalsyBigIntType = (type) => type.isLiteral() && isMatching({ value: { base10Value: "0" } }, type);
183
- /** @internal */
184
- const isFalsyNumberType = (type) => type.isNumberLiteral() && type.value === 0;
185
- /** @internal */
186
- const isFalsyStringType = (type) => type.isStringLiteral() && type.value === "";
187
- /** @internal */
188
- const isNeverType = (type) => isTypeFlagSet(type, ts.TypeFlags.Never);
189
- /** @internal */
190
- const isNullishType = (type) => isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike);
191
- /** @internal */
192
- const isNumberType = (type) => isTypeFlagSet(type, ts.TypeFlags.NumberLike);
193
- /** @internal */
194
- const isObjectType = (type) => !isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike | ts.TypeFlags.BooleanLike | ts.TypeFlags.StringLike | ts.TypeFlags.NumberLike | ts.TypeFlags.BigIntLike | ts.TypeFlags.TypeParameter | ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.Never);
195
- /** @internal */
196
- const isStringType = (type) => isTypeFlagSet(type, ts.TypeFlags.StringLike);
197
- /** @internal */
198
- const isTruthyBigIntType = (type) => type.isLiteral() && isMatching({ value: { base10Value: P.not("0") } }, type);
199
- /** @internal */
200
- const isTruthyNumberType = (type) => type.isNumberLiteral() && type.value !== 0;
201
- /** @internal */
202
- const isTruthyStringType = (type) => type.isStringLiteral() && type.value !== "";
203
- /** @internal */
204
- const isUnknownType = (type) => isTypeFlagSet(type, ts.TypeFlags.Unknown);
205
-
206
- //#endregion
207
- //#region src/utils/type-name.ts
208
- /**
209
- * An enhanced version of getFullyQualifiedName that handles cases that original function does not handle
210
- * @param checker TypeScript type checker
211
- * @param symbol Symbol to get fully qualified name for
212
- * @returns Fully qualified name of the symbol
213
- */
214
- function getFullyQualifiedNameEx(checker, symbol) {
215
- let name = symbol.name;
216
- let parent = symbol.declarations?.at(0)?.parent;
217
- if (parent == null) return checker.getFullyQualifiedName(symbol);
218
- while (parent.kind !== ts.SyntaxKind.SourceFile) {
219
- switch (true) {
220
- case ts.isInterfaceDeclaration(parent):
221
- case ts.isTypeAliasDeclaration(parent):
222
- case ts.isEnumDeclaration(parent):
223
- case ts.isModuleDeclaration(parent):
224
- case ts.isNamespaceImport(parent):
225
- case ts.isNamespaceExport(parent):
226
- case ts.isNamespaceExportDeclaration(parent):
227
- name = `${parent.name.text}.${name}`;
228
- break;
229
- case ts.isPropertySignature(parent) && ts.isIdentifier(parent.name):
230
- case ts.isPropertyDeclaration(parent) && ts.isIdentifier(parent.name):
231
- case ts.isMethodDeclaration(parent) && ts.isIdentifier(parent.name):
232
- case ts.isMethodSignature(parent) && ts.isIdentifier(parent.name):
233
- case ts.isPropertyAssignment(parent) && ts.isIdentifier(parent.name):
234
- name = `${parent.name.text}.${name}`;
235
- break;
236
- case ts.isFunctionDeclaration(parent) && parent.name != null:
237
- case ts.isClassExpression(parent) && parent.name != null:
238
- case ts.isClassDeclaration(parent) && parent.name != null:
239
- name = `${parent.name.text}.${name}`;
240
- break;
241
- case ts.isEnumMember(parent):
242
- name = `${parent.name.getText()}.${name}`;
243
- break;
244
- case ts.isTypeLiteralNode(parent):
245
- case ts.isMappedTypeNode(parent):
246
- case ts.isObjectLiteralExpression(parent):
247
- case ts.isIntersectionTypeNode(parent):
248
- case ts.isUnionTypeNode(parent): break;
249
- default: break;
250
- }
251
- parent = parent.parent;
252
- }
253
- const namespace = parent.getSourceFile().statements.find((n) => ts.isNamespaceExportDeclaration(n))?.name.text;
254
- if (namespace == null) return name;
255
- if (name.startsWith(`${namespace}.`)) return name;
256
- return `${namespace}.${name}`;
257
- }
258
-
259
- //#endregion
260
- //#region src/utils/type-variant.ts
261
- /**
262
- * Ported from https://github.com/typescript-eslint/typescript-eslint/blob/eb736bbfc22554694400e6a4f97051d845d32e0b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts#L826 with some enhancements
263
- * Get the variants of an array of types.
264
- * @param types The types to get the variants of
265
- * @returns The variants of the types
266
- * @internal
267
- */
268
- function getTypeVariants(types) {
269
- const variants = /* @__PURE__ */ new Set();
270
- if (types.some(isUnknownType)) {
271
- variants.add("unknown");
272
- return variants;
273
- }
274
- if (types.some(isNullishType)) variants.add("nullish");
275
- const booleans = types.filter(isBooleanType);
276
- const boolean0 = booleans[0];
277
- if (booleans.length === 1 && boolean0 != null) {
278
- if (isFalseLiteralType(boolean0)) variants.add("falsy boolean");
279
- else if (isTrueLiteralType(boolean0)) variants.add("truthy boolean");
280
- } else if (booleans.length === 2) variants.add("boolean");
281
- const strings = types.filter(isStringType);
282
- if (strings.length > 0) {
283
- const evaluated = match(strings).when((types) => types.every(isTruthyStringType), () => "truthy string").when((types) => types.every(isFalsyStringType), () => "falsy string").otherwise(() => "string");
284
- variants.add(evaluated);
285
- }
286
- const bigints = types.filter(isBigIntType);
287
- if (bigints.length > 0) {
288
- const evaluated = match(bigints).when((types) => types.every(isTruthyBigIntType), () => "truthy bigint").when((types) => types.every(isFalsyBigIntType), () => "falsy bigint").otherwise(() => "bigint");
289
- variants.add(evaluated);
290
- }
291
- const numbers = types.filter(isNumberType);
292
- if (numbers.length > 0) {
293
- const evaluated = match(numbers).when((types) => types.every(isTruthyNumberType), () => "truthy number").when((types) => types.every(isFalsyNumberType), () => "falsy number").otherwise(() => "number");
294
- variants.add(evaluated);
295
- }
296
- if (types.some(isEnumType)) variants.add("enum");
297
- if (types.some(isObjectType)) variants.add("object");
298
- if (types.some(isAnyType)) variants.add("any");
299
- if (types.some(isNeverType)) variants.add("never");
300
- return variants;
301
- }
302
-
303
155
  //#endregion
304
156
  //#region src/rules/component-hook-factories/component-hook-factories.ts
305
- const RULE_NAME$54 = "component-hook-factories";
157
+ const RULE_NAME$53 = "component-hook-factories";
306
158
  var component_hook_factories_default = createRule({
307
159
  meta: {
308
160
  type: "problem",
@@ -313,8 +165,8 @@ var component_hook_factories_default = createRule({
313
165
  },
314
166
  schema: []
315
167
  },
316
- name: RULE_NAME$54,
317
- create: create$54,
168
+ name: RULE_NAME$53,
169
+ create: create$53,
318
170
  defaultOptions: []
319
171
  });
320
172
  /**
@@ -348,7 +200,7 @@ function isComponentTypeName(typeName) {
348
200
  */
349
201
  function isHigherOrderComponent(fn) {
350
202
  return fn.params.some((param) => {
351
- if (param.type === AST_NODE_TYPES.Identifier && core.isComponentNameLoose(param.name)) return true;
203
+ if (param.type === AST_NODE_TYPES.Identifier && core.isFunctionComponentNameLoose(param.name)) return true;
352
204
  if (hasComponentTypeAnnotation(param)) return true;
353
205
  return false;
354
206
  });
@@ -360,10 +212,10 @@ function isHigherOrderComponent(fn) {
360
212
  function isInsideTestMockCallback(node) {
361
213
  return ast.findParent(node, ast.isTestMockCallback) != null;
362
214
  }
363
- function create$54(context) {
364
- const hint = core.ComponentDetectionHint.DoNotIncludeJsxWithNumberValue | core.ComponentDetectionHint.DoNotIncludeJsxWithBooleanValue | core.ComponentDetectionHint.DoNotIncludeJsxWithNullValue | core.ComponentDetectionHint.DoNotIncludeJsxWithStringValue | core.ComponentDetectionHint.DoNotIncludeJsxWithUndefinedValue | core.ComponentDetectionHint.RequireBothSidesOfLogicalExpressionToBeJsx | core.ComponentDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJsx | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayPatternElement | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayExpressionElement | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayMapCallback;
365
- const fCollector = core.getComponentCollector(context, { hint });
366
- const cCollector = core.getComponentCollectorLegacy(context);
215
+ function create$53(context) {
216
+ const hint = core.FunctionComponentDetectionHint.DoNotIncludeJsxWithNumberValue | core.FunctionComponentDetectionHint.DoNotIncludeJsxWithBooleanValue | core.FunctionComponentDetectionHint.DoNotIncludeJsxWithNullValue | core.FunctionComponentDetectionHint.DoNotIncludeJsxWithStringValue | core.FunctionComponentDetectionHint.DoNotIncludeJsxWithUndefinedValue | core.FunctionComponentDetectionHint.RequireBothSidesOfLogicalExpressionToBeJsx | core.FunctionComponentDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJsx | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayPatternElement | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayExpressionElement | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayMapCallback;
217
+ const fCollector = core.getFunctionComponentCollector(context, { hint });
218
+ const cCollector = core.getClassComponentCollector(context);
367
219
  const hCollector = core.getHookCollector(context);
368
220
  const reported = /* @__PURE__ */ new Set();
369
221
  return defineRuleListener(fCollector.visitor, cCollector.visitor, hCollector.visitor, { "Program:exit"(program) {
@@ -411,7 +263,7 @@ function create$54(context) {
411
263
 
412
264
  //#endregion
413
265
  //#region src/rules/error-boundaries/error-boundaries.ts
414
- const RULE_NAME$53 = "error-boundaries";
266
+ const RULE_NAME$52 = "error-boundaries";
415
267
  var error_boundaries_default = createRule({
416
268
  meta: {
417
269
  type: "problem",
@@ -422,20 +274,20 @@ var error_boundaries_default = createRule({
422
274
  },
423
275
  schema: []
424
276
  },
425
- name: RULE_NAME$53,
426
- create: create$53,
277
+ name: RULE_NAME$52,
278
+ create: create$52,
427
279
  defaultOptions: []
428
280
  });
429
- function create$53(context) {
281
+ function create$52(context) {
430
282
  if (!context.sourceCode.text.includes("try")) return {};
431
283
  const hint = JsxDetectionHint.DoNotIncludeJsxWithNullValue | JsxDetectionHint.DoNotIncludeJsxWithNumberValue | JsxDetectionHint.DoNotIncludeJsxWithBigIntValue | JsxDetectionHint.DoNotIncludeJsxWithStringValue | JsxDetectionHint.DoNotIncludeJsxWithBooleanValue | JsxDetectionHint.DoNotIncludeJsxWithUndefinedValue | JsxDetectionHint.DoNotIncludeJsxWithEmptyArrayValue;
432
- const fCollector = core.getComponentCollector(context);
284
+ const fCollector = core.getFunctionComponentCollector(context);
433
285
  const hCollector = core.getHookCollector(context);
434
286
  const reported = /* @__PURE__ */ new Set();
435
287
  const useCalls = /* @__PURE__ */ new Set();
436
288
  return defineRuleListener(fCollector.visitor, hCollector.visitor, {
437
289
  CallExpression(node) {
438
- if (!core.isUseCall(node)) return;
290
+ if (!core.isUseCall(context, node)) return;
439
291
  useCalls.add(node);
440
292
  },
441
293
  "Program:exit"(node) {
@@ -1377,7 +1229,7 @@ function getUnknownDependenciesMessage(reactiveHookName) {
1377
1229
 
1378
1230
  //#endregion
1379
1231
  //#region src/rules/immutability/immutability.ts
1380
- const RULE_NAME$52 = "immutability";
1232
+ const RULE_NAME$51 = "immutability";
1381
1233
  /**
1382
1234
  * Array methods that mutate the array in place.
1383
1235
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
@@ -1403,14 +1255,14 @@ var immutability_default = createRule({
1403
1255
  },
1404
1256
  schema: []
1405
1257
  },
1406
- name: RULE_NAME$52,
1407
- create: create$52,
1258
+ name: RULE_NAME$51,
1259
+ create: create$51,
1408
1260
  defaultOptions: []
1409
1261
  });
1410
- function create$52(context) {
1262
+ function create$51(context) {
1411
1263
  const { additionalStateHooks } = getSettingsFromContext(context);
1412
1264
  const hCollector = core.getHookCollector(context);
1413
- const cCollector = core.getComponentCollector(context);
1265
+ const cCollector = core.getFunctionComponentCollector(context);
1414
1266
  /**
1415
1267
  * Violations accumulated while traversing. Each entry records the node to
1416
1268
  * report and the enclosing function so we can filter at Program:exit.
@@ -1723,7 +1575,7 @@ function getOrInsertComputed(map, key, callback) {
1723
1575
 
1724
1576
  //#endregion
1725
1577
  //#region src/rules/no-access-state-in-setstate/no-access-state-in-setstate.ts
1726
- const RULE_NAME$51 = "no-access-state-in-setstate";
1578
+ const RULE_NAME$50 = "no-access-state-in-setstate";
1727
1579
  function isKeyLiteral$2(node, key) {
1728
1580
  return match(key).with({ type: AST_NODE_TYPES.Literal }, constTrue).with({
1729
1581
  type: AST_NODE_TYPES.TemplateLiteral,
@@ -1737,11 +1589,11 @@ var no_access_state_in_setstate_default = createRule({
1737
1589
  messages: { default: "Do not access 'this.state' within 'setState'. Use the update function instead." },
1738
1590
  schema: []
1739
1591
  },
1740
- name: RULE_NAME$51,
1741
- create: create$51,
1592
+ name: RULE_NAME$50,
1593
+ create: create$50,
1742
1594
  defaultOptions: []
1743
1595
  });
1744
- function create$51(context) {
1596
+ function create$50(context) {
1745
1597
  if (!context.sourceCode.text.includes("setState")) return {};
1746
1598
  const classStack = [];
1747
1599
  const methodStack = [];
@@ -1812,7 +1664,7 @@ function create$51(context) {
1812
1664
 
1813
1665
  //#endregion
1814
1666
  //#region src/rules/no-array-index-key/no-array-index-key.ts
1815
- const RULE_NAME$50 = "no-array-index-key";
1667
+ const RULE_NAME$49 = "no-array-index-key";
1816
1668
  function getIndexParamPosition(methodName) {
1817
1669
  switch (methodName) {
1818
1670
  case "every":
@@ -1857,11 +1709,11 @@ var no_array_index_key_default = createRule({
1857
1709
  messages: { default: "Do not use item index in the array as its key." },
1858
1710
  schema: []
1859
1711
  },
1860
- name: RULE_NAME$50,
1861
- create: create$50,
1712
+ name: RULE_NAME$49,
1713
+ create: create$49,
1862
1714
  defaultOptions: []
1863
1715
  });
1864
- function create$50(context) {
1716
+ function create$49(context) {
1865
1717
  const indexParamNames = [];
1866
1718
  function isArrayIndex(node) {
1867
1719
  return node.type === AST_NODE_TYPES.Identifier && indexParamNames.some((name) => name != null && name === node.name);
@@ -1927,7 +1779,7 @@ function create$50(context) {
1927
1779
 
1928
1780
  //#endregion
1929
1781
  //#region src/rules/no-children-count/no-children-count.ts
1930
- const RULE_NAME$49 = "no-children-count";
1782
+ const RULE_NAME$48 = "no-children-count";
1931
1783
  var no_children_count_default = createRule({
1932
1784
  meta: {
1933
1785
  type: "suggestion",
@@ -1935,11 +1787,11 @@ var no_children_count_default = createRule({
1935
1787
  messages: { default: "Using 'Children.count' is uncommon and can lead to fragile code. Use alternatives instead." },
1936
1788
  schema: []
1937
1789
  },
1938
- name: RULE_NAME$49,
1939
- create: create$49,
1790
+ name: RULE_NAME$48,
1791
+ create: create$48,
1940
1792
  defaultOptions: []
1941
1793
  });
1942
- function create$49(context) {
1794
+ function create$48(context) {
1943
1795
  return defineRuleListener({ MemberExpression(node) {
1944
1796
  if (core.isChildrenCount(context, node)) context.report({
1945
1797
  messageId: "default",
@@ -1950,7 +1802,7 @@ function create$49(context) {
1950
1802
 
1951
1803
  //#endregion
1952
1804
  //#region src/rules/no-children-for-each/no-children-for-each.ts
1953
- const RULE_NAME$48 = "no-children-for-each";
1805
+ const RULE_NAME$47 = "no-children-for-each";
1954
1806
  var no_children_for_each_default = createRule({
1955
1807
  meta: {
1956
1808
  type: "suggestion",
@@ -1958,11 +1810,11 @@ var no_children_for_each_default = createRule({
1958
1810
  messages: { default: "Using 'Children.forEach' is uncommon and can lead to fragile code. Use alternatives instead." },
1959
1811
  schema: []
1960
1812
  },
1961
- name: RULE_NAME$48,
1962
- create: create$48,
1813
+ name: RULE_NAME$47,
1814
+ create: create$47,
1963
1815
  defaultOptions: []
1964
1816
  });
1965
- function create$48(context) {
1817
+ function create$47(context) {
1966
1818
  return defineRuleListener({ MemberExpression(node) {
1967
1819
  if (core.isChildrenForEach(context, node)) context.report({
1968
1820
  messageId: "default",
@@ -1973,7 +1825,7 @@ function create$48(context) {
1973
1825
 
1974
1826
  //#endregion
1975
1827
  //#region src/rules/no-children-map/no-children-map.ts
1976
- const RULE_NAME$47 = "no-children-map";
1828
+ const RULE_NAME$46 = "no-children-map";
1977
1829
  var no_children_map_default = createRule({
1978
1830
  meta: {
1979
1831
  type: "suggestion",
@@ -1981,11 +1833,11 @@ var no_children_map_default = createRule({
1981
1833
  messages: { default: "Using 'Children.map' is uncommon and can lead to fragile code. Use alternatives instead." },
1982
1834
  schema: []
1983
1835
  },
1984
- name: RULE_NAME$47,
1985
- create: create$47,
1836
+ name: RULE_NAME$46,
1837
+ create: create$46,
1986
1838
  defaultOptions: []
1987
1839
  });
1988
- function create$47(context) {
1840
+ function create$46(context) {
1989
1841
  return defineRuleListener({ MemberExpression(node) {
1990
1842
  if (core.isChildrenMap(context, node)) context.report({
1991
1843
  messageId: "default",
@@ -1996,7 +1848,7 @@ function create$47(context) {
1996
1848
 
1997
1849
  //#endregion
1998
1850
  //#region src/rules/no-children-only/no-children-only.ts
1999
- const RULE_NAME$46 = "no-children-only";
1851
+ const RULE_NAME$45 = "no-children-only";
2000
1852
  var no_children_only_default = createRule({
2001
1853
  meta: {
2002
1854
  type: "suggestion",
@@ -2004,11 +1856,11 @@ var no_children_only_default = createRule({
2004
1856
  messages: { default: "Using 'Children.only' is uncommon and can lead to fragile code. Use alternatives instead." },
2005
1857
  schema: []
2006
1858
  },
2007
- name: RULE_NAME$46,
2008
- create: create$46,
1859
+ name: RULE_NAME$45,
1860
+ create: create$45,
2009
1861
  defaultOptions: []
2010
1862
  });
2011
- function create$46(context) {
1863
+ function create$45(context) {
2012
1864
  return defineRuleListener({ MemberExpression(node) {
2013
1865
  if (core.isChildrenOnly(context, node)) context.report({
2014
1866
  messageId: "default",
@@ -2019,7 +1871,7 @@ function create$46(context) {
2019
1871
 
2020
1872
  //#endregion
2021
1873
  //#region src/rules/no-children-to-array/no-children-to-array.ts
2022
- const RULE_NAME$45 = "no-children-to-array";
1874
+ const RULE_NAME$44 = "no-children-to-array";
2023
1875
  var no_children_to_array_default = createRule({
2024
1876
  meta: {
2025
1877
  type: "suggestion",
@@ -2027,11 +1879,11 @@ var no_children_to_array_default = createRule({
2027
1879
  messages: { default: "Using 'Children.toArray' is uncommon and can lead to fragile code. Use alternatives instead." },
2028
1880
  schema: []
2029
1881
  },
2030
- name: RULE_NAME$45,
2031
- create: create$45,
1882
+ name: RULE_NAME$44,
1883
+ create: create$44,
2032
1884
  defaultOptions: []
2033
1885
  });
2034
- function create$45(context) {
1886
+ function create$44(context) {
2035
1887
  return defineRuleListener({ MemberExpression(node) {
2036
1888
  if (core.isChildrenToArray(context, node)) context.report({
2037
1889
  messageId: "default",
@@ -2042,7 +1894,7 @@ function create$45(context) {
2042
1894
 
2043
1895
  //#endregion
2044
1896
  //#region src/rules/no-class-component/no-class-component.ts
2045
- const RULE_NAME$44 = "no-class-component";
1897
+ const RULE_NAME$43 = "no-class-component";
2046
1898
  var no_class_component_default = createRule({
2047
1899
  meta: {
2048
1900
  type: "suggestion",
@@ -2050,13 +1902,13 @@ var no_class_component_default = createRule({
2050
1902
  messages: { default: "Avoid using class components. Use function components instead." },
2051
1903
  schema: []
2052
1904
  },
2053
- name: RULE_NAME$44,
2054
- create: create$44,
1905
+ name: RULE_NAME$43,
1906
+ create: create$43,
2055
1907
  defaultOptions: []
2056
1908
  });
2057
- function create$44(context) {
1909
+ function create$43(context) {
2058
1910
  if (!context.sourceCode.text.includes("Component")) return {};
2059
- const { api, visitor } = core.getComponentCollectorLegacy(context);
1911
+ const { api, visitor } = core.getClassComponentCollector(context);
2060
1912
  return defineRuleListener(visitor, { "Program:exit"(program) {
2061
1913
  for (const { name = "anonymous", node: component } of api.getAllComponents(program)) {
2062
1914
  if (component.body.body.some((m) => core.isComponentDidCatch(m) || core.isGetDerivedStateFromError(m))) continue;
@@ -2071,7 +1923,7 @@ function create$44(context) {
2071
1923
 
2072
1924
  //#endregion
2073
1925
  //#region src/rules/no-clone-element/no-clone-element.ts
2074
- const RULE_NAME$43 = "no-clone-element";
1926
+ const RULE_NAME$42 = "no-clone-element";
2075
1927
  var no_clone_element_default = createRule({
2076
1928
  meta: {
2077
1929
  type: "suggestion",
@@ -2079,11 +1931,11 @@ var no_clone_element_default = createRule({
2079
1931
  messages: { default: "Using 'cloneElement' is uncommon and can lead to fragile code. Use alternatives instead." },
2080
1932
  schema: []
2081
1933
  },
2082
- name: RULE_NAME$43,
2083
- create: create$43,
1934
+ name: RULE_NAME$42,
1935
+ create: create$42,
2084
1936
  defaultOptions: []
2085
1937
  });
2086
- function create$43(context) {
1938
+ function create$42(context) {
2087
1939
  return defineRuleListener({ CallExpression(node) {
2088
1940
  if (core.isCloneElementCall(context, node)) context.report({
2089
1941
  messageId: "default",
@@ -2094,7 +1946,7 @@ function create$43(context) {
2094
1946
 
2095
1947
  //#endregion
2096
1948
  //#region src/rules/no-component-will-mount/no-component-will-mount.ts
2097
- const RULE_NAME$42 = "no-component-will-mount";
1949
+ const RULE_NAME$41 = "no-component-will-mount";
2098
1950
  var no_component_will_mount_default = createRule({
2099
1951
  meta: {
2100
1952
  type: "problem",
@@ -2103,13 +1955,13 @@ var no_component_will_mount_default = createRule({
2103
1955
  messages: { default: "[Deprecated] Use 'UNSAFE_componentWillMount' instead." },
2104
1956
  schema: []
2105
1957
  },
2106
- name: RULE_NAME$42,
2107
- create: create$42,
1958
+ name: RULE_NAME$41,
1959
+ create: create$41,
2108
1960
  defaultOptions: []
2109
1961
  });
2110
- function create$42(context) {
1962
+ function create$41(context) {
2111
1963
  if (!context.sourceCode.text.includes("componentWillMount")) return {};
2112
- const { api, visitor } = core.getComponentCollectorLegacy(context);
1964
+ const { api, visitor } = core.getClassComponentCollector(context);
2113
1965
  return defineRuleListener(visitor, { "Program:exit"(program) {
2114
1966
  for (const { node: component } of api.getAllComponents(program)) {
2115
1967
  const { body } = component.body;
@@ -2127,7 +1979,7 @@ function create$42(context) {
2127
1979
 
2128
1980
  //#endregion
2129
1981
  //#region src/rules/no-component-will-receive-props/no-component-will-receive-props.ts
2130
- const RULE_NAME$41 = "no-component-will-receive-props";
1982
+ const RULE_NAME$40 = "no-component-will-receive-props";
2131
1983
  var no_component_will_receive_props_default = createRule({
2132
1984
  meta: {
2133
1985
  type: "problem",
@@ -2136,13 +1988,13 @@ var no_component_will_receive_props_default = createRule({
2136
1988
  messages: { default: "[Deprecated] Use 'UNSAFE_componentWillReceiveProps' instead." },
2137
1989
  schema: []
2138
1990
  },
2139
- name: RULE_NAME$41,
2140
- create: create$41,
1991
+ name: RULE_NAME$40,
1992
+ create: create$40,
2141
1993
  defaultOptions: []
2142
1994
  });
2143
- function create$41(context) {
1995
+ function create$40(context) {
2144
1996
  if (!context.sourceCode.text.includes("componentWillReceiveProps")) return {};
2145
- const { api, visitor } = core.getComponentCollectorLegacy(context);
1997
+ const { api, visitor } = core.getClassComponentCollector(context);
2146
1998
  return defineRuleListener(visitor, { "Program:exit"(program) {
2147
1999
  for (const { node: component } of api.getAllComponents(program)) {
2148
2000
  const { body } = component.body;
@@ -2160,7 +2012,7 @@ function create$41(context) {
2160
2012
 
2161
2013
  //#endregion
2162
2014
  //#region src/rules/no-component-will-update/no-component-will-update.ts
2163
- const RULE_NAME$40 = "no-component-will-update";
2015
+ const RULE_NAME$39 = "no-component-will-update";
2164
2016
  var no_component_will_update_default = createRule({
2165
2017
  meta: {
2166
2018
  type: "problem",
@@ -2169,13 +2021,13 @@ var no_component_will_update_default = createRule({
2169
2021
  messages: { default: "[Deprecated] Use 'UNSAFE_componentWillUpdate' instead." },
2170
2022
  schema: []
2171
2023
  },
2172
- name: RULE_NAME$40,
2173
- create: create$40,
2024
+ name: RULE_NAME$39,
2025
+ create: create$39,
2174
2026
  defaultOptions: []
2175
2027
  });
2176
- function create$40(context) {
2028
+ function create$39(context) {
2177
2029
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
2178
- const { api, visitor } = core.getComponentCollectorLegacy(context);
2030
+ const { api, visitor } = core.getClassComponentCollector(context);
2179
2031
  return defineRuleListener(visitor, { "Program:exit"(program) {
2180
2032
  for (const { node: component } of api.getAllComponents(program)) {
2181
2033
  const { body } = component.body;
@@ -2193,7 +2045,7 @@ function create$40(context) {
2193
2045
 
2194
2046
  //#endregion
2195
2047
  //#region src/rules/no-context-provider/no-context-provider.ts
2196
- const RULE_NAME$39 = "no-context-provider";
2048
+ const RULE_NAME$38 = "no-context-provider";
2197
2049
  var no_context_provider_default = createRule({
2198
2050
  meta: {
2199
2051
  type: "suggestion",
@@ -2206,11 +2058,11 @@ var no_context_provider_default = createRule({
2206
2058
  },
2207
2059
  schema: []
2208
2060
  },
2209
- name: RULE_NAME$39,
2210
- create: create$39,
2061
+ name: RULE_NAME$38,
2062
+ create: create$38,
2211
2063
  defaultOptions: []
2212
2064
  });
2213
- function create$39(context) {
2065
+ function create$38(context) {
2214
2066
  if (!context.sourceCode.text.includes("Provider")) return {};
2215
2067
  const { version } = getSettingsFromContext(context);
2216
2068
  if (compare(version, "19.0.0", "<")) return {};
@@ -2226,7 +2078,7 @@ function create$39(context) {
2226
2078
  node,
2227
2079
  suggest: [{
2228
2080
  fix(fixer) {
2229
- if (!core.isComponentNameLoose(contextSelfName)) return null;
2081
+ if (!core.isFunctionComponentNameLoose(contextSelfName)) return null;
2230
2082
  const openingElement = node.openingElement;
2231
2083
  const closingElement = node.closingElement;
2232
2084
  if (closingElement == null) return fixer.replaceText(openingElement.name, contextFullName);
@@ -2240,7 +2092,7 @@ function create$39(context) {
2240
2092
 
2241
2093
  //#endregion
2242
2094
  //#region src/rules/no-create-ref/no-create-ref.ts
2243
- const RULE_NAME$38 = "no-create-ref";
2095
+ const RULE_NAME$37 = "no-create-ref";
2244
2096
  var no_create_ref_default = createRule({
2245
2097
  meta: {
2246
2098
  type: "suggestion",
@@ -2248,11 +2100,11 @@ var no_create_ref_default = createRule({
2248
2100
  messages: { default: "[Deprecated] Use 'useRef' instead." },
2249
2101
  schema: []
2250
2102
  },
2251
- name: RULE_NAME$38,
2252
- create: create$38,
2103
+ name: RULE_NAME$37,
2104
+ create: create$37,
2253
2105
  defaultOptions: []
2254
2106
  });
2255
- function create$38(context) {
2107
+ function create$37(context) {
2256
2108
  return defineRuleListener({ CallExpression(node) {
2257
2109
  if (core.isCreateRefCall(context, node) && ast.findParent(node, core.isClassComponent) == null) context.report({
2258
2110
  messageId: "default",
@@ -2263,7 +2115,7 @@ function create$38(context) {
2263
2115
 
2264
2116
  //#endregion
2265
2117
  //#region src/rules/no-direct-mutation-state/no-direct-mutation-state.ts
2266
- const RULE_NAME$37 = "no-direct-mutation-state";
2118
+ const RULE_NAME$36 = "no-direct-mutation-state";
2267
2119
  function isConstructorFunction(node) {
2268
2120
  return ast.isOneOf([AST_NODE_TYPES.FunctionDeclaration, AST_NODE_TYPES.FunctionExpression])(node) && ast.isMethodOrProperty(node.parent) && node.parent.key.type === AST_NODE_TYPES.Identifier && node.parent.key.name === "constructor";
2269
2121
  }
@@ -2274,11 +2126,11 @@ var no_direct_mutation_state_default = createRule({
2274
2126
  messages: { default: "Do not mutate state directly. Use 'setState()' instead." },
2275
2127
  schema: []
2276
2128
  },
2277
- name: RULE_NAME$37,
2278
- create: create$37,
2129
+ name: RULE_NAME$36,
2130
+ create: create$36,
2279
2131
  defaultOptions: []
2280
2132
  });
2281
- function create$37(context) {
2133
+ function create$36(context) {
2282
2134
  return defineRuleListener({ AssignmentExpression(node) {
2283
2135
  if (!core.isAssignmentToThisState(node)) return;
2284
2136
  const parentClass = ast.findParent(node, ast.isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]));
@@ -2292,7 +2144,7 @@ function create$37(context) {
2292
2144
 
2293
2145
  //#endregion
2294
2146
  //#region src/rules/no-duplicate-key/no-duplicate-key.ts
2295
- const RULE_NAME$36 = "no-duplicate-key";
2147
+ const RULE_NAME$35 = "no-duplicate-key";
2296
2148
  var no_duplicate_key_default = createRule({
2297
2149
  meta: {
2298
2150
  type: "problem",
@@ -2300,11 +2152,11 @@ var no_duplicate_key_default = createRule({
2300
2152
  messages: { default: "The 'key' prop must be unique to its sibling elements." },
2301
2153
  schema: []
2302
2154
  },
2303
- name: RULE_NAME$36,
2304
- create: create$36,
2155
+ name: RULE_NAME$35,
2156
+ create: create$35,
2305
2157
  defaultOptions: []
2306
2158
  });
2307
- function create$36(context) {
2159
+ function create$35(context) {
2308
2160
  if (!context.sourceCode.text.includes("key=")) return {};
2309
2161
  const keyedEntries = /* @__PURE__ */ new Map();
2310
2162
  function isKeyValueEqual(a, b) {
@@ -2359,7 +2211,7 @@ function create$36(context) {
2359
2211
 
2360
2212
  //#endregion
2361
2213
  //#region src/rules/no-forward-ref/no-forward-ref.ts
2362
- const RULE_NAME$35 = "no-forward-ref";
2214
+ const RULE_NAME$34 = "no-forward-ref";
2363
2215
  var no_forward_ref_default = createRule({
2364
2216
  meta: {
2365
2217
  type: "suggestion",
@@ -2372,11 +2224,11 @@ var no_forward_ref_default = createRule({
2372
2224
  },
2373
2225
  schema: []
2374
2226
  },
2375
- name: RULE_NAME$35,
2376
- create: create$35,
2227
+ name: RULE_NAME$34,
2228
+ create: create$34,
2377
2229
  defaultOptions: []
2378
2230
  });
2379
- function create$35(context) {
2231
+ function create$34(context) {
2380
2232
  if (!context.sourceCode.text.includes("forwardRef")) return {};
2381
2233
  const { version } = getSettingsFromContext(context);
2382
2234
  if (compare(version, "19.0.0", "<")) return {};
@@ -2406,8 +2258,8 @@ function canFix(context, node) {
2406
2258
  const { importSource } = getSettingsFromContext(context);
2407
2259
  const initialScope = context.sourceCode.getScope(node);
2408
2260
  switch (node.callee.type) {
2409
- case AST_NODE_TYPES.Identifier: return core.isInitializedFromReact(node.callee.name, initialScope, importSource);
2410
- case AST_NODE_TYPES.MemberExpression: return node.callee.object.type === AST_NODE_TYPES.Identifier && core.isInitializedFromReact(node.callee.object.name, initialScope, importSource);
2261
+ case AST_NODE_TYPES.Identifier: return core.isAPIFromReact(node.callee.name, initialScope, importSource);
2262
+ case AST_NODE_TYPES.MemberExpression: return node.callee.object.type === AST_NODE_TYPES.Identifier && core.isAPIFromReact(node.callee.object.name, initialScope, importSource);
2411
2263
  default: return false;
2412
2264
  }
2413
2265
  }
@@ -2481,7 +2333,7 @@ function getComponentPropsFixes(context, fixer, node, typeArguments) {
2481
2333
 
2482
2334
  //#endregion
2483
2335
  //#region src/rules/no-implicit-children/no-implicit-children.ts
2484
- const RULE_NAME$34 = "no-implicit-children";
2336
+ const RULE_NAME$33 = "no-implicit-children";
2485
2337
  const RE_REACT_CHILDREN_TYPE = /react\.(reactnode|reactelement|reactportal)$/i;
2486
2338
  var no_implicit_children_default = createRule({
2487
2339
  meta: {
@@ -2490,18 +2342,18 @@ var no_implicit_children_default = createRule({
2490
2342
  messages: { default: "This spread attribute implicitly passes the 'children' prop to a component, this could lead to unexpected behavior. If you intend to pass the 'children' prop, use 'children={value}'." },
2491
2343
  schema: []
2492
2344
  },
2493
- name: RULE_NAME$34,
2494
- create: create$34,
2345
+ name: RULE_NAME$33,
2346
+ create: create$33,
2495
2347
  defaultOptions: []
2496
2348
  });
2497
- function create$34(context) {
2349
+ function create$33(context) {
2498
2350
  const services = ESLintUtils.getParserServices(context, false);
2499
2351
  const checker = services.program.getTypeChecker();
2500
2352
  return defineRuleListener({ JSXSpreadAttribute(node) {
2501
2353
  for (const type of unionConstituents(getConstrainedTypeAtLocation(services, node.argument))) {
2502
2354
  const children = type.getProperty("children");
2503
2355
  if (children == null) continue;
2504
- const fqn = getFullyQualifiedNameEx(checker, children).toLowerCase();
2356
+ const fqn = core.getFullyQualifiedNameEx(checker, children).toLowerCase();
2505
2357
  if (fqn.endsWith("attributes.children") || fqn.endsWith("propswithchildren.children")) continue;
2506
2358
  const childrenType = checker.getTypeOfSymbol(children);
2507
2359
  const typeSymbol = childrenType.aliasSymbol ?? childrenType.symbol;
@@ -2519,7 +2371,7 @@ function create$34(context) {
2519
2371
 
2520
2372
  //#endregion
2521
2373
  //#region src/rules/no-implicit-key/no-implicit-key.ts
2522
- const RULE_NAME$33 = "no-implicit-key";
2374
+ const RULE_NAME$32 = "no-implicit-key";
2523
2375
  var no_implicit_key_default = createRule({
2524
2376
  meta: {
2525
2377
  type: "problem",
@@ -2527,18 +2379,18 @@ var no_implicit_key_default = createRule({
2527
2379
  messages: { default: "This spread attribute implicitly passes the 'key' prop to a component, this could lead to unexpected behavior. If you intend to pass the 'key' prop, use 'key={value}'." },
2528
2380
  schema: []
2529
2381
  },
2530
- name: RULE_NAME$33,
2531
- create: create$33,
2382
+ name: RULE_NAME$32,
2383
+ create: create$32,
2532
2384
  defaultOptions: []
2533
2385
  });
2534
- function create$33(context) {
2386
+ function create$32(context) {
2535
2387
  const services = ESLintUtils.getParserServices(context, false);
2536
2388
  const checker = services.program.getTypeChecker();
2537
2389
  return defineRuleListener({ JSXSpreadAttribute(node) {
2538
2390
  for (const type of unionConstituents(getConstrainedTypeAtLocation(services, node.argument))) {
2539
2391
  const key = type.getProperty("key");
2540
2392
  if (key == null) continue;
2541
- if (getFullyQualifiedNameEx(checker, key).toLowerCase().endsWith("react.attributes.key")) continue;
2393
+ if (core.getFullyQualifiedNameEx(checker, key).toLowerCase().endsWith("react.attributes.key")) continue;
2542
2394
  const keyType = checker.getTypeOfSymbol(key);
2543
2395
  if (keyType.aliasSymbol != null) {
2544
2396
  if (checker.getFullyQualifiedName(keyType.aliasSymbol).toLowerCase().endsWith("react.key")) continue;
@@ -2553,7 +2405,7 @@ function create$33(context) {
2553
2405
 
2554
2406
  //#endregion
2555
2407
  //#region src/rules/no-implicit-ref/no-implicit-ref.ts
2556
- const RULE_NAME$32 = "no-implicit-ref";
2408
+ const RULE_NAME$31 = "no-implicit-ref";
2557
2409
  const RE_REACT_REF_TYPE = /react\.(ref|legacyref|refcallback|refobject)$/i;
2558
2410
  var no_implicit_ref_default = createRule({
2559
2411
  meta: {
@@ -2562,18 +2414,18 @@ var no_implicit_ref_default = createRule({
2562
2414
  messages: { default: "This spread attribute implicitly passes the 'ref' prop to a component, this could lead to unexpected behavior. If you intend to pass the 'ref' prop, use 'ref={value}'." },
2563
2415
  schema: []
2564
2416
  },
2565
- name: RULE_NAME$32,
2566
- create: create$32,
2417
+ name: RULE_NAME$31,
2418
+ create: create$31,
2567
2419
  defaultOptions: []
2568
2420
  });
2569
- function create$32(context) {
2421
+ function create$31(context) {
2570
2422
  const services = ESLintUtils.getParserServices(context, false);
2571
2423
  const checker = services.program.getTypeChecker();
2572
2424
  return defineRuleListener({ JSXSpreadAttribute(node) {
2573
2425
  for (const type of unionConstituents(getConstrainedTypeAtLocation(services, node.argument))) {
2574
2426
  const ref = type.getProperty("ref");
2575
2427
  if (ref == null) continue;
2576
- if (getFullyQualifiedNameEx(checker, ref).toLowerCase().endsWith("attributes.ref")) continue;
2428
+ if (core.getFullyQualifiedNameEx(checker, ref).toLowerCase().endsWith("attributes.ref")) continue;
2577
2429
  const refType = checker.getTypeOfSymbol(ref);
2578
2430
  const typeSymbol = refType.aliasSymbol ?? refType.symbol;
2579
2431
  if (typeSymbol != null) {
@@ -2590,7 +2442,7 @@ function create$32(context) {
2590
2442
 
2591
2443
  //#endregion
2592
2444
  //#region src/rules/no-leaked-conditional-rendering/no-leaked-conditional-rendering.ts
2593
- const RULE_NAME$31 = "no-leaked-conditional-rendering";
2445
+ const RULE_NAME$30 = "no-leaked-conditional-rendering";
2594
2446
  var no_leaked_conditional_rendering_default = createRule({
2595
2447
  meta: {
2596
2448
  type: "problem",
@@ -2598,11 +2450,11 @@ var no_leaked_conditional_rendering_default = createRule({
2598
2450
  messages: { default: "Potential leaked value {{value}} that might cause unintentionally rendered values or rendering crashes." },
2599
2451
  schema: []
2600
2452
  },
2601
- name: RULE_NAME$31,
2602
- create: create$31,
2453
+ name: RULE_NAME$30,
2454
+ create: create$30,
2603
2455
  defaultOptions: []
2604
2456
  });
2605
- function create$31(context) {
2457
+ function create$30(context) {
2606
2458
  if (!context.sourceCode.text.includes("&&")) return {};
2607
2459
  const { version } = getSettingsFromContext(context);
2608
2460
  const allowedVariants = [
@@ -2640,7 +2492,8 @@ function create$31(context) {
2640
2492
  messageId: "default",
2641
2493
  node: left
2642
2494
  };
2643
- const leftTypeVariants = getTypeVariants(unionConstituents(getConstrainedTypeAtLocation(services, left)));
2495
+ const leftType = getConstrainedTypeAtLocation(services, left);
2496
+ const leftTypeVariants = core.getTypeVariants(unionConstituents(leftType));
2644
2497
  if (Array.from(leftTypeVariants.values()).every((type) => allowedVariants.some((allowed) => allowed === type))) return getReportDescriptor(right);
2645
2498
  return {
2646
2499
  data: { value: context.sourceCode.getText(left) },
@@ -2659,7 +2512,7 @@ function create$31(context) {
2659
2512
 
2660
2513
  //#endregion
2661
2514
  //#region src/rules/no-missing-component-display-name/no-missing-component-display-name.ts
2662
- const RULE_NAME$30 = "no-missing-component-display-name";
2515
+ const RULE_NAME$29 = "no-missing-component-display-name";
2663
2516
  var no_missing_component_display_name_default = createRule({
2664
2517
  meta: {
2665
2518
  type: "suggestion",
@@ -2667,20 +2520,20 @@ var no_missing_component_display_name_default = createRule({
2667
2520
  messages: { default: "Add missing 'displayName' for component." },
2668
2521
  schema: []
2669
2522
  },
2670
- name: RULE_NAME$30,
2671
- create: create$30,
2523
+ name: RULE_NAME$29,
2524
+ create: create$29,
2672
2525
  defaultOptions: []
2673
2526
  });
2674
- function create$30(context) {
2527
+ function create$29(context) {
2675
2528
  if (!context.sourceCode.text.includes("memo") && !context.sourceCode.text.includes("forwardRef")) return {};
2676
- const { api, visitor } = core.getComponentCollector(context, {
2529
+ const { api, visitor } = core.getFunctionComponentCollector(context, {
2677
2530
  collectDisplayName: true,
2678
2531
  hint: core.DEFAULT_COMPONENT_DETECTION_HINT
2679
2532
  });
2680
2533
  return defineRuleListener(visitor, { "Program:exit"(program) {
2681
2534
  for (const { displayName, flag, node } of api.getAllComponents(program)) {
2682
2535
  const id = ast.getFunctionId(node);
2683
- const isMemoOrForwardRef = (flag & (core.ComponentFlag.ForwardRef | core.ComponentFlag.Memo)) > 0n;
2536
+ const isMemoOrForwardRef = (flag & (core.FunctionComponentFlag.ForwardRef | core.FunctionComponentFlag.Memo)) > 0n;
2684
2537
  if (id != null) continue;
2685
2538
  if (!isMemoOrForwardRef) continue;
2686
2539
  if (displayName == null) context.report({
@@ -2693,7 +2546,7 @@ function create$30(context) {
2693
2546
 
2694
2547
  //#endregion
2695
2548
  //#region src/rules/no-missing-context-display-name/no-missing-context-display-name.ts
2696
- const RULE_NAME$29 = "no-missing-context-display-name";
2549
+ const RULE_NAME$28 = "no-missing-context-display-name";
2697
2550
  var no_missing_context_display_name_default = createRule({
2698
2551
  meta: {
2699
2552
  type: "suggestion",
@@ -2702,11 +2555,11 @@ var no_missing_context_display_name_default = createRule({
2702
2555
  messages: { default: "Add missing 'displayName' for context." },
2703
2556
  schema: []
2704
2557
  },
2705
- name: RULE_NAME$29,
2706
- create: create$29,
2558
+ name: RULE_NAME$28,
2559
+ create: create$28,
2707
2560
  defaultOptions: []
2708
2561
  });
2709
- function create$29(context) {
2562
+ function create$28(context) {
2710
2563
  if (!context.sourceCode.text.includes("createContext")) return {};
2711
2564
  const createCalls = [];
2712
2565
  const displayNameAssignments = [];
@@ -2758,7 +2611,7 @@ function create$29(context) {
2758
2611
 
2759
2612
  //#endregion
2760
2613
  //#region src/rules/no-missing-key/no-missing-key.ts
2761
- const RULE_NAME$28 = "no-missing-key";
2614
+ const RULE_NAME$27 = "no-missing-key";
2762
2615
  var no_missing_key_default = createRule({
2763
2616
  meta: {
2764
2617
  type: "problem",
@@ -2769,11 +2622,11 @@ var no_missing_key_default = createRule({
2769
2622
  },
2770
2623
  schema: []
2771
2624
  },
2772
- name: RULE_NAME$28,
2773
- create: create$28,
2625
+ name: RULE_NAME$27,
2626
+ create: create$27,
2774
2627
  defaultOptions: []
2775
2628
  });
2776
- function create$28(ctx) {
2629
+ function create$27(ctx) {
2777
2630
  let inChildrenToArray = false;
2778
2631
  function check(node) {
2779
2632
  if (node.type === AST_NODE_TYPES.JSXElement) return !hasAttribute(ctx, node, "key") ? {
@@ -2843,7 +2696,7 @@ function create$28(ctx) {
2843
2696
 
2844
2697
  //#endregion
2845
2698
  //#region src/rules/no-misused-capture-owner-stack/no-misused-capture-owner-stack.ts
2846
- const RULE_NAME$27 = "no-misused-capture-owner-stack";
2699
+ const RULE_NAME$26 = "no-misused-capture-owner-stack";
2847
2700
  var no_misused_capture_owner_stack_default = createRule({
2848
2701
  meta: {
2849
2702
  type: "problem",
@@ -2854,11 +2707,11 @@ var no_misused_capture_owner_stack_default = createRule({
2854
2707
  },
2855
2708
  schema: []
2856
2709
  },
2857
- name: RULE_NAME$27,
2858
- create: create$27,
2710
+ name: RULE_NAME$26,
2711
+ create: create$26,
2859
2712
  defaultOptions: []
2860
2713
  });
2861
- function create$27(context) {
2714
+ function create$26(context) {
2862
2715
  if (!context.sourceCode.text.includes("captureOwnerStack")) return {};
2863
2716
  const { importSource } = getSettingsFromContext(context);
2864
2717
  return defineRuleListener({
@@ -2889,7 +2742,7 @@ function isDevelopmentOnlyCheck(node) {
2889
2742
 
2890
2743
  //#endregion
2891
2744
  //#region src/rules/no-nested-component-definitions/no-nested-component-definitions.ts
2892
- const RULE_NAME$26 = "no-nested-component-definitions";
2745
+ const RULE_NAME$25 = "no-nested-component-definitions";
2893
2746
  var no_nested_component_definitions_default = createRule({
2894
2747
  meta: {
2895
2748
  type: "problem",
@@ -2897,14 +2750,14 @@ var no_nested_component_definitions_default = createRule({
2897
2750
  messages: { default: "Do not nest component definitions inside other components or props. {{suggestion}}" },
2898
2751
  schema: []
2899
2752
  },
2900
- name: RULE_NAME$26,
2901
- create: create$26,
2753
+ name: RULE_NAME$25,
2754
+ create: create$25,
2902
2755
  defaultOptions: []
2903
2756
  });
2904
- function create$26(context) {
2905
- const hint = core.ComponentDetectionHint.DoNotIncludeJsxWithNumberValue | core.ComponentDetectionHint.DoNotIncludeJsxWithBooleanValue | core.ComponentDetectionHint.DoNotIncludeJsxWithNullValue | core.ComponentDetectionHint.DoNotIncludeJsxWithStringValue | core.ComponentDetectionHint.DoNotIncludeJsxWithUndefinedValue | core.ComponentDetectionHint.RequireBothSidesOfLogicalExpressionToBeJsx | core.ComponentDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJsx | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayPatternElement | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayExpressionElement | core.ComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayMapCallback;
2906
- const fCollector = core.getComponentCollector(context, { hint });
2907
- const cCollector = core.getComponentCollectorLegacy(context);
2757
+ function create$25(context) {
2758
+ const hint = core.FunctionComponentDetectionHint.DoNotIncludeJsxWithNumberValue | core.FunctionComponentDetectionHint.DoNotIncludeJsxWithBooleanValue | core.FunctionComponentDetectionHint.DoNotIncludeJsxWithNullValue | core.FunctionComponentDetectionHint.DoNotIncludeJsxWithStringValue | core.FunctionComponentDetectionHint.DoNotIncludeJsxWithUndefinedValue | core.FunctionComponentDetectionHint.RequireBothSidesOfLogicalExpressionToBeJsx | core.FunctionComponentDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJsx | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayPatternElement | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayExpressionElement | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayMapCallback;
2759
+ const fCollector = core.getFunctionComponentCollector(context, { hint });
2760
+ const cCollector = core.getClassComponentCollector(context);
2908
2761
  return defineRuleListener(fCollector.visitor, cCollector.visitor, { "Program:exit"(program) {
2909
2762
  const fComponents = [...fCollector.api.getAllComponents(program)];
2910
2763
  const cComponents = [...cCollector.api.getAllComponents(program)];
@@ -3005,7 +2858,7 @@ function isInsideCreateElementProps(context, node) {
3005
2858
 
3006
2859
  //#endregion
3007
2860
  //#region src/rules/no-nested-lazy-component-declarations/no-nested-lazy-component-declarations.ts
3008
- const RULE_NAME$25 = "no-nested-lazy-component-declarations";
2861
+ const RULE_NAME$24 = "no-nested-lazy-component-declarations";
3009
2862
  var no_nested_lazy_component_declarations_default = createRule({
3010
2863
  meta: {
3011
2864
  type: "problem",
@@ -3013,13 +2866,13 @@ var no_nested_lazy_component_declarations_default = createRule({
3013
2866
  messages: { default: "Do not declare lazy components inside other components or hooks. Instead, always declare them at the top level of your module." },
3014
2867
  schema: []
3015
2868
  },
3016
- name: RULE_NAME$25,
3017
- create: create$25,
2869
+ name: RULE_NAME$24,
2870
+ create: create$24,
3018
2871
  defaultOptions: []
3019
2872
  });
3020
- function create$25(context) {
3021
- const fCollector = core.getComponentCollector(context);
3022
- const cCollector = core.getComponentCollectorLegacy(context);
2873
+ function create$24(context) {
2874
+ const fCollector = core.getFunctionComponentCollector(context);
2875
+ const cCollector = core.getClassComponentCollector(context);
3023
2876
  const hCollector = core.getHookCollector(context);
3024
2877
  const lazyCalls = /* @__PURE__ */ new Set();
3025
2878
  return defineRuleListener(fCollector.visitor, cCollector.visitor, hCollector.visitor, {
@@ -3041,39 +2894,6 @@ function create$25(context) {
3041
2894
  });
3042
2895
  }
3043
2896
 
3044
- //#endregion
3045
- //#region src/rules/no-redundant-should-component-update/no-redundant-should-component-update.ts
3046
- const RULE_NAME$24 = "no-redundant-should-component-update";
3047
- function isShouldComponentUpdate(node) {
3048
- return ast.isMethodOrProperty(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name === "shouldComponentUpdate";
3049
- }
3050
- var no_redundant_should_component_update_default = createRule({
3051
- meta: {
3052
- type: "problem",
3053
- docs: { description: "Disallows 'shouldComponentUpdate' when extending 'React.PureComponent'." },
3054
- messages: { default: "'{{componentName}}' does not need 'shouldComponentUpdate' when extending 'React.PureComponent'." },
3055
- schema: []
3056
- },
3057
- name: RULE_NAME$24,
3058
- create: create$24,
3059
- defaultOptions: []
3060
- });
3061
- function create$24(context) {
3062
- if (!context.sourceCode.text.includes("shouldComponentUpdate")) return {};
3063
- const { api, visitor } = core.getComponentCollectorLegacy(context);
3064
- return defineRuleListener(visitor, { "Program:exit"(program) {
3065
- for (const { name = "PureComponent", flag, node: component } of api.getAllComponents(program)) {
3066
- if ((flag & core.ComponentFlag.PureComponent) === 0n) continue;
3067
- const { body } = component.body;
3068
- for (const member of body) if (isShouldComponentUpdate(member)) context.report({
3069
- data: { componentName: name },
3070
- messageId: "default",
3071
- node: member
3072
- });
3073
- }
3074
- } });
3075
- }
3076
-
3077
2897
  //#endregion
3078
2898
  //#region src/rules/no-set-state-in-component-did-mount/no-set-state-in-component-did-mount.ts
3079
2899
  const RULE_NAME$23 = "no-set-state-in-component-did-mount";
@@ -3185,7 +3005,7 @@ function create$20(context) {
3185
3005
  if (!context.sourceCode.text.includes("useCallback")) return {};
3186
3006
  return defineRuleListener({ VariableDeclarator(node) {
3187
3007
  const { id, init } = node;
3188
- if (id.type !== AST_NODE_TYPES.Identifier || init?.type !== AST_NODE_TYPES.CallExpression || !core.isUseCallbackCall(init)) return;
3008
+ if (id.type !== AST_NODE_TYPES.Identifier || init?.type !== AST_NODE_TYPES.CallExpression || !core.isUseCallbackCall(context, init)) return;
3189
3009
  const [cbk, ...rest] = context.sourceCode.getDeclaredVariables(node);
3190
3010
  if (cbk == null || rest.length > 0) return;
3191
3011
  const checkForUsageInsideUseEffectReport = checkForUsageInsideUseEffect$1(context.sourceCode, init);
@@ -3265,7 +3085,7 @@ function create$19(context) {
3265
3085
  if (!context.sourceCode.text.includes("useMemo")) return {};
3266
3086
  return defineRuleListener({ VariableDeclarator(node) {
3267
3087
  const { id, init } = node;
3268
- if (id.type !== AST_NODE_TYPES.Identifier || init?.type !== AST_NODE_TYPES.CallExpression || !core.isUseMemoCall(init)) return;
3088
+ if (id.type !== AST_NODE_TYPES.Identifier || init?.type !== AST_NODE_TYPES.CallExpression || !core.isUseMemoCall(context, init)) return;
3269
3089
  const [mem, ...rest] = context.sourceCode.getDeclaredVariables(node);
3270
3090
  if (mem == null || rest.length > 0) return;
3271
3091
  const checkForUsageInsideUseEffectReport = checkForUsageInsideUseEffect(context.sourceCode, init);
@@ -3380,7 +3200,7 @@ var no_unsafe_component_will_mount_default = createRule({
3380
3200
  });
3381
3201
  function create$17(context) {
3382
3202
  if (!context.sourceCode.text.includes("UNSAFE_componentWillMount")) return {};
3383
- const { api, visitor } = core.getComponentCollectorLegacy(context);
3203
+ const { api, visitor } = core.getClassComponentCollector(context);
3384
3204
  return defineRuleListener(visitor, { "Program:exit"(program) {
3385
3205
  for (const { node: component } of api.getAllComponents(program)) {
3386
3206
  const { body } = component.body;
@@ -3408,7 +3228,7 @@ var no_unsafe_component_will_receive_props_default = createRule({
3408
3228
  });
3409
3229
  function create$16(context) {
3410
3230
  if (!context.sourceCode.text.includes("UNSAFE_componentWillReceiveProps")) return {};
3411
- const { api, visitor } = core.getComponentCollectorLegacy(context);
3231
+ const { api, visitor } = core.getClassComponentCollector(context);
3412
3232
  return defineRuleListener(visitor, { "Program:exit"(program) {
3413
3233
  for (const { node: component } of api.getAllComponents(program)) {
3414
3234
  const { body } = component.body;
@@ -3436,7 +3256,7 @@ var no_unsafe_component_will_update_default = createRule({
3436
3256
  });
3437
3257
  function create$15(context) {
3438
3258
  if (!context.sourceCode.text.includes("UNSAFE_componentWillUpdate")) return {};
3439
- const { api, visitor } = core.getComponentCollectorLegacy(context);
3259
+ const { api, visitor } = core.getClassComponentCollector(context);
3440
3260
  return defineRuleListener(visitor, { "Program:exit"(program) {
3441
3261
  for (const { node: component } of api.getAllComponents(program)) {
3442
3262
  const { body } = component.body;
@@ -3467,7 +3287,7 @@ function create$14(context) {
3467
3287
  if (compilationMode === "infer" || compilationMode === "all") return {};
3468
3288
  if (compilationMode === "annotation" && ast.isDirectiveInFile(context.sourceCode.ast, "use memo")) return {};
3469
3289
  const isReact18OrBelow = compare(version, "19.0.0", "<");
3470
- const { api, visitor } = core.getComponentCollector(context);
3290
+ const { api, visitor } = core.getFunctionComponentCollector(context);
3471
3291
  const constructions = /* @__PURE__ */ new WeakMap();
3472
3292
  return defineRuleListener(visitor, {
3473
3293
  JSXOpeningElement(node) {
@@ -3547,7 +3367,7 @@ function create$13(context, [options]) {
3547
3367
  const { compilationMode } = getSettingsFromContext(context);
3548
3368
  if (compilationMode === "infer" || compilationMode === "all") return {};
3549
3369
  if (compilationMode === "annotation" && ast.isDirectiveInFile(context.sourceCode.ast, "use memo")) return {};
3550
- const { api, visitor } = core.getComponentCollector(context);
3370
+ const { api, visitor } = core.getFunctionComponentCollector(context);
3551
3371
  const declarators = /* @__PURE__ */ new WeakMap();
3552
3372
  const { safeDefaultProps = [] } = options;
3553
3373
  const safePatterns = safeDefaultProps.map((s) => toRegExp(s));
@@ -3720,7 +3540,7 @@ var no_unused_props_default = createRule({
3720
3540
  function create$11(context) {
3721
3541
  const services = ESLintUtils.getParserServices(context, false);
3722
3542
  const checker = services.program.getTypeChecker();
3723
- const { api, visitor } = core.getComponentCollector(context);
3543
+ const { api, visitor } = core.getFunctionComponentCollector(context);
3724
3544
  return defineRuleListener(visitor, { "Program:exit"(program) {
3725
3545
  const totalDeclaredProps = /* @__PURE__ */ new Map();
3726
3546
  const totalUsedDeclarations = /* @__PURE__ */ new Set();
@@ -3967,7 +3787,7 @@ function create$9(context) {
3967
3787
  const { version } = getSettingsFromContext(context);
3968
3788
  if (compare(version, "19.0.0", "<")) return {};
3969
3789
  return defineRuleListener({ CallExpression(node) {
3970
- if (!core.isUseContextCall(node)) return;
3790
+ if (!core.isUseContextCall(context, node)) return;
3971
3791
  context.report({
3972
3792
  messageId: "default",
3973
3793
  node: node.callee,
@@ -4000,7 +3820,7 @@ var prefer_destructuring_assignment_default = createRule({
4000
3820
  defaultOptions: []
4001
3821
  });
4002
3822
  function create$8(context) {
4003
- const { api, visitor } = core.getComponentCollector(context);
3823
+ const { api, visitor } = core.getFunctionComponentCollector(context);
4004
3824
  return defineRuleListener(visitor, { "Program:exit"(program) {
4005
3825
  for (const component of api.getAllComponents(program)) {
4006
3826
  if (component.name == null || component.isExportDefaultDeclaration) continue;
@@ -4074,7 +3894,7 @@ var purity_default = createRule({
4074
3894
  });
4075
3895
  function create$6(context) {
4076
3896
  const hCollector = core.getHookCollector(context);
4077
- const cCollector = core.getComponentCollector(context);
3897
+ const cCollector = core.getFunctionComponentCollector(context);
4078
3898
  const cEntries = [];
4079
3899
  const nEntries = [];
4080
3900
  return defineRuleListener(hCollector.visitor, cCollector.visitor, {
@@ -4152,7 +3972,7 @@ var refs_default = createRule({
4152
3972
  });
4153
3973
  function create$5(context) {
4154
3974
  const hCollector = core.getHookCollector(context);
4155
- const cCollector = core.getComponentCollector(context);
3975
+ const cCollector = core.getFunctionComponentCollector(context);
4156
3976
  const refAccesses = [];
4157
3977
  const jsxRefIdentifiers = /* @__PURE__ */ new Set();
4158
3978
  /**
@@ -4195,7 +4015,7 @@ function create$5(context) {
4195
4015
  if (init == null) continue;
4196
4016
  switch (true) {
4197
4017
  case init.type === AST_NODE_TYPES.MemberExpression && init.object.type === AST_NODE_TYPES.Identifier && (init.object.name === "ref" || init.object.name.endsWith("Ref")): return true;
4198
- case init.type === AST_NODE_TYPES.CallExpression && isUseRefCall(init): return true;
4018
+ case init.type === AST_NODE_TYPES.CallExpression && isUseRefCall(context, init): return true;
4199
4019
  }
4200
4020
  }
4201
4021
  return false;
@@ -6537,7 +6357,7 @@ function create$4(context) {
6537
6357
  if (init == null) continue;
6538
6358
  switch (true) {
6539
6359
  case init.type === AST_NODE_TYPES.MemberExpression && init.object.type === AST_NODE_TYPES.Identifier && (init.object.name === "ref" || init.object.name.endsWith("Ref")): return true;
6540
- case init.type === AST_NODE_TYPES.CallExpression && isUseRefCall(init): return true;
6360
+ case init.type === AST_NODE_TYPES.CallExpression && isUseRefCall(context, init): return true;
6541
6361
  }
6542
6362
  }
6543
6363
  return false;
@@ -6609,14 +6429,14 @@ function create$4(context) {
6609
6429
  case AST_NODE_TYPES.ArrowFunctionExpression: {
6610
6430
  const parent = node.parent.parent;
6611
6431
  if (parent.type !== AST_NODE_TYPES.CallExpression) break;
6612
- if (!core.isUseMemoCall(parent)) break;
6432
+ if (!core.isUseMemoCall(context, parent)) break;
6613
6433
  const init = ast.findParent(parent, isHookDecl)?.init;
6614
6434
  if (init != null) getOrInsertComputed(setStateInEffectArg, init, () => []).push(node);
6615
6435
  break;
6616
6436
  }
6617
6437
  case AST_NODE_TYPES.CallExpression:
6618
6438
  if (node !== node.parent.arguments.at(0)) break;
6619
- if (core.isUseCallbackCall(node.parent)) {
6439
+ if (core.isUseCallbackCall(context, node.parent)) {
6620
6440
  const init = ast.findParent(node.parent, isHookDecl)?.init;
6621
6441
  if (init != null) getOrInsertComputed(setStateInEffectArg, init, () => []).push(node);
6622
6442
  break;
@@ -6738,8 +6558,8 @@ function create$3(context) {
6738
6558
  function isComponentOrHookLikeFunction(node) {
6739
6559
  const id = ast.getFunctionId(node);
6740
6560
  if (id == null) return false;
6741
- if (id.type === AST_NODE_TYPES.Identifier) return core.isComponentName(id.name) || core.isHookName(id.name);
6742
- if (id.type === AST_NODE_TYPES.MemberExpression && id.property.type === AST_NODE_TYPES.Identifier) return core.isComponentName(id.property.name) || core.isHookName(id.property.name);
6561
+ if (id.type === AST_NODE_TYPES.Identifier) return core.isFunctionComponentName(id.name) || core.isHookName(id.name);
6562
+ if (id.type === AST_NODE_TYPES.MemberExpression && id.property.type === AST_NODE_TYPES.Identifier) return core.isFunctionComponentName(id.property.name) || core.isHookName(id.property.name);
6743
6563
  return false;
6744
6564
  }
6745
6565
  function getFunctionKind(node) {
@@ -6824,7 +6644,7 @@ function isIifeCall(node) {
6824
6644
  }
6825
6645
  function create$2(context) {
6826
6646
  const hCollector = core.getHookCollector(context);
6827
- const cCollector = core.getComponentCollector(context);
6647
+ const cCollector = core.getFunctionComponentCollector(context);
6828
6648
  const evalCalls = [];
6829
6649
  const withStmts = [];
6830
6650
  return defineRuleListener(hCollector.visitor, cCollector.visitor, {
@@ -6899,7 +6719,7 @@ var use_memo_default = createRule({
6899
6719
  function create$1(context) {
6900
6720
  if (!context.sourceCode.text.includes("useMemo")) return {};
6901
6721
  return defineRuleListener({ CallExpression(node) {
6902
- if (!core.isUseMemoCall(node)) return;
6722
+ if (!core.isUseMemoCall(context, node)) return;
6903
6723
  let parent = node.parent;
6904
6724
  while (ast.isTypeExpression(parent)) parent = parent.parent;
6905
6725
  if (!(parent.type === AST_NODE_TYPES.VariableDeclarator || parent.type === AST_NODE_TYPES.AssignmentExpression || parent.type === AST_NODE_TYPES.AssignmentPattern || parent.type === AST_NODE_TYPES.Property || parent.type === AST_NODE_TYPES.ReturnStatement || parent.type === AST_NODE_TYPES.JSXExpressionContainer || parent.type === AST_NODE_TYPES.CallExpression || parent.type === AST_NODE_TYPES.NewExpression || parent.type === AST_NODE_TYPES.ArrayExpression || parent.type === AST_NODE_TYPES.ConditionalExpression || parent.type === AST_NODE_TYPES.LogicalExpression || parent.type === AST_NODE_TYPES.SequenceExpression || parent.type === AST_NODE_TYPES.SpreadElement || parent.type === AST_NODE_TYPES.TemplateLiteral || parent.type === AST_NODE_TYPES.BinaryExpression || parent.type === AST_NODE_TYPES.UnaryExpression || parent.type === AST_NODE_TYPES.MemberExpression || parent.type === AST_NODE_TYPES.TaggedTemplateExpression || parent.type === AST_NODE_TYPES.ChainExpression || parent.type === AST_NODE_TYPES.ArrowFunctionExpression)) {
@@ -6986,7 +6806,7 @@ function create(context) {
6986
6806
  for (const expr of ast.getNestedNewExpressions(useStateInput)) {
6987
6807
  if (!("name" in expr.callee)) continue;
6988
6808
  if (LAZY_INIT_ALLOW_LIST.includes(expr.callee.name)) continue;
6989
- if (ast.findParent(expr, core.isUseCall) != null) continue;
6809
+ if (ast.findParent(expr, (n) => core.isUseCall(context, n)) != null) continue;
6990
6810
  context.report({
6991
6811
  messageId: "invalidInitialization",
6992
6812
  node: expr
@@ -6996,7 +6816,7 @@ function create(context) {
6996
6816
  if (!("name" in expr.callee)) continue;
6997
6817
  if (core.isHookName(expr.callee.name)) continue;
6998
6818
  if (LAZY_INIT_ALLOW_LIST.includes(expr.callee.name)) continue;
6999
- if (ast.findParent(expr, core.isUseCall) != null) continue;
6819
+ if (ast.findParent(expr, (n) => core.isUseCall(context, n)) != null) continue;
7000
6820
  context.report({
7001
6821
  messageId: "invalidInitialization",
7002
6822
  node: expr
@@ -7091,7 +6911,6 @@ const plugin = {
7091
6911
  "no-misused-capture-owner-stack": no_misused_capture_owner_stack_default,
7092
6912
  "no-nested-component-definitions": no_nested_component_definitions_default,
7093
6913
  "no-nested-lazy-component-declarations": no_nested_lazy_component_declarations_default,
7094
- "no-redundant-should-component-update": no_redundant_should_component_update_default,
7095
6914
  "no-set-state-in-component-did-mount": no_set_state_in_component_did_mount_default,
7096
6915
  "no-set-state-in-component-did-update": no_set_state_in_component_did_update_default,
7097
6916
  "no-set-state-in-component-will-update": no_set_state_in_component_will_update_default,
@@ -7151,7 +6970,6 @@ const rules$6 = {
7151
6970
  "react-x/no-missing-key": "error",
7152
6971
  "react-x/no-nested-component-definitions": "error",
7153
6972
  "react-x/no-nested-lazy-component-declarations": "error",
7154
- "react-x/no-redundant-should-component-update": "error",
7155
6973
  "react-x/no-set-state-in-component-did-mount": "warn",
7156
6974
  "react-x/no-set-state-in-component-did-update": "warn",
7157
6975
  "react-x/no-set-state-in-component-will-update": "warn",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "4.2.5-beta.0",
3
+ "version": "5.0.0-beta.0",
4
4
  "description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
5
5
  "keywords": [
6
6
  "react",
@@ -45,16 +45,16 @@
45
45
  "string-ts": "^2.3.1",
46
46
  "ts-api-utils": "^2.5.0",
47
47
  "ts-pattern": "^5.9.0",
48
- "@eslint-react/ast": "4.2.5-beta.0",
49
- "@eslint-react/core": "4.2.5-beta.0",
50
- "@eslint-react/shared": "4.2.5-beta.0",
51
- "@eslint-react/var": "4.2.5-beta.0",
52
- "@eslint-react/jsx": "4.2.5-beta.0"
48
+ "@eslint-react/ast": "5.0.0-beta.0",
49
+ "@eslint-react/core": "5.0.0-beta.0",
50
+ "@eslint-react/jsx": "5.0.0-beta.0",
51
+ "@eslint-react/shared": "5.0.0-beta.0",
52
+ "@eslint-react/var": "5.0.0-beta.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/react": "^19.2.14",
56
56
  "@types/react-dom": "^19.2.3",
57
- "eslint": "^10.1.0",
57
+ "eslint": "^10.2.0",
58
58
  "tsdown": "^0.21.7",
59
59
  "tsl-dx": "^0.10.2",
60
60
  "@local/configs": "0.0.0",