Skip to content

Commit 0d7a3f0

Browse files
committed
docs: minor improvements
1 parent 879dabb commit 0d7a3f0

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

website/pages/docs/configurations.mdx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ESLint React provides the following configurations:
99
### `version`
1010

1111
```ts
12-
export default "detect" satisfies string
12+
const version = "detect" satisfies string
1313
```
1414

1515
React version to perform the analysis, `"detect"` means auto detect React version from the project's dependencies.
@@ -19,7 +19,7 @@ If failed to detect, it will use the `19.0.0` version.
1919
### `importSource`
2020

2121
```ts
22-
export default "react" satisfies string
22+
const importSource = "react" satisfies string
2323
```
2424

2525
<Callout type="info">If `importSource` is specified, an equivalent version of React should be provided to the [`version`](#version) setting.</Callout>
@@ -37,7 +37,7 @@ import React from "@pika/react";
3737
### `polymorphicPropName`
3838

3939
```ts
40-
export default "as" satisfies string
40+
const polymorphicPropName = "as" satisfies string
4141
```
4242

4343
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.
@@ -67,7 +67,7 @@ interface ComponentEntry {
6767
attributes: ComponentAttributeEntry[];
6868
}
6969

70-
export default [] satisfies ComponentEntry[]
70+
const additionalComponents = [] satisfies ComponentEntry[]
7171
```
7272

7373
<Callout type="info">Before using `additionalComponents`, consider whether `polymorphicPropName` can be used instead, as it simpler and more efficient.</Callout>
@@ -79,7 +79,15 @@ An array of components and its attributes mapping. It allows the related rules t
7979
For example, if you set the `additionalComponents` to:
8080

8181
```json
82-
[{ name: "EmbedContent", as: "iframe", attributes: [{ name: "sandbox", defaultValue: "" }] }]
82+
[
83+
{
84+
"name": "EmbedContent",
85+
"as": "iframe",
86+
"attributes": [
87+
{ "name": "sandbox", "defaultValue": "" }
88+
]
89+
}
90+
]
8391
```
8492

8593
then this element:
@@ -99,7 +107,7 @@ So that both the `dom/no-missing-iframe-sandbox` and `dom/no-unsafe-iframe-sandb
99107
### `additionalHooks`
100108

101109
```ts
102-
export default { useLayoutEffect: ["useIsomorphicLayoutEffect"] } satisfies Record<ReactBuiltInHookName, string[]>
110+
const additionalHooks = { useLayoutEffect: ["useIsomorphicLayoutEffect"] } satisfies Record<ReactBuiltInHookName, string[]>
103111
```
104112

105113
<Callout type="warning">This is intended to cover edge cases. We suggest using the built-in React Hooks whenever possible.</Callout>

0 commit comments

Comments
 (0)