@eslint-react/core 3.0.0-next.80 → 3.0.0-next.81

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 +4 -4
package/dist/index.js CHANGED
@@ -396,11 +396,11 @@ function isUseEffectLikeCall(node, additionalEffectHooks = { test: constFalse })
396
396
  function isUseStateLikeCall(node, additionalStateHooks = { test: constFalse }) {
397
397
  if (node == null) return false;
398
398
  if (node.type !== AST_NODE_TYPES.CallExpression) return false;
399
- return [/^use\w*State$/u, additionalStateHooks].some((regexp) => {
400
- if (node.callee.type === AST_NODE_TYPES.Identifier) return regexp.test(node.callee.name);
401
- if (node.callee.type === AST_NODE_TYPES.MemberExpression) return node.callee.property.type === AST_NODE_TYPES.Identifier && regexp.test(node.callee.property.name);
402
- return false;
403
- });
399
+ switch (true) {
400
+ case node.callee.type === AST_NODE_TYPES.Identifier: return node.callee.name === "useState" || additionalStateHooks.test(node.callee.name);
401
+ case node.callee.type === AST_NODE_TYPES.MemberExpression && node.callee.property.type === AST_NODE_TYPES.Identifier: return ast.getPropertyName(node.callee.property) === "useState" || additionalStateHooks.test(node.callee.property.name);
402
+ }
403
+ return false;
404
404
  }
405
405
  const isUseCall = flip(isHookCallWithName)("use");
406
406
  const isUseActionStateCall = flip(isHookCallWithName)("useActionState");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "3.0.0-next.80",
3
+ "version": "3.0.0-next.81",
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": {
@@ -34,9 +34,9 @@
34
34
  "@typescript-eslint/types": "canary",
35
35
  "@typescript-eslint/utils": "canary",
36
36
  "ts-pattern": "^5.9.0",
37
- "@eslint-react/ast": "3.0.0-next.80",
38
- "@eslint-react/shared": "3.0.0-next.80",
39
- "@eslint-react/var": "3.0.0-next.80"
37
+ "@eslint-react/ast": "3.0.0-next.81",
38
+ "@eslint-react/shared": "3.0.0-next.81",
39
+ "@eslint-react/var": "3.0.0-next.81"
40
40
  },
41
41
  "devDependencies": {
42
42
  "tsdown": "^0.21.0",