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.
Allow / Deny / Warn will override config files rules.
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 your src
directory.
import oxlintPlugin from 'vite-plugin-oxlint'
export default {
plugins: [
oxlintPlugin({
path: 'src',
}),
],
}
You can specify patterns of files to ignore. The supported syntax is the same as for .eslintignore and .gitignore files You should quote your patterns in order to avoid shell interpretation of glob patterns See oxlint ignore
Example: lint files in your src
, but not test.js files:
import oxlintPlugin from 'vite-plugin-oxlint'
export default {
plugins: [
oxlintPlugin({
path: 'src',
ignorePattern: '"test.js"',
}),
],
}
You can allow, deny or warn oxlinter rules or categories.
To see the list of available rules and categories, run:
npx oxlint --rules
This will override config files.
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()],
}