Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add missing changelog * Fix
- Loading branch information
1 parent
520dbcd
commit a980caa
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#### Fix `--cache` set only if with `--write` or `--no-different` (#13016 by @Milly) | ||
|
||
Do not save formatted cache if without `--write` option and the file is modifies by prettier. | ||
|
||
Before fixed, always save formatted cache if with `--cache` option. | ||
Therefore, unformatted files will never be formatted. | ||
|
||
**2.7:** | ||
|
||
``` | ||
> prettier --cache foo.js | ||
# Show formatted contents of `foo.js`. | ||
# Then the cache is created and `foo.js` is flagged as already formatted. | ||
> prettier --cache --write foo.js | ||
foo.js 2ms (cached) | ||
# "... (cached)" means that the file is already formatted and do nothing this time. | ||
``` | ||
|
||
**2.8:** | ||
|
||
``` | ||
> prettier --cache foo.js | ||
# Show formatted contents of `foo.js`. | ||
> prettier --cache --write foo.js | ||
foo.js 2ms | ||
# `foo.js` has | ||
``` |