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