Skip to content

Commit a980caa

Browse files
author
Sosuke Suzuki
authored
Add missing changelog for #13016 (#13812)
* Add missing changelog * Fix
1 parent 520dbcd commit a980caa

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

changelog_unreleased/cli/13016.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#### Fix `--cache` set only if with `--write` or `--no-different` (#13016 by @Milly)
2+
3+
Do not save formatted cache if without `--write` option and the file is modifies by prettier.
4+
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
16+
foo.js 2ms (cached)
17+
# "... (cached)" means that the file is already formatted and do nothing this time.
18+
```
19+
20+
**2.8:**
21+
22+
```
23+
> prettier --cache foo.js
24+
# Show formatted contents of `foo.js`.
25+
26+
> prettier --cache --write foo.js
27+
foo.js 2ms
28+
# `foo.js` has
29+
```

0 commit comments

Comments
 (0)