Skip to content

Commit 68eb1dc

Browse files
committed
refactor: reorganize exports and improve documentation for utilities and core functions
1 parent 4a672d2 commit 68eb1dc

File tree

32 files changed

+465
-271
lines changed

32 files changed

+465
-271
lines changed

eslint.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export default tseslint.config(
168168
"@typescript-eslint/ban-types": "off",
169169
"@typescript-eslint/consistent-type-imports": "error",
170170
"@typescript-eslint/explicit-function-return-type": "off",
171+
"@typescript-eslint/no-namespace": "off",
171172
"@typescript-eslint/no-empty-object-type": "off",
172173
"@typescript-eslint/no-misused-promises": "off",
173174
"@typescript-eslint/no-unnecessary-parameter-property-assignment": "warn",

packages/core/docs/README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44

55
# @eslint-react/core
66

7+
## Namespaces
8+
9+
- [isCallFromReact](namespaces/isCallFromReact/README.md)
10+
- [isCallFromReactMember](namespaces/isCallFromReactMember/README.md)
11+
- [useComponentCollector](namespaces/useComponentCollector/README.md)
12+
- [useComponentCollectorLegacy](namespaces/useComponentCollectorLegacy/README.md)
13+
- [useHookCollector](namespaces/useHookCollector/README.md)
14+
715
## Interfaces
816

9-
- [ComponentCollectorOptions](interfaces/ComponentCollectorOptions.md)
1017
- [ERClassComponent](interfaces/ERClassComponent.md)
1118
- [ERFunctionComponent](interfaces/ERFunctionComponent.md)
1219
- [ERHook](interfaces/ERHook.md)

packages/core/docs/functions/isCallFromReact.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Function: isCallFromReact()
88

9-
> **isCallFromReact**(`name`): `IsCallFromReact`
9+
> **isCallFromReact**(`name`): [`ReturnType`](../namespaces/isCallFromReact/type-aliases/ReturnType.md)
1010
1111
## Parameters
1212

@@ -16,4 +16,4 @@
1616

1717
## Returns
1818

19-
`IsCallFromReact`
19+
[`ReturnType`](../namespaces/isCallFromReact/type-aliases/ReturnType.md)

packages/core/docs/functions/isCallFromReactMember.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Function: isCallFromReactMember()
88

9-
> **isCallFromReactMember**(`pragmaMemberName`, `name`): `IsCallFromReactMember`
9+
> **isCallFromReactMember**(`pragmaMemberName`, `name`): [`ReturnType`](../namespaces/isCallFromReactMember/type-aliases/ReturnType.md)
1010
1111
## Parameters
1212

@@ -20,4 +20,4 @@
2020

2121
## Returns
2222

23-
`IsCallFromReactMember`
23+
[`ReturnType`](../namespaces/isCallFromReactMember/type-aliases/ReturnType.md)

packages/core/docs/functions/useComponentCollector.md

+3-89
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Function: useComponentCollector()
88

9-
> **useComponentCollector**(`context`, `hint`, `options`): `object`
9+
> **useComponentCollector**(`context`, `hint`, `options`): [`ReturnType`](../namespaces/useComponentCollector/type-aliases/ReturnType.md)
1010
1111
Get a ctx and listeners for the rule to collect function components
1212

@@ -26,98 +26,12 @@ The hint to use
2626

2727
### options
2828

29-
[`ComponentCollectorOptions`](../interfaces/ComponentCollectorOptions.md) = `{}`
29+
[`Options`](../namespaces/useComponentCollector/type-aliases/Options.md) = `{}`
3030

3131
The options to use
3232

3333
## Returns
3434

35-
`object`
35+
[`ReturnType`](../namespaces/useComponentCollector/type-aliases/ReturnType.md)
3636

3737
The component collector
38-
39-
### ctx
40-
41-
> **ctx**: `object`
42-
43-
#### ctx.getCurrentEntry()
44-
45-
> **getCurrentEntry**: () => `undefined` \| \{ `hookCalls`: `CallExpression`[]; `isComponent`: `boolean`; `key`: `string`; `node`: `TSESTreeFunction`; \}
46-
47-
##### Returns
48-
49-
`undefined` \| \{ `hookCalls`: `CallExpression`[]; `isComponent`: `boolean`; `key`: `string`; `node`: `TSESTreeFunction`; \}
50-
51-
#### ctx.getAllComponents()
52-
53-
##### Parameters
54-
55-
###### node
56-
57-
`Program`
58-
59-
##### Returns
60-
61-
`Map`\<`string`, [`ERFunctionComponent`](../interfaces/ERFunctionComponent.md)\>
62-
63-
#### ctx.getCurrentEntries()
64-
65-
##### Returns
66-
67-
`object`[]
68-
69-
### listeners
70-
71-
> **listeners**: `object`
72-
73-
#### listeners.:function\[type\]()
74-
75-
> `readonly` **:function\[type\]**: (`node`) => `void` = `onFunctionEnter`
76-
77-
##### Parameters
78-
79-
###### node
80-
81-
`TSESTreeFunction`
82-
83-
##### Returns
84-
85-
`void`
86-
87-
#### listeners.:function\[type\]:exit()
88-
89-
> `readonly` **:function\[type\]:exit**: () => `undefined` \| \{ `hookCalls`: `CallExpression`[]; `isComponent`: `boolean`; `key`: `string`; `node`: `TSESTreeFunction`; \} = `onFunctionExit`
90-
91-
##### Returns
92-
93-
`undefined` \| \{ `hookCalls`: `CallExpression`[]; `isComponent`: `boolean`; `key`: `string`; `node`: `TSESTreeFunction`; \}
94-
95-
#### listeners.ArrowFunctionExpression\[type\]\[body.type!='BlockStatement'\]()
96-
97-
##### Returns
98-
99-
`void`
100-
101-
#### listeners.CallExpression\[type\]:exit()?
102-
103-
##### Parameters
104-
105-
###### node
106-
107-
`CallExpression`
108-
109-
##### Returns
110-
111-
`void`
112-
113-
#### listeners.ReturnStatement\[type\]()
114-
115-
##### Parameters
116-
117-
###### node
118-
119-
`ReturnStatement`
120-
121-
##### Returns
122-
123-
`void`

packages/core/docs/functions/useComponentCollectorLegacy.md

+2-50
Original file line numberDiff line numberDiff line change
@@ -6,60 +6,12 @@
66

77
# Function: useComponentCollectorLegacy()
88

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

1313
## Returns
1414

15-
`object`
15+
[`ReturnType`](../namespaces/useComponentCollectorLegacy/type-aliases/ReturnType.md)
1616

1717
The context and listeners for the rule
18-
19-
### ctx
20-
21-
> **ctx**: `object`
22-
23-
#### ctx.getAllComponents()
24-
25-
##### Parameters
26-
27-
###### node
28-
29-
`Program`
30-
31-
##### Returns
32-
33-
`Map`\<`string`, [`ERClassComponent`](../interfaces/ERClassComponent.md)\>
34-
35-
### listeners
36-
37-
> **listeners**: `object`
38-
39-
#### listeners.ClassDeclaration\[type\]()
40-
41-
> `readonly` **ClassDeclaration\[type\]**: (`node`) => `void` = `collect`
42-
43-
##### Parameters
44-
45-
###### node
46-
47-
`TSESTreeClass`
48-
49-
##### Returns
50-
51-
`void`
52-
53-
#### listeners.ClassExpression\[type\]()
54-
55-
> `readonly` **ClassExpression\[type\]**: (`node`) => `void` = `collect`
56-
57-
##### Parameters
58-
59-
###### node
60-
61-
`TSESTreeClass`
62-
63-
##### Returns
64-
65-
`void`

packages/core/docs/functions/useHookCollector.md

+2-62
Original file line numberDiff line numberDiff line change
@@ -6,68 +6,8 @@
66

77
# Function: useHookCollector()
88

9-
> **useHookCollector**(): `object`
9+
> **useHookCollector**(): [`ReturnType`](../namespaces/useHookCollector/type-aliases/ReturnType.md)
1010
1111
## Returns
1212

13-
`object`
14-
15-
### ctx
16-
17-
> **ctx**: `object`
18-
19-
#### ctx.getAllHooks()
20-
21-
##### Parameters
22-
23-
###### node
24-
25-
`Program`
26-
27-
##### Returns
28-
29-
`Map`\<`string`, [`ERHook`](../interfaces/ERHook.md)\>
30-
31-
#### ctx.getCurrentHooks()
32-
33-
##### Returns
34-
35-
`Map`\<`string`, [`ERHook`](../interfaces/ERHook.md)\>
36-
37-
### listeners
38-
39-
> **listeners**: `object`
40-
41-
#### listeners.:function\[type\]()
42-
43-
> `readonly` **:function\[type\]**: (`node`) => `void` = `onFunctionEnter`
44-
45-
##### Parameters
46-
47-
###### node
48-
49-
`TSESTreeFunction`
50-
51-
##### Returns
52-
53-
`void`
54-
55-
#### listeners.:function\[type\]:exit()
56-
57-
> `readonly` **:function\[type\]:exit**: () => `void` = `onFunctionExit`
58-
59-
##### Returns
60-
61-
`void`
62-
63-
#### listeners.CallExpression\[type\]()
64-
65-
##### Parameters
66-
67-
###### node
68-
69-
`never`
70-
71-
##### Returns
72-
73-
`void`
13+
[`ReturnType`](../namespaces/useHookCollector/type-aliases/ReturnType.md)

packages/core/docs/interfaces/ComponentCollectorOptions.md

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[**@eslint-react/core**](../../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../../README.md) / isCallFromReact
6+
7+
# isCallFromReact
8+
9+
## Type Aliases
10+
11+
- [ReturnType](type-aliases/ReturnType.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[**@eslint-react/core**](../../../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../../../README.md) / [isCallFromReact](../README.md) / ReturnType
6+
7+
# Type Alias: ReturnType()
8+
9+
> **ReturnType**: (`context`) => (`node`) => `node is CallExpression`(`node`, `context`) => `node is CallExpression`
10+
11+
## Parameters
12+
13+
### context
14+
15+
`Readonly`\<`RuleContext`\<`string`, readonly `unknown`[]\>\>
16+
17+
## Returns
18+
19+
`Function`
20+
21+
### Parameters
22+
23+
#### node
24+
25+
`Node`
26+
27+
### Returns
28+
29+
`node is CallExpression`
30+
31+
## Parameters
32+
33+
### node
34+
35+
`Node`
36+
37+
### context
38+
39+
`Readonly`\<`RuleContext`\<`string`, readonly `unknown`[]\>\>
40+
41+
## Returns
42+
43+
`node is CallExpression`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[**@eslint-react/core**](../../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../../README.md) / isCallFromReactMember
6+
7+
# isCallFromReactMember
8+
9+
## Type Aliases
10+
11+
- [ReturnType](type-aliases/ReturnType.md)

0 commit comments

Comments
 (0)