You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -48,8 +48,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
@@ -62,8 +62,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
@@ -49,8 +49,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
@@ -63,8 +63,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
Copy file name to clipboardExpand all lines: website/versioned_docs/version-stable/cli.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -205,3 +205,35 @@ Prevent errors when pattern is unmatched.
205
205
## `--no-plugin-search`
206
206
207
207
Disable plugin autoloading.
208
+
209
+
## `--cache`
210
+
211
+
If this option is enabled, the following values are used as cache keys and the file is formatted only if one of them is changed.
212
+
213
+
- Prettier version
214
+
- Options
215
+
- Node.js version
216
+
- (if `--cache-strategy` is `metadata`) file metadata, such as timestamps
217
+
- (if `--cache-strategy` is `content`) content of the file
218
+
219
+
```bash
220
+
prettier --write --cache src
221
+
```
222
+
223
+
Running Prettier without `--cache` will delete the cache.
224
+
225
+
Also, since the cache file is stored in `./node_modules/.cache/prettier/.prettier-cache`, so you can use `rm ./node_modules/.cache/prettier/.prettier-cache` to remove it manually.
226
+
227
+
> Plugins version and implementation are not used as cache keys. We recommend that you delete the cache when updating plugins.
228
+
229
+
## `--cache-strategy`
230
+
231
+
Strategy for the cache to use for detecting changed files. Can be either `metadata` or `content`.
232
+
233
+
In general, `metadata` is faster. However, `content` is useful for updating the timestamp without changing the file content. This can happen, for example, during git operations such as `git clone`, because it does not track file modification times.
234
+
235
+
If no strategy is specified, `content` will be used.
Copy file name to clipboardExpand all lines: website/versioned_docs/version-stable/configuration.md
+33-5Lines changed: 33 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -177,9 +177,37 @@ If you’d like a JSON schema to validate your configuration, one is available h
177
177
178
178
## EditorConfig
179
179
180
-
If `options.editorconfig` is `true` and an [`.editorconfig` file](https://editorconfig.org/) is in your project, Prettier will parse it and convert its properties to the corresponding Prettier configuration. This configuration will be overridden by `.prettierrc`, etc. Currently, the following EditorConfig properties are supported:
180
+
If `options.editorconfig` is `true` and an [`.editorconfig` file](https://editorconfig.org/) is in your project, Prettier will parse it and convert its properties to the corresponding Prettier configuration. This configuration will be overridden by `.prettierrc`, etc.
181
+
182
+
Here’s an annotated description of how different properties map to Prettier’s behavior:
183
+
184
+
```ini
185
+
# Stop the editor from looking for .editorconfig files in the parent directories
186
+
# root = true
187
+
188
+
[*]
189
+
# Non-configurable Prettier behaviors
190
+
charset = utf-8
191
+
insert_final_newline = true
192
+
# Caveat: Prettier won’t trim trailing whitespace inside template strings, but your editor might.
193
+
# trim_trailing_whitespace = true
194
+
195
+
# Configurable Prettier behaviors
196
+
# (change these if your Prettier config differs)
197
+
end_of_line = lf
198
+
indent_style = space
199
+
indent_size = 2
200
+
max_line_length = 80
201
+
```
202
+
203
+
Here’s a copy+paste-ready `.editorconfig` file if you use the default options:
Copy file name to clipboardExpand all lines: website/versioned_docs/version-stable/plugins.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,7 @@ To turn off plugin autoloading, use `--no-plugin-search` when using Prettier CLI
61
61
-[`prettier-plugin-apex`](https://github.com/dangmai/prettier-plugin-apex) by [**@dangmai**](https://github.com/dangmai)
62
62
-[`prettier-plugin-elm`](https://github.com/gicentre/prettier-plugin-elm) by [**@giCentre**](https://github.com/gicentre)
63
63
-[`prettier-plugin-erb`](https://github.com/adamzapasnik/prettier-plugin-erb) by [**@adamzapasnik**](https://github.com/adamzapasnik)
64
+
-[`prettier-plugin-glsl`](https://github.com/NaridaL/glsl-language-toolkit/tree/main/packages/prettier-plugin-glsl) by [**@NaridaL**](https://github.com/NaridaL)
64
65
-[`prettier-plugin-go-template`](https://github.com/NiklasPor/prettier-plugin-go-template) by [**@NiklasPor**](https://github.com/NiklasPor)
65
66
-[`prettier-plugin-java`](https://github.com/jhipster/prettier-java) by [**@JHipster**](https://github.com/jhipster)
66
67
-[`prettier-plugin-jsonata`](https://github.com/Stedi/prettier-plugin-jsonata) by [**@Stedi**](https://github.com/Stedi)
0 commit comments