eslint-plugin-react-x 2.7.5-next.1 → 2.7.5-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 +7 -7
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ 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, 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";
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, isHookCall, isHookName, isInitializedFromReact, isJsxFragmentElement, isJsxHostElement, isJsxText, isLazyCall, 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
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";
@@ -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.5-next.1";
71
+ var version = "2.7.5-next.4";
72
72
 
73
73
  //#endregion
74
74
  //#region src/utils/create-rule.ts
@@ -1835,7 +1835,7 @@ function create$27(context) {
1835
1835
  const classComponents = collectorLegacy.ctx.getAllComponents(program);
1836
1836
  for (const lazy of lazyComponentDeclarations) if (AST.findParentNode(lazy, (n) => {
1837
1837
  if (AST.isJSX(n)) return true;
1838
- if (n.type === AST_NODE_TYPES.CallExpression) return isReactHookCall(n) || isCreateElementCall(context, n) || isCreateContextCall(context, n);
1838
+ if (n.type === AST_NODE_TYPES.CallExpression) return isHookCall(n) || isCreateElementCall(context, n) || isCreateContextCall(context, n);
1839
1839
  if (AST.isFunction(n)) return functionComponents.some((c) => c.node === n);
1840
1840
  if (AST.isClass(n)) return classComponents.some((c) => c.node === n);
1841
1841
  return false;
@@ -2496,7 +2496,7 @@ function create$12(context) {
2496
2496
  const valueExpression = value.expression;
2497
2497
  const construction = getObjectType(valueExpression, context.sourceCode.getScope(valueExpression));
2498
2498
  if (construction == null) return;
2499
- if (isReactHookCall(construction.node)) return;
2499
+ if (isHookCall(construction.node)) return;
2500
2500
  getOrElseUpdate(constructions, functionEntry.node, () => []).push(construction);
2501
2501
  },
2502
2502
  "Program:exit"(program) {
@@ -2577,7 +2577,7 @@ function create$11(context, [options]) {
2577
2577
  const { right } = value;
2578
2578
  const construction = getObjectType(value, context.sourceCode.getScope(value));
2579
2579
  if (construction == null) continue;
2580
- if (isReactHookCall(construction.node)) continue;
2580
+ if (isHookCall(construction.node)) continue;
2581
2581
  if (safePatterns.length > 0) {
2582
2582
  const identifier = extractIdentifier(right);
2583
2583
  if (identifier != null && safePatterns.some((pattern) => pattern.test(identifier))) continue;
@@ -2969,7 +2969,7 @@ function create$7(context) {
2969
2969
  const hookCalls = /* @__PURE__ */ new Set();
2970
2970
  return {
2971
2971
  CallExpression(node) {
2972
- if (!isReactHookCall(node)) return;
2972
+ if (!isHookCall(node)) return;
2973
2973
  hookCalls.add(node);
2974
2974
  },
2975
2975
  ImportDeclaration(node) {
@@ -3353,7 +3353,7 @@ function create$1(context) {
3353
3353
  }
3354
3354
  for (const expr of AST.getNestedCallExpressions(useStateInput)) {
3355
3355
  if (!("name" in expr.callee)) continue;
3356
- if (isReactHookName(expr.callee.name)) continue;
3356
+ if (isHookName(expr.callee.name)) continue;
3357
3357
  if (ALLOW_LIST.includes(expr.callee.name)) continue;
3358
3358
  if (AST.findParentNode(expr, isUseCall) != null) continue;
3359
3359
  context.report({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "2.7.5-next.1",
3
+ "version": "2.7.5-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",
@@ -37,20 +37,20 @@
37
37
  "./package.json"
38
38
  ],
39
39
  "dependencies": {
40
- "@typescript-eslint/scope-manager": "^8.53.1",
41
- "@typescript-eslint/type-utils": "^8.53.1",
42
- "@typescript-eslint/types": "^8.53.1",
43
- "@typescript-eslint/utils": "^8.53.1",
40
+ "@typescript-eslint/scope-manager": "^8.54.0",
41
+ "@typescript-eslint/type-utils": "^8.54.0",
42
+ "@typescript-eslint/types": "^8.54.0",
43
+ "@typescript-eslint/utils": "^8.54.0",
44
44
  "compare-versions": "^6.1.1",
45
45
  "is-immutable-type": "^5.0.1",
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.5-next.1",
50
- "@eslint-react/core": "2.7.5-next.1",
51
- "@eslint-react/eff": "2.7.5-next.1",
52
- "@eslint-react/shared": "2.7.5-next.1",
53
- "@eslint-react/var": "2.7.5-next.1"
49
+ "@eslint-react/ast": "2.7.5-next.4",
50
+ "@eslint-react/core": "2.7.5-next.4",
51
+ "@eslint-react/eff": "2.7.5-next.4",
52
+ "@eslint-react/var": "2.7.5-next.4",
53
+ "@eslint-react/shared": "2.7.5-next.4"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/react": "^19.2.9",