eslint-plugin-react-x 2.2.3 → 2.2.4-beta.2

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 +9 -6
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { isFalseLiteralType, isTrueLiteralType, isTypeFlagSet, unionConstituents
5
5
  import { P, isMatching, match } from "ts-pattern";
6
6
  import ts from "typescript";
7
7
  import * as AST from "@eslint-react/ast";
8
- import { ConstructionDetectionHint, findVariable, getChildScopes, getConstruction, getVariableDefinitionNode } from "@eslint-react/var";
8
+ import { findVariable, getChildScopes, getObjectType, getVariableDefinitionNode } from "@eslint-react/var";
9
9
  import { ComponentDetectionHint, ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit, findParentJsxAttribute, getInstanceId, 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, isRenderMethodLike, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseCall, isUseCallbackCall, isUseContextCall, isUseMemoCall, isUseStateCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector } from "@eslint-react/core";
10
10
  import { constFalse, constTrue, flow, getOrElseUpdate, identity, unit } from "@eslint-react/eff";
11
11
  import { compare } from "compare-versions";
@@ -28,7 +28,7 @@ var __export = (all) => {
28
28
  //#endregion
29
29
  //#region package.json
30
30
  var name$6 = "eslint-plugin-react-x";
31
- var version = "2.2.3";
31
+ var version = "2.2.4-beta.2";
32
32
 
33
33
  //#endregion
34
34
  //#region src/utils/create-rule.ts
@@ -2558,7 +2558,7 @@ function create$11(context) {
2558
2558
  const value = attribute.value;
2559
2559
  if (value?.type !== AST_NODE_TYPES.JSXExpressionContainer) return;
2560
2560
  const valueExpression = value.expression;
2561
- const construction = getConstruction(valueExpression, context.sourceCode.getScope(valueExpression));
2561
+ const construction = getObjectType(valueExpression, context.sourceCode.getScope(valueExpression));
2562
2562
  if (construction == null) return;
2563
2563
  if (isReactHookCall(construction.node)) return;
2564
2564
  getOrElseUpdate(constructions, functionEntry.node, () => []).push(construction);
@@ -2567,7 +2567,7 @@ function create$11(context) {
2567
2567
  const components = ctx.getAllComponents(program).values();
2568
2568
  for (const { node: component } of components) for (const construction of constructions.get(component) ?? []) {
2569
2569
  const { kind, node: constructionNode } = construction;
2570
- const suggestion = kind.startsWith("Function") ? "Consider wrapping it in a useCallback hook." : "Consider wrapping it in a useMemo hook.";
2570
+ const suggestion = kind === "function" ? "Consider wrapping it in a useCallback hook." : "Consider wrapping it in a useMemo hook.";
2571
2571
  context.report({
2572
2572
  messageId: "unstableContextValue",
2573
2573
  node: constructionNode,
@@ -2627,7 +2627,7 @@ function create$10(context) {
2627
2627
  if (prop.type !== AST_NODE_TYPES.Property || prop.value.type !== AST_NODE_TYPES.AssignmentPattern) continue;
2628
2628
  const { value } = prop;
2629
2629
  const { right } = value;
2630
- const construction = getConstruction(value, context.sourceCode.getScope(value), ConstructionDetectionHint.StrictCallExpression);
2630
+ const construction = getObjectType(value, context.sourceCode.getScope(value));
2631
2631
  if (construction == null) continue;
2632
2632
  if (isReactHookCall(construction.node)) continue;
2633
2633
  const forbiddenType = AST.toDelimiterFormat(right);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "2.2.3",
3
+ "version": "2.2.4-beta.2",
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",
@@ -29,6 +29,9 @@
29
29
  },
30
30
  "./package.json": "./package.json"
31
31
  },
32
+ "main": "./dist/index.js",
33
+ "module": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
32
35
  "files": [
33
36
  "dist",
34
37
  "./package.json"
@@ -43,11 +46,11 @@
43
46
  "string-ts": "^2.2.1",
44
47
  "ts-api-utils": "^2.1.0",
45
48
  "ts-pattern": "^5.8.0",
46
- "@eslint-react/ast": "2.2.3",
47
- "@eslint-react/core": "2.2.3",
48
- "@eslint-react/eff": "2.2.3",
49
- "@eslint-react/shared": "2.2.3",
50
- "@eslint-react/var": "2.2.3"
49
+ "@eslint-react/ast": "2.2.4-beta.2",
50
+ "@eslint-react/core": "2.2.4-beta.2",
51
+ "@eslint-react/eff": "2.2.4-beta.2",
52
+ "@eslint-react/shared": "2.2.4-beta.2",
53
+ "@eslint-react/var": "2.2.4-beta.2"
51
54
  },
52
55
  "devDependencies": {
53
56
  "@types/react": "^19.2.2",