forked from maogongzi/prettier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revert function composition logic for decorators (prettier#7138)
fixes prettier#6953
- Loading branch information
Showing
3 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters