You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/pages/docs/configurations.mdx
+74-18Lines changed: 74 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,65 +8,121 @@ ESLint React provides the following configurations:
8
8
9
9
### `version`
10
10
11
-
(type: `string`, default: `"detect"`)
11
+
```ts
12
+
exportdefault"detect"satisfiesstring
13
+
```
14
+
15
+
React version to perform the analysis, `"detect"` means auto detect React version from the project's dependencies.
12
16
13
-
React version to use, `"detect"` means auto detect React version from the project's dependencies.
17
+
If failed to detect, it will use the `19.0.0` version.
14
18
15
19
### `importSource`
16
20
17
-
(type: `string`, default: `"react"`)
21
+
```ts
22
+
exportdefault"react"satisfiesstring
23
+
```
24
+
25
+
<Callouttype="info">If `importSource` is specified, an equivalent version of React should be provided to the [`version`](#version) setting.</Callout>
18
26
19
-
The source where React is imported from.\
20
-
This allows to specify a custom import location for React when not using the official distribution.\
21
-
If `importSource` is specified, an equivalent version of React should be provided to the [`version`](#version) setting.
27
+
The source where React is imported from.
22
28
23
-
(e.g. `@pika/react`, etc)
29
+
This allows to specify a custom import location for React when not using the official distribution.
30
+
31
+
For example, if you are using `@pika/react` instead of `react`, you can set the `importSource` to `@pika/react`:
32
+
33
+
```tsx
34
+
importReactfrom"@pika/react";
35
+
```
24
36
25
37
### `polymorphicPropName`
26
38
27
-
(type: `string`)
39
+
```ts
40
+
exportdefault"as"satisfiesstring
41
+
```
28
42
29
43
You can optionally use the `polymorphicPropName` setting to define the prop your code uses to create polymorphic components. This setting will be used determine the element type in rules that require semantic context.
30
44
31
45
For example, if you set the `polymorphicPropName` setting to `as` then this element:
32
46
33
-
`<Box as="h3">Configurations </Box>`
47
+
```tsx
48
+
<Boxas="h3">Configurations</Box>
49
+
```
34
50
35
51
will be evaluated as an `h3`.
36
52
37
53
If no `polymorphicPropName` is set, then the component will be evaluated as `Box`.
<Callouttype="info">Before using `additionalComponents`, consider whether `polymorphicPropName` can be used instead, as it simpler and more efficient.</Callout>
44
74
45
75
<Callouttype="warning">This is an experimental feature that can be unstable and lacks documentation.</Callout>
46
76
47
77
An array of components and its attributes mapping. It allows the related rules to do even more comprehensive analysis. You can also provide default values for attributes here, that will be used when that attribute is not present in the component.
48
78
49
-
For example, if you set the `additionalComponents` to`[{ name: "EmbedContent", as: "iframe", attributes: [{ name: "sandbox", defaultValue: "" }] }]` then this element:
79
+
For example, if you set the `additionalComponents` to:
0 commit comments