File tree Expand file tree Collapse file tree 4 files changed +16
-15
lines changed
packages/core/src/component Expand file tree Collapse file tree 4 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ import { DISPLAY_NAME_ASSIGNMENT_SELECTOR } from "../constants";
1414import { isReactHookCall } from "../hook" ;
1515import { DEFAULT_COMPONENT_HINT } from "./component-collector-hint" ;
1616import { isValidComponentDefinition } from "./component-definition" ;
17- import { getComponentFlagFromInitPath } from "./component-flag" ;
1817import { getFunctionComponentId } from "./component-id" ;
18+ import { getComponentFlagFromInitPath } from "./component-init-path" ;
1919import { getComponentNameFromId , hasNoneOrLooseComponentName } from "./component-name" ;
2020
2121type FunctionEntry = {
Original file line number Diff line number Diff line change 1- import type { FunctionComponent } from "./component-semantic-node" ;
2- import * as AST from "@eslint-react/ast" ;
3-
41/* eslint-disable perfectionist/sort-objects */
52export type ComponentFlag = bigint ;
63
@@ -12,14 +9,3 @@ export const ComponentFlag = {
129 ForwardRef : 1n << 3n ,
1310 Async : 1n << 4n ,
1411} ;
15-
16- export function getComponentFlagFromInitPath ( initPath : FunctionComponent [ "initPath" ] ) {
17- let flag = ComponentFlag . None ;
18- if ( initPath != null && AST . hasCallInFunctionInitPath ( "memo" , initPath ) ) {
19- flag |= ComponentFlag . Memo ;
20- }
21- if ( initPath != null && AST . hasCallInFunctionInitPath ( "forwardRef" , initPath ) ) {
22- flag |= ComponentFlag . ForwardRef ;
23- }
24- return flag ;
25- }
Original file line number Diff line number Diff line change 1+ import type { FunctionComponent } from "./component-semantic-node" ;
2+ import * as AST from "@eslint-react/ast" ;
3+ import { ComponentFlag } from "./component-flag" ;
4+
5+ export function getComponentFlagFromInitPath ( initPath : FunctionComponent [ "initPath" ] ) {
6+ let flag = ComponentFlag . None ;
7+ if ( initPath != null && AST . hasCallInFunctionInitPath ( "memo" , initPath ) ) {
8+ flag |= ComponentFlag . Memo ;
9+ }
10+ if ( initPath != null && AST . hasCallInFunctionInitPath ( "forwardRef" , initPath ) ) {
11+ flag |= ComponentFlag . ForwardRef ;
12+ }
13+ return flag ;
14+ }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ export * from "./component-collector-hint";
33export * from "./component-collector-legacy" ;
44export * from "./component-flag" ;
55export * from "./component-id" ;
6+ export * from "./component-init-path" ;
67export type * from "./component-kind" ;
78export * from "./component-lifecycle" ;
89export * from "./component-name" ;
You can’t perform that action at this time.
0 commit comments