@eslint-react/core 5.10.4 → 5.11.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 +7 -7
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Check, Extract, Traverse, is, isOneOf } from "@eslint-react/ast";
1
+ import { Check, Extract, Traverse } from "@eslint-react/ast";
2
2
  import { AST_NODE_TYPES } from "@typescript-eslint/types";
3
3
  import { randomBytes } from "node:crypto";
4
4
  import { DEFAULT_JSX_DETECTION_HINT, JsxDetectionHint } from "@eslint-react/jsx";
@@ -312,7 +312,7 @@ const isGetDerivedStateFromError = createLifecycleChecker("getDerivedStateFromEr
312
312
  * @deprecated Class components are legacy. This function exists only to support legacy rules.
313
313
  */
314
314
  function isRenderMethodLike(node) {
315
- return Check.isPropertyOrMethod(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name.startsWith("render") && isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression])(node.parent.parent);
315
+ return Check.isPropertyOrMethod(node) && node.key.type === AST_NODE_TYPES.Identifier && node.key.name.startsWith("render") && Check.isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression])(node.parent.parent);
316
316
  }
317
317
  function isRenderMethodCallback(node) {
318
318
  const parent = node.parent;
@@ -651,13 +651,13 @@ function isFunctionComponentDefinition(context, node, hint) {
651
651
  while (Check.isTypeExpression(parent)) parent = parent.parent;
652
652
  const parentCallee = parent.type === AST_NODE_TYPES.CallExpression ? Extract.unwrap(parent.callee) : null;
653
653
  switch (true) {
654
- case isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(node) && parent.type === AST_NODE_TYPES.Property && parent.parent.type === AST_NODE_TYPES.ObjectExpression:
654
+ case Check.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(node) && parent.type === AST_NODE_TYPES.Property && parent.parent.type === AST_NODE_TYPES.ObjectExpression:
655
655
  if (hint & FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsObjectMethod) return false;
656
656
  break;
657
- case isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(node) && parent.type === AST_NODE_TYPES.MethodDefinition:
657
+ case Check.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(node) && parent.type === AST_NODE_TYPES.MethodDefinition:
658
658
  if (hint & FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsClassMethod) return false;
659
659
  break;
660
- case isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(node) && parent.type === AST_NODE_TYPES.Property:
660
+ case Check.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(node) && parent.type === AST_NODE_TYPES.Property:
661
661
  if (hint & FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsClassProperty) return false;
662
662
  break;
663
663
  case parent.type === AST_NODE_TYPES.ArrayPattern:
@@ -676,7 +676,7 @@ function isFunctionComponentDefinition(context, node, hint) {
676
676
  if (hint & FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArbitraryCallExpressionCallback) return false;
677
677
  break;
678
678
  }
679
- const significantParent = Traverse.findParent(node, isOneOf([
679
+ const significantParent = Traverse.findParent(node, Check.isOneOf([
680
680
  AST_NODE_TYPES.JSXExpressionContainer,
681
681
  AST_NODE_TYPES.ArrowFunctionExpression,
682
682
  AST_NODE_TYPES.FunctionExpression,
@@ -807,7 +807,7 @@ function isUseEffectSetupCallback(node) {
807
807
  function isUseEffectCleanupCallback(node) {
808
808
  if (node == null) return false;
809
809
  const expr = Extract.unwrap(node);
810
- const returnStatement = Traverse.findParent(expr, is(AST_NODE_TYPES.ReturnStatement));
810
+ const returnStatement = Traverse.findParent(expr, Check.is(AST_NODE_TYPES.ReturnStatement));
811
811
  const enclosingFunction = Traverse.findParent(expr, Check.isFunction);
812
812
  if (enclosingFunction !== Traverse.findParent(returnStatement, Check.isFunction)) return false;
813
813
  return isUseEffectSetupCallback(enclosingFunction);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "5.10.4",
3
+ "version": "5.11.2",
4
4
  "description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -33,11 +33,11 @@
33
33
  "@typescript-eslint/types": "^8.62.1",
34
34
  "@typescript-eslint/utils": "^8.62.1",
35
35
  "ts-pattern": "^5.9.0",
36
- "@eslint-react/eslint": "5.10.4",
37
- "@eslint-react/ast": "5.10.4",
38
- "@eslint-react/jsx": "5.10.4",
39
- "@eslint-react/var": "5.10.4",
40
- "@eslint-react/shared": "5.10.4"
36
+ "@eslint-react/ast": "5.11.2",
37
+ "@eslint-react/eslint": "5.11.2",
38
+ "@eslint-react/jsx": "5.11.2",
39
+ "@eslint-react/var": "5.11.2",
40
+ "@eslint-react/shared": "5.11.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@typescript-eslint/parser": "^8.62.1",
@@ -46,8 +46,8 @@
46
46
  "tsdown": "^0.22.3",
47
47
  "typescript": "6.0.3",
48
48
  "vitest": "^4.1.9",
49
- "@local/configs": "0.0.0",
50
- "@local/eff": "0.0.0"
49
+ "@local/eff": "0.0.0",
50
+ "@local/configs": "0.0.0"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "eslint": "*",