A Vite plugin for integrating the Oxlint linter into your Vite project.
npm install vite-plugin-oxlint oxlintimport oxlintPlugin from 'vite-plugin-oxlint'
export default {
plugins: [oxlintPlugin()]
}| 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 |
lintOnHotUpdate |
boolean |
true |
Run oxlint on every HMR update during dev |
params |
string |
— | Additional raw CLI flags passed to oxlint |
All examples below assume the following setup:
import oxlintPlugin from 'vite-plugin-oxlint'
export default {
plugins: [
oxlintPlugin({
/* options here */
})
]
}Use a custom oxlint config file. Default is oxlintrc.json.
Note: allow, deny, and warn options override config file rules.
{
configFile: 'eslintrc.json'
}Restrict linting to a subdirectory. Default is the project root.
{
path: 'src'
}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/**"']
}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']
}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'
}Change how lint diagnostics are reported. See oxlint output formats.
Available: default, checkstyle, github, gitlab, json, junit, stylish, unix.
{
format: 'stylish'
}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
{
lintOnStart: false
}
// Disable linting on HMR updates
{
lintOnHotUpdate: false
}Pass any raw CLI flags as a string. See oxlint CLI options.
{
params: '--deny-warnings --quiet'
}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()]
}