parent
d52021ecbf
commit
10bd71e478
|
@ -910,6 +910,73 @@ function doSmth() {
|
|||
|
||||
// Prettier (master)
|
||||
(<a />).toString();
|
||||
|
||||
#### JavaScript: Object destructuring in method parameters always broke into multiple lines ([#6646] by [@ericsakmar])
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```js
|
||||
// Input
|
||||
const obj = {
|
||||
func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
},
|
||||
};
|
||||
|
||||
class A {
|
||||
func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
#func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
}
|
||||
|
||||
// Prettier (stable)
|
||||
const obj = {
|
||||
func(
|
||||
id,
|
||||
{
|
||||
blog: { title }
|
||||
}
|
||||
) {
|
||||
return id + title;
|
||||
}
|
||||
};
|
||||
|
||||
class A {
|
||||
func(
|
||||
id,
|
||||
{
|
||||
blog: { title }
|
||||
}
|
||||
) {
|
||||
return id + title;
|
||||
}
|
||||
#func(
|
||||
id,
|
||||
{
|
||||
blog: { title }
|
||||
}
|
||||
) {
|
||||
return id + title;
|
||||
}
|
||||
}
|
||||
|
||||
// Prettier (master)
|
||||
const obj = {
|
||||
func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
},
|
||||
};
|
||||
|
||||
class A {
|
||||
func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
#func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
[#5910]: https://github.com/prettier/prettier/pull/5910
|
||||
|
@ -942,6 +1009,7 @@ function doSmth() {
|
|||
[#6496]: https://github.com/prettier/prettier/pull/6496
|
||||
[#6605]: https://github.com/prettier/prettier/pull/6605
|
||||
[#6640]: https://github.com/prettier/prettier/pull/6640
|
||||
[#6646]: https://github.com/prettier/prettier/pull/6646
|
||||
[@brainkim]: https://github.com/brainkim
|
||||
[@duailibe]: https://github.com/duailibe
|
||||
[@gavinjoyce]: https://github.com/gavinjoyce
|
||||
|
@ -952,3 +1020,4 @@ function doSmth() {
|
|||
[@thorn0]: https://github.com/thorn0
|
||||
[@dcyriller]: https://github.com/dcyriller
|
||||
[@rreverser]: https://github.com/RReverser
|
||||
[@ericsakmar]: https://github.com/ericsakmar
|
||||
|
|
|
@ -1289,6 +1289,9 @@ function printPathNoParens(path, options, print, args) {
|
|||
parent.type !== "FunctionDeclaration" &&
|
||||
parent.type !== "FunctionExpression" &&
|
||||
parent.type !== "ArrowFunctionExpression" &&
|
||||
parent.type !== "ObjectMethod" &&
|
||||
parent.type !== "ClassMethod" &&
|
||||
parent.type !== "ClassPrivateMethod" &&
|
||||
parent.type !== "AssignmentPattern" &&
|
||||
parent.type !== "CatchClause" &&
|
||||
n.properties.some(
|
||||
|
|
|
@ -50,6 +50,12 @@ class E {
|
|||
set #f(taz) {}
|
||||
}
|
||||
|
||||
class F {
|
||||
#func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class A {
|
||||
#x;
|
||||
|
@ -113,6 +119,12 @@ class E {
|
|||
set #f(taz) {}
|
||||
}
|
||||
|
||||
class F {
|
||||
#func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
|
@ -167,6 +179,12 @@ class E {
|
|||
set #f(taz) {}
|
||||
}
|
||||
|
||||
class F {
|
||||
#func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
class A {
|
||||
#x
|
||||
|
@ -230,6 +248,12 @@ class E {
|
|||
set #f(taz) {}
|
||||
}
|
||||
|
||||
class F {
|
||||
#func(id, { blog: { title } }) {
|
||||
return id + title
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
||||
|
|
|
@ -41,3 +41,9 @@ class E {
|
|||
get #f() {}
|
||||
set #f(taz) {}
|
||||
}
|
||||
|
||||
class F {
|
||||
#func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,18 @@ try {
|
|||
// code
|
||||
}
|
||||
|
||||
const obj = {
|
||||
func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
},
|
||||
};
|
||||
|
||||
class A {
|
||||
func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
}
|
||||
|
||||
=====================================output=====================================
|
||||
const [one, two = null, three = null] = arr;
|
||||
a = ([s = 1]) => 1;
|
||||
|
@ -90,5 +102,17 @@ try {
|
|||
// code
|
||||
}
|
||||
|
||||
const obj = {
|
||||
func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
};
|
||||
|
||||
class A {
|
||||
func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
`;
|
||||
|
|
|
@ -31,3 +31,15 @@ try {
|
|||
} catch ({ data: { message: { errors }}}) {
|
||||
// code
|
||||
}
|
||||
|
||||
const obj = {
|
||||
func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
},
|
||||
};
|
||||
|
||||
class A {
|
||||
func(id, { blog: { title } }) {
|
||||
return id + title;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue