Skip to content

Commit 3613b1e

Browse files
fiskerkachkaevautofix-ci[bot]
authored
Add blog post for v3.9 (#19414)
Co-authored-by: Alexander Kachkaev <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 8171cf4 commit 3613b1e

10 files changed

Lines changed: 2680 additions & 40 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
authors: "fisker"
3+
title: "Prettier 3.9: New Parser Foundations and Formatting Improvements"
4+
---
5+
6+
We are excited to announce Prettier 3.9!
7+
8+
This release brings major parser upgrades for Markdown, YAML, Flow, GraphQL, and Angular, along with formatting improvements for JavaScript and TypeScript (particularly in `--no-semi` mode).
9+
10+
If you find Prettier valuable, please consider [sponsoring us on OpenCollective](https://opencollective.com/prettier) or supporting the upstream projects we rely on. Your contributions help us keep improving the tool for everyone.
11+
12+
Thank you for your continued support! ❤️
13+
14+
A reminder, when Prettier is installed or updated, it’s [strongly recommended](https://prettier.io/docs/install#summary) to specify the exact version in `package.json`: `"prettier": "3.9.0"`, not `"prettier": "^3.9.0"`.
15+
16+
If you use [`@prettier/plugin-oxc`](https://www.npmjs.com/package/@prettier/plugin-oxc) or [`@prettier/plugin-hermes`](https://www.npmjs.com/package/@prettier/plugin-hermes), don't forget upgrade them to ensure the new formatting rules are applied.
17+
18+
<!-- truncate -->
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#### Preserve Flow comment syntax (#19398 by @SamChou19815)
2+
3+
Preserves Flow comment syntax annotations instead of printing them as regular Flow syntax.
4+
5+
<!-- prettier-ignore -->
6+
```flow
7+
// Input
8+
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
9+
10+
// Prettier stable
11+
function foo<T>(bar: T[], baz: T): S {}
12+
13+
// Prettier main
14+
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
15+
```

‎changelog_unreleased/flow/19398.md‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
#### Preserve Flow comment syntax and improve parser performance (#19398 by @SamChou19815)
1+
#### [HIGHLIGHT] New Rust-based Flow parser (#19398 by @SamChou19815)
22

3-
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.
3+
Prettier now uses the new Rust-based Flow parser (oxidized) released by the Flow team, which improves performance for Flow-typed code.
44

5-
<!-- prettier-ignore -->
6-
```flow
7-
// Input
8-
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
9-
10-
// Prettier stable
11-
function foo<T>(bar: T[], baz: T): S {}
12-
13-
// Prettier main
14-
function foo<T>(bar /*: T[] */, baz /*: T */) /*: S */ {}
15-
```
5+
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.

‎changelog_unreleased/graphql/19171.md‎

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
#### Support "Fragment arguments" (#19297 by @fisker)
1+
#### [HIGHLIGHT] Support GraphQL.js v17 (#19171 by @YBJ0000, #19297 by @fisker)
22

3-
[Fragment arguments](https://github.com/graphql/graphql-js/pull/4015) are now supported.
3+
Prettier now fully supports newer syntax features from GraphQL.js v17, including directives on directive definitions, fragment arguments, and other enhancements.
4+
5+
[Fragment arguments](https://github.com/graphql/graphql-js/pull/4015)
46

57
<!-- prettier-ignore -->
68
```gql
@@ -11,13 +13,25 @@ fragment variableProfilePic on User {
1113

1214
# Prettier stable
1315
SyntaxError: Syntax Error: Expected Name, found "(". (2:23)
14-
1 | fragment variableProfilePic on User {
15-
> 2 | ...dynamicProfilePic(size: $size)
16-
| ^
17-
3 | }
1816

1917
# Prettier main
2018
fragment variableProfilePic on User {
2119
...dynamicProfilePic(size: $size)
2220
}
2321
```
22+
23+
[Directives on directive definitions](https://github.com/graphql/graphql-js/pull/4521) (and `extend directive` extensions)
24+
25+
<!-- prettier-ignore -->
26+
```gql
27+
# Input
28+
directive @a @b on QUERY
29+
extend directive @a @b
30+
31+
# Prettier stable
32+
Error: Syntax Error: Expected "on", found "@".
33+
34+
# Prettier main
35+
directive @a @b on QUERY
36+
extend directive @a @b
37+
```
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#### [HIGHLIGHT] Upgrade parser to latest micromark (#18277 by @seiyab, @j-f1, @fisker)
22

3-
We've upgraded Prettier's Markdown parser from the outdated remark-parse v8 to the modern micromark v4. This upgrade significantly enhances CommonMark and GFM compliance, resolves numerous long-standing parsing bugs, and lays a stronger foundation for future enhancements.
3+
We've upgraded Prettier's Markdown parser from the outdated `remark-parse` v8 to the modern `micromark` v4. This upgrade significantly enhances CommonMark and GFM compliance, resolves numerous long-standing parsing bugs, and lays a stronger foundation for future enhancements.
44

5-
A huge thank you to @seiyab for their tremendous effort in driving this major upgrade!
5+
Huge thanks to [@seiyab](https://github.com/seiyab), [@j-f1](https://github.com/j-f1), and everyone else who contributed to this long-awaited improvement for their tremendous effort in driving this major upgrade!
6+
7+
**Note**: While the core Markdown parser has been upgraded, [the MDX parser upgrade](https://github.com/prettier/prettier/pull/18533) is not yet complete. If you're familiar with the unified ecosystem, micromark, or MDX, we'd love your help to finish the migration — contributions are very welcome!

‎changelog_unreleased/misc/19014.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#### updating `Printer` interface (#19014 by @Janther)
1+
#### Update `Printer` interface (#19014 by @Janther)
22

33
```diff
44
export interface Printer<T = any> {

‎changelog_unreleased/yaml/18419.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#### [HIGHLIGHT] Update dependency `yaml` to v2 (#18419 by @ota-meshi, @fisker)
2+
3+
The YAML parser has been upgraded to use `yaml` v2, which fixes many long standing parse issues.
4+
5+
Thanks to excellent work on the [`yaml-unist-parser`](https://github.com/prettier/yaml-unist-parser/pull/301) side by [@ota-meshi](https://github.com/ota-meshi).

‎scripts/draft-blog-post.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ for (const entry of fs.readdirSync(changelogUnreleasedDirectory, {
4747
continue;
4848
}
4949

50-
const dirPath = path.join(entry.path, entry.name);
50+
const dirPath = path.join(entry.parentPath, entry.name);
5151
const category = categoriesByDir.get(entry.name);
5252

5353
if (!category) {

0 commit comments

Comments
 (0)