Merge branch 'main' into next
# Conflicts: # docs/browser.md # src/language-js/print/literal.js # src/language-js/print/misc.js # src/language-js/printer-estree.js # tests/format/markdown/auto-link/jsfmt.spec.js # yarn.lock
This commit is contained in:
commit
0cd7e10447
44 files changed
+1413
-459
No files matched your search
@@ -1,19 +0,0 @@
|
||||
#### Fix missing parentheses when an expression statement starts with `let[` (#14000, #14044 by @fisker, @thorn0)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Input
|
||||
(let[0] = 2);
|
||||
|
||||
// Prettier stable
|
||||
let[0] = 2;
|
||||
|
||||
// Prettier stable (second format)
|
||||
SyntaxError: Unexpected token (1:5)
|
||||
> 1 | let[0] = 2;
|
||||
| ^
|
||||
2 |
|
||||
|
||||
// Prettier main
|
||||
(let)[0] = 2;
|
||||
```
|
||||
@@ -1,32 +0,0 @@
|
||||
#### Fix formatting for auto-accessors with comments (#14038 by @fisker)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Input
|
||||
class A {
|
||||
@dec()
|
||||
// comment
|
||||
accessor b;
|
||||
}
|
||||
|
||||
// Prettier stable
|
||||
class A {
|
||||
@dec()
|
||||
accessor // comment
|
||||
b;
|
||||
}
|
||||
|
||||
// Prettier stable (second format)
|
||||
class A {
|
||||
@dec()
|
||||
accessor; // comment
|
||||
b;
|
||||
}
|
||||
|
||||
// Prettier main
|
||||
class A {
|
||||
@dec()
|
||||
// comment
|
||||
accessor b;
|
||||
}
|
||||
```
|
||||
@@ -1,27 +0,0 @@
|
||||
#### Fix displacing of comments in default switch case (#14047 by @thorn0)
|
||||
|
||||
It was a regression in Prettier 2.6.0.
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Input
|
||||
switch (state) {
|
||||
default:
|
||||
result = state; // no change
|
||||
break;
|
||||
}
|
||||
|
||||
// Prettier stable
|
||||
switch (state) {
|
||||
default: // no change
|
||||
result = state;
|
||||
break;
|
||||
}
|
||||
|
||||
// Prettier main
|
||||
switch (state) {
|
||||
default:
|
||||
result = state; // no change
|
||||
break;
|
||||
}
|
||||
```
|
||||
@@ -1,19 +0,0 @@
|
||||
#### Add parentheses to head of `ExpressionStatement` instead of the whole statement (#14077 by @fisker)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Input
|
||||
({}).toString.call(foo) === "[object Array]"
|
||||
? foo.forEach(iterateArray)
|
||||
: iterateObject(foo);
|
||||
|
||||
// Prettier stable
|
||||
({}.toString.call(foo) === "[object Array]"
|
||||
? foo.forEach(iterateArray)
|
||||
: iterateObject(foo));
|
||||
|
||||
// Prettier main
|
||||
({}).toString.call(foo.forEach) === "[object Array]"
|
||||
? foo.forEach(iterateArray)
|
||||
: iterateObject(foo);
|
||||
```
|
||||
@@ -1,17 +0,0 @@
|
||||
#### Fix formatting for comments inside JSX attribute (#14082 with by @fisker)
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Input
|
||||
function MyFunctionComponent() {
|
||||
<button label=/*old*/"new">button</button>
|
||||
}
|
||||
|
||||
// Prettier stable
|
||||
Error: Comment "old" was not printed. Please report this error!
|
||||
|
||||
// Prettier main
|
||||
function MyFunctionComponent() {
|
||||
<button label=/*old*/ "new">button</button>;
|
||||
}
|
||||
```
|
||||
Reference in new issue
Block a user