Skip to content

Commit 8147ddd

Browse files
committed
Release 3.7.0
1 parent 8a59916 commit 8147ddd

7 files changed

Lines changed: 62 additions & 25 deletions

File tree

.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 3.6.2**
29+
**Prettier 3.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: 3.6.2
23+
- Prettier Version: 3.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+
# 3.7.0
2+
3+
[diff](https://github.com/prettier/prettier/compare/3.6.2...3.7.0)
4+
5+
🔗 [Release Notes](https://prettier.io/blog/2025/11/27/3.7.0)
6+
17
# 3.6.2
28

39
[diff](https://github.com/prettier/prettier/compare/3.6.1...3.6.2)

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": "3.7.0-dev",
3+
"version": "3.7.0",
44
"description": "Prettier is an opinionated code formatter",
55
"bin": "./bin/prettier.cjs",
66
"repository": "prettier/prettier",

website/versioned_docs/version-stable/browser.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Required options:
2121

2222
- **[`parser`](options.md#parser) (or [`filepath`](options.md#file-path))**: One of these options has to be specified for Prettier to know which parser to use.
2323

24-
- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource-options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in [https://unpkg.com/browse/prettier@3.6.2/plugins](https://unpkg.com/browse/prettier@3.6.2/plugins). Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
24+
- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource-options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in [https://unpkg.com/browse/prettier@3.7.0/plugins](https://unpkg.com/browse/prettier@3.7.0/plugins). Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
2525

2626
You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option.
2727

@@ -32,8 +32,8 @@ See below for examples.
3232
### Global
3333

3434
```html
35-
<script src="https://unpkg.com/prettier@3.6.2/standalone.js"></script>
36-
<script src="https://unpkg.com/prettier@3.6.2/plugins/graphql.js"></script>
35+
<script src="https://unpkg.com/prettier@3.7.0/standalone.js"></script>
36+
<script src="https://unpkg.com/prettier@3.7.0/plugins/graphql.js"></script>
3737
<script>
3838
(async () => {
3939
const formatted = await prettier.format("type Query { hello: String }", {
@@ -50,8 +50,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
5050

5151
```html
5252
<script type="module">
53-
import * as prettier from "https://unpkg.com/prettier@3.6.2/standalone.mjs";
54-
import * as prettierPluginGraphql from "https://unpkg.com/prettier@3.6.2/plugins/graphql.mjs";
53+
import * as prettier from "https://unpkg.com/prettier@3.7.0/standalone.mjs";
54+
import * as prettierPluginGraphql from "https://unpkg.com/prettier@3.7.0/plugins/graphql.mjs";
5555
5656
const formatted = await prettier.format("type Query { hello: String }", {
5757
parser: "graphql",
@@ -64,8 +64,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
6464

6565
```js
6666
define([
67-
"https://unpkg.com/prettier@3.6.2/standalone.js",
68-
"https://unpkg.com/prettier@3.6.2/plugins/graphql.js",
67+
"https://unpkg.com/prettier@3.7.0/standalone.js",
68+
"https://unpkg.com/prettier@3.7.0/plugins/graphql.js",
6969
], async (prettier, ...plugins) => {
7070
const formatted = await prettier.format("type Query { hello: String }", {
7171
parser: "graphql",
@@ -96,8 +96,8 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b
9696
<TabItem value="module" label="Module worker">
9797

9898
```js
99-
import * as prettier from "https://unpkg.com/prettier@3.6.2/standalone.mjs";
100-
import * as prettierPluginGraphql from "https://unpkg.com/prettier@3.6.21/plugins/graphql.mjs";
99+
import * as prettier from "https://unpkg.com/prettier@3.7.0/standalone.mjs";
100+
import * as prettierPluginGraphql from "https://unpkg.com/prettier@3.7.01/plugins/graphql.mjs";
101101

102102
const formatted = await prettier.format("type Query { hello: String }", {
103103
parser: "graphql",
@@ -110,8 +110,8 @@ const formatted = await prettier.format("type Query { hello: String }", {
110110

111111
```js
112112
importScripts(
113-
"https://unpkg.com/prettier@3.6.2/standalone.js",
114-
"https://unpkg.com/prettier@3.6.2/plugins/graphql.js",
113+
"https://unpkg.com/prettier@3.7.0/standalone.js",
114+
"https://unpkg.com/prettier@3.7.0/plugins/graphql.js",
115115
);
116116

117117
(async () => {
@@ -131,9 +131,9 @@ If you want to format [embedded code](options.md#embedded-language-formatting),
131131

132132
```html
133133
<script type="module">
134-
import * as prettier from "https://unpkg.com/prettier@3.6.2/standalone.mjs";
135-
import * as prettierPluginBabel from "https://unpkg.com/prettier@3.6.2/plugins/babel.mjs";
136-
import * as prettierPluginEstree from "https://unpkg.com/prettier@3.6.2/plugins/estree.mjs";
134+
import * as prettier from "https://unpkg.com/prettier@3.7.0/standalone.mjs";
135+
import * as prettierPluginBabel from "https://unpkg.com/prettier@3.7.0/plugins/babel.mjs";
136+
import * as prettierPluginEstree from "https://unpkg.com/prettier@3.7.0/plugins/estree.mjs";
137137
138138
console.log(
139139
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {
@@ -149,10 +149,10 @@ The HTML code embedded in JavaScript stays unformatted because the `html` parser
149149

150150
```html
151151
<script type="module">
152-
import * as prettier from "https://unpkg.com/prettier@3.6.2/standalone.mjs";
153-
import * as prettierPluginBabel from "https://unpkg.com/prettier@3.6.2/plugins/babel.mjs";
154-
import * as prettierPluginEstree from "https://unpkg.com/prettier@3.6.2/plugins/estree.mjs";
155-
import * as prettierPluginHtml from "https://unpkg.com/prettier@3.6.2/plugins/html.mjs";
152+
import * as prettier from "https://unpkg.com/prettier@3.7.0/standalone.mjs";
153+
import * as prettierPluginBabel from "https://unpkg.com/prettier@3.7.0/plugins/babel.mjs";
154+
import * as prettierPluginEstree from "https://unpkg.com/prettier@3.7.0/plugins/estree.mjs";
155+
import * as prettierPluginHtml from "https://unpkg.com/prettier@3.7.0/plugins/html.mjs";
156156
157157
console.log(
158158
await prettier.format("const html=/* HTML */ `<DIV> </DIV>`", {

website/versioned_docs/version-stable/plugins.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ Strings provided to `plugins` are ultimately passed to [`import()` expression](h
5151

5252
- [`prettier-plugin-apex`](https://github.com/dangmai/prettier-plugin-apex) by [**@dangmai**](https://github.com/dangmai)
5353
- [`prettier-plugin-astro`](https://github.com/withastro/prettier-plugin-astro) by [**@withastro contributors**](https://github.com/withastro/prettier-plugin-astro/graphs/contributors)
54+
- [`prettier-plugin-bigcommerce-stencil`](https://github.com/phoenix128/prettier-plugin-bigcommerce-stencil) by [**@phoenix128**](https://github.com/phoenix128)
5455
- [`prettier-plugin-elm`](https://github.com/gicentre/prettier-plugin-elm) by [**@giCentre**](https://github.com/gicentre)
5556
- [`prettier-plugin-erb`](https://github.com/adamzapasnik/prettier-plugin-erb) by [**@adamzapasnik**](https://github.com/adamzapasnik)
5657
- [`prettier-plugin-gherkin`](https://github.com/mapado/prettier-plugin-gherkin) by [**@mapado**](https://github.com/mapado)
5758
- [`prettier-plugin-glsl`](https://github.com/NaridaL/glsl-language-toolkit/tree/main/packages/prettier-plugin-glsl) by [**@NaridaL**](https://github.com/NaridaL)
5859
- [`prettier-plugin-go-template`](https://github.com/NiklasPor/prettier-plugin-go-template) by [**@NiklasPor**](https://github.com/NiklasPor)
60+
- [`prettier-plugin-hugo-post`](https://github.com/metcalfc/prettier-plugin-hugo-post) by [**@metcalfc**](https://github.com/metcalfc)
5961
- [`prettier-plugin-java`](https://github.com/jhipster/prettier-java) by [**@JHipster**](https://github.com/jhipster)
6062
- [`prettier-plugin-jinja-template`](https://github.com/davidodenwald/prettier-plugin-jinja-template) by [**@davidodenwald**](https://github.com/davidodenwald)
6163
- [`prettier-plugin-jsonata`](https://github.com/Stedi/prettier-plugin-jsonata) by [**@Stedi**](https://github.com/Stedi)
@@ -149,9 +151,11 @@ function hasIgnorePragma(text: string): boolean;
149151
_(Optional)_ The preprocess function can process the input text before passing into `parse` function.
150152

151153
```ts
152-
function preprocess(text: string, options: object): string;
154+
function preprocess(text: string, options: object): string | Promise<string>;
153155
```
154156

157+
_Support for async preprocess first added in v3.7.0_
158+
155159
### `printers`
156160

157161
Printers convert ASTs into a Prettier intermediate representation, also known as a Doc.
@@ -170,6 +174,8 @@ export const printers = {
170174
isBlockComment,
171175
printComment,
172176
getCommentChildNodes,
177+
hasPrettierIgnore,
178+
printPrettierIgnored,
173179
handleComments: {
174180
ownLine,
175181
endOfLine,
@@ -394,6 +400,22 @@ function getCommentChildNodes(
394400

395401
Return `[]` if the node has no children or `undefined` to fall back on the default behavior.
396402

403+
### (optional) `hasPrettierIgnore`
404+
405+
```ts
406+
function hasPrettierIgnore(path: AstPath): boolean;
407+
```
408+
409+
Returns whether or not the AST node is `prettier-ignore`d.
410+
411+
### (optional) `printPrettierIgnored`
412+
413+
If the AST node is `prettier-ignore`d, Prettier will slice for the text for parsing without calling `print` function by default, however plugin can also handle the `prettier-ignore`d node print by adding this property.
414+
415+
This property have the same signature as the `print` property.
416+
417+
_First available in v3.7.0_
418+
397419
#### (optional) `printComment`
398420

399421
Called whenever a comment node needs to be printed. It has the signature:
@@ -410,17 +432,24 @@ function printComment(
410432
#### (optional) `canAttachComment`
411433

412434
```ts
413-
function canAttachComment(node: AST): boolean;
435+
function canAttachComment(node: AST, ancestors: T[]): boolean;
414436
```
415437

416438
This function is used for deciding whether a comment can be attached to a particular AST node. By default, _all_ AST properties are traversed searching for nodes that comments can be attached to. This function is used to prevent comments from being attached to a particular node. A typical implementation looks like
417439

418440
```js
419-
function canAttachComment(node) {
420-
return node.type && node.type !== "comment";
441+
function canAttachComment(node, [parent]) {
442+
return !(
443+
node.type === "comment" ||
444+
(parent?.type === "shorthand-property" &&
445+
parent.key === node &&
446+
parent.key !== parent.value)
447+
);
421448
}
422449
```
423450
451+
_The second parameter `ancestors` first added in v3.7.0._
452+
424453
#### (optional) `isBlockComment`
425454
426455
```ts

website/versioned_docs/version-stable/related-projects.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ title: Related Projects
3030
- [prettier-chrome](https://github.com/u3u/prettier-chrome) is an extension that runs Prettier in the browser
3131
- [spotless](https://github.com/diffplug/spotless) lets you run prettier from [gradle](https://github.com/diffplug/spotless/tree/main/plugin-gradle#prettier) or [maven](https://github.com/diffplug/spotless/tree/main/plugin-maven#prettier).
3232
- [csharpier](https://github.com/belav/csharpier) is a port of Prettier for C#
33+
- [Prettier](https://github.com/jaywcjlove/Prettier) is a Swift version based on Prettier
3334
- [reviewdog-action-prettier](https://github.com/EPMatt/reviewdog-action-prettier) runs Prettier in GitHub Actions CI/CD workflows
35+
- [monaco-prettier](https://github.com/remcohaszing/monaco-prettier) integrates Prettier into [Monaco editor](https://microsoft.github.io/monaco-editor/)

0 commit comments

Comments
 (0)