Skip to content

Oxfmt

Oxfmt is a high-performance formatter for the JavaScript ecosystem. It is Prettier-compatible (matching 100% of Prettier’s JS/TS conformance tests) and supports a wide range of languages out of the box — including TypeScript, JSX, JSON, CSS, SCSS, Less, Markdown, MDX, HTML, Vue, and Astro.

Oxfmt is a drop-in replacement for Prettier (and the formatting part of Biome) that is ≈30× faster. Its CLI behaves similarly to Prettier, so adoption requires minimal changes to scripts and tooling.

Terminal window
npm i oxfmt

Oxfmt options live in an oxfmt.config.ts file (Prettier-style keys):

oxfmt.config.ts
import { defineConfig } from 'oxfmt'
export default defineConfig({
printWidth: 80,
useTabs: false,
tabWidth: 2,
semi: false,
singleQuote: true,
arrowParens: 'avoid',
trailingComma: 'all',
})
OptionTypeDefaultNotes
printWidthinteger100Max line length before wrapping
tabWidthinteger2Spaces per indentation level
useTabsbooleanfalseUse tabs instead of spaces
semibooleantruePrint semicolons at end of statements
singleQuotebooleanfalseUse single quotes
arrowParens"always" | "avoid""always"Parens around sole arrow function parameter
trailingComma"all" | "es5" | "none""all"Trailing commas in multi-line structures
endOfLine"lf" | "crlf" | "cr""lf"Line ending style
sortImportsobjectdisabledSort import statements (built-in)

Unlike Prettier, Oxfmt ships with import sorting baked in — no extra plugin needed:

oxfmt.config.ts
{
sortImports: {
internalPattern: ['~/', '@/']
}
}

Add to package.json:

{
"scripts": {
"format": "oxfmt --write",
"format:check": "oxfmt --check"
}
}

Install the Oxc extension and configure it as the default formatter:

.vscode/settings.json
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "oxc.oxc-vscode",
"[javascript]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
"[javascriptreact]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
"[typescript]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
"[typescriptreact]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
"[json]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
"[css]": {
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": "explicit"
}
}
}