Skip to content

Commit 13dcc16

Browse files
committed
Release 2.7.0
1 parent 00ee6fb commit 13dcc16

File tree

9 files changed

+101
-34
lines changed

9 files changed

+101
-34
lines changed

.github/ISSUE_TEMPLATE/formatting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Don't fill the form below manually! Let a program create a report for you:
2626
2727
-->
2828

29-
**Prettier 2.6.2**
29+
**Prettier 2.7.0**
3030
[Playground link](https://prettier.io/playground/#.....)
3131

3232
```sh

.github/ISSUE_TEMPLATE/integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ BEFORE SUBMITTING AN ISSUE:
2020

2121
**Environments:**
2222

23-
- Prettier Version: 2.6.2
23+
- Prettier Version: 2.7.0
2424
- Running Prettier via: <!-- CLI, Node.js API, Browser API, etc. -->
2525
- Runtime: <!-- Node.js v14, Chrome v83, etc. -->
2626
- Operating System: <!-- Windows, Linux, macOS, etc. -->

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.7.0
2+
3+
[diff](https://github.com/prettier/prettier/compare/2.6.2...2.7.0)
4+
5+
🔗 [Release Notes](https://prettier.io/blog/2022/06/14/2.7.0.html)
6+
17
# 2.6.2
28

39
[diff](https://github.com/prettier/prettier/compare/2.6.1...2.6.2)

docs/browser.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ See below for examples.
3232
### Global
3333

3434
```html
35-
<script src="https://unpkg.com/prettier@2.6.2/standalone.js"></script>
36-
<script src="https://unpkg.com/prettier@2.6.2/parser-graphql.js"></script>
35+
<script src="https://unpkg.com/prettier@2.7.0/standalone.js"></script>
36+
<script src="https://unpkg.com/prettier@2.7.0/parser-graphql.js"></script>
3737
<script>
3838
prettier.format("type Query { hello: String }", {
3939
parser: "graphql",
@@ -48,8 +48,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
4848

4949
```html
5050
<script type="module">
51-
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
52-
import parserGraphql from "https://unpkg.com/prettier@2.6.2/esm/parser-graphql.mjs";
51+
import prettier from "https://unpkg.com/prettier@2.7.0/esm/standalone.mjs";
52+
import parserGraphql from "https://unpkg.com/prettier@2.7.0/esm/parser-graphql.mjs";
5353
5454
prettier.format("type Query { hello: String }", {
5555
parser: "graphql",
@@ -62,8 +62,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
6262

6363
```js
6464
define([
65-
"https://unpkg.com/prettier@2.6.2/standalone.js",
66-
"https://unpkg.com/prettier@2.6.2/parser-graphql.js",
65+
"https://unpkg.com/prettier@2.7.0/standalone.js",
66+
"https://unpkg.com/prettier@2.7.0/parser-graphql.js",
6767
], (prettier, ...plugins) => {
6868
prettier.format("type Query { hello: String }", {
6969
parser: "graphql",
@@ -88,8 +88,8 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b
8888
### Worker
8989

9090
```js
91-
importScripts("https://unpkg.com/prettier@2.6.2/standalone.js");
92-
importScripts("https://unpkg.com/prettier@2.6.2/parser-graphql.js");
91+
importScripts("https://unpkg.com/prettier@2.7.0/standalone.js");
92+
importScripts("https://unpkg.com/prettier@2.7.0/parser-graphql.js");
9393
prettier.format("type Query { hello: String }", {
9494
parser: "graphql",
9595
plugins: prettierPlugins,
@@ -102,8 +102,8 @@ If you want to format [embedded code](options.md#embedded-language-formatting),
102102

103103
```html
104104
<script type="module">
105-
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
106-
import parserBabel from "https://unpkg.com/prettier@2.6.2/esm/parser-babel.mjs";
105+
import prettier from "https://unpkg.com/prettier@2.7.0/esm/standalone.mjs";
106+
import parserBabel from "https://unpkg.com/prettier@2.7.0/esm/parser-babel.mjs";
107107
108108
console.log(
109109
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
@@ -119,9 +119,9 @@ The HTML code embedded in JavaScript stays unformatted because the `html` parser
119119

120120
```html
121121
<script type="module">
122-
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
123-
import parserBabel from "https://unpkg.com/prettier@2.6.2/esm/parser-babel.mjs";
124-
import parserHtml from "https://unpkg.com/prettier@2.6.2/esm/parser-html.mjs";
122+
import prettier from "https://unpkg.com/prettier@2.7.0/esm/standalone.mjs";
123+
import parserBabel from "https://unpkg.com/prettier@2.7.0/esm/parser-babel.mjs";
124+
import parserHtml from "https://unpkg.com/prettier@2.7.0/esm/parser-html.mjs";
125125
126126
console.log(
127127
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "prettier",
3-
"version": "2.7.0-dev",
3+
"version": "2.7.0",
44
"description": "Prettier is an opinionated code formatter",
55
"bin": "./bin/prettier.js",
66
"repository": "prettier/prettier",

website/versioned_docs/version-stable/browser.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ See below for examples.
3333
### Global
3434

3535
```html
36-
<script src="https://unpkg.com/prettier@2.6.2/standalone.js"></script>
37-
<script src="https://unpkg.com/prettier@2.6.2/parser-graphql.js"></script>
36+
<script src="https://unpkg.com/prettier@2.7.0/standalone.js"></script>
37+
<script src="https://unpkg.com/prettier@2.7.0/parser-graphql.js"></script>
3838
<script>
3939
prettier.format("type Query { hello: String }", {
4040
parser: "graphql",
@@ -49,8 +49,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
4949

5050
```html
5151
<script type="module">
52-
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
53-
import parserGraphql from "https://unpkg.com/prettier@2.6.2/esm/parser-graphql.mjs";
52+
import prettier from "https://unpkg.com/prettier@2.7.0/esm/standalone.mjs";
53+
import parserGraphql from "https://unpkg.com/prettier@2.7.0/esm/parser-graphql.mjs";
5454
5555
prettier.format("type Query { hello: String }", {
5656
parser: "graphql",
@@ -63,8 +63,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
6363

6464
```js
6565
define([
66-
"https://unpkg.com/prettier@2.6.2/standalone.js",
67-
"https://unpkg.com/prettier@2.6.2/parser-graphql.js",
66+
"https://unpkg.com/prettier@2.7.0/standalone.js",
67+
"https://unpkg.com/prettier@2.7.0/parser-graphql.js",
6868
], (prettier, ...plugins) => {
6969
prettier.format("type Query { hello: String }", {
7070
parser: "graphql",
@@ -89,8 +89,8 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b
8989
### Worker
9090

9191
```js
92-
importScripts("https://unpkg.com/prettier@2.6.2/standalone.js");
93-
importScripts("https://unpkg.com/prettier@2.6.2/parser-graphql.js");
92+
importScripts("https://unpkg.com/prettier@2.7.0/standalone.js");
93+
importScripts("https://unpkg.com/prettier@2.7.0/parser-graphql.js");
9494
prettier.format("type Query { hello: String }", {
9595
parser: "graphql",
9696
plugins: prettierPlugins,
@@ -103,8 +103,8 @@ If you want to format [embedded code](options.md#embedded-language-formatting),
103103

104104
```html
105105
<script type="module">
106-
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
107-
import parserBabel from "https://unpkg.com/prettier@2.6.2/esm/parser-babel.mjs";
106+
import prettier from "https://unpkg.com/prettier@2.7.0/esm/standalone.mjs";
107+
import parserBabel from "https://unpkg.com/prettier@2.7.0/esm/parser-babel.mjs";
108108
109109
console.log(
110110
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
@@ -120,9 +120,9 @@ The HTML code embedded in JavaScript stays unformatted because the `html` parser
120120

121121
```html
122122
<script type="module">
123-
import prettier from "https://unpkg.com/prettier@2.6.2/esm/standalone.mjs";
124-
import parserBabel from "https://unpkg.com/prettier@2.6.2/esm/parser-babel.mjs";
125-
import parserHtml from "https://unpkg.com/prettier@2.6.2/esm/parser-html.mjs";
123+
import prettier from "https://unpkg.com/prettier@2.7.0/esm/standalone.mjs";
124+
import parserBabel from "https://unpkg.com/prettier@2.7.0/esm/parser-babel.mjs";
125+
import parserHtml from "https://unpkg.com/prettier@2.7.0/esm/parser-html.mjs";
126126
127127
console.log(
128128
prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {

website/versioned_docs/version-stable/cli.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,35 @@ Prevent errors when pattern is unmatched.
205205
## `--no-plugin-search`
206206

207207
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.
236+
237+
```bash
238+
prettier --write --cache --cache-strategy metadata src
239+
```

website/versioned_docs/version-stable/configuration.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,37 @@ If you’d like a JSON schema to validate your configuration, one is available h
177177

178178
## EditorConfig
179179

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:
181204

182-
- `end_of_line`
183-
- `indent_style`
184-
- `indent_size`/`tab_width`
185-
- `max_line_length`
205+
```ini
206+
[*]
207+
charset = utf-8
208+
insert_final_newline = true
209+
end_of_line = lf
210+
indent_style = space
211+
indent_size = 2
212+
max_line_length = 80
213+
```

website/versioned_docs/version-stable/plugins.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ To turn off plugin autoloading, use `--no-plugin-search` when using Prettier CLI
6161
- [`prettier-plugin-apex`](https://github.com/dangmai/prettier-plugin-apex) by [**@dangmai**](https://github.com/dangmai)
6262
- [`prettier-plugin-elm`](https://github.com/gicentre/prettier-plugin-elm) by [**@giCentre**](https://github.com/gicentre)
6363
- [`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)
6465
- [`prettier-plugin-go-template`](https://github.com/NiklasPor/prettier-plugin-go-template) by [**@NiklasPor**](https://github.com/NiklasPor)
6566
- [`prettier-plugin-java`](https://github.com/jhipster/prettier-java) by [**@JHipster**](https://github.com/jhipster)
6667
- [`prettier-plugin-jsonata`](https://github.com/Stedi/prettier-plugin-jsonata) by [**@Stedi**](https://github.com/Stedi)

0 commit comments

Comments
 (0)