|
33 | 33 |
|
34 | 34 | ### Functions
|
35 | 35 |
|
36 |
| -- [componentCollector](README.md#componentcollector) |
37 |
| -- [componentCollectorLegacy](README.md#componentcollectorlegacy) |
38 | 36 | - [constructionDetector](README.md#constructiondetector)
|
39 | 37 | - [getComponentInitPath](README.md#getcomponentinitpath)
|
40 | 38 | - [getComponentNameFromIdentifier](README.md#getcomponentnamefromidentifier)
|
41 | 39 | - [getFunctionComponentIdentifier](README.md#getfunctioncomponentidentifier)
|
42 | 40 | - [getParentClassComponent](README.md#getparentclasscomponent)
|
43 | 41 | - [hasCallInInitPath](README.md#hascallininitpath)
|
44 | 42 | - [hasNoneOrValidComponentName](README.md#hasnoneorvalidcomponentname)
|
45 |
| -- [hookCollector](README.md#hookcollector) |
46 | 43 | - [isChildrenCount](README.md#ischildrencount)
|
47 | 44 | - [isChildrenCountCall](README.md#ischildrencountcall)
|
48 | 45 | - [isChildrenForEach](README.md#ischildrenforeach)
|
|
97 | 94 | - [unsafeIsDeclaredInRenderProp](README.md#unsafeisdeclaredinrenderprop)
|
98 | 95 | - [unsafeIsRenderFunction](README.md#unsafeisrenderfunction)
|
99 | 96 | - [unsafeIsRenderProp](README.md#unsafeisrenderprop)
|
| 97 | +- [useComponentCollector](README.md#usecomponentcollector) |
| 98 | +- [useComponentCollectorLegacy](README.md#usecomponentcollectorlegacy) |
| 99 | +- [useHookCollector](README.md#usehookcollector) |
100 | 100 |
|
101 | 101 | ## Type Aliases
|
102 | 102 |
|
|
238 | 238 |
|
239 | 239 | ## Functions
|
240 | 240 |
|
241 |
| -### componentCollector |
242 |
| - |
243 |
| -▸ **componentCollector**(`context`, `hint?`, `pragma?`): `Object` |
244 |
| - |
245 |
| -#### Parameters |
246 |
| - |
247 |
| -| Name | Type | Default value | |
248 |
| -| :------ | :------ | :------ | |
249 |
| -| `context` | `Readonly`\<`RuleContext`\<`string`, readonly `unknown`[]\>\> | `undefined` | |
250 |
| -| `hint` | `bigint` | `DEFAULT_COMPONENT_COLLECTOR_HINT` | |
251 |
| -| `pragma` | `string` | `undefined` | |
252 |
| - |
253 |
| -#### Returns |
254 |
| - |
255 |
| -`Object` |
256 |
| - |
257 |
| -| Name | Type | |
258 |
| -| :------ | :------ | |
259 |
| -| `ctx` | \{ `getCurrentFunction`: () => `Option`\<[`TSESTreeFunction`, `boolean`, `CallExpression`[]]\> ; `getAllComponents`: (`_`: `Program`) => `Map`\<`string`, [`ERFunctionComponent`](interfaces/ERFunctionComponent.md)\> ; `getCurrentComponents`: () => `Map`\<`string`, [`ERFunctionComponent`](interfaces/ERFunctionComponent.md)\> ; `getCurrentFunctionStack`: () => [`TSESTreeFunction`, `boolean`, `CallExpression`[]][] } | |
260 |
| -| `ctx.getCurrentFunction` | () => `Option`\<[`TSESTreeFunction`, `boolean`, `CallExpression`[]]\> | |
261 |
| -| `ctx.getAllComponents` | [object Object] | |
262 |
| -| `ctx.getCurrentComponents` | [object Object] | |
263 |
| -| `ctx.getCurrentFunctionStack` | [object Object] | |
264 |
| -| `listeners` | \{ `:function`: (`node`: `TSESTreeFunction`) => `MutableList`\<[`TSESTreeFunction`, `boolean`, `CallExpression`[]]\> = onFunctionEnter; `:function:exit`: () => `undefined` \| [`TSESTreeFunction`, `boolean`, `CallExpression`[]] = onFunctionExit; `ArrowFunctionExpression[body.type!='BlockStatement']`: () => `void` ; `AssignmentExpression[operator='='][left.type='MemberExpression'][left.property.name='displayName']`: (`node`: `AssignmentExpression`) => `void` ; `CallExpression:exit`: (`node`: `CallExpression`) => `void` ; `ReturnStatement`: (`node`: `ReturnStatement`) => `void` } | |
265 |
| -| `listeners.:function` | (`node`: `TSESTreeFunction`) => `MutableList`\<[`TSESTreeFunction`, `boolean`, `CallExpression`[]]\> | |
266 |
| -| `listeners.:function:exit` | () => `undefined` \| [`TSESTreeFunction`, `boolean`, `CallExpression`[]] | |
267 |
| -| `listeners.ArrowFunctionExpression[body.type!='BlockStatement']` | [object Object] | |
268 |
| -| `listeners.AssignmentExpression[operator='='][left.type='MemberExpression'][left.property.name='displayName']` | [object Object] | |
269 |
| -| `listeners.CallExpression:exit` | [object Object] | |
270 |
| -| `listeners.ReturnStatement` | [object Object] | |
271 |
| - |
272 |
| -___ |
273 |
| - |
274 |
| -### componentCollectorLegacy |
275 |
| - |
276 |
| -▸ **componentCollectorLegacy**(`context`): `Object` |
277 |
| - |
278 |
| -#### Parameters |
279 |
| - |
280 |
| -| Name | Type | |
281 |
| -| :------ | :------ | |
282 |
| -| `context` | `Readonly`\<`RuleContext`\<`string`, readonly `unknown`[]\>\> | |
283 |
| - |
284 |
| -#### Returns |
285 |
| - |
286 |
| -`Object` |
287 |
| - |
288 |
| -| Name | Type | |
289 |
| -| :------ | :------ | |
290 |
| -| `ctx` | \{ `getAllComponents`: (`_`: `Program`) => `Map`\<`string`, [`ERClassComponent`](interfaces/ERClassComponent.md)\> ; `getCurrentComponents`: () => `Map`\<`string`, [`ERClassComponent`](interfaces/ERClassComponent.md)\> } | |
291 |
| -| `ctx.getAllComponents` | [object Object] | |
292 |
| -| `ctx.getCurrentComponents` | [object Object] | |
293 |
| -| `listeners` | \{ `ClassDeclaration`: (`node`: `TSESTreeClass`) => `void` = collect; `ClassExpression`: (`node`: `TSESTreeClass`) => `void` = collect } | |
294 |
| -| `listeners.ClassDeclaration` | (`node`: `TSESTreeClass`) => `void` | |
295 |
| -| `listeners.ClassExpression` | (`node`: `TSESTreeClass`) => `void` | |
296 |
| - |
297 |
| -___ |
298 |
| - |
299 | 241 | ### constructionDetector
|
300 | 242 |
|
301 | 243 | ▸ **constructionDetector**\<`T`\>(`context`): (`node`: `TSESTree.Node`) => [`ERConstruction`](README.md#erconstruction-1)
|
|
450 | 392 |
|
451 | 393 | ___
|
452 | 394 |
|
453 |
| -### hookCollector |
454 |
| - |
455 |
| -▸ **hookCollector**(): `Object` |
456 |
| - |
457 |
| -#### Returns |
458 |
| - |
459 |
| -`Object` |
460 |
| - |
461 |
| -| Name | Type | |
462 |
| -| :------ | :------ | |
463 |
| -| `ctx` | \{ `getAllHooks`: (`_`: `Program`) => `Map`\<`string`, [`ERHook`](interfaces/ERHook.md)\> ; `getCurrentHooks`: () => `Map`\<`string`, [`ERHook`](interfaces/ERHook.md)\> } | |
464 |
| -| `ctx.getAllHooks` | [object Object] | |
465 |
| -| `ctx.getCurrentHooks` | [object Object] | |
466 |
| -| `listeners` | `ESLintUtils.RuleListener` | |
467 |
| - |
468 |
| -___ |
469 |
| - |
470 | 395 | ### isChildrenCount
|
471 | 396 |
|
472 | 397 | ▸ **isChildrenCount**(`node`, `context`, `pragma?`): `boolean`
|
@@ -1493,3 +1418,78 @@ _ = <Component renderRow={() => <div />} />
|
1493 | 1418 | `boolean`
|
1494 | 1419 |
|
1495 | 1420 | `true` if node is a render prop, `false` if not
|
| 1421 | + |
| 1422 | +___ |
| 1423 | + |
| 1424 | +### useComponentCollector |
| 1425 | + |
| 1426 | +▸ **useComponentCollector**(`context`, `hint?`, `pragma?`): `Object` |
| 1427 | + |
| 1428 | +#### Parameters |
| 1429 | + |
| 1430 | +| Name | Type | Default value | |
| 1431 | +| :------ | :------ | :------ | |
| 1432 | +| `context` | `Readonly`\<`RuleContext`\<`string`, readonly `unknown`[]\>\> | `undefined` | |
| 1433 | +| `hint` | `bigint` | `DEFAULT_COMPONENT_COLLECTOR_HINT` | |
| 1434 | +| `pragma` | `string` | `undefined` | |
| 1435 | + |
| 1436 | +#### Returns |
| 1437 | + |
| 1438 | +`Object` |
| 1439 | + |
| 1440 | +| Name | Type | |
| 1441 | +| :------ | :------ | |
| 1442 | +| `ctx` | \{ `getCurrentFunction`: () => `Option`\<[`TSESTreeFunction`, `boolean`, `CallExpression`[]]\> ; `getAllComponents`: (`_`: `Program`) => `Map`\<`string`, [`ERFunctionComponent`](interfaces/ERFunctionComponent.md)\> ; `getCurrentComponents`: () => `Map`\<`string`, [`ERFunctionComponent`](interfaces/ERFunctionComponent.md)\> ; `getCurrentFunctionStack`: () => [`TSESTreeFunction`, `boolean`, `CallExpression`[]][] } | |
| 1443 | +| `ctx.getCurrentFunction` | () => `Option`\<[`TSESTreeFunction`, `boolean`, `CallExpression`[]]\> | |
| 1444 | +| `ctx.getAllComponents` | [object Object] | |
| 1445 | +| `ctx.getCurrentComponents` | [object Object] | |
| 1446 | +| `ctx.getCurrentFunctionStack` | [object Object] | |
| 1447 | +| `listeners` | \{ `:function`: (`node`: `TSESTreeFunction`) => `MutableList`\<[`TSESTreeFunction`, `boolean`, `CallExpression`[]]\> = onFunctionEnter; `:function:exit`: () => `undefined` \| [`TSESTreeFunction`, `boolean`, `CallExpression`[]] = onFunctionExit; `ArrowFunctionExpression[body.type!='BlockStatement']`: () => `void` ; `AssignmentExpression[operator='='][left.type='MemberExpression'][left.property.name='displayName']`: (`node`: `AssignmentExpression`) => `void` ; `CallExpression:exit`: (`node`: `CallExpression`) => `void` ; `ReturnStatement`: (`node`: `ReturnStatement`) => `void` } | |
| 1448 | +| `listeners.:function` | (`node`: `TSESTreeFunction`) => `MutableList`\<[`TSESTreeFunction`, `boolean`, `CallExpression`[]]\> | |
| 1449 | +| `listeners.:function:exit` | () => `undefined` \| [`TSESTreeFunction`, `boolean`, `CallExpression`[]] | |
| 1450 | +| `listeners.ArrowFunctionExpression[body.type!='BlockStatement']` | [object Object] | |
| 1451 | +| `listeners.AssignmentExpression[operator='='][left.type='MemberExpression'][left.property.name='displayName']` | [object Object] | |
| 1452 | +| `listeners.CallExpression:exit` | [object Object] | |
| 1453 | +| `listeners.ReturnStatement` | [object Object] | |
| 1454 | + |
| 1455 | +___ |
| 1456 | + |
| 1457 | +### useComponentCollectorLegacy |
| 1458 | + |
| 1459 | +▸ **useComponentCollectorLegacy**(`context`): `Object` |
| 1460 | + |
| 1461 | +#### Parameters |
| 1462 | + |
| 1463 | +| Name | Type | |
| 1464 | +| :------ | :------ | |
| 1465 | +| `context` | `Readonly`\<`RuleContext`\<`string`, readonly `unknown`[]\>\> | |
| 1466 | + |
| 1467 | +#### Returns |
| 1468 | + |
| 1469 | +`Object` |
| 1470 | + |
| 1471 | +| Name | Type | |
| 1472 | +| :------ | :------ | |
| 1473 | +| `ctx` | \{ `getAllComponents`: (`_`: `Program`) => `Map`\<`string`, [`ERClassComponent`](interfaces/ERClassComponent.md)\> ; `getCurrentComponents`: () => `Map`\<`string`, [`ERClassComponent`](interfaces/ERClassComponent.md)\> } | |
| 1474 | +| `ctx.getAllComponents` | [object Object] | |
| 1475 | +| `ctx.getCurrentComponents` | [object Object] | |
| 1476 | +| `listeners` | \{ `ClassDeclaration`: (`node`: `TSESTreeClass`) => `void` = collect; `ClassExpression`: (`node`: `TSESTreeClass`) => `void` = collect } | |
| 1477 | +| `listeners.ClassDeclaration` | (`node`: `TSESTreeClass`) => `void` | |
| 1478 | +| `listeners.ClassExpression` | (`node`: `TSESTreeClass`) => `void` | |
| 1479 | + |
| 1480 | +___ |
| 1481 | + |
| 1482 | +### useHookCollector |
| 1483 | + |
| 1484 | +▸ **useHookCollector**(): `Object` |
| 1485 | + |
| 1486 | +#### Returns |
| 1487 | + |
| 1488 | +`Object` |
| 1489 | + |
| 1490 | +| Name | Type | |
| 1491 | +| :------ | :------ | |
| 1492 | +| `ctx` | \{ `getAllHooks`: (`_`: `Program`) => `Map`\<`string`, [`ERHook`](interfaces/ERHook.md)\> ; `getCurrentHooks`: () => `Map`\<`string`, [`ERHook`](interfaces/ERHook.md)\> } | |
| 1493 | +| `ctx.getAllHooks` | [object Object] | |
| 1494 | +| `ctx.getCurrentHooks` | [object Object] | |
| 1495 | +| `listeners` | `ESLintUtils.RuleListener` | |
0 commit comments