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 -D oxfmt

Oxfmt options live in an oxfmtrc.json file (Prettier-style keys):

.oxfmtrc.json
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"printWidth": 80,
"useTabs": false,
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"arrowParens": "avoid",
"trailingComma": "all"
}
Option Type Default Notes
printWidth integer 100 Max line length before wrapping
tabWidth integer 2 Spaces per indentation level
useTabs boolean false Use tabs instead of spaces
semi boolean true Print semicolons at end of statements
singleQuote boolean false Use 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
sortImports object disabled Sort import statements (built-in)

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

.oxfmtrc.json
{
"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"
}
}
}