@eslint-react/core 1.24.0-beta.1 → 1.24.0-beta.5

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.mts CHANGED
@@ -2,17 +2,16 @@ import * as AST from '@eslint-react/ast';
2
2
  import * as _eslint_react_eff from '@eslint-react/eff';
3
3
  import { _ } from '@eslint-react/eff';
4
4
  import { TSESTree } from '@typescript-eslint/types';
5
- import * as _eslint_react_types from '@eslint-react/types';
6
- import { RuleContext } from '@eslint-react/types';
5
+ import * as _eslint_react_shared from '@eslint-react/shared';
6
+ import { RuleContext, CustomComponentNormalized } from '@eslint-react/shared';
7
7
  import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
8
- import { CustomComponentNormalized } from '@eslint-react/shared';
9
8
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
10
9
  import { Scope } from '@typescript-eslint/scope-manager';
11
10
  import { SyntaxKind } from 'typescript';
12
11
 
13
12
  interface ERSemanticNode {
14
- _: string;
15
13
  id: _ | TSESTree.Identifier | TSESTree.Identifier[];
14
+ key: string;
16
15
  kind: string;
17
16
  name: _ | string;
18
17
  node: TSESTree.Node;
@@ -79,7 +78,11 @@ interface ERClassComponent extends ERSemanticNode {
79
78
  }
80
79
  type ERComponent = ERClassComponent | ERFunctionComponent;
81
80
 
82
- declare function useComponentCollector(context: RuleContext, hint?: bigint): {
81
+ interface ComponentCollectorOptions {
82
+ collectDisplayName?: boolean;
83
+ collectHookCalls?: boolean;
84
+ }
85
+ declare function useComponentCollector(context: RuleContext, hint?: bigint, options?: ComponentCollectorOptions): {
83
86
  readonly ctx: {
84
87
  readonly getAllComponents: (node: TSESTree.Program) => Map<string, ERFunctionComponent>;
85
88
  readonly getCurrentEntries: () => {
@@ -96,6 +99,11 @@ declare function useComponentCollector(context: RuleContext, hint?: bigint): {
96
99
  } | undefined;
97
100
  };
98
101
  readonly listeners: {
102
+ readonly "ReturnStatement[type]": (node: TSESTree.ReturnStatement) => void;
103
+ readonly "CallExpression[type]:exit"?: (node: TSESTree.CallExpression) => void;
104
+ readonly "AssignmentExpression[type][operator='='][left.type='MemberExpression'][left.property.name='displayName']"?: (node: TSESTree.AssignmentExpression & {
105
+ left: TSESTree.MemberExpression;
106
+ }) => void;
99
107
  readonly ":function[type]": (node: AST.TSESTreeFunction) => void;
100
108
  readonly ":function[type]:exit": () => {
101
109
  key: string;
@@ -104,11 +112,6 @@ declare function useComponentCollector(context: RuleContext, hint?: bigint): {
104
112
  isComponent: boolean;
105
113
  } | undefined;
106
114
  readonly "ArrowFunctionExpression[type][body.type!='BlockStatement']": () => void;
107
- readonly "AssignmentExpression[type][operator='='][left.type='MemberExpression'][left.property.name='displayName']": (node: TSESTree.AssignmentExpression & {
108
- left: TSESTree.MemberExpression;
109
- }) => void;
110
- readonly "CallExpression[type]:exit": (node: TSESTree.CallExpression) => void;
111
- readonly "ReturnStatement[type]": (node: TSESTree.ReturnStatement) => void;
112
115
  };
113
116
  };
114
117
 
@@ -2499,80 +2502,80 @@ declare function isReactAPIWithName(name: string): ReturnType<typeof isFromReact
2499
2502
  declare function isReactAPIWithName(name: string, member: string): ReturnType<typeof isFromReactMember>;
2500
2503
  declare function isReactAPICallWithName(name: string): ReturnType<typeof isCallFromReact>;
2501
2504
  declare function isReactAPICallWithName(name: string, member: string): ReturnType<typeof isCallFromReactMember>;
2502
- declare const isChildrenCount: (node: MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2503
- declare const isChildrenForEach: (node: MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2504
- declare const isChildrenMap: (node: MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2505
- declare const isChildrenOnly: (node: MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2506
- declare const isChildrenToArray: (node: MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2507
- declare const isCloneElement: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2508
- declare const isCreateContext: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2509
- declare const isCreateElement: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2510
- declare const isCreateRef: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2511
- declare const isForwardRef: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2512
- declare const isMemo: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2505
+ declare const isChildrenCount: (node: MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2506
+ declare const isChildrenForEach: (node: MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2507
+ declare const isChildrenMap: (node: MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2508
+ declare const isChildrenOnly: (node: MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2509
+ declare const isChildrenToArray: (node: MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2510
+ declare const isCloneElement: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2511
+ declare const isCreateContext: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2512
+ declare const isCreateElement: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2513
+ declare const isCreateRef: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2514
+ declare const isForwardRef: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2515
+ declare const isMemo: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2513
2516
  declare const isChildrenCountCall: {
2514
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression & {
2517
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression & {
2515
2518
  callee: MemberExpression;
2516
2519
  };
2517
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression & {
2520
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression & {
2518
2521
  callee: MemberExpression;
2519
2522
  };
2520
2523
  };
2521
2524
  declare const isChildrenForEachCall: {
2522
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression & {
2525
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression & {
2523
2526
  callee: MemberExpression;
2524
2527
  };
2525
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression & {
2528
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression & {
2526
2529
  callee: MemberExpression;
2527
2530
  };
2528
2531
  };
2529
2532
  declare const isChildrenMapCall: {
2530
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression & {
2533
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression & {
2531
2534
  callee: MemberExpression;
2532
2535
  };
2533
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression & {
2536
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression & {
2534
2537
  callee: MemberExpression;
2535
2538
  };
2536
2539
  };
2537
2540
  declare const isChildrenOnlyCall: {
2538
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression & {
2541
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression & {
2539
2542
  callee: MemberExpression;
2540
2543
  };
2541
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression & {
2544
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression & {
2542
2545
  callee: MemberExpression;
2543
2546
  };
2544
2547
  };
2545
2548
  declare const isChildrenToArrayCall: {
2546
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression & {
2549
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression & {
2547
2550
  callee: MemberExpression;
2548
2551
  };
2549
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression & {
2552
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression & {
2550
2553
  callee: MemberExpression;
2551
2554
  };
2552
2555
  };
2553
2556
  declare const isCloneElementCall: {
2554
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2555
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2557
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2558
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2556
2559
  };
2557
2560
  declare const isCreateContextCall: {
2558
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2559
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2561
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2562
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2560
2563
  };
2561
2564
  declare const isCreateElementCall: {
2562
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2563
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2565
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2566
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2564
2567
  };
2565
2568
  declare const isCreateRefCall: {
2566
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2567
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2569
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2570
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2568
2571
  };
2569
2572
  declare const isForwardRefCall: {
2570
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2571
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2573
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2574
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2572
2575
  };
2573
2576
  declare const isMemoCall: {
2574
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2575
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2577
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2578
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2576
2579
  };
2577
2580
 
2578
- export { DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementNameAndRepresentName, getFunctionComponentIdentifier, getId, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isSetupFunction, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
2581
+ export { type ComponentCollectorOptions, DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementNameAndRepresentName, getFunctionComponentIdentifier, getId, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isSetupFunction, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
package/dist/index.d.ts CHANGED
@@ -2,17 +2,16 @@ import * as AST from '@eslint-react/ast';
2
2
  import * as _eslint_react_eff from '@eslint-react/eff';
3
3
  import { _ } from '@eslint-react/eff';
4
4
  import { TSESTree } from '@typescript-eslint/types';
5
- import * as _eslint_react_types from '@eslint-react/types';
6
- import { RuleContext } from '@eslint-react/types';
5
+ import * as _eslint_react_shared from '@eslint-react/shared';
6
+ import { RuleContext, CustomComponentNormalized } from '@eslint-react/shared';
7
7
  import { TSESTree as TSESTree$1 } from '@typescript-eslint/utils';
8
- import { CustomComponentNormalized } from '@eslint-react/shared';
9
8
  import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
10
9
  import { Scope } from '@typescript-eslint/scope-manager';
11
10
  import { SyntaxKind } from 'typescript';
12
11
 
13
12
  interface ERSemanticNode {
14
- _: string;
15
13
  id: _ | TSESTree.Identifier | TSESTree.Identifier[];
14
+ key: string;
16
15
  kind: string;
17
16
  name: _ | string;
18
17
  node: TSESTree.Node;
@@ -79,7 +78,11 @@ interface ERClassComponent extends ERSemanticNode {
79
78
  }
80
79
  type ERComponent = ERClassComponent | ERFunctionComponent;
81
80
 
82
- declare function useComponentCollector(context: RuleContext, hint?: bigint): {
81
+ interface ComponentCollectorOptions {
82
+ collectDisplayName?: boolean;
83
+ collectHookCalls?: boolean;
84
+ }
85
+ declare function useComponentCollector(context: RuleContext, hint?: bigint, options?: ComponentCollectorOptions): {
83
86
  readonly ctx: {
84
87
  readonly getAllComponents: (node: TSESTree.Program) => Map<string, ERFunctionComponent>;
85
88
  readonly getCurrentEntries: () => {
@@ -96,6 +99,11 @@ declare function useComponentCollector(context: RuleContext, hint?: bigint): {
96
99
  } | undefined;
97
100
  };
98
101
  readonly listeners: {
102
+ readonly "ReturnStatement[type]": (node: TSESTree.ReturnStatement) => void;
103
+ readonly "CallExpression[type]:exit"?: (node: TSESTree.CallExpression) => void;
104
+ readonly "AssignmentExpression[type][operator='='][left.type='MemberExpression'][left.property.name='displayName']"?: (node: TSESTree.AssignmentExpression & {
105
+ left: TSESTree.MemberExpression;
106
+ }) => void;
99
107
  readonly ":function[type]": (node: AST.TSESTreeFunction) => void;
100
108
  readonly ":function[type]:exit": () => {
101
109
  key: string;
@@ -104,11 +112,6 @@ declare function useComponentCollector(context: RuleContext, hint?: bigint): {
104
112
  isComponent: boolean;
105
113
  } | undefined;
106
114
  readonly "ArrowFunctionExpression[type][body.type!='BlockStatement']": () => void;
107
- readonly "AssignmentExpression[type][operator='='][left.type='MemberExpression'][left.property.name='displayName']": (node: TSESTree.AssignmentExpression & {
108
- left: TSESTree.MemberExpression;
109
- }) => void;
110
- readonly "CallExpression[type]:exit": (node: TSESTree.CallExpression) => void;
111
- readonly "ReturnStatement[type]": (node: TSESTree.ReturnStatement) => void;
112
115
  };
113
116
  };
114
117
 
@@ -2499,80 +2502,80 @@ declare function isReactAPIWithName(name: string): ReturnType<typeof isFromReact
2499
2502
  declare function isReactAPIWithName(name: string, member: string): ReturnType<typeof isFromReactMember>;
2500
2503
  declare function isReactAPICallWithName(name: string): ReturnType<typeof isCallFromReact>;
2501
2504
  declare function isReactAPICallWithName(name: string, member: string): ReturnType<typeof isCallFromReactMember>;
2502
- declare const isChildrenCount: (node: MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2503
- declare const isChildrenForEach: (node: MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2504
- declare const isChildrenMap: (node: MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2505
- declare const isChildrenOnly: (node: MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2506
- declare const isChildrenToArray: (node: MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2507
- declare const isCloneElement: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2508
- declare const isCreateContext: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2509
- declare const isCreateElement: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2510
- declare const isCreateRef: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2511
- declare const isForwardRef: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2512
- declare const isMemo: (node: Identifier | MemberExpression, context: _eslint_react_types.RuleContext) => boolean;
2505
+ declare const isChildrenCount: (node: MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2506
+ declare const isChildrenForEach: (node: MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2507
+ declare const isChildrenMap: (node: MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2508
+ declare const isChildrenOnly: (node: MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2509
+ declare const isChildrenToArray: (node: MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2510
+ declare const isCloneElement: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2511
+ declare const isCreateContext: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2512
+ declare const isCreateElement: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2513
+ declare const isCreateRef: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2514
+ declare const isForwardRef: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2515
+ declare const isMemo: (node: Identifier | MemberExpression, context: _eslint_react_shared.RuleContext) => boolean;
2513
2516
  declare const isChildrenCountCall: {
2514
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression & {
2517
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression & {
2515
2518
  callee: MemberExpression;
2516
2519
  };
2517
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression & {
2520
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression & {
2518
2521
  callee: MemberExpression;
2519
2522
  };
2520
2523
  };
2521
2524
  declare const isChildrenForEachCall: {
2522
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression & {
2525
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression & {
2523
2526
  callee: MemberExpression;
2524
2527
  };
2525
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression & {
2528
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression & {
2526
2529
  callee: MemberExpression;
2527
2530
  };
2528
2531
  };
2529
2532
  declare const isChildrenMapCall: {
2530
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression & {
2533
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression & {
2531
2534
  callee: MemberExpression;
2532
2535
  };
2533
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression & {
2536
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression & {
2534
2537
  callee: MemberExpression;
2535
2538
  };
2536
2539
  };
2537
2540
  declare const isChildrenOnlyCall: {
2538
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression & {
2541
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression & {
2539
2542
  callee: MemberExpression;
2540
2543
  };
2541
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression & {
2544
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression & {
2542
2545
  callee: MemberExpression;
2543
2546
  };
2544
2547
  };
2545
2548
  declare const isChildrenToArrayCall: {
2546
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression & {
2549
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression & {
2547
2550
  callee: MemberExpression;
2548
2551
  };
2549
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression & {
2552
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression & {
2550
2553
  callee: MemberExpression;
2551
2554
  };
2552
2555
  };
2553
2556
  declare const isCloneElementCall: {
2554
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2555
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2557
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2558
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2556
2559
  };
2557
2560
  declare const isCreateContextCall: {
2558
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2559
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2561
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2562
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2560
2563
  };
2561
2564
  declare const isCreateElementCall: {
2562
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2563
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2565
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2566
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2564
2567
  };
2565
2568
  declare const isCreateRefCall: {
2566
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2567
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2569
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2570
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2568
2571
  };
2569
2572
  declare const isForwardRefCall: {
2570
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2571
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2573
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2574
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2572
2575
  };
2573
2576
  declare const isMemoCall: {
2574
- (context: _eslint_react_types.RuleContext): (node: Node) => node is CallExpression;
2575
- (node: Node, context: _eslint_react_types.RuleContext): node is CallExpression;
2577
+ (context: _eslint_react_shared.RuleContext): (node: Node) => node is CallExpression;
2578
+ (node: Node, context: _eslint_react_shared.RuleContext): node is CallExpression;
2576
2579
  };
2577
2580
 
2578
- export { DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementNameAndRepresentName, getFunctionComponentIdentifier, getId, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isSetupFunction, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
2581
+ export { type ComponentCollectorOptions, DEFAULT_COMPONENT_HINT, type ERClassComponent, ERClassComponentFlag, type ERComponent, ERComponentHint, type ERComponentKind, type EREffectKind, type EREffectMethodKind, type EREffectPhaseKind, type ERFunctionComponent, ERFunctionComponentFlag, type ERHook, type ERHookKind, type ERLifecycleMethodKind, type ERLifecyclePhaseKind, type ERPhaseKind, ERPhaseRelevance, type ERSemanticEntry, type ERSemanticNode, type ERStateKind, RE_COMPONENT_NAME, RE_HOOK_NAME, getComponentNameFromIdentifier, getElementNameAndRepresentName, getFunctionComponentIdentifier, getId, hasNoneOrValidComponentName, isCallFromReact, isCallFromReactMember, isChildrenCount, isChildrenCountCall, isChildrenForEach, isChildrenForEachCall, isChildrenMap, isChildrenMapCall, isChildrenOfCreateElement, isChildrenOnly, isChildrenOnlyCall, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCleanupFunction, isCloneElement, isCloneElementCall, isComponentDidMount, isComponentDidMountFunction, isComponentName, isComponentWillUnmount, isComponentWillUnmountFunction, isCreateContext, isCreateContextCall, isCreateElement, isCreateElementCall, isCreateRef, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRef, isForwardRefCall, isFromReact, isFromReactMember, isFunctionOfRenderMethod, isInitializedFromReact, isInsideCreateElementProps, isInsideReactHook, isInsideRenderMethod, isInversePhase, isMemo, isMemoCall, isPureComponent, isReactAPICallWithName, isReactAPIWithName, isReactHook, isReactHookCall, isReactHookCallWithName, isReactHookCallWithNameAlias, isReactHookCallWithNameLoose, isReactHookName, isRenderFunctionLoose, isRenderMethodLike, isRenderPropLoose, isSetupFunction, isThisSetState, isUseCallbackCall, isUseContextCall, isUseDebugValueCall, isUseDeferredValueCall, isUseEffectCall, isUseEffectCallLoose, isUseIdCall, isUseImperativeHandleCall, isUseInsertionEffectCall, isUseLayoutEffectCall, isUseMemoCall, isUseReducerCall, isUseRefCall, isUseStateCall, isUseSyncExternalStoreCall, isUseTransitionCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector };
package/dist/index.js CHANGED
@@ -164,9 +164,9 @@ var isMemoCall = isReactAPICallWithName("memo");
164
164
 
165
165
  // src/element/hierarchy.ts
166
166
  function isInsideCreateElementProps(node, context) {
167
- const call = AST8__namespace.findParentNodeGuard(node, isCreateElementCall(context));
167
+ const call = AST8__namespace.findParentNode(node, isCreateElementCall(context));
168
168
  if (call == null) return false;
169
- const prop = AST8__namespace.findParentNodeGuard(node, AST8__namespace.is(types.AST_NODE_TYPES.ObjectExpression));
169
+ const prop = AST8__namespace.findParentNode(node, AST8__namespace.is(types.AST_NODE_TYPES.ObjectExpression));
170
170
  if (prop == null) return false;
171
171
  return prop === call.arguments[1];
172
172
  }
@@ -276,7 +276,7 @@ var isUseTransitionCall = eff.flip(isReactHookCallWithName)("useTransition");
276
276
 
277
277
  // src/hook/hierarchy.ts
278
278
  function isInsideReactHook(node) {
279
- return isReactHook(AST8__namespace.findParentNodeGuard(node, AST8__namespace.isFunction));
279
+ return isReactHook(AST8__namespace.findParentNode(node, AST8__namespace.isFunction));
280
280
  }
281
281
  function useHookCollector() {
282
282
  const hooks = /* @__PURE__ */ new Map();
@@ -288,8 +288,8 @@ function useHookCollector() {
288
288
  const key = getId();
289
289
  fEntries.push({ key, node });
290
290
  hooks.set(key, {
291
- _: key,
292
291
  id: id2,
292
+ key,
293
293
  kind: "function",
294
294
  name,
295
295
  node,
@@ -328,13 +328,7 @@ function useHookCollector() {
328
328
  if (hook == null) {
329
329
  return;
330
330
  }
331
- hooks.set(hook._, {
332
- ...hook,
333
- hookCalls: [
334
- ...hook.hookCalls,
335
- node
336
- ]
337
- });
331
+ hook.hookCalls.push(node);
338
332
  }
339
333
  };
340
334
  return { ctx, listeners };
@@ -481,15 +475,17 @@ function hasValidHierarchy(node, context, hint) {
481
475
  }
482
476
  function getComponentFlag(initPath) {
483
477
  let flag = ERFunctionComponentFlag.None;
484
- if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("memo")(initPath)) {
478
+ if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("memo", initPath)) {
485
479
  flag |= ERFunctionComponentFlag.Memo;
486
480
  }
487
- if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("forwardRef")(initPath)) {
481
+ if (initPath != null && AST8__namespace.hasCallInFunctionInitPath("forwardRef", initPath)) {
488
482
  flag |= ERFunctionComponentFlag.ForwardRef;
489
483
  }
490
484
  return flag;
491
485
  }
492
- function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
486
+ var displayNameAssignmentSelector = "AssignmentExpression[type][operator='='][left.type='MemberExpression'][left.property.name='displayName']";
487
+ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT, options = {}) {
488
+ const { collectDisplayName = false, collectHookCalls = false } = options;
493
489
  const jsxCtx = { getScope: (node) => context.sourceCode.getScope(node) };
494
490
  const components = /* @__PURE__ */ new Map();
495
491
  const functionEntries = [];
@@ -540,8 +536,8 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
540
536
  const name = getComponentNameFromIdentifier(id2);
541
537
  const key = getId();
542
538
  components.set(key, {
543
- _: key,
544
539
  id: id2,
540
+ key,
545
541
  kind: "function",
546
542
  name,
547
543
  node: entry.node,
@@ -552,29 +548,29 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
552
548
  initPath
553
549
  });
554
550
  },
555
- "AssignmentExpression[type][operator='='][left.type='MemberExpression'][left.property.name='displayName']"(node) {
556
- const { left, right } = node;
557
- const componentName = left.object.type === types.AST_NODE_TYPES.Identifier ? left.object.name : eff._;
558
- const component = [...components.values()].findLast(({ name }) => name != null && name === componentName);
559
- if (component == null) {
560
- return;
561
- }
562
- components.set(component._, {
563
- ...component,
564
- displayName: right
565
- });
566
- },
567
- "CallExpression[type]:exit"(node) {
568
- if (!isReactHookCall(node)) {
569
- return;
551
+ ...collectDisplayName ? {
552
+ [displayNameAssignmentSelector](node) {
553
+ const { left, right } = node;
554
+ const componentName = left.object.type === types.AST_NODE_TYPES.Identifier ? left.object.name : eff._;
555
+ const component = [...components.values()].findLast(({ name }) => name != null && name === componentName);
556
+ if (component == null) {
557
+ return;
558
+ }
559
+ component.displayName = right;
570
560
  }
571
- const entry = getCurrentEntry();
572
- if (entry == null) {
573
- return;
561
+ } : {},
562
+ ...collectHookCalls ? {
563
+ "CallExpression[type]:exit"(node) {
564
+ if (!isReactHookCall(node)) {
565
+ return;
566
+ }
567
+ const entry = getCurrentEntry();
568
+ if (entry == null) {
569
+ return;
570
+ }
571
+ entry.hookCalls.push(node);
574
572
  }
575
- functionEntries.pop();
576
- functionEntries.push({ ...entry, hookCalls: [...entry.hookCalls, node] });
577
- },
573
+ } : {},
578
574
  "ReturnStatement[type]"(node) {
579
575
  const entry = getCurrentEntry();
580
576
  if (entry == null) {
@@ -590,8 +586,8 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
590
586
  const id2 = getFunctionComponentIdentifier(entry.node, context);
591
587
  const name = getComponentNameFromIdentifier(id2);
592
588
  components.set(entry.key, {
593
- _: entry.key,
594
589
  id: id2,
590
+ key: entry.key,
595
591
  kind: "function",
596
592
  name,
597
593
  node: entry.node,
@@ -623,8 +619,8 @@ function useComponentCollectorLegacy() {
623
619
  components.set(
624
620
  key,
625
621
  {
626
- _: key,
627
622
  id: id2,
623
+ key,
628
624
  kind: "class",
629
625
  name: id2?.name,
630
626
  node,
@@ -648,9 +644,9 @@ function isSetupFunction(node) {
648
644
  return node.parent?.type === types.AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === types.AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
649
645
  }
650
646
  function isCleanupFunction(node) {
651
- const nearReturn = AST8__namespace.findParentNodeGuard(node, AST8__namespace.is(types.AST_NODE_TYPES.ReturnStatement));
652
- const nearFunction = AST8__namespace.findParentNodeGuard(node, AST8__namespace.isFunction);
653
- const nearFunctionOfReturn = AST8__namespace.findParentNodeGuard(nearReturn, AST8__namespace.isFunction);
647
+ const nearReturn = AST8__namespace.findParentNode(node, AST8__namespace.is(types.AST_NODE_TYPES.ReturnStatement));
648
+ const nearFunction = AST8__namespace.findParentNode(node, AST8__namespace.isFunction);
649
+ const nearFunctionOfReturn = AST8__namespace.findParentNode(nearReturn, AST8__namespace.isFunction);
654
650
  return nearFunction === nearFunctionOfReturn && isSetupFunction(nearFunction);
655
651
  }
656
652
  function isComponentDidMount(node) {
@@ -680,7 +676,7 @@ function isDeclaredInRenderPropLoose(node) {
680
676
  if (isDirectValueOfRenderPropertyLoose(node)) {
681
677
  return true;
682
678
  }
683
- const parent = AST8__namespace.findParentNodeGuard(node, AST8__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer))?.parent;
679
+ const parent = AST8__namespace.findParentNode(node, AST8__namespace.is(types.AST_NODE_TYPES.JSXExpressionContainer))?.parent;
684
680
  if (parent?.type !== types.AST_NODE_TYPES.JSXAttribute) {
685
681
  return false;
686
682
  }
package/dist/index.mjs CHANGED
@@ -140,9 +140,9 @@ var isMemoCall = isReactAPICallWithName("memo");
140
140
 
141
141
  // src/element/hierarchy.ts
142
142
  function isInsideCreateElementProps(node, context) {
143
- const call = AST8.findParentNodeGuard(node, isCreateElementCall(context));
143
+ const call = AST8.findParentNode(node, isCreateElementCall(context));
144
144
  if (call == null) return false;
145
- const prop = AST8.findParentNodeGuard(node, AST8.is(AST_NODE_TYPES.ObjectExpression));
145
+ const prop = AST8.findParentNode(node, AST8.is(AST_NODE_TYPES.ObjectExpression));
146
146
  if (prop == null) return false;
147
147
  return prop === call.arguments[1];
148
148
  }
@@ -252,7 +252,7 @@ var isUseTransitionCall = flip(isReactHookCallWithName)("useTransition");
252
252
 
253
253
  // src/hook/hierarchy.ts
254
254
  function isInsideReactHook(node) {
255
- return isReactHook(AST8.findParentNodeGuard(node, AST8.isFunction));
255
+ return isReactHook(AST8.findParentNode(node, AST8.isFunction));
256
256
  }
257
257
  function useHookCollector() {
258
258
  const hooks = /* @__PURE__ */ new Map();
@@ -264,8 +264,8 @@ function useHookCollector() {
264
264
  const key = getId();
265
265
  fEntries.push({ key, node });
266
266
  hooks.set(key, {
267
- _: key,
268
267
  id: id2,
268
+ key,
269
269
  kind: "function",
270
270
  name,
271
271
  node,
@@ -304,13 +304,7 @@ function useHookCollector() {
304
304
  if (hook == null) {
305
305
  return;
306
306
  }
307
- hooks.set(hook._, {
308
- ...hook,
309
- hookCalls: [
310
- ...hook.hookCalls,
311
- node
312
- ]
313
- });
307
+ hook.hookCalls.push(node);
314
308
  }
315
309
  };
316
310
  return { ctx, listeners };
@@ -457,15 +451,17 @@ function hasValidHierarchy(node, context, hint) {
457
451
  }
458
452
  function getComponentFlag(initPath) {
459
453
  let flag = ERFunctionComponentFlag.None;
460
- if (initPath != null && AST8.hasCallInFunctionInitPath("memo")(initPath)) {
454
+ if (initPath != null && AST8.hasCallInFunctionInitPath("memo", initPath)) {
461
455
  flag |= ERFunctionComponentFlag.Memo;
462
456
  }
463
- if (initPath != null && AST8.hasCallInFunctionInitPath("forwardRef")(initPath)) {
457
+ if (initPath != null && AST8.hasCallInFunctionInitPath("forwardRef", initPath)) {
464
458
  flag |= ERFunctionComponentFlag.ForwardRef;
465
459
  }
466
460
  return flag;
467
461
  }
468
- function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
462
+ var displayNameAssignmentSelector = "AssignmentExpression[type][operator='='][left.type='MemberExpression'][left.property.name='displayName']";
463
+ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT, options = {}) {
464
+ const { collectDisplayName = false, collectHookCalls = false } = options;
469
465
  const jsxCtx = { getScope: (node) => context.sourceCode.getScope(node) };
470
466
  const components = /* @__PURE__ */ new Map();
471
467
  const functionEntries = [];
@@ -516,8 +512,8 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
516
512
  const name = getComponentNameFromIdentifier(id2);
517
513
  const key = getId();
518
514
  components.set(key, {
519
- _: key,
520
515
  id: id2,
516
+ key,
521
517
  kind: "function",
522
518
  name,
523
519
  node: entry.node,
@@ -528,29 +524,29 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
528
524
  initPath
529
525
  });
530
526
  },
531
- "AssignmentExpression[type][operator='='][left.type='MemberExpression'][left.property.name='displayName']"(node) {
532
- const { left, right } = node;
533
- const componentName = left.object.type === AST_NODE_TYPES.Identifier ? left.object.name : _;
534
- const component = [...components.values()].findLast(({ name }) => name != null && name === componentName);
535
- if (component == null) {
536
- return;
537
- }
538
- components.set(component._, {
539
- ...component,
540
- displayName: right
541
- });
542
- },
543
- "CallExpression[type]:exit"(node) {
544
- if (!isReactHookCall(node)) {
545
- return;
527
+ ...collectDisplayName ? {
528
+ [displayNameAssignmentSelector](node) {
529
+ const { left, right } = node;
530
+ const componentName = left.object.type === AST_NODE_TYPES.Identifier ? left.object.name : _;
531
+ const component = [...components.values()].findLast(({ name }) => name != null && name === componentName);
532
+ if (component == null) {
533
+ return;
534
+ }
535
+ component.displayName = right;
546
536
  }
547
- const entry = getCurrentEntry();
548
- if (entry == null) {
549
- return;
537
+ } : {},
538
+ ...collectHookCalls ? {
539
+ "CallExpression[type]:exit"(node) {
540
+ if (!isReactHookCall(node)) {
541
+ return;
542
+ }
543
+ const entry = getCurrentEntry();
544
+ if (entry == null) {
545
+ return;
546
+ }
547
+ entry.hookCalls.push(node);
550
548
  }
551
- functionEntries.pop();
552
- functionEntries.push({ ...entry, hookCalls: [...entry.hookCalls, node] });
553
- },
549
+ } : {},
554
550
  "ReturnStatement[type]"(node) {
555
551
  const entry = getCurrentEntry();
556
552
  if (entry == null) {
@@ -566,8 +562,8 @@ function useComponentCollector(context, hint = DEFAULT_COMPONENT_HINT) {
566
562
  const id2 = getFunctionComponentIdentifier(entry.node, context);
567
563
  const name = getComponentNameFromIdentifier(id2);
568
564
  components.set(entry.key, {
569
- _: entry.key,
570
565
  id: id2,
566
+ key: entry.key,
571
567
  kind: "function",
572
568
  name,
573
569
  node: entry.node,
@@ -599,8 +595,8 @@ function useComponentCollectorLegacy() {
599
595
  components.set(
600
596
  key,
601
597
  {
602
- _: key,
603
598
  id: id2,
599
+ key,
604
600
  kind: "class",
605
601
  name: id2?.name,
606
602
  node,
@@ -624,9 +620,9 @@ function isSetupFunction(node) {
624
620
  return node.parent?.type === AST_NODE_TYPES.CallExpression && node.parent.callee !== node && node.parent.callee.type === AST_NODE_TYPES.Identifier && node.parent.arguments.at(0) === node && isUseEffectCallLoose(node.parent);
625
621
  }
626
622
  function isCleanupFunction(node) {
627
- const nearReturn = AST8.findParentNodeGuard(node, AST8.is(AST_NODE_TYPES.ReturnStatement));
628
- const nearFunction = AST8.findParentNodeGuard(node, AST8.isFunction);
629
- const nearFunctionOfReturn = AST8.findParentNodeGuard(nearReturn, AST8.isFunction);
623
+ const nearReturn = AST8.findParentNode(node, AST8.is(AST_NODE_TYPES.ReturnStatement));
624
+ const nearFunction = AST8.findParentNode(node, AST8.isFunction);
625
+ const nearFunctionOfReturn = AST8.findParentNode(nearReturn, AST8.isFunction);
630
626
  return nearFunction === nearFunctionOfReturn && isSetupFunction(nearFunction);
631
627
  }
632
628
  function isComponentDidMount(node) {
@@ -656,7 +652,7 @@ function isDeclaredInRenderPropLoose(node) {
656
652
  if (isDirectValueOfRenderPropertyLoose(node)) {
657
653
  return true;
658
654
  }
659
- const parent = AST8.findParentNodeGuard(node, AST8.is(AST_NODE_TYPES.JSXExpressionContainer))?.parent;
655
+ const parent = AST8.findParentNode(node, AST8.is(AST_NODE_TYPES.JSXExpressionContainer))?.parent;
660
656
  if (parent?.type !== AST_NODE_TYPES.JSXAttribute) {
661
657
  return false;
662
658
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/core",
3
- "version": "1.24.0-beta.1",
3
+ "version": "1.24.0-beta.5",
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": {
@@ -38,12 +38,11 @@
38
38
  "@typescript-eslint/types": "^8.19.1",
39
39
  "@typescript-eslint/utils": "^8.19.1",
40
40
  "ts-pattern": "^5.6.0",
41
- "@eslint-react/ast": "1.24.0-beta.1",
42
- "@eslint-react/eff": "1.24.0-beta.1",
43
- "@eslint-react/jsx": "1.24.0-beta.1",
44
- "@eslint-react/types": "1.24.0-beta.1",
45
- "@eslint-react/shared": "1.24.0-beta.1",
46
- "@eslint-react/var": "1.24.0-beta.1"
41
+ "@eslint-react/ast": "1.24.0-beta.5",
42
+ "@eslint-react/eff": "1.24.0-beta.5",
43
+ "@eslint-react/jsx": "1.24.0-beta.5",
44
+ "@eslint-react/shared": "1.24.0-beta.5",
45
+ "@eslint-react/var": "1.24.0-beta.5"
47
46
  },
48
47
  "devDependencies": {
49
48
  "tsup": "^8.3.5",