Shared oxlint and oxfmt configuration for Thesis projects. The rules carry over the decisions from @thesis-co/eslint-config and @thesis/prettier-config.
Install the config together with the tools it configures:
pnpm add -D github:thesis/oxc-config oxlint oxfmt oxlint-tsgolintBoth tools read their config from a TypeScript file at the repository root. A JSON config cannot import a package, so .oxlintrc.json and .oxfmtrc.json do not work with this package.
Name the files oxlint.config.mts and oxfmt.config.mts unless the root package.json has "type": "module". Both tools find either name. With the .ts name in a repository without that field, Node prints a MODULE_TYPELESS_PACKAGE_JSON warning on every run.
oxlint.config.mts:
import { defineConfig } from "oxlint"
import thesis from "@thesis-co/oxc-config/oxlint"
import thesisReact from "@thesis-co/oxc-config/oxlint/react" // React projects only
export default defineConfig({
extends: [thesis, thesisReact],
plugins: [],
ignorePatterns: ["dist"],
})oxfmt.config.mts:
import { defineConfig } from "oxfmt"
import thesis from "@thesis-co/oxc-config/oxfmt"
export default defineConfig({
...thesis,
ignorePatterns: ["dist"],
})Then run oxlint --type-aware and oxfmt --check from the repository root.
@thesis-co/oxc-config/oxlint: thetypescript,import,jest,vitest,unicornandpromiseplugins, thecorrectnesscategory as errors, thesuspiciouscategory as warnings, and the rule decisions shared by every Thesis TypeScript project.@thesis-co/oxc-config/oxlint/react: adds thereactandjsx-a11yplugins and their rules. Extend it after the base.@thesis-co/oxc-config/oxfmt: no semicolons, 80 columns. Everything else is the oxfmt default.
oxlint merges rules, plugins, categories and overrides from extended configs. It does not merge ignorePatterns, env, globals or settings, so those belong in your oxlint.config.ts. oxfmt has no extends, which is why the snippet spreads the object. Its ignorePatterns resolve relative to your config file.
Two details are easy to miss:
plugins: []is required. When a config omitsplugins, oxlint adds its default plugins on top of the extended list. The empty array inherits exactly the plugins of the shared config.- Type-aware linting is a root-config decision. Pass
--type-awareon the command line or setoptions.typeAwarein your root config. The shared config never sets it, because oxlint rejects it in a non-root config.
- Node.js 22.18 or newer, because oxlint and oxfmt load
*.config.tsthrough Node's own TypeScript support. - The npm packages
oxlint(1.81.0 or newer) andoxfmt(0.66.0 or newer). The standalone binaries do not load TypeScript configs. oxlint-tsgolintfor--type-aware.
pnpm typecheck checks the config objects against the types that oxlint and oxfmt ship. pnpm check lints and format-checks this repository through its own exports. pnpm test runs both tools on the files in test/fixtures and asserts which rules fire and how the output is formatted. oxfmt accepts unknown option names, in its types and at run time, so the fixture test is what guards the formatting options.