Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing changelog for #13016 #13812

Merged
merged 2 commits into from Nov 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions changelog_unreleased/cli/13016.md
@@ -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
```