-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Keep parameter decorators on different lines as parameter when possible (Babylon, TypeScript) #4922
Copy link
Copy link
Closed
Closed
Suggestion
Copy link
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:needs discussionIssues needing discussion and a decision to be made before action can be takenIssues needing discussion and a decision to be made before action can be taken
Description
Prettier 1.14.0
Playground link
# Options (if any):
--parser typescript --trailing-comma allInput:
class Foo {
constructor(
@inject(Bar)
private readonly bar: IBar,
@inject(MyProcessor)
private readonly myProcessor: IMyProcessor,
@inject(InjectionTypes.AnotherThing)
private readonly anotherThing: IAnotherThing | undefined,
) { }
}Output:
class Foo {
constructor(
@inject(Bar) private readonly bar: IBar,
@inject(MyProcessor) private readonly myProcessor: IMyProcessor,
@inject(InjectionTypes.AnotherThing)
private readonly anotherThing: IAnotherThing | undefined,
) {}
}Expected behavior:
It's very difficult to read constructor parameters when they're on the same line and have irregular levels of starting indentation. The input is what you would expect a well-formatted document to look like.
Counterpart to #1974. I'd personally prefer to just send a revert PR for #459 (@vjeux) as this code sample is very common with libraries such as http://inversify.io. If it's desirable to have the current behavior, I'd also be more than happy to send a PR that adds a flag.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:needs discussionIssues needing discussion and a decision to be made before action can be takenIssues needing discussion and a decision to be made before action can be taken