Back to Prettier

19398

changelog_unreleased/flow/19398.md

3.9.0698 B
Original Source

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 */ {}