forked from oxc-project/oxc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema_markdown.snap
435 lines (209 loc) · 6.84 KB
/
schema_markdown.snap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
---
source: tasks/website/src/linter/json_schema.rs
expression: snapshot
---
# Oxlint Configuration File
This configuration is aligned with ESLint v8's configuration schema (`eslintrc.json`).
Usage: `oxlint -c oxlintrc.json --import-plugin`
::: danger NOTE
Only the `.json` format is supported. You can use comments in configuration files.
:::
Example
`.oxlintrc.json`
```json
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": [
"import",
"typescript",
"unicorn"
],
"env": {
"browser": true
},
"globals": {
"foo": "readonly"
},
"settings": {},
"rules": {
"eqeqeq": "warn",
"import/no-cycle": "error"
},
"overrides": [
{
"files": [
"*.test.ts",
"*.spec.ts"
],
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
}
]
}
```
## categories
type: `object`
Configure an entire category of rules all at once.
Rules enabled or disabled this way will be overwritten by individual rules in the `rules` field.
# Example
```json
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"categories": {
"correctness": "warn"
},
"rules": {
"eslint/no-unused-vars": "error"
}
}
```
### categories.correctness
### categories.nursery
### categories.pedantic
### categories.perf
### categories.restriction
### categories.style
### categories.suspicious
## env
type: `Record<string, boolean>`
Predefine global variables.
Environments specify what global variables are predefined. See [ESLint's list of environments](https://eslint.org/docs/v8.x/use/configure/language-options#specifying-environments) for what environments are available and what each one provides.
## globals
type: `Record<string, string>`
Add or remove global variables.
For each global variable, set the corresponding value equal to `"writable"` to allow the variable to be overwritten or `"readonly"` to disallow overwriting.
Globals can be disabled by setting their value to `"off"`. For example, in an environment where most Es2015 globals are available but `Promise` is unavailable, you might use this config:
```json
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"env": {
"es6": true
},
"globals": {
"Promise": "off"
}
}
```
You may also use `"readable"` or `false` to represent `"readonly"`, and `"writeable"` or `true` to represent `"writable"`.
## ignorePatterns
type: `string[]`
default: `[]`
Globs to ignore during linting. These are resolved from the configuration file path.
## overrides
type: `array`
### overrides[n]
type: `object`
#### overrides[n].files
type: `string[]`
#### overrides[n].rules
type: `object`
See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html)
## plugins
type: `string[]`
default: `["react", "unicorn", "typescript", "oxc"]`
## rules
type: `object`
See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html)
## settings
type: `object`
Configure the behavior of linter plugins.
## Example
Here's an example if you're using Next.js in a monorepo:
```json
{
"settings": {
"next": {
"rootDir": "apps/dashboard/"
},
"react": {
"linkComponents": [
{
"name": "Link",
"linkAttribute": "to"
}
]
},
"jsx-a11y": {
"components": {
"Link": "a",
"Button": "button"
}
}
}
}
```
### settings.jsdoc
type: `object`
#### settings.jsdoc.augmentsExtendsReplacesDocs
type: `boolean`
default: `false`
Only for `require-(yields|returns|description|example|param|throws)` rule
#### settings.jsdoc.exemptDestructuredRootsFromChecks
type: `boolean`
default: `false`
Only for `require-param-type` and `require-param-description` rule
#### settings.jsdoc.ignoreInternal
type: `boolean`
default: `false`
For all rules but NOT apply to `empty-tags` rule
#### settings.jsdoc.ignorePrivate
type: `boolean`
default: `false`
For all rules but NOT apply to `check-access` and `empty-tags` rule
#### settings.jsdoc.ignoreReplacesDocs
type: `boolean`
default: `true`
Only for `require-(yields|returns|description|example|param|throws)` rule
#### settings.jsdoc.implementsReplacesDocs
type: `boolean`
default: `false`
Only for `require-(yields|returns|description|example|param|throws)` rule
#### settings.jsdoc.overrideReplacesDocs
type: `boolean`
default: `true`
Only for `require-(yields|returns|description|example|param|throws)` rule
#### settings.jsdoc.tagNamePreference
type: `object`
default: `{}`
### settings.jsx-a11y
type: `object`
Configure JSX A11y plugin rules.
See [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y#configurations)'s configuration for a full reference.
#### settings.jsx-a11y.components
type: `Record<string, string>`
default: `{}`
To have your custom components be checked as DOM elements, you can provide a mapping of your component names to the DOM element name.
## Example
```json { "settings": { "jsx-a11y": { "components": { "Link": "a", "IconButton": "button" } } } } ```
#### settings.jsx-a11y.polymorphicPropName
type: `[
string,
null
]`
An optional setting that define the prop your code uses to create polymorphic components. This setting will be used to determine the element type in rules that require semantic context.
For example, if you set the `polymorphicPropName` to `as`, then this element:
```jsx <Box as="h3">Hello</Box> ```
Will be treated as an `h3`. If not set, this component will be treated as a `Box`.
### settings.next
type: `object`
Configure Next.js plugin rules.
#### settings.next.rootDir
### settings.react
type: `object`
Configure React plugin rules.
Derived from [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react#configuration-legacy-eslintrc-)
#### settings.react.formComponents
type: `array`
default: `[]`
Components used as alternatives to `<form>` for forms, such as `<Formik>`.
## Example
```jsonc { "settings": { "react": { "formComponents": [ "CustomForm", // OtherForm is considered a form component and has an endpoint attribute { "name": "OtherForm", "formAttribute": "endpoint" }, // allows specifying multiple properties if necessary { "name": "Form", "formAttribute": ["registerEndpoint", "loginEndpoint"] } ] } } } ```
##### settings.react.formComponents[n]
#### settings.react.linkComponents
type: `array`
default: `[]`
Components used as alternatives to `<a>` for linking, such as `<Link>`.
## Example
```jsonc { "settings": { "react": { "linkComponents": [ "HyperLink", // Use `linkAttribute` for components that use a different prop name // than `href`. { "name": "MyLink", "linkAttribute": "to" }, // allows specifying multiple properties if necessary { "name": "Link", "linkAttribute": ["to", "href"] } ] } } } ```
##### settings.react.linkComponents[n]