Configuration
Oxlint works out of the box, but most teams commit a configuration file (.oxlintrc.json or oxlint.config.ts) to keep linting consistent across local runs, editors, and CI.
This page focuses on project configuration: rules, categories, plugins, overrides, and shared settings.
Create a config file
To generate a starter config in the current directory (JSON):
sh
oxlint --init
``````sh
oxlint -c ./oxlintrc.json
# or
oxlint --config ./oxlintrc.json
``````json [.oxlintrc.json]
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"categories": {
"correctness": "warn"
},
"rules": {
"eslint/no-unused-vars": "error"
}
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
categories: {
correctness: "warn",
},
rules: {
"eslint/no-unused-vars": "error",
},
});
``````json [.oxlintrc.json]
{
"options": {
"typeAware": true,
"typeCheck": true,
"maxWarnings": 10
}
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
options: {
typeAware: true,
typeCheck: true,
maxWarnings: 10,
},
});
``````json [.oxlintrc.json]
{
"rules": {
"no-alert": "error",
"oxc/approx-constant": "warn",
"no-plusplus": "off",
"eslint/prefer-const": ["error", { "destructuring": "any" }]
}
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
rules: {
"no-alert": "error",
"oxc/approx-constant": "warn",
"no-plusplus": "off",
"eslint/prefer-const": ["error", { destructuring: "any" }],
},
});
``````json [.oxlintrc.json]
{
"rules": {
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }]
}
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
rules: {
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
},
});
``````sh
oxlint -D no-alert -W oxc/approx-constant -A no-plusplus
``````json [.oxlintrc.json]
{
"categories": {
"correctness": "error",
"suspicious": "warn",
"pedantic": "off"
}
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
categories: {
correctness: "error",
suspicious: "warn",
pedantic: "off",
},
});
``````sh
oxlint -D correctness -D suspicious
``````json [.oxlintrc.json]
{
"plugins": ["unicorn", "typescript", "oxc"]
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["unicorn", "typescript", "oxc"],
});
``````json [.oxlintrc.json]
{
"plugins": []
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: [],
});
``````json [.oxlintrc.json]
{
"jsPlugins": [
"eslint-plugin-playwright",
{ "name": "my-eslint-react", "specifier": "eslint-plugin-react" }
]
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
jsPlugins: [
"eslint-plugin-playwright",
{ name: "my-eslint-react", specifier: "eslint-plugin-react" },
],
});
``````json [.oxlintrc.json]
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"rules": {
"no-console": "error"
},
"overrides": [
{
"files": ["scripts/*.js"],
"rules": {
"no-console": "off"
}
},
{
"files": ["**/*.{ts,tsx}"],
"plugins": ["typescript"],
"rules": {
"typescript/no-explicit-any": "error"
}
},
{
"files": ["**/test/**"],
"plugins": ["jest"],
"env": {
"jest": true
},
"rules": {
"jest/no-disabled-tests": "off"
}
}
]
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
rules: {
"no-console": "error",
},
overrides: [
{
files: ["scripts/*.js"],
rules: {
"no-console": "off",
},
},
{
files: ["**/*.{ts,tsx}"],
plugins: ["typescript"],
rules: {
"typescript/no-explicit-any": "error",
},
},
{
files: ["**/test/**"],
plugins: ["jest"],
env: {
jest: true,
},
rules: {
"jest/no-disabled-tests": "off",
},
},
],
});
``````json [.oxlintrc.json]
{
"extends": ["./configs/base.json", "./configs/frontend.json"]
}
``````ts [oxlint.config.ts]
import baseConfig from "./configs/base.ts";
import frontendConfig from "./configs/frontend.ts";
import { defineConfig } from "oxlint";
export default defineConfig({
extends: [baseConfig, frontendConfig],
});
``````json [.oxlintrc.json]
{
"env": {
"es6": true
},
"globals": {
"MY_GLOBAL": "readonly",
"Promise": "off"
}
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
env: {
es6: true,
},
globals: {
MY_GLOBAL: "readonly",
Promise: "off",
},
});
``````json [.oxlintrc.json]
{
"settings": {
"next": {
"rootDir": "apps/dashboard/"
},
"react": {
"linkComponents": [{ "name": "Link", "linkAttribute": "to" }]
},
"jsx-a11y": {
"components": {
"Link": "a",
"Button": "button"
}
}
}
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";
export default defineConfig({
settings: {
next: {
rootDir: "apps/dashboard/",
},
react: {
linkComponents: [{ name: "Link", linkAttribute: "to" }],
},
"jsx-a11y": {
components: {
Link: "a",
Button: "button",
},
},
},
});