Migrate from Prettier
This guide covers migrating from Prettier to Oxfmt.
WARNING
Oxfmt is in alpha and may not suit complex setups.
Quick start
For simple setups, migrate with a single command:
$ npm add -D oxfmt@latest && npx oxfmt --migrate=prettier && npx oxfmt$ pnpm add -D oxfmt@latest && pnpm oxfmt --migrate=prettier && pnpm oxfmt$ yarn add -D oxfmt@latest && yarn oxfmt --migrate=prettier && yarn oxfmt$ bun add -D oxfmt@latest && bunx oxfmt --migrate=prettier && bunx oxfmtBefore you migrate
Oxfmt is compatible with Prettier v3.7 for basic configurations.
Key differences:
- Default
printWidthis 100 (Prettier uses 80) - Prettier plugins are not supported
- Some options are not supported (see config reference)
- Editor integration via
--lspis still in development
See Unsupported features for details.
Step 1: Upgrade Prettier to v3.7 (optional)
Oxfmt's output is closest to Prettier v3.7. Upgrading first minimizes formatting differences.
Step 2: Install Oxfmt
$ npm add -D oxfmt@latest$ pnpm add -D oxfmt@latest$ yarn add -D oxfmt@latest$ bun add -D oxfmt@latest$ deno add -D npm:oxfmt@latestStep 3: Migrate configuration
Oxfmt uses .oxfmtrc.json (JSON only). Basic example:
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"printWidth": 80
}Run oxfmt --migrate prettier to convert your Prettier config automatically.
prettierrc.js example
Before:
module.exports = {
singleQuote: true,
jsxSingleQuote: true,
};After (.oxfmtrc.json):
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"singleQuote": true,
"jsxSingleQuote": true,
"printWidth": 80
}prettierrc.yaml example
Before:
trailingComma: "es5"
tabWidth: 4
semi: false
singleQuote: trueAfter (.oxfmtrc.json):
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": true,
"printWidth": 80
}Step 4: Update scripts
package.json scripts
{
"scripts": {
- "format": "prettier --write .",
+ "format": "oxfmt",
- "format:check": "prettier --check ."
+ "format:check": "oxfmt --check"
}
}CI workflows
- name: Check formatting
- run: yarn prettier --check .
+ run: yarn oxfmt --checkGit hooks (husky, lint-staged)
"lint-staged": {
- "*": "prettier --write --no-error-on-unmatched-pattern"
+ "*": "oxfmt --no-error-on-unmatched-pattern"
}Step 5: Run formatter
npm run formatUninstall Prettier if no longer needed.
Optional steps
Update editor integrations
See Setup editors.
Update documentation
Update references to Prettier in CONTRIBUTING.md, AGENTS.md, or CLAUDE.md.
Update lint rules
Remove eslint-plugin-prettier if present. Consider migrating to oxlint.
Update .git-blame-ignore-revs
Add the reformatting commit SHA to .git-blame-ignore-revs to hide it from git blame.
