ArnaudBarre/prettier-oxc-parser

Use oxc as a Prettier parser for JavaScript and TypeScript.

TypeScript

71

46 commits

updated Jul 19, 2025

See the code

README

prettier-oxc-parser npm

Use oxc as a Prettier parser for JavaScript and TypeScript.

Requires Prettier >= 3.6.2

Installation

$ npm install -D prettier-oxc-parser
$ yarn add -D prettier-oxc-parser
$ pnpm install -D prettier-oxc-parser
$ bun add -D prettier-oxc-parser

Add the plugin to your Prettier config:

{
  "plugins": ["prettier-oxc-parser"]
}

Why?

oxc is a fast, really fast. And with the addition of raw transfer, the cost of passing the AST from Rust to JavaScript is close to 0. Raw transfer is only available in Node >= 22.

While Prettier with this plugin is far from the performances of pure native formatters like Biome, it give a significant performance improvement for large TS projects while keeping one tool to format all files types.

Benchmark

For full benchmark results see benchmark/report.md or run it yourself with bun benchmark.

Keep in mind that the timing are for "parse + format". When using oxc as a parser, ~90% of the time is spent of the format part.

On this benchmark, this plugin is faster than @prettier/plugin-oxc because the official one is using the async API without raw transfer. Benchmarking in real conditions is needed to know which one is better.

An interesting thing is that you can get a part of the performance boost for TS files by using babel-ts via overrides.

Averages when running on Apple M1 Pro with node 24.3.

JS(X)

File sizeSmall (1kb)Medium (10kb)Large (28kb)
prettier-oxc-parser0.9 ms3.9 ms10.4 ms
@prettier/plugin-oxc1.2 ms4.6 ms12.5 ms
default1.0 ms3.9 ms11.0 ms

TS(X)

File sizeSmall (1kb)Medium (7kb)Large (40kb)TS Compiler
prettier-oxc-parser0.7 ms3.8 ms18.4 ms737 ms
@prettier/plugin-oxc0.9 ms5.3 ms31.5 ms1132 ms
babel-ts0.8 ms4.3 ms20.6 ms848 ms
default1.2 ms5.6 ms27.8 ms1093 ms

Caveats

Flow inside .js files via @flow pragma is not supported.

Contributors

ArnaudBarre

45 commits

leaysgur

1 commits

ArnaudBarre/prettier-oxc-parser

Use oxc as a Prettier parser for JavaScript and TypeScript.

TypeScript

71

46 commits

updated Jul 19, 2025

See the code

README

prettier-oxc-parser npm

Use oxc as a Prettier parser for JavaScript and TypeScript.

Requires Prettier >= 3.6.2

Installation

$ npm install -D prettier-oxc-parser
$ yarn add -D prettier-oxc-parser
$ pnpm install -D prettier-oxc-parser
$ bun add -D prettier-oxc-parser

Add the plugin to your Prettier config:

{
  "plugins": ["prettier-oxc-parser"]
}

Why?

oxc is a fast, really fast. And with the addition of raw transfer, the cost of passing the AST from Rust to JavaScript is close to 0. Raw transfer is only available in Node >= 22.

While Prettier with this plugin is far from the performances of pure native formatters like Biome, it give a significant performance improvement for large TS projects while keeping one tool to format all files types.

Benchmark

For full benchmark results see benchmark/report.md or run it yourself with bun benchmark.

Keep in mind that the timing are for "parse + format". When using oxc as a parser, ~90% of the time is spent of the format part.

On this benchmark, this plugin is faster than @prettier/plugin-oxc because the official one is using the async API without raw transfer. Benchmarking in real conditions is needed to know which one is better.

An interesting thing is that you can get a part of the performance boost for TS files by using babel-ts via overrides.

Averages when running on Apple M1 Pro with node 24.3.

JS(X)

File sizeSmall (1kb)Medium (10kb)Large (28kb)
prettier-oxc-parser0.9 ms3.9 ms10.4 ms
@prettier/plugin-oxc1.2 ms4.6 ms12.5 ms
default1.0 ms3.9 ms11.0 ms

TS(X)

File sizeSmall (1kb)Medium (7kb)Large (40kb)TS Compiler
prettier-oxc-parser0.7 ms3.8 ms18.4 ms737 ms
@prettier/plugin-oxc0.9 ms5.3 ms31.5 ms1132 ms
babel-ts0.8 ms4.3 ms20.6 ms848 ms
default1.2 ms5.6 ms27.8 ms1093 ms

Caveats

Flow inside .js files via @flow pragma is not supported.

Contributors

ArnaudBarre

45 commits

leaysgur

1 commits

Languages

TypeScript

78.5%

JavaScript

21.5%