eslint-plugin-react-x 4.0.2-beta.1 → 4.0.2-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +10 -10
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -147,7 +147,7 @@ const rules$7 = {
147
147
  //#endregion
148
148
  //#region package.json
149
149
  var name$6 = "eslint-plugin-react-x";
150
- var version = "4.0.2-beta.1";
150
+ var version = "4.0.2-beta.3";
151
151
 
152
152
  //#endregion
153
153
  //#region src/utils/create-rule.ts
@@ -1657,9 +1657,9 @@ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
1657
1657
  };
1658
1658
  }
1659
1659
  }
1660
- function getOrElseUpdate(map, key, callback) {
1660
+ function getOrInsertComputed(map, key, callback) {
1661
1661
  if (map.has(key)) return map.get(key);
1662
- const value = callback();
1662
+ const value = callback(key);
1663
1663
  map.set(key, value);
1664
1664
  return value;
1665
1665
  }
@@ -3430,7 +3430,7 @@ function create$16(context) {
3430
3430
  const construction = computeObjectType(context, valueExpression);
3431
3431
  if (construction == null) return;
3432
3432
  if (core.isHookCall(construction.node)) return;
3433
- getOrElseUpdate(constructions, enclosingFunction, () => []).push(construction);
3433
+ getOrInsertComputed(constructions, enclosingFunction, () => []).push(construction);
3434
3434
  },
3435
3435
  "Program:exit"(program) {
3436
3436
  for (const { directives, node: component } of api.getAllComponents(program)) {
@@ -3500,7 +3500,7 @@ function create$15(context, [options]) {
3500
3500
  [ast.SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR](node) {
3501
3501
  const enclosingFunction = ast.findParent(node, ast.isFunction);
3502
3502
  if (enclosingFunction == null) return;
3503
- getOrElseUpdate(declarators, enclosingFunction, () => []).push(node);
3503
+ getOrInsertComputed(declarators, enclosingFunction, () => []).push(node);
3504
3504
  },
3505
3505
  "Program:exit"(program) {
3506
3506
  for (const { node: component } of api.getAllComponents(program)) {
@@ -6534,8 +6534,8 @@ function create$6(context) {
6534
6534
  }
6535
6535
  default: {
6536
6536
  const init = ast.findParent(node, isHookDecl)?.init;
6537
- if (init == null) getOrElseUpdate(setStateCallsByFn, entry.node, () => []).push(node);
6538
- else getOrElseUpdate(setStateInHookCallbacks, init, () => []).push(node);
6537
+ if (init == null) getOrInsertComputed(setStateCallsByFn, entry.node, () => []).push(node);
6538
+ else getOrInsertComputed(setStateInHookCallbacks, init, () => []).push(node);
6539
6539
  }
6540
6540
  }
6541
6541
  }).with("useEffect", () => {
@@ -6555,17 +6555,17 @@ function create$6(context) {
6555
6555
  if (parent.type !== AST_NODE_TYPES.CallExpression) break;
6556
6556
  if (!core.isUseMemoCall(parent)) break;
6557
6557
  const init = ast.findParent(parent, isHookDecl)?.init;
6558
- if (init != null) getOrElseUpdate(setStateInEffectArg, init, () => []).push(node);
6558
+ if (init != null) getOrInsertComputed(setStateInEffectArg, init, () => []).push(node);
6559
6559
  break;
6560
6560
  }
6561
6561
  case AST_NODE_TYPES.CallExpression:
6562
6562
  if (node !== node.parent.arguments.at(0)) break;
6563
6563
  if (core.isUseCallbackCall(node.parent)) {
6564
6564
  const init = ast.findParent(node.parent, isHookDecl)?.init;
6565
- if (init != null) getOrElseUpdate(setStateInEffectArg, init, () => []).push(node);
6565
+ if (init != null) getOrInsertComputed(setStateInEffectArg, init, () => []).push(node);
6566
6566
  break;
6567
6567
  }
6568
- if (isUseEffectCall(node.parent)) getOrElseUpdate(setStateInEffectSetup, node.parent, () => []).push(node);
6568
+ if (isUseEffectCall(node.parent)) getOrInsertComputed(setStateInEffectSetup, node.parent, () => []).push(node);
6569
6569
  }
6570
6570
  },
6571
6571
  "Program:exit"() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "4.0.2-beta.1",
3
+ "version": "4.0.2-beta.3",
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,17 +45,17 @@
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.0.2-beta.1",
49
- "@eslint-react/core": "4.0.2-beta.1",
50
- "@eslint-react/shared": "4.0.2-beta.1",
51
- "@eslint-react/jsx": "4.0.2-beta.1",
52
- "@eslint-react/var": "4.0.2-beta.1"
48
+ "@eslint-react/ast": "4.0.2-beta.3",
49
+ "@eslint-react/jsx": "4.0.2-beta.3",
50
+ "@eslint-react/shared": "4.0.2-beta.3",
51
+ "@eslint-react/core": "4.0.2-beta.3",
52
+ "@eslint-react/var": "4.0.2-beta.3"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/react": "^19.2.14",
56
56
  "@types/react-dom": "^19.2.3",
57
57
  "eslint": "^10.1.0",
58
- "tsdown": "^0.21.6",
58
+ "tsdown": "^0.21.7",
59
59
  "tsl-dx": "^0.10.2",
60
60
  "@local/configs": "0.0.0",
61
61
  "@local/eff": "3.0.0-beta.72"