Put decorators on the same line#459
Conversation
|
redux |
|
@vramana good call! It seems like redux connect takes arguments. We likely don't want decorators with arguments to be inlined. Let me encode this rule as well! |
Mobx is the only popular JavaScript library that I know about which uses decorators. They put things on the same line so we should follow their conventions. The logic implemented here is the following: if there is one decorator, it's on the same line. If there is more than one, they are each on their own line. Fixes prettier#325
|
Done, now it has to be a single decorator AND just an identifier to be inlined. I also tried to enable flow decorator support but it only supports half of the decorators in the tests and has a different AST structure, so it's not worth using it. |
|
Thanks, looks good! |
|
Is there a possibility to make this configurable? I personally really dislike decorators being in the same line. Makes it very hard to browse the class properties. @Entity("Todos")
export class Todo implements ITodo {
@PrimaryGeneratedColumn("uuid") public id?: string;
@Column() public text: string;
@Column() public completed: boolean;
} |
|
@jlongster @vjeux @vramana I agree highly with @egeozcan -- would love to see this be a configurable value. If I submit a PR, would the team be up for merging it or is everyone set on keeping things as is? |
|
@JoshuaKGoldberg Please open a new issue, filling the template |
Mobx is the only popular JavaScript library that I know about which uses decorators. They put things on the same line so we should follow their conventions.
The logic implemented here is the following: if there is one decorator, it's on the same line. If there is more than one, they are each on their own line.
Fixes #325