Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vitepress/config/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const enConfig = defineLocaleConfig("root", {
{
text: "Resources",
items: [
{ text: "Blog", link: "/blog/2025-10-09-oxlint-js-plugins" },
{ text: "Blog", link: "/blog/2025-11-24-oxfmt-alpha" },
{ text: "Team", link: "/team" },
{ text: "Release Notes", link: "https://github.com/oxc-project/oxc/releases" },
{ text: "Branding", link: "/branding" },
Expand Down
2 changes: 1 addition & 1 deletion .vitepress/config/inlined-scripts/banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
}
};

window.__OXC_BANNER_ID__ = "/blog/2025-10-09-oxlint-js-plugins";
window.__OXC_BANNER_ID__ = "/blog/2025-11-24-oxfmt-alpha";
restore(`oxc-banner-dismissed-${__OXC_BANNER_ID__}`, "banner-dismissed");
})();
4 changes: 4 additions & 0 deletions .vitepress/sidebar.blog.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
{
"text": "Oxfmt Alpha",
"link": "/blog/2025-11-24-oxfmt-alpha"
},
{
"text": "Oxlint JS Plugins Preview",
"link": "/blog/2025-10-09-oxlint-js-plugins"
Expand Down
4 changes: 2 additions & 2 deletions .vitepress/theme/components/Banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const hide = () => {
};
// Sync with inlined-scripts/banner.js
const slug = "/blog/2025-10-09-oxlint-js-plugins";
const slug = "/blog/2025-11-24-oxfmt-alpha";
const bannerDismissed = useLocalStorage<boolean>(`oxc-banner-dismissed-${slug}`, false);
Expand Down Expand Up @@ -46,7 +46,7 @@ const dismiss = () => {

<template>
<div ref="el" class="banner banner-dismissed">
<div class="text"><a :href="slug">Announcing Oxlint JS Plugins Preview</a> 🎉</div>
<div class="text"><a :href="slug">Announcing Oxfmt Alpha</a> 🎉</div>

<button type="button" @click="dismiss">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
Expand Down
151 changes: 151 additions & 0 deletions src/blog/2025-11-24-oxfmt-alpha.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
---
title: Oxc Formatter Alpha
outline: deep
authors:
- boshen
- Dunqing
- leaysgur
---

<AppBlogPostHeader />

We are excited to announce an alpha release for Oxfmt!

Oxfmt is a Rust-powered formatter, designed to be compatible with Prettier.

At this alpha stage, Oxfmt can only format JS and TS files, but we encourage you to give it a try.

## Quick Start

To format files in your current working directory, simply run one of the following commands:

::: code-group

```sh [npm]
$ npx oxfmt@latest
```

```sh [pnpm]
$ pnpm dlx oxfmt@latest
```

```sh [yarn]
$ yarn dlx oxfmt@latest
```

```sh [bun]
$ bunx oxfmt@latest
```

```sh [deno]
$ deno run npm:oxfmt@latest
```

:::

Unlike Prettier, Oxfmt's default behavior is equivalent to `prettier . --write`, providing the same UX as `cargo fmt`.

This command produces no output by default. Use `--check` to see details.

## Prettier compatible

The Oxc team always keeps compatibility with existing ecosystems in mind.

### Formatting results

Therefore, Oxfmt is carefully implemented to match Prettier's formatting results as closely as possible.
While not 100% compatible, we achieve excellent coverage, as demonstrated by our test results:

> TODO: The latest coverage numbers here...

Of course, there are cases where we believe Oxfmt produces better formatting than Prettier, and these will produce different results.

We are also actively reporting bugs and submitting PRs to Prettier itself, so the formatting results between the two should converge even more over time.

For detailed differences, please refer to the following discussion:

> `Oxfmt` differences with `Prettier` · oxc-project/oxc · Discussion #14669\
> https://github.com/oxc-project/oxc/discussions/14669

### Configuration

Additionally, configuration files and ignore files are also compatible with Prettier.

In the simplest case, migrating your configuration file looks like this:

```sh
cp .prettierrc.json .oxfmtrc.jsonc
```

While we don't support all options yet, we do support all of the following major options.

- `experimentalOperatorPosition`
- `printWidth`
- `tabWidth`
- `useTabs`
- `semi`
- `singleQuote`
- `quoteProps`
- `jsxSingleQuote`
- `trailingComma`
- `bracketSpacing`
- `objectWrap`
- `bracketSameLine`
- `arrowParens`
- `endOfLine`
- `singleAttributePerLine`

(Listed in the order they appear in Prettier's [documentation](https://prettier.io/docs/options))

Additionally, we support `ignorePatterns`, which is familiar from ESLint configuration files.
While `.prettierignore` is also supported, using `ignorePatterns` allows you to consolidate everything into a single configuration file!

Please also refer to our Formatter [documentation page](/docs/guide/usage/formatter.html) for more details.

## Yet better performance

While Oxfmt demonstrates high compatibility with Prettier, performance is a different story — it runs incredibly fast!

Check out our benchmark results on the [Outline](https://github.com/outline/outline) repository:

> TODO: Benchmark numbers with the latest release here...

For detailed benchmark setup, please refer to the following repository:

> oxc-project/bench-formatter\
> https://github.com/oxc-project/bench-formatter/tree/main

## What's next

While the timeline is not yet determined, we are planning the following initiatives for our next milestone — the beta release:

First, stabilize experimental options disabled by default.

- `embeddedLanguageFormatting`
- Support for embedded languages like CSS-in-JS
- Currently, partially supported only for non-substitution template
- `experimentalSortImports`
- Built-in support for the highly-demanded `prettier-plugin-sort-imports` functionality
- Based on `eslint-plugin-perfectionist/sort-imports` rule

And next, support more major Prettier plugins.
It means primarily support for popular frameworks like Vue, Svelte, and Astro.

> Formatter Beta · Milestone #15 · oxc-project/oxc\
> https://github.com/oxc-project/oxc/milestone/15

Needless to say, we will continue working daily on performance improvements and CLI UX enhancements!

## Join the Community

> RFC: Formatter · oxc-project/oxc · Discussion #13608\
> https://github.com/oxc-project/oxc/discussions/13608

We welcome your feedback to help make Oxfmt even better!

## Acknowledgements

- Thanks biome, rome and everyone who contributed to
- Especially [@ematipico](https://github.com/ematipico) and [@MichaReiser](https://github.com/MichaReiser)
- Oxfmt is using fork of `biome_formatter` infrastructure
- Thanks [@fisker](https://github.com/fisker) for triaging our reported issues