eslint-plugin-react-x 2.7.4-next.2 → 2.7.4-next.4

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 +5 -5
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -3,9 +3,9 @@ import { AST_NODE_TYPES } from "@typescript-eslint/types";
3
3
  import { ESLintUtils } from "@typescript-eslint/utils";
4
4
  import { P, isMatching, match } from "ts-pattern";
5
5
  import ts from "typescript";
6
- import { ComponentDetectionHint, ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit, findEnclosingAssignmentTarget, findParentJsxAttribute, getJsxAttribute, getJsxAttributeName, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, isAssignmentToThisState, isCaptureOwnerStackCall, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUpdate, isCreateContextCall, isCreateElementCall, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRefCall, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInstanceIdEqual, isJsxFragmentElement, isJsxHostElement, isJsxText, isLazyCall, isReactHookCall, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseCall, isUseCallbackCall, isUseContextCall, isUseEffectLikeCall, isUseMemoCall, isUseRefCall, isUseStateCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector } from "@eslint-react/core";
6
+ import { ComponentDetectionHint, ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit, findParentJsxAttribute, getJsxAttribute, getJsxAttributeName, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, isAssignmentToThisState, isCaptureOwnerStackCall, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUpdate, isCreateContextCall, isCreateElementCall, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRefCall, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isJsxFragmentElement, isJsxHostElement, isJsxText, isLazyCall, isReactHookCall, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseCall, isUseCallbackCall, isUseContextCall, isUseEffectLikeCall, isUseMemoCall, isUseRefCall, isUseStateCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector } from "@eslint-react/core";
7
7
  import * as AST from "@eslint-react/ast";
8
- import { findVariable, getChildScopes, getObjectType, getVariableDefinitionNode } from "@eslint-react/var";
8
+ import { findEnclosingAssignmentTarget, findVariable, getChildScopes, getObjectType, getVariableDefinitionNode, isAssignmentTargetEqual } from "@eslint-react/var";
9
9
  import { constFalse, constTrue, flow, getOrElseUpdate, identity, unit } from "@eslint-react/eff";
10
10
  import { compare } from "compare-versions";
11
11
  import { getConstrainedTypeAtLocation, isTypeReadonly } from "@typescript-eslint/type-utils";
@@ -68,7 +68,7 @@ const rules$7 = {
68
68
  //#endregion
69
69
  //#region package.json
70
70
  var name$6 = "eslint-plugin-react-x";
71
- var version = "2.7.4-next.2";
71
+ var version = "2.7.4-next.4";
72
72
 
73
73
  //#endregion
74
74
  //#region src/utils/create-rule.ts
@@ -1443,7 +1443,7 @@ function create$33(context) {
1443
1443
  }, ({ left, right }) => {
1444
1444
  if (left.type === AST_NODE_TYPES.UnaryExpression && left.operator === "!") return getReportDescriptor(right);
1445
1445
  const initialScope = context.sourceCode.getScope(left);
1446
- if (left.type === AST_NODE_TYPES.Identifier && left.name === "NaN" || getStaticValue(left, initialScope)?.value === "NaN") return {
1446
+ if (AST.isNaN(left) || getStaticValue(left, initialScope)?.value === "NaN") return {
1447
1447
  messageId: "noLeakedConditionalRendering",
1448
1448
  node: left,
1449
1449
  data: { value: context.sourceCode.getText(left) }
@@ -1541,7 +1541,7 @@ function create$31(context) {
1541
1541
  const left = node.left;
1542
1542
  if (left.type !== AST_NODE_TYPES.MemberExpression) return false;
1543
1543
  const object = left.object;
1544
- return isInstanceIdEqual(context, id, object);
1544
+ return isAssignmentTargetEqual(context, id, object);
1545
1545
  })) context.report({
1546
1546
  messageId: "noMissingContextDisplayName",
1547
1547
  node: id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "2.7.4-next.2",
3
+ "version": "2.7.4-next.4",
4
4
  "description": "A set of composable ESLint rules for for libraries and frameworks that use React as a UI runtime.",
5
5
  "keywords": [
6
6
  "react",
@@ -46,11 +46,11 @@
46
46
  "string-ts": "^2.3.1",
47
47
  "ts-api-utils": "^2.4.0",
48
48
  "ts-pattern": "^5.9.0",
49
- "@eslint-react/ast": "2.7.4-next.2",
50
- "@eslint-react/core": "2.7.4-next.2",
51
- "@eslint-react/eff": "2.7.4-next.2",
52
- "@eslint-react/shared": "2.7.4-next.2",
53
- "@eslint-react/var": "2.7.4-next.2"
49
+ "@eslint-react/ast": "2.7.4-next.4",
50
+ "@eslint-react/core": "2.7.4-next.4",
51
+ "@eslint-react/eff": "2.7.4-next.4",
52
+ "@eslint-react/shared": "2.7.4-next.4",
53
+ "@eslint-react/var": "2.7.4-next.4"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/react": "^19.2.9",