Oxc Releases Prettier-Compatible Formatter 'Oxfmt'
The Oxc project announced the beta release of Oxfmt, a JavaScript formatter designed to be 100% compatible with Prettier. The new tool includes native Tailwind CSS integration, automated import and package.json sorting, and IDE support. Oxfmt is positioned as a high-performance alternative for formatting React and Next.js codebases.
- The Oxc project, which includes Oxfmt, is an open-source initiative led by Boshen Chen and backed by VoidZero Inc., a company associated with Vue.js creator Evan You. The project aims to create a suite of high-performance JavaScript and TypeScript tools written in the Rust programming language. - Performance benchmarks indicate that Oxfmt is significantly faster than its counterparts, running over 30 times faster than Prettier and 3 times faster than Biome on initial runs without a cache. This speed is attributed to its Rust-based architecture, which avoids common bottlenecks found in JavaScript-based tools. - The built-in Tailwind CSS class sorting is a key feature, as it was one of the most requested by users looking to migrate from Prettier. This eliminates the need for a separate plugin, like `prettier-plugin-tailwindcss`, which is required in a standard Prettier setup. - In addition to Tailwind support, Oxfmt comes with "batteries included" features that typically require external plugins in Prettier, such as automated import sorting and sorting of `package.json` fields. - While aiming for 100% Prettier compatibility, Oxfmt currently passes about 95% of Prettier's JavaScript and TypeScript tests. The Oxc team actively collaborates with the Prettier team by submitting bug reports and pull requests to align their formatting rules. - Migrating an existing project from Prettier to Oxfmt is designed to be straightforward. For many setups, it only requires renaming the `.prettierrc` configuration file to `.oxfmtrc.jsonc` and installing the `oxfmt` package. - The Oxc toolchain is already being adopted by major projects in the JavaScript ecosystem. For instance, Rolldown (Vite's future bundler) and Nuxt use Oxc for parsing, while companies like Preact, Shopify, and ByteDance use its linter, Oxlint. - Future plans for Oxfmt's beta release include stabilizing experimental options like CSS-in-JS formatting and researching plugin support for frameworks such as Vue, Svelte, and Astro.