eslint-plugin-react-x 5.17.1 → 5.17.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 +13 -13
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -3,11 +3,11 @@ import { ESLintUtils } from "@typescript-eslint/utils";
3
3
  import { Check, Compare, Extract, Traverse } from "@eslint-react/ast";
4
4
  import * as core from "@eslint-react/core";
5
5
  import { merge } from "@eslint-react/eslint";
6
- import { JsxDetectionHint, findParentAttribute, getElementFullType, hasAttribute } from "@eslint-react/jsx";
7
6
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
8
- import { computeObjectType, isAssignmentTargetEqual, isInitializedFromReact, resolve, resolveEnclosingAssignmentTarget } from "@eslint-react/var";
7
+ import { isAssignmentTargetEqual, isInitializedFromReact, resolve, resolveEnclosingAssignmentTarget, resolveObjectType } from "@eslint-react/var";
9
8
  import { DefinitionType, ScopeType } from "@typescript-eslint/scope-manager";
10
9
  import { findVariable, getStaticValue } from "@typescript-eslint/utils/ast-utils";
10
+ import { findParentAttribute, getElementFullType, hasAttribute } from "@eslint-react/jsx";
11
11
  import { compare } from "compare-versions";
12
12
  import { P, isMatching, match } from "ts-pattern";
13
13
  import { getConstrainedTypeAtLocation } from "@typescript-eslint/type-utils";
@@ -144,7 +144,7 @@ const rules$6 = {
144
144
  //#endregion
145
145
  //#region package.json
146
146
  var name$6 = "eslint-plugin-react-x";
147
- var version = "5.17.1";
147
+ var version = "5.17.3";
148
148
 
149
149
  //#endregion
150
150
  //#region src/utils/create-rule.ts
@@ -193,7 +193,7 @@ function getEnclosingTryBlock(node) {
193
193
  }
194
194
  function create$50(context) {
195
195
  if (!context.sourceCode.text.includes("try")) return {};
196
- const hint = JsxDetectionHint.DoNotIncludeJsxWithNullValue | JsxDetectionHint.DoNotIncludeJsxWithNumberValue | JsxDetectionHint.DoNotIncludeJsxWithBigIntValue | JsxDetectionHint.DoNotIncludeJsxWithStringValue | JsxDetectionHint.DoNotIncludeJsxWithBooleanValue | JsxDetectionHint.DoNotIncludeJsxWithUndefinedValue | JsxDetectionHint.DoNotIncludeJsxWithEmptyArrayValue;
196
+ const hint = core.JsxDetectionHint.DoNotIncludeJsxWithNullValue | core.JsxDetectionHint.DoNotIncludeJsxWithNumberValue | core.JsxDetectionHint.DoNotIncludeJsxWithBigIntValue | core.JsxDetectionHint.DoNotIncludeJsxWithStringValue | core.JsxDetectionHint.DoNotIncludeJsxWithBooleanValue | core.JsxDetectionHint.DoNotIncludeJsxWithUndefinedValue | core.JsxDetectionHint.DoNotIncludeJsxWithEmptyArrayValue;
197
197
  const fc = core.getFunctionComponentCollector(context);
198
198
  const hc = core.getHookCollector(context);
199
199
  const reported = /* @__PURE__ */ new Set();
@@ -1380,7 +1380,7 @@ function hasRefLikeNameInChain(node) {
1380
1380
  return node.property.type === AST_NODE_TYPES.Identifier ? isRefLikeName$1(node.property.name) || hasRefLikeNameInChain(node.object) : hasRefLikeNameInChain(node.object);
1381
1381
  }
1382
1382
  function isInitializedFromCall(context, node, isCall) {
1383
- const root = node.type === AST_NODE_TYPES.Identifier ? node : Extract.getRootIdentifier(node);
1383
+ const root = node.type === AST_NODE_TYPES.Identifier ? node : Extract.getIdentifierAt(node, 0);
1384
1384
  if (root == null) return false;
1385
1385
  const variable = findVariable(context.sourceCode.getScope(root), root);
1386
1386
  if (variable == null) return false;
@@ -1431,7 +1431,7 @@ function createImmutabilityCollector() {
1431
1431
  pushMutation("binding", node, target, target);
1432
1432
  return;
1433
1433
  case AST_NODE_TYPES.MemberExpression: {
1434
- const root = Extract.getRootIdentifier(target);
1434
+ const root = Extract.getIdentifierAt(target, 0);
1435
1435
  if (root != null) pushMutation("value", node, target, root);
1436
1436
  return;
1437
1437
  }
@@ -1442,7 +1442,7 @@ function createImmutabilityCollector() {
1442
1442
  if (callee.type === AST_NODE_TYPES.MemberExpression) {
1443
1443
  const method = Extract.getCalleeName(node);
1444
1444
  if (method != null && MUTATING_METHODS.has(method)) {
1445
- const root = Extract.getRootIdentifier(callee.object);
1445
+ const root = Extract.getIdentifierAt(callee.object, 0);
1446
1446
  if (root != null) pushMutation("value", node, callee.object, root);
1447
1447
  }
1448
1448
  }
@@ -1468,7 +1468,7 @@ function createImmutabilityCollector() {
1468
1468
  if (node.operator !== "delete") return;
1469
1469
  const target = Extract.unwrap(node.argument);
1470
1470
  if (target.type !== AST_NODE_TYPES.MemberExpression) return;
1471
- const root = Extract.getRootIdentifier(target);
1471
+ const root = Extract.getIdentifierAt(target, 0);
1472
1472
  if (root != null) pushMutation("value", node, target, root);
1473
1473
  },
1474
1474
  UpdateExpression(node) {
@@ -1478,7 +1478,7 @@ function createImmutabilityCollector() {
1478
1478
  pushMutation("binding", node, target, target);
1479
1479
  return;
1480
1480
  case AST_NODE_TYPES.MemberExpression: {
1481
- const root = Extract.getRootIdentifier(target);
1481
+ const root = Extract.getIdentifierAt(target, 0);
1482
1482
  if (root != null) pushMutation("value", node, target, root);
1483
1483
  return;
1484
1484
  }
@@ -3827,7 +3827,7 @@ function create$13(context) {
3827
3827
  const value = attribute.value;
3828
3828
  if (value?.type !== AST_NODE_TYPES.JSXExpressionContainer) return;
3829
3829
  const valueExpression = value.expression;
3830
- const construction = computeObjectType(context, valueExpression);
3830
+ const construction = resolveObjectType(context, valueExpression);
3831
3831
  if (construction == null) return;
3832
3832
  if (core.isHookCall(construction.node)) return;
3833
3833
  getOrInsertComputed(constructions, enclosingFunction, () => []).push(construction);
@@ -3927,7 +3927,7 @@ function create$12(context, [options]) {
3927
3927
  if (prop.type !== AST_NODE_TYPES.Property || prop.value.type !== AST_NODE_TYPES.AssignmentPattern) continue;
3928
3928
  const { value } = prop;
3929
3929
  const { right } = value;
3930
- const construction = computeObjectType(context, value);
3930
+ const construction = resolveObjectType(context, value);
3931
3931
  if (construction == null) continue;
3932
3932
  if (core.isHookCall(construction.node)) continue;
3933
3933
  if (safePatterns.length > 0) {
@@ -4573,7 +4573,7 @@ function resolveBuiltinObjectName(context, node, seen = /* @__PURE__ */ new Set(
4573
4573
  const init = Extract.unwrap(def.node.init);
4574
4574
  if (init.type === AST_NODE_TYPES.Identifier) return resolveBuiltinObjectName(context, init, seen);
4575
4575
  if (init.type === AST_NODE_TYPES.MemberExpression) {
4576
- const rootId = Extract.getRootIdentifier(init);
4576
+ const rootId = Extract.getIdentifierAt(init, 0);
4577
4577
  if (rootId != null) return resolveBuiltinObjectName(context, rootId, seen);
4578
4578
  }
4579
4579
  }
@@ -4617,7 +4617,7 @@ function create$7(context) {
4617
4617
  break;
4618
4618
  }
4619
4619
  case expr.type === AST_NODE_TYPES.MemberExpression && expr.property.type === AST_NODE_TYPES.Identifier: {
4620
- const rootId = Extract.getRootIdentifier(expr.object);
4620
+ const rootId = Extract.getIdentifierAt(expr.object, 0);
4621
4621
  if (rootId == null) return;
4622
4622
  const objectName = resolveBuiltinObjectName(context, rootId);
4623
4623
  if (objectName == null) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "5.17.1",
3
+ "version": "5.17.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,12 +45,12 @@
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": "5.17.1",
49
- "@eslint-react/eslint": "5.17.1",
50
- "@eslint-react/shared": "5.17.1",
51
- "@eslint-react/core": "5.17.1",
52
- "@eslint-react/jsx": "5.17.1",
53
- "@eslint-react/var": "5.17.1"
48
+ "@eslint-react/ast": "5.17.3",
49
+ "@eslint-react/eslint": "5.17.3",
50
+ "@eslint-react/jsx": "5.17.3",
51
+ "@eslint-react/core": "5.17.3",
52
+ "@eslint-react/shared": "5.17.3",
53
+ "@eslint-react/var": "5.17.3"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/react": "^19.2.17",
@@ -59,7 +59,7 @@
59
59
  "eslint": "^10.7.0",
60
60
  "react": "^19.2.7",
61
61
  "react-dom": "^19.2.7",
62
- "tsdown": "^0.22.8",
62
+ "tsdown": "^0.22.9",
63
63
  "tsl": "^1.0.30",
64
64
  "tsl-dx": "^0.13.3",
65
65
  "typescript": "6.0.3",