vite-plugin-oxlint
v2.0.1
Published
Oxlint plugin for vite.
Readme
⚓️+⚡️Vite Plugin Oxlint
A Vite plugin for integrating the Oxlint linter into your Vite project.
Table of Contents
Installation
npm install vite-plugin-oxlint oxlintUsage
import oxlintPlugin from 'vite-plugin-oxlint'
export default {
plugins: [oxlintPlugin()]
}Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| configFile | string | oxlintrc.json | Path to the oxlint config file |
| path | string | . | Directory where oxlint runs |
| ignorePattern | string \| string[] | — | Glob patterns of files to ignore |
| allow | string[] | — | Rules/categories to allow (turn off) |
| deny | string[] | — | Rules/categories to deny (turn on) |
| warn | string[] | — | Rules/categories to warn |
| oxlintPath | string | — | Path to the oxlint binary (useful in monorepos) |
| format | string | default | Output format (default, checkstyle, github, gitlab, json, junit, stylish, unix) |
| quiet | boolean | false | Suppress warnings, only report errors |
| fix | boolean | false | Enable auto-fixing |
| failOnError | boolean | false | Fail the build on lint errors |
| failOnWarning | boolean | false | Fail the build on lint warnings |
| lintOnStart | boolean | true | Run oxlint when the build starts |
| params | string | — | Additional raw CLI flags passed to oxlint |
Advanced Usage
All examples below assume the following setup:
import oxlintPlugin from 'vite-plugin-oxlint'
export default {
plugins: [oxlintPlugin({ /* options here */ })]
}Configuration file
Use a custom oxlint config file. Default is oxlintrc.json.
Note: allow, deny, and warn options override config file rules.
{ configFile: 'eslintrc.json' }Working directory
Restrict linting to a subdirectory. Default is the project root.
{ path: 'src' }Ignore patterns
Ignore files using .gitignore-style patterns. See oxlint ignore docs.
Quote patterns to avoid shell glob interpretation.
// Single pattern
{ ignorePattern: '"test.js"' }
// Multiple patterns
{ ignorePattern: ['"test.js"', '"dist/**"'] }Allow / Deny / Warn rules
Control which rules or categories are active. Run npx oxlint --rules to list available rules and categories.
These options override any rules defined in the config file.
{
deny: ['correctness', 'perf'], // turn on
allow: ['debugger', 'eqeqeq'], // turn off
warn: ['suspicious']
}Oxlint binary path
In monorepos, if you get "command not found: oxlint" errors, specify the binary path explicitly.
Without this option, the plugin falls back to npx (or your package manager's equivalent).
{ oxlintPath: '/path/to/your/monorepo/node_modules/.bin/oxlint' }Output format
Change how lint diagnostics are reported. See oxlint output formats.
Available: default, checkstyle, github, gitlab, json, junit, stylish, unix.
{ format: 'stylish' }Fail on errors or warnings
By default, lint issues are logged but don't fail the build.
// Suppress warnings entirely (only report errors)
{ quiet: true }
// Fail on errors
{ failOnError: true }
// Fail on warnings
{ failOnWarning: true }
// Disable linting at build start (only lint on file changes during dev)
{ lintOnStart: false }Additional CLI options
Pass any raw CLI flags as a string. See oxlint CLI options.
{ params: '--deny-warnings --quiet' }Integration with ESLint
If your project still needs ESLint, use vite-plugin-eslint alongside this plugin, and configure ESLint with eslint-plugin-oxlint to disable rules already covered by oxlint.
import oxlintPlugin from 'vite-plugin-oxlint'
import eslintPlugin from 'vite-plugin-eslint'
export default {
plugins: [oxlintPlugin(), eslintPlugin()]
}