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
#### Fix cursor positioning for a special case ([#14812](https://github.com/prettier/prettier/pull/14812) by [@fisker](https://github.com/fisker))
6
+
7
+
<!-- prettier-ignore -->
8
+
```js
9
+
// <|> is the cursor position
10
+
11
+
/* Input */
12
+
// All messages are represented in JSON.
13
+
// So, the prettier.py controls a subprocess which spawns "node {this_file}".
14
+
import {<|> } from "fs"
15
+
16
+
/* Prettier 3.0.0 */
17
+
// All messages are represented in JSON.
18
+
// So, the prettier.py <|>controls a subprocess which spawns "node {this_file}".
19
+
import {} from "fs"
20
+
21
+
/* Prettier 3.0.1 */
22
+
// All messages are represented in JSON.
23
+
// So, the prettier.py controls a subprocess which spawns "node {this_file}".
24
+
import {<|>} from "fs"
25
+
```
26
+
27
+
#### Fix plugins/estree.d.ts to make it a module ([#15018](https://github.com/prettier/prettier/pull/15018) by [@kingyue737](https://github.com/kingyue737))
28
+
29
+
Add `export {}` in `plugins/estree.d.ts` to fix the "File is not a module" error
30
+
31
+
#### Add parenthesis around leading multiline comment in return statement ([#15037](https://github.com/prettier/prettier/pull/15037) by [@auvred](https://github.com/auvred))
32
+
33
+
<!-- prettier-ignore -->
34
+
```jsx
35
+
// Input
36
+
function fn() {
37
+
return (
38
+
/**
39
+
* @type {...}
40
+
*/ expresssion
41
+
)
42
+
}
43
+
44
+
// Prettier 3.0.0
45
+
function fn() {
46
+
return /**
47
+
* @type {...}
48
+
*/ expresssion;
49
+
}
50
+
51
+
// Prettier 3.0.1
52
+
function fn() {
53
+
return (
54
+
/**
55
+
* @type {...}
56
+
*/ expresssion
57
+
);
58
+
}
59
+
```
60
+
61
+
#### Add support for Vue "Generic Components" ([#15066](https://github.com/prettier/prettier/pull/15066) by [@auvred](https://github.com/auvred))
<script setup lang="ts" generic="T extends Type1 & Type2 & (Type3 | Type4), U extends string | number | boolean"></script>
69
+
70
+
<!-- Prettier 3.0.0 -->
71
+
<script
72
+
setup
73
+
lang="ts"
74
+
generic="T extends Type1 & Type2 & (Type3 | Type4), U extends string | number | boolean"
75
+
></script>
76
+
77
+
<!-- Prettier 3.0.1 -->
78
+
<script
79
+
setup
80
+
lang="ts"
81
+
generic="
82
+
T extends Type1 & Type2 & (Type3 | Type4),
83
+
U extends string | number | boolean
84
+
"
85
+
></script>
86
+
```
87
+
88
+
#### Fix comments print in `IfStatement` ([#15076](https://github.com/prettier/prettier/pull/15076) by [@fisker](https://github.com/fisker))
89
+
90
+
<!-- prettier-ignore -->
91
+
```js
92
+
function a(b) {
93
+
if (b) return 1; // comment
94
+
else return 2;
95
+
}
96
+
97
+
/* Prettier 3.0.0 */
98
+
Error: Comment "comment" was not printed. Please report this error!
99
+
100
+
/* Prettier 3.0.1 */
101
+
function a(b) {
102
+
if (b) return 1; // comment
103
+
else return 2;
104
+
}
105
+
```
106
+
107
+
#### Add missing type definition for `printer.preprocess` ([#15123](https://github.com/prettier/prettier/pull/15123) by [@so1ve](https://github.com/so1ve))
108
+
109
+
```diff
110
+
export interface Printer<T = any> {
111
+
// ...
112
+
+ preprocess?:
113
+
+ | ((ast: T, options: ParserOptions<T>) => T | Promise<T>)
114
+
+ | undefined;
115
+
}
116
+
```
117
+
118
+
#### Add missing `getVisitorKeys` method type definition for `Printer` ([#15125](https://github.com/prettier/prettier/pull/15125) by [@auvred](https://github.com/auvred))
119
+
120
+
```tsx
121
+
const printer: Printer = {
122
+
print: () => [],
123
+
getVisitorKeys(node, nonTraversableKeys) {
124
+
return ["body"];
125
+
},
126
+
};
127
+
```
128
+
129
+
#### Add typing to support `readonly` array properties of AST Node ([#15127](https://github.com/prettier/prettier/pull/15127) by [@auvred](https://github.com/auvred))
130
+
131
+
<!-- prettier-ignore -->
132
+
```tsx
133
+
// Input
134
+
interface TestNode {
135
+
readonlyArray: readonly string[];
136
+
}
137
+
138
+
declare const path: AstPath<TestNode>;
139
+
140
+
path.map(() => "", "readonlyArray");
141
+
142
+
// Prettier 3.0.0
143
+
interface TestNode {
144
+
readonlyArray: readonly string[];
145
+
}
146
+
147
+
declare const path: AstPath<TestNode>;
148
+
149
+
path.map(() => "", "readonlyArray");
150
+
// ^ Argument of type '"readonlyArray"' is not assignable to parameter of type '"regularArray"'. ts(2345)
151
+
152
+
// Prettier 3.0.1
153
+
interface TestNode {
154
+
readonlyArray: readonly string[];
155
+
}
156
+
157
+
declare const path: AstPath<TestNode>;
158
+
159
+
path.map(() => "", "readonlyArray");
160
+
```
161
+
162
+
#### Add space before unary minus followed by a function call ([#15129](https://github.com/prettier/prettier/pull/15129) by [@pamelalozano](https://github.com/pamelalozano))
Copy file name to clipboardExpand all lines: docs/browser.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Required options:
18
18
19
19
-**[`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.
20
20
21
-
-**`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/[email protected].0/plugins/>. Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
21
+
-**`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/[email protected].1/plugins/>. Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
22
22
23
23
You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option.
@@ -47,8 +47,8 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack
@@ -61,8 +61,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/browser.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Required options:
19
19
20
20
-**[`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.
21
21
22
-
-**`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/[email protected].0/plugins/>. Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
22
+
-**`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/[email protected].1/plugins/>. Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON.
23
23
24
24
You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option.
@@ -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
0 commit comments