JS Plugins
Oxlint supports plugins written in JS - either custom-written, or from npm.
Oxlint's plugin API is compatible with ESLint v9+, so most existing ESLint plugins should work out of the box with Oxlint.
Almost the entirety of ESLint's plugin API is now implemented (see below), so most existing ESLint plugins should work out of the box.
INFO
JS plugins are currently in alpha, and remain under active development.
All APIs should behave identically to ESLint. If you find any differences in behavior, that's a bug - please report it.
Using JS plugins
- Add a path to the plugin to the
.oxlintrc.jsonconfig file, underjsPlugins. - Add rules from the plugin, under
rules.
The path can be any valid import specifier e.g. ./plugin.js, eslint-plugin-foo, or @foo/eslint-plugin. Paths are resolved relative to the config file itself.
jsonc
{
"jsPlugins": ["./path/to/my-plugin.js", "eslint-plugin-whatever", "@foobar/eslint-plugin"],
"rules": {
"my-plugin/rule1": "error",
"my-plugin/rule2": "warn",
"whatever/rule1": "error",
"whatever/rule2": "warn",
"@foobar/rule1": "error",
},
// ... other config ...
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
jsPlugins: ["./path/to/my-plugin.js", "eslint-plugin-whatever", "@foobar/eslint-plugin"],
rules: {
"my-plugin/rule1": "error",
"my-plugin/rule2": "warn",
"whatever/rule1": "error",
"whatever/rule2": "warn",
"@foobar/rule1": "error",
},
// ... other config ...
});
``````jsonc [.oxlintrc.json]
{
"jsPlugins": [
// `jsdoc` is a reserved name, as Oxlint supports it natively
{
"name": "jsdoc-js",
"specifier": "eslint-plugin-jsdoc",
},
// Shorten name
{
"name": "short",
"specifier": "eslint-plugin-with-name-so-very-very-long",
},
// List plugins you don't want to alias as just specifiers
"eslint-plugin-whatever",
],
"rules": {
"jsdoc-js/check-alignment": "error",
"short/rule1": "error",
"whatever/rule2": "error",
},
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
jsPlugins: [
// `jsdoc` is a reserved name, as Oxlint supports it natively
{
name: "jsdoc-js",
specifier: "eslint-plugin-jsdoc",
},
// Shorten name
{
name: "short",
specifier: "eslint-plugin-with-name-so-very-very-long",
},
// List plugins you don't want to alias as just specifiers
"eslint-plugin-whatever",
],
rules: {
"jsdoc-js/check-alignment": "error",
"short/rule1": "error",
"whatever/rule2": "error",
},
});