The Oxidation Compiler is creating a suite of high-performance tools for JavaScript and TypeScript, written in Rust – a formatter (oxfmt) and linter (oxlint) tools are important part of this tools suite.
Oxfmt is a high-performance formatter for the JavaScript ecosystem.
Oxfmt promises to be ~30x times faster than Prettier and 2x faster than Biome.
Supports: JavaScript, JSX, TypeScript, TSX, JSON, JSONC, JSON5, YAML, TOML, HTML, Angular, Vue, CSS, SCSS, Less, Markdown, MDX, GraphQL, Ember, Handlebars, and more.
Chapter 1 - How to migrate from Prettier to Oxfmt in simple steps
Simply run from CLI the following command:
npm add -D oxfmt@latest && npx oxfmt --migrate=prettier && npx oxfmt
What the above command does under the hood:
1. it is installing the oxfmt npm package as dev dependency,
2. migrates all the existing prettier rules a new configuration file called ‘.oxfmtrc.json’
3. runs the new oxfmt formatter command
Note: your project root contains ‘.oxfmtrc.json’ file, which is an alternative to the previous ‘.prettierrc’

How the .oxfmtrc.json file looks like

It contains all the rules that were migrated from the ‘.prettierrc’ file
When the migration process is complete, you can also modify/add new code format rules into that config file.
Full list of code formatting rules HERE
Note: the above config includes ‘ignorePatterns’ key that contains all the paths that we do not want to be in scope for code formatting. In prettier, we usually set them into .prettierignore file. If that file exists, during the migration process, they are automatically included in the above config file and oxfmt will be aware of them.
Add scripts to package.json

Format files
npm run fmt
Check formatting without writing files
npm run fmt:check
Chapter 2 - Installing Oxfmt from scratch
- install oxfmt as dev dependency
npm add -D oxfmt
2. add scripts to package.json as shown above
{
"scripts": {
"fmt": "oxfmt",
"fmt:check": "oxfmt --check"
}
}3. generate the .oxfmtrc.json config file using
oxfmt --init
4. Add formatting rules and ignorePatterns into .oxfmtrc.json file accordingly (see example above, in Chapter 1)
Full list of code formatting rules HERE
5. simply run ‘npm run fmt’ to format file, or ‘npm run fmt:check’ to check formatting without writing files
