Goodbye ESLint and Prettier: 10x Faster Linting
Last year I wrote about a code quality pipeline built on ESLint, Prettier, and Husky. This site has run on that pipeline ever since. This week I replaced the two slowest parts of it, ESLint and Prettier, with Oxlint 1.96 and oxfmt 0.81 from the Oxc project. Husky, lint-staged, and commitlint stayed. Here is what the swap bought, measured on this repo, followed by the parts that needed manual work.
The Numbers
Same machine, same files, before and after the swap. I timed each tool binary on its own as well as through pnpm:
Metric | ESLint + Prettier | Oxlint + oxfmt |
|---|---|---|
| 6.7s | 0.86s |
Linter binary alone | 5.85s | 0.58s |
Format check | 0.92s | 0.33s |
devDependencies | 30 | 18 |
Lint and format packages | 16 | 4 |
Packages in the lockfile | 828 | 706 |
pnpm lint runs about 7.8x faster, the linter on its own about 10x, and the format check about 2.8x. Sixteen lint and format packages became four: oxlint, oxfmt, and the two ESLint plugins I chose to keep, which the next section covers.
One number barely moved. A clean install weighs 768 MB before and 763 MB after, even with 122 fewer packages in the lockfile. Oxlint and oxfmt ship native binaries, and pnpm installs both the glibc and musl builds on Linux, around 52 MB together. Fewer packages is not the same as a lighter node_modules.
Where the Lint Time Goes
Oxlint runs 100 rules natively here, plus 20 more for TypeScript files. On their own they finish in 122ms. The full run takes 576ms, and the difference is two style rules that still come from ESLint plugins:
react/jsx-sort-props, fromeslint-plugin-reactpadding-line-between-statements, from@stylistic/eslint-plugin
Oxlint has no native version of either, so it runs them through its JS plugin support, which loads ESLint plugins inside Oxlint. Those two rules cost about four times as much as the other hundred combined. I kept them because the codebase is written to them, and dropping them would let the style drift on every new file. Even with that cost, the whole run is still ten times faster than ESLint was.
Migrating the Lint Config
The starting point was a 200-line ESLint flat config that wired up typescript-eslint, React, React Hooks, the React Compiler plugin, jsx-a11y, import, the Next.js plugin, and Prettier through eslint-plugin-prettier. Oxc publishes a tool that reads that file and writes the Oxlint equivalent:
npx @oxlint/migrate@1.96.0 eslint.config.mjs --js-plugins=falseIt translated 102 rules into .oxlintrc.json. Almost every plugin in that list has a native counterpart in Oxlint, so the rules map one to one: React, React Hooks and the React Compiler rules land in Oxlint's react plugin, and jsx-a11y, typescript-eslint, import, and the Next.js plugin each have their own. I passed --js-plugins=false so I could add the two remaining rules myself:
{
"jsPlugins": [
{ "name": "react-js", "specifier": "eslint-plugin-react" },
"@stylistic/eslint-plugin"
],
"rules": {
"react-js/jsx-sort-props": [
"warn",
{ "callbacksLast": true, "shorthandFirst": true, "reservedFirst": true }
],
"@stylistic/padding-line-between-statements": [
"warn",
{ "blankLine": "always", "prev": "*", "next": ["return", "export"] },
{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] }
]
}
}The alias matters. react is a reserved plugin name in Oxlint, because it belongs to the native React plugin, so eslint-plugin-react has to be loaded under a different name. Its rules then live under react-js/.
Two smaller fixes came out of the migration output. The tool warns that "react": { "version": "detect" } is unsupported, so I pinned it to "19.2". And @oxlint/migrate turned off the correctness category so that only the rules from the old config ran. That kept the comparison fair, and I can turn the category on later as its own change.
Same Findings, Plus Two New Ones
Oxlint reported the same two warnings ESLint had: set-state-in-effect on the next-themes hydration guard and on the scroll-spy hook. Both are known and both stay as warnings.
It also raised two things ESLint had never flagged.
react/purity in the footer. The footer prints the year with new Date().getFullYear(), and Oxlint's React Compiler rules treat that as an impure call during render. The rule is right in general. Here the component is a Server Component, prerendered at build time, so the year is the year of the last deploy. That is deliberate: every deploy refreshes it, and no JavaScript ships just to print a number. I silenced the rule on that one line and wrote down why:
// Server-rendered at build time, so this is the year of the last deploy. Deliberate: every
// deploy refreshes it, and it avoids shipping JavaScript just to print a year.
// oxlint-disable-next-line react/purity -- build-time value, see above
const currentYear = new Date().getFullYear();react/jsx-no-target-blank on MDX links. Blog links get rel='noopener noreferrer' and target='_blank' under the same condition, when the href starts with http. The rule cannot prove the two conditions match, so it reports a false positive. The detail that cost me a few minutes: the disable comment has to sit directly above the target attribute, not above the <a> tag, because that is the line Oxlint reports.
<a
href={href}
rel={href?.startsWith('http') ? 'noopener noreferrer' : undefined}
// oxlint-disable-next-line react/jsx-no-target-blank -- rel above is set under the same condition
target={href?.startsWith('http') ? '_blank' : undefined}
>The Formatter Found a Config Conflict
Moving the formatter settings into .oxfmtrc.json meant reading the old ones carefully, and they did not agree with each other. There were two Prettier configurations in the repo:
.prettierrc, used by theprettier --writestep in lint-staged, settrailingComma: "es5"and loaded no plugins.- The
prettier/prettierrule inside the ESLint config settrailingComma: "all"and loadedprettier-plugin-tailwindcss.
Lint-staged ran Prettier first and eslint --fix second, so every staged file was formatted one way and then reformatted the other way. The ESLint version won because it ran last. The Tailwind plugin was also never told where the Tailwind v4 stylesheet was, so it did not know the custom brand colors defined in globals.css. It treated bg-brand and text-brand-text as unknown classes and moved them to the front of every class list.
oxfmt replaces both with one file and sorts Tailwind classes and imports natively:
{
"printWidth": 100,
"singleQuote": true,
"jsxSingleQuote": true,
"trailingComma": "all",
"sortTailwindcss": { "stylesheet": "./src/app/globals.css" },
"sortImports": {
"groups": ["type", "builtin", "external", "internal", "parent", "sibling", "index", "unknown"]
},
"ignorePatterns": ["*.md", "*.mdx", ".vscode/", "next-env.d.ts", "pnpm-lock.yaml"],
"sortPackageJson": false
}With the stylesheet in place, the custom classes land where they belong:
// Before: unknown to the sorter, pushed to the front
<span className='bg-brand h-2 w-2 rounded-full' />
// After: sorted as the background utility it is
<span className='h-2 w-2 rounded-full bg-brand' />The first oxfmt run touched 41 files. Most of the changes were class order, import order, and @apply lists in globals.css, which Prettier had never formatted.
sortPackageJson is on by default in oxfmt, and it reorders the top-level keys of package.json. I turned it off so the file keeps its existing order.
Proving the Reformat Changed Nothing
Reordering classes looks harmless, but this project uses tailwind-merge, where order can decide which conflicting class wins. There is no test runner here, so I checked the rendered output instead. I built main and the migration branch side by side and screenshotted five pages, the home page, the blog index, the projects page, a long post, and the interview-prep section. Each was captured at 1440px in light and dark, and at 390px on mobile, with reduced motion on so that animations could not shift a pixel.
All 15 pairs came out pixel-identical. The build, the type check, and the SEO audit matched as well.
Gotchas Worth Knowing
- oxfmt exits with an error when every file it is given is ignored. Lint-staged passes the staged paths that match each glob, so a commit whose only YAML change is
pnpm-lock.yaml, which oxfmt ignores, would fail the hook. Add--no-error-on-unmatched-pattern. - ESLint is still installed.
eslint-plugin-reactand@stylistic/eslint-plugindeclare it as a peer dependency, and pnpm installs peers automatically. Nothing runs it, but it is innode_modules. next builddoes not lint, as of Next.js 16.pnpm lintand the pre-commit hook are the only lint gates, so they are worth keeping fast.- Markdown and MDX are excluded on purpose. The posts contain hand-written JSX tables like the one above, and I want them left exactly as written.
The lint-staged change itself is small:
{
"*.{js,jsx,ts,tsx,mjs,cjs}": ["oxfmt --no-error-on-unmatched-pattern", "oxlint --fix", "oxlint"],
"*.{json,jsonc,css,yml,yaml}": ["oxfmt --no-error-on-unmatched-pattern"]
}The Tradeoffs
JS plugin support in Oxlint is marked alpha and is not covered by semver, so a minor release could change how my two kept rules run. oxfmt is still before 1.0. I pinned both to exact versions, oxlint@1.96.0 and oxfmt@0.81.0, so an upgrade happens only when I make it and can check the output.
If those two rules ever break, the fallback is to drop them and check prop order and blank lines in code review instead.
Additional Resources
- Oxc project: oxc.rs
- Oxc on GitHub: github.com/oxc-project/oxc
- @oxlint/migrate: npmjs.com/package/@oxlint/migrate
- lint-staged: github.com/lint-staged/lint-staged
- The earlier pipeline post: ESLint, Prettier, and Husky
Measured on this site: a Next.js 16.5 App Router portfolio with 15 MDX posts, Tailwind v4, and no test suite. Your numbers will differ with your rule set, but most of the gain comes from the native rules, which every project gets.