0
# Plugins
1
2
Oxlint features a comprehensive plugin system that provides specialized linting rules for different frameworks, libraries, and coding standards. Plugins can be enabled or disabled through both command-line options and configuration files.
3
4
## Plugin Architecture
5
6
Oxlint plugins are built-in modules that provide additional linting rules beyond the core JavaScript/TypeScript rules. Each plugin focuses on specific domains like frameworks (React, Vue), testing libraries (Jest, Vitest), or coding standards (accessibility, performance).
7
8
## Built-in Plugins
9
10
### Default Enabled Plugins
11
12
These plugins are enabled by default and can be disabled if not needed:
13
14
#### ESLint Core Plugin
15
16
**Configuration:**
17
```json
18
{
19
"plugins": ["eslint"]
20
}
21
```
22
23
Core ESLint rules for JavaScript linting (always enabled).
24
25
#### Unicorn Plugin
26
27
```bash { .api }
28
# Disable unicorn plugin
29
oxlint --disable-unicorn-plugin
30
```
31
32
**Configuration:**
33
```json
34
{
35
"plugins": ["unicorn"]
36
}
37
```
38
39
Provides modern JavaScript best practices and code quality rules.
40
41
#### OXC Plugin
42
43
```bash { .api }
44
# Disable oxc unique rules
45
oxlint --disable-oxc-plugin
46
```
47
48
**Configuration:**
49
```json
50
{
51
"plugins": ["oxc"]
52
// or alternative name
53
"plugins": ["deepscan"]
54
}
55
```
56
57
Oxlint-specific rules and optimizations not found in other linters.
58
59
#### TypeScript Plugin
60
61
```bash { .api }
62
# Disable TypeScript plugin
63
oxlint --disable-typescript-plugin
64
```
65
66
**Configuration:**
67
```json
68
{
69
"plugins": ["typescript"]
70
// or alternative name
71
"plugins": ["@typescript-eslint"]
72
}
73
```
74
75
Provides @typescript-eslint compatible rules for TypeScript code analysis.
76
77
### Framework Plugins
78
79
#### React Plugin
80
81
```bash { .api }
82
# Enable React plugin
83
oxlint --react-plugin
84
```
85
86
**Configuration:**
87
```json
88
{
89
"plugins": ["react", "react-hooks"],
90
"settings": {
91
"react": {
92
"version": "detect",
93
"pragma": "React",
94
"fragment": "Fragment",
95
"createClass": "createReactClass",
96
"flowVersion": "0.53"
97
}
98
}
99
}
100
```
101
102
React-specific linting rules for JSX, hooks, and component patterns. Includes both `react` and `react-hooks` rules.
103
104
#### Vue Plugin
105
106
```bash { .api }
107
# Enable Vue plugin
108
oxlint --vue-plugin
109
```
110
111
**Configuration:**
112
```json
113
{
114
"plugins": ["vue"]
115
}
116
```
117
118
Vue.js-specific linting rules for Single File Components and Vue syntax.
119
120
#### Next.js Plugin
121
122
```bash { .api }
123
# Enable Next.js plugin
124
oxlint --nextjs-plugin
125
```
126
127
**Configuration:**
128
```json
129
{
130
"plugins": ["nextjs"]
131
}
132
```
133
134
Next.js framework-specific rules for pages, API routes, and optimization patterns.
135
136
### Testing Plugins
137
138
#### Jest Plugin
139
140
```bash { .api }
141
# Enable Jest plugin
142
oxlint --jest-plugin
143
```
144
145
**Configuration:**
146
```json
147
{
148
"plugins": ["jest"],
149
"env": {
150
"jest": true
151
}
152
}
153
```
154
155
Jest testing framework rules for test structure, assertions, and best practices.
156
157
#### Vitest Plugin
158
159
```bash { .api }
160
# Enable Vitest plugin
161
oxlint --vitest-plugin
162
```
163
164
**Configuration:**
165
```json
166
{
167
"plugins": ["vitest"]
168
}
169
```
170
171
Vitest testing framework rules. When enabled, automatically enables Jest plugin rules for compatibility.
172
173
### Code Quality Plugins
174
175
#### Import Plugin
176
177
```bash { .api }
178
# Enable import plugin (experimental)
179
oxlint --import-plugin
180
```
181
182
**Configuration:**
183
```json
184
{
185
"plugins": ["import"]
186
// or alternative name
187
"plugins": ["import-x"]
188
}
189
```
190
191
**Settings:**
192
```json
193
{
194
"settings": {
195
"import/resolver": {
196
"node": {
197
"extensions": [".js", ".jsx", ".ts", ".tsx"]
198
},
199
"typescript": {
200
"alwaysTryTypes": true,
201
"project": "./tsconfig.json"
202
}
203
},
204
"import/ignore": ["node_modules"],
205
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
206
"import/core-modules": ["electron"]
207
}
208
}
209
```
210
211
ES6 import/export validation and dependency analysis. Works best with `--tsconfig` option.
212
213
#### JSDoc Plugin
214
215
```bash { .api }
216
# Enable JSDoc plugin
217
oxlint --jsdoc-plugin
218
```
219
220
**Configuration:**
221
```json
222
{
223
"plugins": ["jsdoc"]
224
}
225
```
226
227
JSDoc comment validation and documentation standards enforcement.
228
229
#### Promise Plugin
230
231
```bash { .api }
232
# Enable Promise plugin
233
oxlint --promise-plugin
234
```
235
236
**Configuration:**
237
```json
238
{
239
"plugins": ["promise"]
240
}
241
```
242
243
Promise usage patterns, async/await best practices, and error handling.
244
245
#### Node.js Plugin
246
247
```bash { .api }
248
# Enable Node.js plugin
249
oxlint --node-plugin
250
```
251
252
**Configuration:**
253
```json
254
{
255
"plugins": ["node"],
256
"env": {
257
"node": true
258
}
259
}
260
```
261
262
Node.js specific rules for modules, APIs, and server-side patterns.
263
264
### Accessibility and Performance
265
266
#### JSX A11y Plugin
267
268
```bash { .api }
269
# Enable JSX accessibility plugin
270
oxlint --jsx-a11y-plugin
271
```
272
273
**Configuration:**
274
```json
275
{
276
"plugins": ["jsx-a11y"]
277
}
278
```
279
280
Accessibility rules for JSX elements, ARIA attributes, and semantic HTML.
281
282
#### React Performance Plugin
283
284
```bash { .api }
285
# Enable React performance plugin
286
oxlint --react-perf-plugin
287
```
288
289
**Configuration:**
290
```json
291
{
292
"plugins": ["react-perf"]
293
}
294
```
295
296
React performance optimization rules for rendering, memoization, and bundle size.
297
298
### Utility Plugins
299
300
#### Regex Plugin
301
302
```bash { .api }
303
# Enable regex plugin
304
oxlint --regex-plugin
305
```
306
307
**Configuration:**
308
```json
309
{
310
"plugins": ["regex"]
311
}
312
```
313
314
Regular expression validation and security rules.
315
316
## Plugin Configuration
317
318
### Multiple Plugin Activation
319
320
```bash
321
# Enable multiple plugins simultaneously
322
oxlint --react-plugin --import-plugin --jest-plugin --jsx-a11y-plugin src/
323
324
# Mix of enable/disable options
325
oxlint --react-plugin --disable-unicorn-plugin --disable-oxc-plugin src/
326
```
327
328
### Configuration File Plugin Management
329
330
```json
331
{
332
"plugins": [
333
"typescript",
334
"react",
335
"import",
336
"jest",
337
"jsx-a11y"
338
],
339
"rules": {
340
"react/jsx-uses-react": "error",
341
"import/no-unresolved": "error",
342
"jest/expect-expect": "warn",
343
"@typescript-eslint/no-unused-vars": "error"
344
}
345
}
346
```
347
348
## Plugin-Specific Rule Configuration
349
350
### TypeScript Plugin Rules
351
352
```json
353
{
354
"plugins": ["typescript"],
355
"rules": {
356
"@typescript-eslint/explicit-function-return-type": "warn",
357
"@typescript-eslint/no-explicit-any": "error",
358
"@typescript-eslint/no-unused-vars": "error",
359
"@typescript-eslint/prefer-nullish-coalescing": "warn"
360
}
361
}
362
```
363
364
### React Plugin Rules
365
366
```json
367
{
368
"plugins": ["react"],
369
"rules": {
370
"react/jsx-uses-react": "error",
371
"react/jsx-uses-vars": "error",
372
"react/no-unused-state": "warn",
373
"react/prefer-stateless-function": "warn"
374
},
375
"settings": {
376
"react": {
377
"version": "detect"
378
}
379
}
380
}
381
```
382
383
### Import Plugin Rules
384
385
```json
386
{
387
"plugins": ["import"],
388
"rules": {
389
"import/no-unresolved": "error",
390
"import/no-cycle": "error",
391
"import/order": ["warn", {
392
"groups": ["builtin", "external", "internal"]
393
}]
394
},
395
"settings": {
396
"import/resolver": {
397
"typescript": true
398
}
399
}
400
}
401
```
402
403
## Advanced Plugin Usage
404
405
### Type-Aware Linting
406
407
Some plugins require type information for advanced analysis:
408
409
```bash
410
# Enable type-aware rules with TypeScript configuration
411
oxlint --type-aware --tsconfig ./tsconfig.json --import-plugin src/
412
```
413
414
### Project-Specific Plugin Selection
415
416
```json
417
{
418
"overrides": [
419
{
420
"files": ["src/components/**/*.tsx"],
421
"plugins": ["react", "jsx-a11y"],
422
"rules": {
423
"react/jsx-props-no-spreading": "error",
424
"jsx-a11y/alt-text": "error"
425
}
426
},
427
{
428
"files": ["**/*.test.ts", "**/*.test.tsx"],
429
"plugins": ["jest"],
430
"env": {
431
"jest": true
432
}
433
}
434
]
435
}
436
```
437
438
### Plugin Compatibility
439
440
- **Vitest + Jest**: Enabling Vitest automatically enables Jest for compatibility
441
- **TypeScript + Import**: Import plugin works best with TypeScript resolver
442
- **React + JSX A11y**: Common combination for React accessibility
443
- **React + React Performance**: Comprehensive React optimization
444
445
## Experimental Features
446
447
### JavaScript Plugins
448
449
```bash
450
# Enable experimental JavaScript plugins (requires npm distribution)
451
oxlint --experimental-js-plugins
452
```
453
454
**Requirements:**
455
- 64-bit little-endian platform
456
- Running through npm/npx (not standalone binary)
457
- External linter integration
458
459
**Note:** This feature is experimental and primarily intended for integration with Node.js tools and language servers.