Skip to content

Commit ebd4542

Browse files
Sosuke Suzukithorn0
andauthored
2.8 blog post (#13813)
* Draft * Update * Generate * Add `truncate` * Address review * Regen * Update * Reword changelog for #13016 * Edit intro * Edit changelog for #13019 * Regenerate blog post * Address review Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
1 parent a34272d commit ebd4542

5 files changed

Lines changed: 395 additions & 26 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
author: "Sosuke Suzuki (@sosukesuzuki)"
3+
authorURL: "https://github.com/sosukesuzuki"
4+
title: "Prettier 2.8: improve --cache CLI option and TypeScript 4.9 satisfies operator!"
5+
---
6+
7+
This release includes improvements to the `--cache` option added in 2.7. A new `--cache-location` option has been added, and a bug that saved the cache even when `--write` wasn't specified has been fixed.
8+
9+
We're also adding support for TypeScript 4.9 `satisfies` operator!
10+
11+
If you enjoy Prettier and would like to support our work, consider sponsoring us directly via [our OpenCollective](https://opencollective.com/prettier) or by sponsoring the projects we depend on, including [typescript-eslint](https://opencollective.com/typescript-eslint), [remark](https://opencollective.com/unified), and [Babel](https://opencollective.com/babel).
12+
13+
The Prettier team plans to release 3.0 within the next few months. If you are a plugin developer, get ready for the migration. Visit [the migration guide](https://github.com/prettier/prettier/wiki/How-to-migrate-my-plugin-to-support-Prettier-v3%3F) and issue [#13606](https://github.com/prettier/prettier/issues/13616) for more information.
14+
15+
<!--truncate-->

changelog_unreleased/cli/13016.md

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
1-
#### Fix `--cache` set only if with `--write` or `--no-different` (#13016 by @Milly)
1+
#### [HIGHLIGHT] Do not save the cache if the `--write` option wasn't specified (#13016 by @Milly)
22

3-
Do not save formatted cache if without `--write` option and the file is modifies by prettier.
3+
<!-- prettier-ignore -->
4+
```bash
5+
# Prettier stable
6+
$ prettier --cache foo.js
7+
# This shows formatted contents of `foo.js`.
8+
# Then cache is created and `foo.js` is flagged as already formatted.
49

5-
Before fixed, always save formatted cache if with `--cache` option.
6-
Therefore, unformatted files will never be formatted.
7-
8-
**2.7:**
9-
10-
```
11-
> prettier --cache foo.js
12-
# Show formatted contents of `foo.js`.
13-
# Then the cache is created and `foo.js` is flagged as already formatted.
14-
15-
> prettier --cache --write foo.js
10+
$ prettier --cache --write foo.js
1611
foo.js 2ms (cached)
17-
# "... (cached)" means that the file is already formatted and do nothing this time.
18-
```
12+
# "... (cached)" means the file is already formatted, so nothing is done this time.
1913

20-
**2.8:**
21-
22-
```
23-
> prettier --cache foo.js
14+
# Prettier main
15+
$ prettier --cache foo.js
2416
# Show formatted contents of `foo.js`.
2517

26-
> prettier --cache --write foo.js
18+
$ prettier --cache --write foo.js
2719
foo.js 2ms
28-
# `foo.js` has
20+
# `foo.js` is formatted now.
2921
```

changelog_unreleased/cli/13019.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
#### Add `--cache-location` option (#13019 by @sosukesuzuki)
1+
#### [HIGHLIGHT] Add `--cache-location` option (#13019 by @sosukesuzuki)
22

3-
Path to the cache file location used by `--cache` flag. If you don't explicit `--cache-location`, Prettier saves cache file at `./node_modules/.cache/prettier/.prettier-cache`.
4-
5-
If a file path is passed, that file is used as the cache file.
3+
By default, Prettier CLI saves the cache file for the `--cache` option at `./node_modules/.cache/prettier/.prettier-cache`. This can be overridden now:
64

75
```bash
86
prettier --write --cache --cache-location=my_cache_file src

changelog_unreleased/typescript/13764.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#### Support TypeScript 4.9 [`satisfies` operator](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#satisfies) (#13764, #13783, #13872 by @sosukesuzuki)
1+
#### [HIGHLIGHT]Support TypeScript 4.9 [`satisfies` operator](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#satisfies) (#13764, #13783, #13872 by @sosukesuzuki)
22

33
<!-- prettier-ignore -->
44
```tsx

0 commit comments

Comments
 (0)