This is a Vite plugin for integrating the Oxlint linter into your Vite project. This plugin is an adaptation of the vite-plugin-biome for oxlint.
npm install vite-plugin-oxlint oxlint
Add the plugin to your vite.config.js
file.
import oxlintPlugin from 'vite-plugin-oxlint'
export default {
plugins: [oxlintPlugin()],
}
You can use a configuration file. See Oxlint configuration file.
If you use a configuration file, other Allow / Deny / Warn rules configurations will be ignored.
Default to oxlintrc.json
.
import oxlintPlugin from 'vite-plugin-oxlint'
export default {
plugins: [
oxlintPlugin({
configFile: 'eslintrc.json',
}),
],
}
You can change the directory where oxlinter will run. Default to the root of your project.
Examples: only lint files in yout src
directory.
import oxlintPlugin from 'vite-plugin-oxlint'
export default {
plugins: [
oxlintPlugin({
path: 'src',
}),
],
}
You can allow, deny or warn oxlinter rules or categories.
To see the list of available rules and categories, run:
npx oxlint --rules
Default to deny: correctness.
Example: deny (turn on) correctness
and perf
rules and allow (turn off) the debugger
and eqeqeq
rule.
import oxlintPlugin from 'vite-plugin-oxlint'
export default {
plugins: [
oxlintPlugin({
deny: ['correctness', 'perf'],
allow: ['debugger', 'eqeqeq'],
warn: [],
}),
],
}
You can pass any additional oxlint config as a string. See oxlint options for a list of available options.
Example: add the --deny-warnings
and --quiet
option to the vite-plugin-oxlint
config:
import oxlintPlugin from 'vite-plugin-oxlint'
export default {
plugins: [
oxlintPlugin({
params: '--deny-warnings --quiet',
}),
],
}
If your project still needs ESlint, you can use vite-plugin-eslint and configure ESlint with eslint-plugin-oxlint to turn off rules already supported in oxlint
import oxlintPlugin from 'vite-plugin-oxlint'
import eslintPlugin from 'vite-plugin-eslint'
export default {
plugins: [oxlintPlugin(), eslintPlugin()],
}