Switch to oxidized flow parser (#19398)

Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
Sam Zhouandfisker authored and GitHub committed 2026-06-23 08:44:23 +08:00
1 parent 3b5e6d059c
commit 9c0e48cd25
53 files changed
+575 -345

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
#### Preserve Flow comment syntax and improve parser performance (#19398 by @SamChou19815)
Prettier now uses Flow's Rust-backed parser. This preserves Flow comment syntax annotations instead of printing them as regular Flow syntax. In local parser-only benchmarks, `flow-parser/oxidized` parsed Prettier's valid Flow fixtures in 266.4ms median time, compared with 422.6ms for the old parser, and parsed `flow_parser.js` in 1298.0ms, compared with 2269.6ms.
<!-- prettier-ignore -->
```flow
// Input
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
// Prettier stable
function foo<T>(bar: T[], baz: T): S {}
// Prettier main
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
```