1 parent
025fcdea95
commit
64d4b2f49f
3 files changed
+36
-5
No files matched your search
@@ -0,0 +1,31 @@
|
||||
#### Tweak function composition logic for decorators ([#7138](https://github.com/prettier/prettier/pull/7138) by [@brainkim](https://github.com/brainkim))
|
||||
|
||||
Because decorators modify the line following, splitting a decorator call’s
|
||||
arguments onto multiple lines can obscure the relationship between the
|
||||
decorator and its intended target, producing less-readable code. Therefore, the
|
||||
function composition logic introduced in #6033 has been changed to exclude
|
||||
decorator calls.
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```jsx
|
||||
// Input
|
||||
export class Item {
|
||||
@OneToOne(() => Thing, x => x.item)
|
||||
thing!: Thing;
|
||||
}
|
||||
|
||||
// Output (Prettier stable)
|
||||
export class Item {
|
||||
@OneToOne(
|
||||
() => Thing,
|
||||
x => x.item,
|
||||
)
|
||||
thing!: Thing;
|
||||
}
|
||||
|
||||
// Output (Prettier master)
|
||||
export class Item {
|
||||
@OneToOne(() => Thing, x => x.item)
|
||||
thing!: Thing;
|
||||
}
|
||||
```
|
||||
@@ -4069,7 +4069,10 @@ function printArgumentsList(path, options, print) {
|
||||
);
|
||||
}
|
||||
|
||||
if (isFunctionCompositionArgs(args)) {
|
||||
if (
|
||||
path.getParentNode().type !== "Decorator" &&
|
||||
isFunctionCompositionArgs(args)
|
||||
) {
|
||||
return allArgsBrokenOut();
|
||||
}
|
||||
|
||||
|
||||
@@ -321,10 +321,7 @@ export class Board {
|
||||
@Column()
|
||||
description: string;
|
||||
|
||||
@OneToMany(
|
||||
type => Topic,
|
||||
topic => topic.board
|
||||
)
|
||||
@OneToMany(type => Topic, topic => topic.board)
|
||||
topics: Topic[];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user