File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments