Getting Started
Install @zap-studio/oxlint, extend a preset, and override a single rule without forking it.
Installation
npm install --save-dev @zap-studio/oxlint oxlintyarn add -D @zap-studio/oxlint oxlintpnpm add -D @zap-studio/oxlint oxlintbun add -D @zap-studio/oxlint oxlintdeno add -D npm:@zap-studio/oxlint npm:oxlintoxlint is a peer dependency — install the version you want to run. If you use the typeAware/typeCheck options from base (on by default), also install oxlint-tsgolint.
Extend a Preset
Start with base — it’s the one bundled preset, and the only one every project wants regardless of framework. Import it by name from the package root:
import { defineConfig } from "oxlint";
import { base } from "@zap-studio/oxlint";
export default defineConfig({
extends: [base],
});
Combine Presets
Every other preset owns one plugin or one framework integration’s slice of rules, and none of them imply another — extends accepts an array, and you list every preset your project needs. A React project on Next.js adds react (hooks), react-a11y (accessibility), react-doctor (the rest of React-Doctor’s framework-agnostic rules), a JSX runtime preset, and nextjs:
import { defineConfig } from "oxlint";
import {
base,
react,
reactA11y,
reactDoctor,
jsxRuntimeAutomatic,
nextjs,
} from "@zap-studio/oxlint";
export default defineConfig({
extends: [base, react, reactA11y, reactDoctor, jsxRuntimeAutomatic, nextjs],
});
This is more imports than one bundled preset would need — that’s the tradeoff for never inheriting rules you didn’t ask for. See Presets for the full list and what each one owns.
Every preset is also reachable by its own subpath, e.g. @zap-studio/oxlint/react, if you’d rather import one preset per line instead of destructuring the root — both forms export the same value:
import { defineConfig } from "oxlint";
import react from "@zap-studio/oxlint/react";
export default defineConfig({
extends: [react],
});
Override a Rule
extends merges rules key-by-key and unions plugins/jsPlugins. Anything you set in your own rules after extends overrides the preset, so disabling or retuning a single rule doesn’t require forking it:
import { defineConfig } from "oxlint";
import { react } from "@zap-studio/oxlint";
export default defineConfig({
extends: [react],
rules: {
"sonarjs/cognitive-complexity": "off",
},
});
Cherry-Pick Pieces
Every preset is already just plugins/jsPlugins/rules under the hood — each also exports those pieces by name, so you can merge them by hand instead of taking the default export, useful for overriding one rule out of a large preset like react-doctor:
import { defineConfig } from "oxlint";
import { basePlugins, baseJsPlugins, baseRules } from "@zap-studio/oxlint/base";
import { reactDoctorJsPlugins, reactDoctorRulesFinal } from "@zap-studio/oxlint/react-doctor";
export default defineConfig({
plugins: basePlugins,
jsPlugins: [...baseJsPlugins, ...reactDoctorJsPlugins],
rules: { ...baseRules, ...reactDoctorRulesFinal, "react-doctor/no-barrel-import": "off" },
});