|
8 | 8 |
|
9 | 9 | > **decodeSettings**(`settings`): `object` |
10 | 10 |
|
| 11 | +Decodes and validates ESLint React settings, using defaults if invalid |
| 12 | + |
11 | 13 | ## Parameters |
12 | 14 |
|
13 | 15 | ### settings |
14 | 16 |
|
15 | 17 | `unknown` |
16 | 18 |
|
| 19 | +The settings object to decode |
| 20 | + |
17 | 21 | ## Returns |
18 | 22 |
|
19 | 23 | ### additionalComponents? |
20 | 24 |
|
21 | 25 | > `optional` **additionalComponents**: `object`[] |
22 | 26 |
|
23 | | -An array of user-defined components |
24 | | - |
25 | | -#### Description |
26 | | - |
27 | | -This is used to inform the ESLint React plugins how to treat these components during checks. |
| 27 | +User-defined components configuration |
| 28 | +Informs ESLint React how to treat these components during validation |
28 | 29 |
|
29 | 30 | #### Example |
30 | 31 |
|
31 | 32 | ```ts |
32 | | -`[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }, { name: "rel", defaultValue: "noopener noreferrer" }] }]` |
| 33 | +[{ name: "Link", as: "a", attributes: [{ name: "to", as: "href" }] }] |
33 | 34 | ``` |
34 | 35 |
|
35 | 36 | ### additionalHooks? |
36 | 37 |
|
37 | 38 | > `optional` **additionalHooks**: `object` |
38 | 39 |
|
39 | | -A object to define additional hooks that are equivalent to the built-in React Hooks. |
40 | | - |
41 | | -#### Description |
42 | | - |
43 | | -ESLint React will recognize these aliases as equivalent to the built-in hooks in all its rules. |
| 40 | +Custom hooks that should be treated as equivalent to built-in React Hooks |
44 | 41 |
|
45 | 42 | #### Example |
46 | 43 |
|
47 | 44 | ```ts |
48 | | -`{ useEffect: ["useIsomorphicLayoutEffect"] }` |
| 45 | +{ useEffect: ["useIsomorphicLayoutEffect"] } |
49 | 46 | ``` |
50 | 47 |
|
51 | 48 | #### additionalHooks.use? |
@@ -128,51 +125,49 @@ ESLint React will recognize these aliases as equivalent to the built-in hooks in |
128 | 125 |
|
129 | 126 | > `optional` **importSource**: `string` |
130 | 127 |
|
131 | | -The source where React is imported from. |
132 | | - |
133 | | -#### Description |
134 | | - |
135 | | -This allows to specify a custom import location for React when not using the official distribution. |
| 128 | +The source where React is imported from |
| 129 | +Allows specifying a custom import location for React |
136 | 130 |
|
137 | 131 | #### Default |
138 | 132 |
|
139 | | -`"react"` |
| 133 | +```ts |
| 134 | +"react" |
| 135 | +``` |
140 | 136 |
|
141 | 137 | #### Example |
142 | 138 |
|
143 | 139 | ```ts |
144 | | -`"@pika/react"` |
| 140 | +"@pika/react" |
145 | 141 | ``` |
146 | 142 |
|
147 | 143 | ### polymorphicPropName? |
148 | 144 |
|
149 | 145 | > `optional` **polymorphicPropName**: `string` |
150 | 146 |
|
151 | | -The name of the prop that is used for polymorphic components. |
152 | | - |
153 | | -#### Description |
154 | | - |
155 | | -This is used to determine the type of the component. |
| 147 | +The prop name used for polymorphic components |
| 148 | +Used to determine the component's type |
156 | 149 |
|
157 | 150 | #### Example |
158 | 151 |
|
159 | 152 | ```ts |
160 | | -`"as"` |
| 153 | +"as" |
161 | 154 | ``` |
162 | 155 |
|
163 | 156 | ### version? |
164 | 157 |
|
165 | 158 | > `optional` **version**: `string` |
166 | 159 |
|
167 | | -React version to use, "detect" means auto detect React version from the project's dependencies. |
168 | | -If `importSource` is specified, an equivalent version of React should be provided here. |
| 160 | +React version to use |
| 161 | +"detect" means auto-detect React version from project dependencies |
169 | 162 |
|
170 | 163 | #### Example |
171 | 164 |
|
172 | 165 | ```ts |
173 | | -`"18.3.1"` |
| 166 | +"18.3.1" |
174 | 167 | ``` |
175 | 168 |
|
176 | 169 | #### Default |
177 | 170 |
|
178 | | -`"detect"` |
| 171 | +```ts |
| 172 | +"detect" |
| 173 | +``` |
0 commit comments