eslint-plugin-react-x 3.0.0-beta.63 → 3.0.0-beta.65

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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ESLint, Linter } from "eslint";
2
2
 
3
3
  //#region src/index.d.ts
4
- type ConfigName = "disable-experimental" | "disable-type-checked" | "recommended" | "recommended-type-checked" | "recommended-typescript" | "strict" | "strict-type-checked" | "strict-typescript";
4
+ type ConfigName = "disable-experimental" | "disable-type-checked" | "disable-conflict-eslint-plugin-react" | "disable-conflict-eslint-plugin-react-hooks" | "recommended" | "recommended-type-checked" | "recommended-typescript" | "strict" | "strict-type-checked" | "strict-typescript";
5
5
  declare const finalPlugin: ESLint.Plugin & {
6
6
  configs: Record<ConfigName, Linter.Config>;
7
7
  };
package/dist/index.js CHANGED
@@ -5,13 +5,13 @@ import { ESLintUtils } from "@typescript-eslint/utils";
5
5
  import { P, isMatching, match } from "ts-pattern";
6
6
  import ts from "typescript";
7
7
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
8
- import { constFalse, constTrue, constVoid, flow, getOrElseUpdate, identity, not, unit } from "@eslint-react/eff";
8
+ import { computeObjectType, findEnclosingAssignmentTarget, isAssignmentTargetEqual, resolve } from "@eslint-react/var";
9
9
  import { DefinitionType } from "@typescript-eslint/scope-manager";
10
10
  import { findVariable, getStaticValue, isIdentifier, isVariableDeclarator } from "@typescript-eslint/utils/ast-utils";
11
+ import { constFalse, constTrue, constVoid, flow, getOrElseUpdate, identity, not } from "@eslint-react/eff";
11
12
  import { compare } from "compare-versions";
12
13
  import { getConstrainedTypeAtLocation } from "@typescript-eslint/type-utils";
13
14
  import { unionConstituents } from "ts-api-utils";
14
- import { computeObjectType, findEnclosingAssignmentTarget, isAssignmentTargetEqual } from "@eslint-react/var";
15
15
  import { snakeCase } from "string-ts";
16
16
 
17
17
  //#region \0rolldown/runtime.js
@@ -30,6 +30,84 @@ var __exportAll = (all, no_symbols) => {
30
30
  return target;
31
31
  };
32
32
 
33
+ //#endregion
34
+ //#region src/configs/disable-conflict-eslint-plugin-react.ts
35
+ var disable_conflict_eslint_plugin_react_exports = /* @__PURE__ */ __exportAll({
36
+ name: () => name$10,
37
+ rules: () => rules$10
38
+ });
39
+ const conflictingRules$1 = [
40
+ "react/button-has-type",
41
+ "react/destructuring-assignment",
42
+ "react/display-name",
43
+ "react/forbid-prop-types",
44
+ "react/forward-ref-uses-ref",
45
+ "react/hook-use-state",
46
+ "react/iframe-missing-sandbox",
47
+ "react/jsx-boolean-value",
48
+ "react/jsx-filename-extension",
49
+ "react/jsx-fragments",
50
+ "react/jsx-key",
51
+ "react/jsx-no-comment-textnodes",
52
+ "react/jsx-no-constructed-context-values",
53
+ "react/jsx-no-duplicate-props",
54
+ "react/jsx-no-leaked-render",
55
+ "react/jsx-no-script-url",
56
+ "react/jsx-no-target-blank",
57
+ "react/jsx-no-useless-fragment",
58
+ "react/jsx-pascal-case",
59
+ "react/jsx-uses-react",
60
+ "react/jsx-uses-vars",
61
+ "react/no-access-state-in-setstate",
62
+ "react/no-array-index-key",
63
+ "react/no-children-prop",
64
+ "react/no-danger",
65
+ "react/no-danger-with-children",
66
+ "react/no-deprecated",
67
+ "react/no-did-mount-set-state",
68
+ "react/no-did-update-set-state",
69
+ "react/no-direct-mutation-state",
70
+ "react/no-find-dom-node",
71
+ "react/no-namespace",
72
+ "react/no-object-type-as-default-prop",
73
+ "react/no-redundant-should-component-update",
74
+ "react/no-render-return-value",
75
+ "react/no-string-refs",
76
+ "react/no-unknown-property",
77
+ "react/no-unsafe",
78
+ "react/no-unstable-nested-components",
79
+ "react/no-unused-class-component-members",
80
+ "react/no-unused-state",
81
+ "react/no-will-update-set-state",
82
+ "react/prop-types",
83
+ "react/void-dom-elements-no-children"
84
+ ];
85
+ const name$10 = "react-x/disable-conflict-eslint-plugin-react";
86
+ const rules$10 = Object.fromEntries(conflictingRules$1.map((key) => [key, "off"]));
87
+
88
+ //#endregion
89
+ //#region src/configs/disable-conflict-eslint-plugin-react-hooks.ts
90
+ var disable_conflict_eslint_plugin_react_hooks_exports = /* @__PURE__ */ __exportAll({
91
+ name: () => name$9,
92
+ rules: () => rules$9
93
+ });
94
+ const conflictingRules = [
95
+ "react-hooks/exhaustive-deps",
96
+ "react-hooks/rules-of-hooks",
97
+ "react-hooks/component-hook-factories",
98
+ "react-hooks/error-boundaries",
99
+ "react-hooks/immutability",
100
+ "react-hooks/purity",
101
+ "react-hooks/refs",
102
+ "react-hooks/set-state-in-effect",
103
+ "react-hooks/set-state-in-render",
104
+ "react-hooks/static-components",
105
+ "react-hooks/unsupported-syntax",
106
+ "react-hooks/use-memo"
107
+ ];
108
+ const name$9 = "react-x/disable-conflict-eslint-plugin-react-hooks";
109
+ const rules$9 = Object.fromEntries(conflictingRules.map((key) => [key, "off"]));
110
+
33
111
  //#endregion
34
112
  //#region src/configs/disable-experimental.ts
35
113
  var disable_experimental_exports = /* @__PURE__ */ __exportAll({
@@ -69,7 +147,7 @@ const rules$7 = {
69
147
  //#endregion
70
148
  //#region package.json
71
149
  var name$6 = "eslint-plugin-react-x";
72
- var version = "3.0.0-beta.63";
150
+ var version = "3.0.0-beta.65";
73
151
 
74
152
  //#endregion
75
153
  //#region src/utils/create-rule.ts
@@ -1289,7 +1367,7 @@ function create$61(context) {
1289
1367
  * @returns True if `id` is a state variable, false otherwise.
1290
1368
  */
1291
1369
  function isStateValue(id) {
1292
- const initNode = resolve$4(findVariable(context.sourceCode.getScope(id), id));
1370
+ const initNode = resolve(context, id);
1293
1371
  if (initNode == null || initNode.type !== AST_NODE_TYPES.CallExpression) return false;
1294
1372
  if (!isUseStateCall(initNode)) return false;
1295
1373
  const declarator = initNode.parent;
@@ -1388,13 +1466,6 @@ function create$61(context) {
1388
1466
  }
1389
1467
  });
1390
1468
  }
1391
- function resolve$4(v) {
1392
- if (v == null) return unit;
1393
- const def = v.defs.at(0);
1394
- if (def == null) return unit;
1395
- if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
1396
- return def.node;
1397
- }
1398
1469
 
1399
1470
  //#endregion
1400
1471
  //#region src/rules/jsx-dollar/jsx-dollar.ts
@@ -1839,18 +1910,18 @@ function getIndexParamPosition(methodName) {
1839
1910
  }
1840
1911
  function getMapIndexParamName(context, node) {
1841
1912
  const { callee } = node;
1842
- if (callee.type !== AST_NODE_TYPES.MemberExpression) return unit;
1843
- if (callee.property.type !== AST_NODE_TYPES.Identifier) return unit;
1913
+ if (callee.type !== AST_NODE_TYPES.MemberExpression) return null;
1914
+ if (callee.property.type !== AST_NODE_TYPES.Identifier) return null;
1844
1915
  const { name } = callee.property;
1845
1916
  const indexPosition = getIndexParamPosition(name);
1846
- if (indexPosition === -1) return unit;
1917
+ if (indexPosition === -1) return null;
1847
1918
  const callbackArg = node.arguments[core.isChildrenMap(context, callee) || core.isChildrenForEach(context, callee) ? 1 : 0];
1848
- if (callbackArg == null) return unit;
1849
- if (!ast.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(callbackArg)) return unit;
1919
+ if (callbackArg == null) return null;
1920
+ if (!ast.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(callbackArg)) return null;
1850
1921
  const { params } = callbackArg;
1851
- if (params.length < indexPosition + 1) return unit;
1922
+ if (params.length < indexPosition + 1) return null;
1852
1923
  const param = params.at(indexPosition);
1853
- return param != null && "name" in param ? param.name : unit;
1924
+ return param != null && "name" in param ? param.name : null;
1854
1925
  }
1855
1926
  function getIdentifiersFromBinaryExpression(side) {
1856
1927
  if (side.type === AST_NODE_TYPES.Identifier) return [side];
@@ -2574,12 +2645,12 @@ function create$33(context) {
2574
2645
  /**
2575
2646
  * Recursively inspects a node to find potential leaked conditional rendering
2576
2647
  * @param node The AST node to inspect
2577
- * @returns A report descriptor if a problem is found, otherwise `unit`
2648
+ * @returns A report descriptor if a problem is found, otherwise `null`
2578
2649
  */
2579
2650
  function getReportDescriptor(node) {
2580
- if (node == null) return unit;
2651
+ if (node == null) return null;
2581
2652
  if (ast.is(AST_NODE_TYPES.JSXExpressionContainer)(node)) return getReportDescriptor(node.expression);
2582
- if (ast.isJSX(node)) return unit;
2653
+ if (ast.isJSX(node)) return null;
2583
2654
  if (ast.isTypeExpression(node)) return getReportDescriptor(node.expression);
2584
2655
  return match(node).with({
2585
2656
  type: AST_NODE_TYPES.LogicalExpression,
@@ -2603,8 +2674,8 @@ function create$33(context) {
2603
2674
  return getReportDescriptor(consequent) ?? getReportDescriptor(alternate);
2604
2675
  }).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
2605
2676
  const variableDefNode = findVariable(context.sourceCode.getScope(n), n.name)?.defs.at(0)?.node;
2606
- return match(variableDefNode).with({ init: P.select({ type: P.not(AST_NODE_TYPES.VariableDeclaration) }) }, getReportDescriptor).otherwise(() => unit);
2607
- }).otherwise(() => unit);
2677
+ return match(variableDefNode).with({ init: P.select({ type: P.not(AST_NODE_TYPES.VariableDeclaration) }) }, getReportDescriptor).otherwise(() => null);
2678
+ }).otherwise(() => null);
2608
2679
  }
2609
2680
  return defineRuleListener({ JSXExpressionContainer: flow(getReportDescriptor, report(context)) });
2610
2681
  }
@@ -3145,13 +3216,13 @@ function create$22(context) {
3145
3216
  const [cbk, ...rest] = context.sourceCode.getDeclaredVariables(node);
3146
3217
  if (cbk == null || rest.length > 0) return;
3147
3218
  const checkForUsageInsideUseEffectReport = checkForUsageInsideUseEffect$1(context.sourceCode, init);
3148
- const scope = context.sourceCode.getScope(init);
3219
+ context.sourceCode.getScope(init);
3149
3220
  const component = context.sourceCode.getScope(init).block;
3150
3221
  if (!ast.isFunction(component)) return;
3151
3222
  const [arg0, arg1] = init.arguments;
3152
3223
  if (arg0 == null || arg1 == null) return;
3153
3224
  if (!match(arg1).with({ type: AST_NODE_TYPES.ArrayExpression }, (n) => n.elements.length === 0).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
3154
- const initNode = resolve$3(findVariable(scope, n.name));
3225
+ const initNode = resolve(context, n);
3155
3226
  if (initNode?.type !== AST_NODE_TYPES.ArrayExpression) return false;
3156
3227
  return initNode.elements.length === 0;
3157
3228
  }).otherwise(() => false)) {
@@ -3162,7 +3233,7 @@ function create$22(context) {
3162
3233
  if (n.body.type === AST_NODE_TYPES.ArrowFunctionExpression) return n.body;
3163
3234
  return n;
3164
3235
  }).with({ type: AST_NODE_TYPES.FunctionExpression }, identity).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
3165
- const initNode = resolve$3(findVariable(scope, n.name));
3236
+ const initNode = resolve(context, n);
3166
3237
  if (initNode?.type !== AST_NODE_TYPES.ArrowFunctionExpression && initNode?.type !== AST_NODE_TYPES.FunctionExpression) return null;
3167
3238
  return initNode;
3168
3239
  }).otherwise(() => null);
@@ -3181,17 +3252,17 @@ function create$22(context) {
3181
3252
  } });
3182
3253
  }
3183
3254
  function checkForUsageInsideUseEffect$1(sourceCode, node) {
3184
- if (!/use\w*Effect/u.test(sourceCode.text)) return;
3185
- if (!isVariableDeclarator(node.parent)) return;
3186
- if (!isIdentifier(node.parent.id)) return;
3255
+ if (!/use\w*Effect/u.test(sourceCode.text)) return null;
3256
+ if (!isVariableDeclarator(node.parent)) return null;
3257
+ if (!isIdentifier(node.parent.id)) return null;
3187
3258
  const usages = (sourceCode.getDeclaredVariables(node.parent)[0]?.references ?? []).filter((ref) => ref.init !== true);
3188
- if (usages.length === 0) return;
3259
+ if (usages.length === 0) return null;
3189
3260
  const effectSet = /* @__PURE__ */ new Set();
3190
3261
  for (const usage of usages) {
3191
3262
  const effect = ast.findParentNode(usage.identifier, core.isUseEffectLikeCall);
3192
- if (effect == null) return;
3263
+ if (effect == null) return null;
3193
3264
  effectSet.add(effect);
3194
- if (effectSet.size > 1) return;
3265
+ if (effectSet.size > 1) return null;
3195
3266
  }
3196
3267
  return {
3197
3268
  data: { name: node.parent.id.name },
@@ -3199,13 +3270,6 @@ function checkForUsageInsideUseEffect$1(sourceCode, node) {
3199
3270
  node
3200
3271
  };
3201
3272
  }
3202
- function resolve$3(v) {
3203
- if (v == null) return unit;
3204
- const def = v.defs.at(0);
3205
- if (def == null) return unit;
3206
- if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
3207
- return def.node;
3208
- }
3209
3273
 
3210
3274
  //#endregion
3211
3275
  //#region src/rules/no-unnecessary-use-memo/no-unnecessary-use-memo.ts
@@ -3232,8 +3296,7 @@ function create$21(context) {
3232
3296
  const [mem, ...rest] = context.sourceCode.getDeclaredVariables(node);
3233
3297
  if (mem == null || rest.length > 0) return;
3234
3298
  const checkForUsageInsideUseEffectReport = checkForUsageInsideUseEffect(context.sourceCode, init);
3235
- const scope = context.sourceCode.getScope(init);
3236
- const component = scope.block;
3299
+ const component = context.sourceCode.getScope(init).block;
3237
3300
  if (!ast.isFunction(component)) return;
3238
3301
  const [arg0, arg1] = init.arguments;
3239
3302
  if (arg0 == null || arg1 == null) return;
@@ -3242,7 +3305,7 @@ function create$21(context) {
3242
3305
  return;
3243
3306
  }
3244
3307
  if (!match(arg1).with({ type: AST_NODE_TYPES.ArrayExpression }, (n) => n.elements.length === 0).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
3245
- const initNode = resolve$2(findVariable(scope, n.name));
3308
+ const initNode = resolve(context, n);
3246
3309
  if (initNode?.type !== AST_NODE_TYPES.ArrayExpression) return false;
3247
3310
  return initNode.elements.length === 0;
3248
3311
  }).otherwise(() => false)) {
@@ -3253,9 +3316,9 @@ function create$21(context) {
3253
3316
  if (n.body.type === AST_NODE_TYPES.ArrowFunctionExpression) return n.body;
3254
3317
  return n;
3255
3318
  }).with({ type: AST_NODE_TYPES.FunctionExpression }, identity).with({ type: AST_NODE_TYPES.Identifier }, (n) => {
3256
- const variableNode = resolve$2(findVariable(scope, n.name));
3257
- if (variableNode?.type !== AST_NODE_TYPES.ArrowFunctionExpression && variableNode?.type !== AST_NODE_TYPES.FunctionExpression) return null;
3258
- return variableNode;
3319
+ const initNode = resolve(context, n);
3320
+ if (initNode?.type !== AST_NODE_TYPES.ArrowFunctionExpression && initNode?.type !== AST_NODE_TYPES.FunctionExpression) return null;
3321
+ return initNode;
3259
3322
  }).otherwise(() => null);
3260
3323
  if (arg0Node == null) return;
3261
3324
  function getChildScopes(scope) {
@@ -3272,17 +3335,17 @@ function create$21(context) {
3272
3335
  } });
3273
3336
  }
3274
3337
  function checkForUsageInsideUseEffect(sourceCode, node) {
3275
- if (!/use\w*Effect/u.test(sourceCode.text)) return;
3276
- if (!isVariableDeclarator(node.parent)) return;
3277
- if (!isIdentifier(node.parent.id)) return;
3338
+ if (!/use\w*Effect/u.test(sourceCode.text)) return null;
3339
+ if (!isVariableDeclarator(node.parent)) return null;
3340
+ if (!isIdentifier(node.parent.id)) return null;
3278
3341
  const usages = (sourceCode.getDeclaredVariables(node.parent)[0]?.references ?? []).filter((ref) => ref.init !== true);
3279
- if (usages.length === 0) return;
3342
+ if (usages.length === 0) return null;
3280
3343
  const effectSet = /* @__PURE__ */ new Set();
3281
3344
  for (const usage of usages) {
3282
3345
  const effect = ast.findParentNode(usage.identifier, core.isUseEffectLikeCall);
3283
- if (effect == null) return;
3346
+ if (effect == null) return null;
3284
3347
  effectSet.add(effect);
3285
- if (effectSet.size > 1) return;
3348
+ if (effectSet.size > 1) return null;
3286
3349
  }
3287
3350
  return {
3288
3351
  data: { name: node.parent.id.name },
@@ -3290,13 +3353,6 @@ function checkForUsageInsideUseEffect(sourceCode, node) {
3290
3353
  node
3291
3354
  };
3292
3355
  }
3293
- function resolve$2(v) {
3294
- if (v == null) return unit;
3295
- const def = v.defs.at(0);
3296
- if (def == null) return unit;
3297
- if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
3298
- return def.node;
3299
- }
3300
3356
 
3301
3357
  //#endregion
3302
3358
  //#region src/rules/no-unnecessary-use-prefix/no-unnecessary-use-prefix.ts
@@ -3452,7 +3508,7 @@ function create$16(context) {
3452
3508
  const value = attribute.value;
3453
3509
  if (value?.type !== AST_NODE_TYPES.JSXExpressionContainer) return;
3454
3510
  const valueExpression = value.expression;
3455
- const construction = computeObjectType(valueExpression, context.sourceCode.getScope(valueExpression));
3511
+ const construction = computeObjectType(context, valueExpression);
3456
3512
  if (construction == null) return;
3457
3513
  if (core.isHookCall(construction.node)) return;
3458
3514
  getOrElseUpdate(constructions, functionEntry.node, () => []).push(construction);
@@ -3539,7 +3595,7 @@ function create$15(context, [options]) {
3539
3595
  if (prop.type !== AST_NODE_TYPES.Property || prop.value.type !== AST_NODE_TYPES.AssignmentPattern) continue;
3540
3596
  const { value } = prop;
3541
3597
  const { right } = value;
3542
- const construction = computeObjectType(value, context.sourceCode.getScope(value));
3598
+ const construction = computeObjectType(context, value);
3543
3599
  if (construction == null) continue;
3544
3600
  if (core.isHookCall(construction.node)) continue;
3545
3601
  if (safePatterns.length > 0) {
@@ -3831,7 +3887,7 @@ function create$12(context) {
3831
3887
  if (currentClass == null || !core.isClassComponent(currentClass)) return;
3832
3888
  if (node.static) {
3833
3889
  if (core.isGetDerivedStateFromProps(node) && isMatching({ params: [P.nonNullable, ...P.array()] })(node.value)) {
3834
- const defNode = stateDefs.get(currentClass)?.node;
3890
+ const defNode = stateDefs.get(currentClass)?.node ?? null;
3835
3891
  stateDefs.set(currentClass, {
3836
3892
  isUsed: true,
3837
3893
  node: defNode
@@ -3879,7 +3935,7 @@ function create$12(context) {
3879
3935
  if (currentMethod == null || currentMethod.static) return;
3880
3936
  if (currentMethod === constructorStack.at(-1)) return;
3881
3937
  if (!currentClass.body.body.includes(currentMethod)) return;
3882
- const defNode = stateDefs.get(currentClass)?.node;
3938
+ const defNode = stateDefs.get(currentClass)?.node ?? null;
3883
3939
  stateDefs.set(currentClass, {
3884
3940
  isUsed: true,
3885
3941
  node: defNode
@@ -3903,7 +3959,7 @@ function create$12(context) {
3903
3959
  if (prop.type === AST_NODE_TYPES.Property && isKeyLiteral(prop, prop.key)) return ast.getPropertyName(prop.key) === "state";
3904
3960
  return false;
3905
3961
  })) return;
3906
- const defNode = stateDefs.get(currentClass)?.node;
3962
+ const defNode = stateDefs.get(currentClass)?.node ?? null;
3907
3963
  stateDefs.set(currentClass, {
3908
3964
  isUsed: true,
3909
3965
  node: defNode
@@ -4016,7 +4072,7 @@ function create$10(context, [option]) {
4016
4072
  }
4017
4073
  const isChildElement = ast.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(node.parent);
4018
4074
  switch (true) {
4019
- case allowExpressions && !isChildElement && node.children.length === 1 && core.isJsxText(node.children.at(0)): return;
4075
+ case allowExpressions && !isChildElement && node.children.length === 1 && core.isJsxText(node.children.at(0) ?? null): return;
4020
4076
  case !allowExpressions && isChildElement:
4021
4077
  context.report({
4022
4078
  data: { reason: "contains less than two children" },
@@ -6566,7 +6622,7 @@ function create$5(context) {
6566
6622
  }
6567
6623
  }
6568
6624
  function isIdFromUseStateCall(id, at) {
6569
- const initNode = resolve$1(findVariable(context.sourceCode.getScope(id), id));
6625
+ const initNode = resolve(context, id);
6570
6626
  if (initNode == null) return false;
6571
6627
  if (initNode.type !== AST_NODE_TYPES.CallExpression) return false;
6572
6628
  if (!isUseStateCall(initNode)) return false;
@@ -6688,8 +6744,8 @@ function create$5(context) {
6688
6744
  }
6689
6745
  },
6690
6746
  "Program:exit"() {
6691
- const getSetStateCalls = (id, initialScope) => {
6692
- const node = resolve$1(findVariable(initialScope, id));
6747
+ const getSetStateCalls = (context, id) => {
6748
+ const node = resolve(context, id);
6693
6749
  switch (node?.type) {
6694
6750
  case AST_NODE_TYPES.ArrowFunctionExpression:
6695
6751
  case AST_NODE_TYPES.FunctionDeclaration:
@@ -6705,8 +6761,7 @@ function create$5(context) {
6705
6761
  });
6706
6762
  for (const { callee } of trackedFnCalls) {
6707
6763
  if (!("name" in callee)) continue;
6708
- const { name } = callee;
6709
- const setStateCalls = getSetStateCalls(name, context.sourceCode.getScope(callee));
6764
+ const setStateCalls = getSetStateCalls(context, callee);
6710
6765
  for (const setStateCall of setStateCalls) context.report({
6711
6766
  data: { name: getCallName(setStateCall) },
6712
6767
  messageId: "default",
@@ -6714,7 +6769,7 @@ function create$5(context) {
6714
6769
  });
6715
6770
  }
6716
6771
  for (const id of setupFnIds) {
6717
- const setStateCalls = getSetStateCalls(id.name, context.sourceCode.getScope(id));
6772
+ const setStateCalls = getSetStateCalls(context, id);
6718
6773
  for (const setStateCall of setStateCalls) context.report({
6719
6774
  data: { name: getCallName(setStateCall) },
6720
6775
  messageId: "default",
@@ -6724,17 +6779,6 @@ function create$5(context) {
6724
6779
  }
6725
6780
  });
6726
6781
  }
6727
- function resolve$1(v) {
6728
- if (v == null) return unit;
6729
- const def = v.defs.at(0);
6730
- if (def == null) return unit;
6731
- switch (true) {
6732
- case def.type === DefinitionType.FunctionName && def.node.type === AST_NODE_TYPES.FunctionDeclaration: return def.node;
6733
- case def.type === DefinitionType.ClassName && def.node.type === AST_NODE_TYPES.ClassDeclaration: return def.node;
6734
- case "init" in def.node && def.node.init != null && !("declarations" in def.node.init): return def.node.init;
6735
- default: return unit;
6736
- }
6737
- }
6738
6782
 
6739
6783
  //#endregion
6740
6784
  //#region src/rules/set-state-in-render/set-state-in-render.ts
@@ -6759,7 +6803,7 @@ function create$4(context) {
6759
6803
  return core.isUseStateLikeCall(node, additionalStateHooks);
6760
6804
  }
6761
6805
  function isIdFromUseStateCall(topLevelId, at) {
6762
- const initNode = resolve(findVariable(context.sourceCode.getScope(topLevelId), topLevelId));
6806
+ const initNode = resolve(context, topLevelId);
6763
6807
  if (initNode == null) return false;
6764
6808
  if (initNode.type !== AST_NODE_TYPES.CallExpression) return false;
6765
6809
  if (!isUseStateCall(initNode)) return false;
@@ -6872,13 +6916,6 @@ function create$4(context) {
6872
6916
  }
6873
6917
  });
6874
6918
  }
6875
- function resolve(v) {
6876
- if (v == null) return unit;
6877
- const def = v.defs.at(0);
6878
- if (def == null) return unit;
6879
- if ("init" in def.node && def.node.init != null && !("declarations" in def.node.init)) return def.node.init;
6880
- return def.node;
6881
- }
6882
6919
 
6883
6920
  //#endregion
6884
6921
  //#region src/rules/unsupported-syntax/unsupported-syntax.ts
@@ -7424,6 +7461,8 @@ const finalPlugin = {
7424
7461
  configs: {
7425
7462
  ["disable-experimental"]: disable_experimental_exports,
7426
7463
  ["disable-type-checked"]: disable_type_checked_exports,
7464
+ ["disable-conflict-eslint-plugin-react"]: disable_conflict_eslint_plugin_react_exports,
7465
+ ["disable-conflict-eslint-plugin-react-hooks"]: disable_conflict_eslint_plugin_react_hooks_exports,
7427
7466
  ["recommended"]: recommended_exports,
7428
7467
  ["recommended-type-checked"]: recommended_type_checked_exports,
7429
7468
  ["recommended-typescript"]: recommended_typescript_exports,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "3.0.0-beta.63",
3
+ "version": "3.0.0-beta.65",
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,18 +45,18 @@
45
45
  "string-ts": "^2.3.1",
46
46
  "ts-api-utils": "^2.4.0",
47
47
  "ts-pattern": "^5.9.0",
48
- "@eslint-react/ast": "3.0.0-beta.63",
49
- "@eslint-react/eff": "3.0.0-beta.63",
50
- "@eslint-react/core": "3.0.0-beta.63",
51
- "@eslint-react/shared": "3.0.0-beta.63",
52
- "@eslint-react/var": "3.0.0-beta.63"
48
+ "@eslint-react/ast": "3.0.0-beta.65",
49
+ "@eslint-react/shared": "3.0.0-beta.65",
50
+ "@eslint-react/eff": "3.0.0-beta.65",
51
+ "@eslint-react/var": "3.0.0-beta.65",
52
+ "@eslint-react/core": "3.0.0-beta.65"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/react": "^19.2.14",
56
56
  "@types/react-dom": "^19.2.3",
57
57
  "eslint": "^10.0.2",
58
58
  "tsdown": "^0.21.0-beta.2",
59
- "tsl-dx": "^0.8.0",
59
+ "tsl-dx": "^0.9.0",
60
60
  "@local/configs": "0.0.0"
61
61
  },
62
62
  "peerDependencies": {