@eslint-react/core 2.7.5-next.3 → 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.
package/dist/index.d.ts CHANGED
@@ -127,21 +127,6 @@ declare const ComponentDetectionHint: {
127
127
  */
128
128
  declare const DEFAULT_COMPONENT_DETECTION_HINT: bigint;
129
129
  //#endregion
130
- //#region src/component/component-phase.d.ts
131
- type ComponentEffectPhaseKind = "cleanup" | "setup";
132
- type ComponentLifecyclePhaseKind = "mount" | "unmount";
133
- type ComponentPhaseKind = ComponentEffectPhaseKind | ComponentLifecyclePhaseKind;
134
- declare const ComponentPhaseRelevance: birecord0.BiRecord<{
135
- readonly mount: "unmount";
136
- readonly setup: "cleanup";
137
- }>;
138
- //#endregion
139
- //#region src/semantic/semantic-entry.d.ts
140
- interface SemanticEntry {
141
- node: TSESTree.Node;
142
- phase: ComponentPhaseKind;
143
- }
144
- //#endregion
145
130
  //#region src/semantic/semantic-node.d.ts
146
131
  interface SemanticNode {
147
132
  id: unit | TSESTree.Node;
@@ -153,6 +138,18 @@ interface SemanticNode {
153
138
  hint: bigint;
154
139
  }
155
140
  //#endregion
141
+ //#region src/semantic/semantic-func.d.ts
142
+ interface SemanticFunc extends SemanticNode {
143
+ id: AST.FunctionID | unit;
144
+ node: AST.TSESTreeFunction;
145
+ name: string | unit;
146
+ type: TSESTree.TSTypeAnnotation | unit;
147
+ body: TSESTree.BlockStatement | TSESTree.Expression;
148
+ directives: TSESTree.StringLiteral[];
149
+ parameters: TSESTree.Parameter[];
150
+ typeParameters: TSESTree.TSTypeParameterDeclaration | unit;
151
+ }
152
+ //#endregion
156
153
  //#region src/component/component-flag.d.ts
157
154
  type ComponentFlag = bigint;
158
155
  declare const ComponentFlag: {
@@ -250,7 +247,7 @@ interface ClassComponent extends SemanticNode {
250
247
  /**
251
248
  * Union type representing either a class or function component
252
249
  */
253
- type ReactComponent = ClassComponent | FunctionComponent;
250
+ type Component = ClassComponent | FunctionComponent;
254
251
  //#endregion
255
252
  //#region src/component/component-collector.d.ts
256
253
  type FunctionEntry$1 = {
@@ -400,6 +397,15 @@ declare function isComponentNameLoose(name: string): boolean;
400
397
  */
401
398
  declare function hasNoneOrLooseComponentName(context: RuleContext, fn: AST.TSESTreeFunction): boolean;
402
399
  //#endregion
400
+ //#region src/component/component-phase.d.ts
401
+ type ComponentEffectPhaseKind = "cleanup" | "setup";
402
+ type ComponentLifecyclePhaseKind = "mount" | "unmount";
403
+ type ComponentPhaseKind = ComponentEffectPhaseKind | ComponentLifecyclePhaseKind;
404
+ declare const ComponentPhaseRelevance: birecord0.BiRecord<{
405
+ readonly mount: "unmount";
406
+ readonly setup: "cleanup";
407
+ }>;
408
+ //#endregion
403
409
  //#region src/component/component-phase-helpers.d.ts
404
410
  declare const isInversePhase: {
405
411
  (a: ComponentPhaseKind): (b: ComponentPhaseKind) => boolean;
@@ -503,18 +509,6 @@ declare function isComponentWrapperCallback(context: RuleContext, node: TSESTree
503
509
  */
504
510
  declare function isComponentWrapperCallbackLoose(context: RuleContext, node: TSESTree.Node): boolean;
505
511
  //#endregion
506
- //#region src/function/function-semantic-node.d.ts
507
- interface ReactFunction extends SemanticNode {
508
- id: AST.FunctionID | unit;
509
- node: AST.TSESTreeFunction;
510
- name: string | unit;
511
- type: TSESTree.TSTypeAnnotation | unit;
512
- body: TSESTree.BlockStatement | TSESTree.Expression;
513
- directives: TSESTree.StringLiteral[];
514
- parameters: TSESTree.Parameter[];
515
- typeParameters: TSESTree.TSTypeParameterDeclaration | unit;
516
- }
517
- //#endregion
518
512
  //#region src/hierarchy/find-enclosing-component-or-hook.d.ts
519
513
  type FindEnclosingComponentOrHookFilter = (n: TSESTree.Node, name: string | null) => boolean;
520
514
  /**
@@ -523,7 +517,7 @@ type FindEnclosingComponentOrHookFilter = (n: TSESTree.Node, name: string | null
523
517
  * @param test Optional test function to customize component or hook identification
524
518
  * @returns The enclosing component or hook node, or `null` if none is found
525
519
  */
526
- declare function findEnclosingComponentOrHook(node: TSESTree.Node | unit, test?: FindEnclosingComponentOrHookFilter): TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | undefined;
520
+ declare function findEnclosingComponentOrHook(node: TSESTree.Node | unit, test?: FindEnclosingComponentOrHookFilter): TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression | undefined;
527
521
  //#endregion
528
522
  //#region src/hierarchy/is-inside-component-or-hook.d.ts
529
523
  /**
@@ -546,7 +540,7 @@ declare function isUseEffectSetupCallback(node: TSESTree.Node | unit): boolean;
546
540
  declare function isUseEffectCleanupCallback(node: TSESTree.Node | unit): boolean;
547
541
  //#endregion
548
542
  //#region src/hook/hook-semantic-node.d.ts
549
- interface ReactHook extends SemanticNode {
543
+ interface Hook extends SemanticNode {
550
544
  id: AST.FunctionID | unit;
551
545
  node: AST.TSESTreeFunction;
552
546
  name: string;
@@ -562,7 +556,7 @@ type FunctionEntry = {
562
556
  declare namespace useHookCollector {
563
557
  type ReturnType = {
564
558
  ctx: {
565
- getAllHooks(node: TSESTree$1.Program): ReactHook[];
559
+ getAllHooks(node: TSESTree$1.Program): Hook[];
566
560
  getCurrentEntries(): FunctionEntry[];
567
561
  getCurrentEntry(): FunctionEntry | unit;
568
562
  };
@@ -577,7 +571,7 @@ declare namespace useHookCollector {
577
571
  declare function useHookCollector(context: RuleContext): useHookCollector.ReturnType;
578
572
  //#endregion
579
573
  //#region src/hook/hook-id.d.ts
580
- declare function isReactHookId(id: TSESTree.Node): id is TSESTree.Identifier | TSESTree.MemberExpression;
574
+ declare function isHookId(id: TSESTree.Node): id is TSESTree.Identifier | TSESTree.MemberExpression;
581
575
  //#endregion
582
576
  //#region src/hook/hook-is.d.ts
583
577
  /**
@@ -585,20 +579,20 @@ declare function isReactHookId(id: TSESTree.Node): id is TSESTree.Identifier | T
585
579
  * @param node The function node to check
586
580
  * @returns True if the function is a React Hook, false otherwise
587
581
  */
588
- declare function isReactHook(node: AST.TSESTreeFunction | unit): boolean;
582
+ declare function isHook(node: AST.TSESTreeFunction | unit): boolean;
589
583
  /**
590
584
  * Check if the given node is a React Hook call by its name.
591
585
  * @param node The node to check.
592
586
  * @returns `true` if the node is a React Hook call, `false` otherwise.
593
587
  */
594
- declare function isReactHookCall(node: TSESTree.Node | unit): node is TSESTree.CallExpression;
588
+ declare function isHookCall(node: TSESTree.Node | unit): node is TSESTree.CallExpression;
595
589
  /**
596
590
  * Checks if a node is a call to a specific React hook.
597
591
  * Returns a function that accepts a hook name to check against.
598
592
  * @param node The AST node to check
599
593
  * @returns A function that takes a hook name and returns boolean
600
594
  */
601
- declare function isReactHookCallWithName(node: TSESTree.Node | unit): (name: string) => boolean;
595
+ declare function isHookCallWithName(node: TSESTree.Node | unit): (name: string) => boolean;
602
596
  /**
603
597
  * Detects useEffect calls and variations (useLayoutEffect, etc.) using regex pattern.
604
598
  * @param node The AST node to check
@@ -641,7 +635,7 @@ declare const REACT_BUILTIN_HOOK_NAMES: readonly ["use", "useActionState", "useC
641
635
  * @param name The name of the identifier to check.
642
636
  * @see https://github.com/facebook/react/blob/1d6c8168db1d82713202e842df3167787ffa00ed/packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts#L16
643
637
  */
644
- declare function isReactHookName(name: string): boolean;
638
+ declare function isHookName(name: string): boolean;
645
639
  //#endregion
646
640
  //#region src/jsx/jsx-attribute.d.ts
647
641
  /**
@@ -707,7 +701,7 @@ declare function resolveJsxAttributeValue(context: RuleContext, attribute: AST.T
707
701
  readonly toStatic: () => string | number | bigint | boolean | RegExp | null;
708
702
  } | {
709
703
  readonly kind: "expression";
710
- readonly node: TSESTree.Expression | TSESTree.JSXEmptyExpression;
704
+ readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
711
705
  readonly toStatic: () => unknown;
712
706
  } | {
713
707
  readonly kind: "element";
@@ -715,7 +709,7 @@ declare function resolveJsxAttributeValue(context: RuleContext, attribute: AST.T
715
709
  readonly toStatic: () => undefined;
716
710
  } | {
717
711
  readonly kind: "spreadChild";
718
- readonly node: TSESTree.Expression | TSESTree.JSXEmptyExpression;
712
+ readonly node: TSESTree.JSXEmptyExpression | TSESTree.Expression;
719
713
  readonly toStatic: () => undefined;
720
714
  } | {
721
715
  readonly kind: "spreadProps";
@@ -871,4 +865,4 @@ declare function isInitializedFromRef(name: string, initialScope: Scope): boolea
871
865
  */
872
866
  declare function isRefName(name: string): boolean;
873
867
  //#endregion
874
- export { ClassComponent, ComponentDetectionHint, ComponentEffectPhaseKind, ComponentFlag, ComponentKind, ComponentLifecyclePhaseKind, ComponentPhaseKind, ComponentPhaseRelevance, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, FindEnclosingComponentOrHookFilter, FunctionComponent, JsxAttributeValue, JsxConfig, JsxDetectionHint, JsxEmit, REACT_BUILTIN_HOOK_NAMES, ReactComponent, ReactFunction, ReactHook, SemanticEntry, SemanticNode, findEnclosingComponentOrHook, findParentJsxAttribute, getComponentFlagFromInitPath, getFunctionComponentId, getJsxAttribute, getJsxAttributeName, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, getPhaseKindOfFunction, hasNoneOrLooseComponentName, isAssignmentToThisState, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDefinition, isComponentDidCatch, isComponentDidMount, isComponentDidMountCallback, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUnmountCallback, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isComponentWrapperCallback, isComponentWrapperCallbackLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isInitializedFromReact, isInitializedFromReactNative, isInitializedFromRef, isInsideComponentOrHook, isInversePhase, isJsxFragmentElement, isJsxHostElement, isJsxLike, isJsxText, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookId, isReactHookName, isRefName, isRender, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStoreCall, isUseTransitionCall, resolveJsxAttributeValue, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
868
+ export { ClassComponent, Component, ComponentDetectionHint, ComponentEffectPhaseKind, ComponentFlag, ComponentKind, ComponentLifecyclePhaseKind, ComponentPhaseKind, ComponentPhaseRelevance, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, FindEnclosingComponentOrHookFilter, FunctionComponent, Hook, JsxAttributeValue, JsxConfig, JsxDetectionHint, JsxEmit, REACT_BUILTIN_HOOK_NAMES, SemanticFunc, SemanticNode, findEnclosingComponentOrHook, findParentJsxAttribute, getComponentFlagFromInitPath, getFunctionComponentId, getJsxAttribute, getJsxAttributeName, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, getPhaseKindOfFunction, hasNoneOrLooseComponentName, isAssignmentToThisState, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDefinition, isComponentDidCatch, isComponentDidMount, isComponentDidMountCallback, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUnmountCallback, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isComponentWrapperCallback, isComponentWrapperCallbackLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHook, isHookCall, isHookCallWithName, isHookId, isHookName, isInitializedFromReact, isInitializedFromReactNative, isInitializedFromRef, isInsideComponentOrHook, isInversePhase, isJsxFragmentElement, isJsxHostElement, isJsxLike, isJsxText, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isRefName, isRender, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStoreCall, isUseTransitionCall, resolveJsxAttributeValue, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
package/dist/index.js CHANGED
@@ -124,7 +124,7 @@ const REACT_BUILTIN_HOOK_NAMES = [
124
124
  * @param name The name of the identifier to check.
125
125
  * @see https://github.com/facebook/react/blob/1d6c8168db1d82713202e842df3167787ffa00ed/packages/eslint-plugin-react-hooks/src/rules/RulesOfHooks.ts#L16
126
126
  */
127
- function isReactHookName(name) {
127
+ function isHookName(name) {
128
128
  return name === "use" || /^use[A-Z0-9]/.test(name);
129
129
  }
130
130
 
@@ -135,12 +135,12 @@ function isReactHookName(name) {
135
135
  * @param node The function node to check
136
136
  * @returns True if the function is a React Hook, false otherwise
137
137
  */
138
- function isReactHook(node) {
138
+ function isHook(node) {
139
139
  if (node == null) return false;
140
140
  const id = AST.getFunctionId(node);
141
141
  switch (id?.type) {
142
- case AST_NODE_TYPES.Identifier: return isReactHookName(id.name);
143
- case AST_NODE_TYPES.MemberExpression: return "name" in id.property && isReactHookName(id.property.name);
142
+ case AST_NODE_TYPES.Identifier: return isHookName(id.name);
143
+ case AST_NODE_TYPES.MemberExpression: return "name" in id.property && isHookName(id.property.name);
144
144
  default: return false;
145
145
  }
146
146
  }
@@ -149,11 +149,11 @@ function isReactHook(node) {
149
149
  * @param node The node to check.
150
150
  * @returns `true` if the node is a React Hook call, `false` otherwise.
151
151
  */
152
- function isReactHookCall(node) {
152
+ function isHookCall(node) {
153
153
  if (node == null) return false;
154
154
  if (node.type !== AST_NODE_TYPES.CallExpression) return false;
155
- if (node.callee.type === AST_NODE_TYPES.Identifier) return isReactHookName(node.callee.name);
156
- if (node.callee.type === AST_NODE_TYPES.MemberExpression) return node.callee.property.type === AST_NODE_TYPES.Identifier && isReactHookName(node.callee.property.name);
155
+ if (node.callee.type === AST_NODE_TYPES.Identifier) return isHookName(node.callee.name);
156
+ if (node.callee.type === AST_NODE_TYPES.MemberExpression) return node.callee.property.type === AST_NODE_TYPES.Identifier && isHookName(node.callee.property.name);
157
157
  return false;
158
158
  }
159
159
  /**
@@ -162,7 +162,7 @@ function isReactHookCall(node) {
162
162
  * @param node The AST node to check
163
163
  * @returns A function that takes a hook name and returns boolean
164
164
  */
165
- function isReactHookCallWithName(node) {
165
+ function isHookCallWithName(node) {
166
166
  if (node == null || node.type !== AST_NODE_TYPES.CallExpression) return constFalse;
167
167
  return (name) => {
168
168
  switch (node.callee.type) {
@@ -202,25 +202,25 @@ function isUseStateLikeCall(node, additionalStateHooks = { test: constFalse }) {
202
202
  return false;
203
203
  });
204
204
  }
205
- const isUseCall = flip(isReactHookCallWithName)("use");
206
- const isUseActionStateCall = flip(isReactHookCallWithName)("useActionState");
207
- const isUseCallbackCall = flip(isReactHookCallWithName)("useCallback");
208
- const isUseContextCall = flip(isReactHookCallWithName)("useContext");
209
- const isUseDebugValueCall = flip(isReactHookCallWithName)("useDebugValue");
210
- const isUseDeferredValueCall = flip(isReactHookCallWithName)("useDeferredValue");
211
- const isUseEffectCall = flip(isReactHookCallWithName)("useEffect");
212
- const isUseFormStatusCall = flip(isReactHookCallWithName)("useFormStatus");
213
- const isUseIdCall = flip(isReactHookCallWithName)("useId");
214
- const isUseImperativeHandleCall = flip(isReactHookCallWithName)("useImperativeHandle");
215
- const isUseInsertionEffectCall = flip(isReactHookCallWithName)("useInsertionEffect");
216
- const isUseLayoutEffectCall = flip(isReactHookCallWithName)("useLayoutEffect");
217
- const isUseMemoCall = flip(isReactHookCallWithName)("useMemo");
218
- const isUseOptimisticCall = flip(isReactHookCallWithName)("useOptimistic");
219
- const isUseReducerCall = flip(isReactHookCallWithName)("useReducer");
220
- const isUseRefCall = flip(isReactHookCallWithName)("useRef");
221
- const isUseStateCall = flip(isReactHookCallWithName)("useState");
222
- const isUseSyncExternalStoreCall = flip(isReactHookCallWithName)("useSyncExternalStore");
223
- const isUseTransitionCall = flip(isReactHookCallWithName)("useTransition");
205
+ const isUseCall = flip(isHookCallWithName)("use");
206
+ const isUseActionStateCall = flip(isHookCallWithName)("useActionState");
207
+ const isUseCallbackCall = flip(isHookCallWithName)("useCallback");
208
+ const isUseContextCall = flip(isHookCallWithName)("useContext");
209
+ const isUseDebugValueCall = flip(isHookCallWithName)("useDebugValue");
210
+ const isUseDeferredValueCall = flip(isHookCallWithName)("useDeferredValue");
211
+ const isUseEffectCall = flip(isHookCallWithName)("useEffect");
212
+ const isUseFormStatusCall = flip(isHookCallWithName)("useFormStatus");
213
+ const isUseIdCall = flip(isHookCallWithName)("useId");
214
+ const isUseImperativeHandleCall = flip(isHookCallWithName)("useImperativeHandle");
215
+ const isUseInsertionEffectCall = flip(isHookCallWithName)("useInsertionEffect");
216
+ const isUseLayoutEffectCall = flip(isHookCallWithName)("useLayoutEffect");
217
+ const isUseMemoCall = flip(isHookCallWithName)("useMemo");
218
+ const isUseOptimisticCall = flip(isHookCallWithName)("useOptimistic");
219
+ const isUseReducerCall = flip(isHookCallWithName)("useReducer");
220
+ const isUseRefCall = flip(isHookCallWithName)("useRef");
221
+ const isUseStateCall = flip(isHookCallWithName)("useState");
222
+ const isUseSyncExternalStoreCall = flip(isHookCallWithName)("useSyncExternalStore");
223
+ const isUseTransitionCall = flip(isHookCallWithName)("useTransition");
224
224
 
225
225
  //#endregion
226
226
  //#region src/hook/hook-callback.ts
@@ -246,10 +246,10 @@ function isUseEffectCleanupCallback(node) {
246
246
 
247
247
  //#endregion
248
248
  //#region src/hook/hook-id.ts
249
- function isReactHookId(id) {
249
+ function isHookId(id) {
250
250
  switch (id.type) {
251
- case AST_NODE_TYPES.Identifier: return isReactHookName(id.name);
252
- case AST_NODE_TYPES.MemberExpression: return "name" in id.property && isReactHookName(id.property.name);
251
+ case AST_NODE_TYPES.Identifier: return isHookName(id.name);
252
+ case AST_NODE_TYPES.MemberExpression: return "name" in id.property && isHookName(id.property.name);
253
253
  default: return false;
254
254
  }
255
255
  }
@@ -270,7 +270,7 @@ function useHookCollector(context) {
270
270
  const onFunctionEnter = (node) => {
271
271
  const id = AST.getFunctionId(node);
272
272
  const key = idGen$2.next();
273
- if (id != null && isReactHookId(id)) {
273
+ if (id != null && isHookId(id)) {
274
274
  functionEntries.push({
275
275
  key,
276
276
  node,
@@ -309,7 +309,7 @@ function useHookCollector(context) {
309
309
  ":function": onFunctionEnter,
310
310
  ":function:exit": onFunctionExit,
311
311
  CallExpression(node) {
312
- if (!isReactHookCall(node)) return;
312
+ if (!isHookCall(node)) return;
313
313
  const fEntry = getCurrentEntry();
314
314
  if (fEntry?.key == null) return;
315
315
  const hook = hooks.get(fEntry.key);
@@ -1004,7 +1004,7 @@ function useComponentCollector(context, options = {}) {
1004
1004
  component.displayName = right;
1005
1005
  } } : {},
1006
1006
  ...collectHookCalls ? { "CallExpression:exit"(node) {
1007
- if (!isReactHookCall(node)) return;
1007
+ if (!isHookCall(node)) return;
1008
1008
  const entry = getCurrentEntry();
1009
1009
  if (entry == null) return;
1010
1010
  entry.hookCalls.push(node);
@@ -1248,7 +1248,7 @@ function isDeclaredInRenderPropLoose(node) {
1248
1248
  */
1249
1249
  function findEnclosingComponentOrHook(node, test = (n, name) => {
1250
1250
  if (name == null) return false;
1251
- return isComponentNameLoose(name) || isReactHookName(name);
1251
+ return isComponentNameLoose(name) || isHookName(name);
1252
1252
  }) {
1253
1253
  const enclosingNode = AST.findParentNode(node, (n) => {
1254
1254
  if (!AST.isFunction(n)) return false;
@@ -1304,4 +1304,4 @@ function isInitializedFromRef(name, initialScope) {
1304
1304
  }
1305
1305
 
1306
1306
  //#endregion
1307
- export { ComponentDetectionHint, ComponentFlag, ComponentPhaseRelevance, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, JsxDetectionHint, JsxEmit, REACT_BUILTIN_HOOK_NAMES, findEnclosingComponentOrHook, findParentJsxAttribute, getComponentFlagFromInitPath, getFunctionComponentId, getJsxAttribute, getJsxAttributeName, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, getPhaseKindOfFunction, hasNoneOrLooseComponentName, isAssignmentToThisState, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDefinition, isComponentDidCatch, isComponentDidMount, isComponentDidMountCallback, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUnmountCallback, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isComponentWrapperCallback, isComponentWrapperCallbackLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isInitializedFromReact, isInitializedFromReactNative, isInitializedFromRef, isInsideComponentOrHook, isInversePhase, isJsxFragmentElement, isJsxHostElement, isJsxLike, isJsxText, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookId, isReactHookName, isRefName, isRender, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStoreCall, isUseTransitionCall, resolveJsxAttributeValue, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
1307
+ export { ComponentDetectionHint, ComponentFlag, ComponentPhaseRelevance, DEFAULT_COMPONENT_DETECTION_HINT, DEFAULT_JSX_DETECTION_HINT, JsxDetectionHint, JsxEmit, REACT_BUILTIN_HOOK_NAMES, findEnclosingComponentOrHook, findParentJsxAttribute, getComponentFlagFromInitPath, getFunctionComponentId, getJsxAttribute, getJsxAttributeName, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, getPhaseKindOfFunction, hasNoneOrLooseComponentName, isAssignmentToThisState, isCaptureOwnerStack, isCaptureOwnerStackCall, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElement, isCloneElementCall, isComponentDefinition, isComponentDidCatch, isComponentDidMount, isComponentDidMountCallback, isComponentDidUpdate, isComponentName, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUnmount, isComponentWillUnmountCallback, isComponentWillUpdate, isComponentWrapperCall, isComponentWrapperCallLoose, isComponentWrapperCallback, isComponentWrapperCallbackLoose, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isGetChildContext, isGetDefaultProps, isGetDerivedStateFromError, isGetDerivedStateFromProps, isGetInitialState, isGetSnapshotBeforeUpdate, isHook, isHookCall, isHookCallWithName, isHookId, isHookName, isInitializedFromReact, isInitializedFromReactNative, isInitializedFromRef, isInsideComponentOrHook, isInversePhase, isJsxFragmentElement, isJsxHostElement, isJsxLike, isJsxText, isLazy, isLazyCall, isMemo, isMemoCall, isPureComponent, isReactAPI, isReactAPICall, isRefName, isRender, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isShouldComponentUpdate, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseActionStateCall, isUseCall, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCleanupCallback, isUseEffectLikeCall, isUseEffectSetupCallback, isUseFormStatusCall, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseOptimisticCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseStateLikeCall, isUseSyncExternalStoreCall, isUseTransitionCall, resolveJsxAttributeValue, stringifyJsx, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "2.7.5-next.3",
3
+ "version": "2.7.5-next.4",
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": {
@@ -35,10 +35,10 @@
35
35
  "@typescript-eslint/utils": "^8.54.0",
36
36
  "birecord": "^0.1.1",
37
37
  "ts-pattern": "^5.9.0",
38
- "@eslint-react/eff": "2.7.5-next.3",
39
- "@eslint-react/var": "2.7.5-next.3",
40
- "@eslint-react/ast": "2.7.5-next.3",
41
- "@eslint-react/shared": "2.7.5-next.3"
38
+ "@eslint-react/ast": "2.7.5-next.4",
39
+ "@eslint-react/eff": "2.7.5-next.4",
40
+ "@eslint-react/shared": "2.7.5-next.4",
41
+ "@eslint-react/var": "2.7.5-next.4"
42
42
  },
43
43
  "devDependencies": {
44
44
  "tsdown": "^0.20.1",