π A universal bundler plugin for integrating the Oxlint linter into your project, based on vite-plugin-oxlint.
π A quick and simple way to use oxlint in your project.
π οΈ Support linting with both bundler plugin and Node.js API.
βοΈ Support common bundlers like Vite, Rollup, esbuild, and Webpack by unplugin.
π Support mixed use in eslint projects by eslint-plugin-oxlint.
π Friendly output in terminal, grouped by filepath, and support including targets with glob patterns.
β‘ Only lint the files that have changed for better performance by chokidar.
# npm
npm i -D oxlint unplugin-oxlint
# pnpm
pnpm add -D oxlint unplugin-oxlint
# yar
yarn add -D oxlint unplugin-oxlint
Recommended the bundler plugin way to use the full options
of unplugin-oxlint
.
Vite
// vite.config.ts
import Oxlint from 'unplugin-oxlint/vite'
export default defineConfig({
plugins: [Oxlint()],
})
Rollup
// rollup.config.js
import Oxlint from 'unplugin-oxlint/rollup'
export default {
plugins: [Oxlint()],
}
esbuild
// esbuild.config.js
import { build } from 'esbuild'
build({
plugins: [require('unplugin-oxlint/esbuild')()],
})
Webpack
// webpack.config.js
module.exports = {
/* ... */
plugins: [require('unplugin-oxlint/webpack')()],
}
You can also use unox
command to lint files like eslint
// package.json
{
"scripts": {
"lint": "unox",
"lint:fix": "unox --fix"
}
}
unox
support most of the options of unplugin-oxlint
, use them as params like:
unox src/**/*.ts --watch
For further configuration, create a config file named unox.config.{js,cjs,mjs,ts,mts,cts}
See playground.
If you are looking for a way to use oxlint in projects that still need ESLint, You can use eslint-plugin-oxlint to turn off ESLint rules that are already supported by oxlint.
The rules are extracted from here
unplugin-oxlint
will automatically run the eslint
script after oxlint
when build start and file change.
# npm
npm i -D eslint eslint-plugin-oxlint
# pnpm
pnpm add -D eslint eslint-plugin-oxlint
# yarn
yarn add -D eslint eslint-plugin-oxlint
Use eslint-plugin-oxlint with @antfu/eslint-config
// eslint.config.js
import antfu from '@antfu/eslint-config'
import oxlint from 'eslint-plugin-oxlint'
export default antfu({
...oxlint.configs['flat/recommended'],
})
For all options please refer to docs.
This plugin accepts most options of vite-plugin-oxlint, and some extra options that are specific to this plugin.
Type:string | string[]
Default:'.'
- Type:
string | string[]
- Default:
'**/*.{js,ts,jsx,tsx,vue}'
Paths to files, dirs to be watched by glob patterns
- Type:
RegExp[]
- Default:
[/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/]
- Type:
string
- Default:
'.'
- Type:
boolean
- Default:
false
Fix as many issues as possible. Only unfixed issues are reported in the output
- Type:
boolean
- Default:
false
Continue to watch for changes in any of the resolved path
- Type:
string
- Default:
''
ESLint configuration file
- Type:
boolean
- Default:
false
Disables excluding of files from .eslintignore files, --ignore-path
flags and --ignore-pattern
flags
- Type:
boolean
- Default:
false
Disable reporting on warnings, only errors are reported
- Type:
boolean
- Default:
false
Ensure warnings produce a non-zero exit code
- Type:
'npm' | 'pnpm' | 'yarn' | 'bun'
Declare the package manager which you want to use
Normally you don't need to modify this option. unplugin-oxlint
will automatically detect package.json
and lock file by nypm