Skip to content

Commit 6016ff4

Browse files
committed
refactor: rewrite react api detection to better align with eslint-plugin-react-hook
1 parent 146541d commit 6016ff4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+949
-523
lines changed

apps/website/content/docs/configuration/configure-analyzer.mdx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,6 @@ Example for using `@pika/react` instead of `react`:
4545
import React from "@pika/react";
4646
```
4747

48-
### `skipImportCheck`
49-
50-
Controls whether to verify the import source when identifying React APIs.
51-
52-
Default is `true` (checks only API shape). When `false`, both shape and import source are verified, preventing false positives from third-party libraries with similar APIs.
53-
54-
```ts
55-
import { memo } from "unrelated-library";
56-
57-
const NonComponentFunction = memo(() => {
58-
// When skipImportCheck: false, this isn't recognized as React's memo
59-
});
60-
```
61-
6248
### `polymorphicPropName`
6349

6450
Defines the prop used for polymorphic components. Helps rules determine element types for semantic context.

apps/website/content/docs/configuration/configure-analyzer.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ export function AnalyzerPropertyTypeTable() {
1919
description: <Link href="#importsource">The source where React is imported from ⤵</Link>,
2020
default: '"react"',
2121
},
22-
skipImportCheck: {
23-
type: "boolean",
24-
description: (
25-
<Link href="#skipimportcheck">
26-
When determining whether an API originates from React, bypass the import source check. ⤵
27-
</Link>
28-
),
29-
default: "true",
30-
},
3122
polymorphicPropName: {
3223
type: "string",
3324
description: (
Lines changed: 11 additions & 0 deletions
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) / isReactAPI
6+
7+
# isReactAPI
8+
9+
## Type Aliases
10+
11+
- [ReturnType](type-aliases/ReturnType.md)
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[**@eslint-react/core**](../../../../README.md)
2+
3+
***
4+
5+
[@eslint-react/core](../../../../README.md) / [isReactAPI](../README.md) / ReturnType
6+
7+
# Type Alias: ReturnType()
8+
9+
> **ReturnType** = \{(`context`, `node`): `boolean`; (`context`): (`node`) => `boolean`; \}
10+
11+
## Call Signature
12+
13+
> (`context`, `node`): `boolean`
14+
15+
### Parameters
16+
17+
#### context
18+
19+
`RuleContext`
20+
21+
#### node
22+
23+
`undefined` | `null` | `Node`
24+
25+
### Returns
26+
27+
`boolean`
28+
29+
## Call Signature
30+
31+
> (`context`): (`node`) => `boolean`
32+
33+
### Parameters
34+
35+
#### context
36+
37+
`RuleContext`
38+
39+
### Returns
40+
41+
> (`node`): `boolean`
42+
43+
#### Parameters
44+
45+
##### node
46+
47+
`undefined` | `null` | `Node`
48+
49+
#### Returns
50+
51+
`boolean`

packages/core/docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
## Namespaces
88

9+
- [isReactAPI](@eslint-react/namespaces/isReactAPI/README.md)
910
- [useComponentCollector](@eslint-react/namespaces/useComponentCollector/README.md)
1011
- [useComponentCollectorLegacy](@eslint-react/namespaces/useComponentCollectorLegacy/README.md)
1112
- [useHookCollector](@eslint-react/namespaces/useHookCollector/README.md)

packages/core/docs/functions/isReactAPI.md

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,14 @@
66

77
# Function: isReactAPI()
88

9-
## Call Signature
9+
> **isReactAPI**(`api`): [`ReturnType`](../@eslint-react/namespaces/isReactAPI/type-aliases/ReturnType.md)
1010
11-
> **isReactAPI**(`name`): `ReturnType`
11+
## Parameters
1212

13-
### Parameters
14-
15-
#### name
16-
17-
`string`
18-
19-
### Returns
20-
21-
`ReturnType`
22-
23-
## Call Signature
24-
25-
> **isReactAPI**(`objectName`, `propertyName`): `ReturnType`
26-
27-
### Parameters
28-
29-
#### objectName
30-
31-
`string`
32-
33-
#### propertyName
13+
### api
3414

3515
`string`
3616

37-
### Returns
17+
## Returns
3818

39-
`ReturnType`
19+
[`ReturnType`](../@eslint-react/namespaces/isReactAPI/type-aliases/ReturnType.md)

packages/core/docs/functions/isReactAPICall.md

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,14 @@
66

77
# Function: isReactAPICall()
88

9-
## Call Signature
9+
> **isReactAPICall**(`api`): [`ReturnType`](../@eslint-react/namespaces/isReactAPI/type-aliases/ReturnType.md)
1010
11-
> **isReactAPICall**(`name`): `ReturnType`
11+
## Parameters
1212

13-
### Parameters
14-
15-
#### name
16-
17-
`string`
18-
19-
### Returns
20-
21-
`ReturnType`
22-
23-
## Call Signature
24-
25-
> **isReactAPICall**(`objectName`, `propertyName`): `ReturnType`
26-
27-
### Parameters
28-
29-
#### objectName
30-
31-
`string`
32-
33-
#### propertyName
13+
### api
3414

3515
`string`
3616

37-
### Returns
17+
## Returns
3818

39-
`ReturnType`
19+
[`ReturnType`](../@eslint-react/namespaces/isReactAPI/type-aliases/ReturnType.md)

packages/core/docs/variables/isCaptureOwnerStack.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
# Variable: isCaptureOwnerStack
88

9-
> `const` **isCaptureOwnerStack**: `ReturnType`
9+
> `const` **isCaptureOwnerStack**: [`ReturnType`](../@eslint-react/namespaces/isReactAPI/type-aliases/ReturnType.md)

packages/core/docs/variables/isCaptureOwnerStackCall.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
# Variable: isCaptureOwnerStackCall
88

9-
> `const` **isCaptureOwnerStackCall**: `ReturnType`
9+
> `const` **isCaptureOwnerStackCall**: [`ReturnType`](../@eslint-react/namespaces/isReactAPI/type-aliases/ReturnType.md)

packages/core/docs/variables/isChildrenCount.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
# Variable: isChildrenCount
88

9-
> `const` **isChildrenCount**: `ReturnType`
9+
> `const` **isChildrenCount**: [`ReturnType`](../@eslint-react/namespaces/isReactAPI/type-aliases/ReturnType.md)

0 commit comments

Comments
 (0)