Skip to content

Commit ce8fac6

Browse files
committed
refactor(core): add function docs and reorganize component-related code
1 parent 111bc57 commit ce8fac6

23 files changed

+262
-119
lines changed

packages/core/docs/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,20 @@
9090

9191
## Functions
9292

93+
- [getComponentFlagFromInitPath](functions/getComponentFlagFromInitPath.md)
9394
- [getComponentNameFromId](functions/getComponentNameFromId.md)
9495
- [getFunctionComponentId](functions/getFunctionComponentId.md)
9596
- [hasNoneOrLooseComponentName](functions/hasNoneOrLooseComponentName.md)
9697
- [isAssignmentToThisState](functions/isAssignmentToThisState.md)
98+
- [isChildrenOfCreateElement](functions/isChildrenOfCreateElement.md)
9799
- [isClassComponent](functions/isClassComponent.md)
98100
- [isComponentDidCatch](functions/isComponentDidCatch.md)
99101
- [isComponentDidMount](functions/isComponentDidMount.md)
100102
- [isComponentName](functions/isComponentName.md)
101103
- [isComponentNameLoose](functions/isComponentNameLoose.md)
102104
- [isComponentWillUnmount](functions/isComponentWillUnmount.md)
105+
- [isComponentWrapperCall](functions/isComponentWrapperCall.md)
106+
- [isComponentWrapperCallLoose](functions/isComponentWrapperCallLoose.md)
103107
- [isDeclaredInRenderPropLoose](functions/isDeclaredInRenderPropLoose.md)
104108
- [isFunctionOfComponentDidMount](functions/isFunctionOfComponentDidMount.md)
105109
- [isFunctionOfComponentWillUnmount](functions/isFunctionOfComponentWillUnmount.md)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[**@eslint-react/core**](../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../README.md) / getComponentFlagFromInitPath
6+
7+
# Function: getComponentFlagFromInitPath()
8+
9+
> **getComponentFlagFromInitPath**(`initPath`): `bigint`
10+
11+
## Parameters
12+
13+
### initPath
14+
15+
`undefined` | [`FunctionInitPath`](../-internal-/type-aliases/FunctionInitPath.md)
16+
17+
## Returns
18+
19+
`bigint`
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[**@eslint-react/core**](../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../README.md) / isChildrenOfCreateElement
6+
7+
# Function: isChildrenOfCreateElement()
8+
9+
> **isChildrenOfCreateElement**(`context`, `node`): `boolean`
10+
11+
Determines whether inside `createElement`'s children.
12+
13+
## Parameters
14+
15+
### context
16+
17+
[`RuleContext`](../-internal-/type-aliases/RuleContext.md)
18+
19+
The rule context
20+
21+
### node
22+
23+
[`Node`](../-internal-/type-aliases/Node.md)
24+
25+
The AST node to check
26+
27+
## Returns
28+
29+
`boolean`
30+
31+
`true` if the node is inside createElement's children
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[**@eslint-react/core**](../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../README.md) / isComponentWrapperCall
6+
7+
# Function: isComponentWrapperCall()
8+
9+
> **isComponentWrapperCall**(`context`, `node`): `boolean`
10+
11+
Check if the node is a call expression for a component wrapper
12+
13+
## Parameters
14+
15+
### context
16+
17+
[`RuleContext`](../-internal-/type-aliases/RuleContext.md)
18+
19+
The ESLint rule context
20+
21+
### node
22+
23+
[`Node`](../-internal-/type-aliases/Node.md)
24+
25+
The node to check
26+
27+
## Returns
28+
29+
`boolean`
30+
31+
`true` if the node is a call expression for a component wrapper
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[**@eslint-react/core**](../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../README.md) / isComponentWrapperCallLoose
6+
7+
# Function: isComponentWrapperCallLoose()
8+
9+
> **isComponentWrapperCallLoose**(`context`, `node`): `boolean`
10+
11+
Check if the node is a call expression for a component wrapper loosely
12+
13+
## Parameters
14+
15+
### context
16+
17+
[`RuleContext`](../-internal-/type-aliases/RuleContext.md)
18+
19+
The ESLint rule context
20+
21+
### node
22+
23+
[`Node`](../-internal-/type-aliases/Node.md)
24+
25+
The node to check
26+
27+
## Returns
28+
29+
`boolean`
30+
31+
`true` if the node is a call expression for a component wrapper loosely

packages/core/docs/functions/useComponentCollectorLegacy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
> **useComponentCollectorLegacy**(): [`ReturnType`](../@eslint-react/namespaces/useComponentCollectorLegacy/type-aliases/ReturnType.md)
1010
11-
Get a ctx and listeners for the rule to collect class components
11+
Get a ctx and listeners object for the rule to collect class components
1212

1313
## Returns
1414

packages/core/docs/variables/ComponentCollectorHint.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
> **ComponentCollectorHint**: `object`
1010
11-
hints for component collector
11+
Hints for component collector
1212

1313
## Type declaration
1414

packages/core/docs/variables/DEFAULT_COMPONENT_HINT.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
# Variable: DEFAULT\_COMPONENT\_HINT
88

99
> `const` **DEFAULT\_COMPONENT\_HINT**: `bigint`
10+
11+
Default component collector hint

packages/core/src/component/component-collector-hint.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as JSX from "@eslint-react/jsx";
44
export type ComponentCollectorHint = bigint;
55

66
/**
7-
* hints for component collector
7+
* Hints for component collector
88
*/
99
export const ComponentCollectorHint = {
1010
/**
@@ -37,6 +37,9 @@ export const ComponentCollectorHint = {
3737
SkipClassProperty: 1n << 69n,
3838
} as const;
3939

40+
/**
41+
* Default component collector hint
42+
*/
4043
export const DEFAULT_COMPONENT_HINT = 0n
4144
| ComponentCollectorHint.SkipBooleanLiteral
4245
| ComponentCollectorHint.SkipEmptyArray

packages/core/src/component/component-collector-legacy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export declare namespace useComponentCollectorLegacy {
1717
}
1818

1919
/**
20-
* Get a ctx and listeners for the rule to collect class components
20+
* Get a ctx and listeners object for the rule to collect class components
2121
* @returns The context and listeners for the rule
2222
*/
2323
export function useComponentCollectorLegacy(): useComponentCollectorLegacy.ReturnType {

0 commit comments

Comments
 (0)