Skip to content

Commit

Permalink
Reword changelog for prettier#13016
Browse files Browse the repository at this point in the history
  • Loading branch information
thorn0 committed Nov 22, 2022
1 parent 4435001 commit cd1540a
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions changelog_unreleased/cli/13016.md
@@ -1,29 +1,21 @@
#### [HIGHLIGHT]Fix `--cache` set only if with `--write` or `--no-different` (#13016 by @Milly)
#### [HIGHLIGHT] Do not save the cache if the `--write` option wasn't specified (#13016 by @Milly)

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

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
$ prettier --cache --write foo.js
foo.js 2ms (cached)
# "... (cached)" means that the file is already formatted and do nothing this time.
```
# "... (cached)" means the file is already formatted, so nothing is done this time.

**2.8:**

```
> prettier --cache foo.js
# Prettier main
$ prettier --cache foo.js
# Show formatted contents of `foo.js`.

> prettier --cache --write foo.js
$ prettier --cache --write foo.js
foo.js 2ms
# `foo.js` has
# `foo.js` is formatted now.
```

0 comments on commit cd1540a

Please sign in to comment.