@eslint-react/core
Advanced tools
Comparing version
@@ -137,3 +137,3 @@ import { RuleContext } from '@eslint-react/kit'; | ||
declare function getFunctionComponentIdentifier(context: RuleContext, node: AST.TSESTreeFunction): TSESTree.Identifier | TSESTree.Identifier[] | _; | ||
declare function getFunctionComponentId(context: RuleContext, node: AST.TSESTreeFunction): TSESTree.Identifier | TSESTree.Identifier[] | _; | ||
@@ -172,4 +172,4 @@ type ERComponentKind = "classComponent" | "functionComponent"; | ||
declare function isComponentNameLoose(name: string): boolean; | ||
declare function getComponentNameFromIdentifier(node: TSESTree.Identifier | TSESTree.Identifier[] | _): string | undefined; | ||
declare function hasNoneOrLooseComponentName(context: RuleContext, node: AST.TSESTreeFunction): boolean; | ||
declare function getComponentNameFromId(id: TSESTree.Identifier | TSESTree.Identifier[] | _): string | undefined; | ||
declare function hasNoneOrLooseComponentName(context: RuleContext, fn: AST.TSESTreeFunction): boolean; | ||
@@ -396,2 +396,2 @@ type EREffectPhaseKind = "cleanup" | "setup"; | ||
export { DEFAULT_COMPONENT_HINT, DISPLAY_NAME_ASSIGNMENT_SELECTOR, type ERClassComponent, type ERComponent, ERComponentFlag, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectPhaseKind, type ERFunctionComponent, type ERHook, type ERHookKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_HOOK_NAME, getComponentNameFromIdentifier, getFunctionComponentIdentifier, getInstanceId, hasNoneOrLooseComponentName, hasValidHierarchy, isAssignmentToThisState, isCallFromReact, isCallFromReactObject, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentName, isComponentNameLoose, isComponentWillUnmount, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactLoose, isFromReactObject, isFromReactStrict, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInsideRenderMethod, isInstanceIdEqual, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isReactHookNameLoose, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isThisSetState, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector }; | ||
export { DEFAULT_COMPONENT_HINT, DISPLAY_NAME_ASSIGNMENT_SELECTOR, type ERClassComponent, type ERComponent, ERComponentFlag, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectPhaseKind, type ERFunctionComponent, type ERHook, type ERHookKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE, RE_HOOK_NAME, getComponentNameFromId, getFunctionComponentId, getInstanceId, hasNoneOrLooseComponentName, hasValidHierarchy, isAssignmentToThisState, isCallFromReact, isCallFromReactObject, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentName, isComponentNameLoose, isComponentWillUnmount, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactLoose, isFromReactObject, isFromReactStrict, isFunctionOfComponentDidMount, isFunctionOfComponentWillUnmount, isFunctionOfRenderMethod, isFunctionOfUseEffectCleanup, isFunctionOfUseEffectSetup, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInsideRenderMethod, isInstanceIdEqual, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isReactHookNameLoose, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isThisSetState, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector }; |
@@ -865,3 +865,3 @@ 'use strict'; | ||
} | ||
function getFunctionComponentIdentifier(context, node) { | ||
function getFunctionComponentId(context, node) { | ||
const functionId = AST6__namespace.getFunctionIdentifier(node); | ||
@@ -888,8 +888,8 @@ if (functionId != null) { | ||
} | ||
function getComponentNameFromIdentifier(node) { | ||
if (node == null) return eff._; | ||
return Array.isArray(node) ? node.map((n) => n.name).join(".") : node.name; | ||
function getComponentNameFromId(id) { | ||
if (id == null) return eff._; | ||
return Array.isArray(id) ? id.map((n) => n.name).join(".") : id.name; | ||
} | ||
function hasNoneOrLooseComponentName(context, node) { | ||
const id = getFunctionComponentIdentifier(context, node); | ||
function hasNoneOrLooseComponentName(context, fn) { | ||
const id = getFunctionComponentId(context, fn); | ||
if (id == null) return true; | ||
@@ -1051,4 +1051,4 @@ const name = Array.isArray(id) ? id.at(-1)?.name : id.name; | ||
const initPath = AST6__namespace.getFunctionInitPath(entry.node); | ||
const id = getFunctionComponentIdentifier(context, entry.node); | ||
const name = getComponentNameFromIdentifier(id); | ||
const id = getFunctionComponentId(context, entry.node); | ||
const name = getComponentNameFromId(id); | ||
const key = shared.getId(); | ||
@@ -1093,4 +1093,4 @@ components.set(key, { | ||
const initPath = AST6__namespace.getFunctionInitPath(entry.node); | ||
const id = getFunctionComponentIdentifier(context, entry.node); | ||
const name = getComponentNameFromIdentifier(id); | ||
const id = getFunctionComponentId(context, entry.node); | ||
const name = getComponentNameFromId(id); | ||
components.set(entry.key, { | ||
@@ -1228,4 +1228,4 @@ id, | ||
exports.RE_HOOK_NAME = RE_HOOK_NAME; | ||
exports.getComponentNameFromIdentifier = getComponentNameFromIdentifier; | ||
exports.getFunctionComponentIdentifier = getFunctionComponentIdentifier; | ||
exports.getComponentNameFromId = getComponentNameFromId; | ||
exports.getFunctionComponentId = getFunctionComponentId; | ||
exports.getInstanceId = getInstanceId; | ||
@@ -1232,0 +1232,0 @@ exports.hasNoneOrLooseComponentName = hasNoneOrLooseComponentName; |
{ | ||
"name": "@eslint-react/core", | ||
"version": "1.38.2", | ||
"version": "1.38.3-next.0", | ||
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.", | ||
@@ -44,8 +44,8 @@ "homepage": "https://github.com/Rel1cx/eslint-react", | ||
"ts-pattern": "^5.6.2", | ||
"@eslint-react/ast": "1.38.2", | ||
"@eslint-react/eff": "1.38.2", | ||
"@eslint-react/jsx": "1.38.2", | ||
"@eslint-react/kit": "1.38.2", | ||
"@eslint-react/shared": "1.38.2", | ||
"@eslint-react/var": "1.38.2" | ||
"@eslint-react/ast": "1.38.3-next.0", | ||
"@eslint-react/eff": "1.38.3-next.0", | ||
"@eslint-react/jsx": "1.38.3-next.0", | ||
"@eslint-react/kit": "1.38.3-next.0", | ||
"@eslint-react/shared": "1.38.3-next.0", | ||
"@eslint-react/var": "1.38.3-next.0" | ||
}, | ||
@@ -52,0 +52,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
138472
-0.15%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed