Reputation: 421
I would like to know if there's a rule to add a new line between function/statement and comment in typescript with prettier (.prettierrc at the root of the project).
Current behaviour:
} else if (request.type === 'membership-fee') {
/**
* If type is membership fee
*/
this.form.get('total')?.setValue(this.gym?.membership_fee?.total);
} else {
/**
* Operation type not recognized
*/
this.toast.error('Tipo di operazione non riconosciuto');
($('#editSaleModal') as any).modal('hide');
}
Desired behaviour:
} else if (request.type === 'membership-fee') {
/**
* If type is membership fee
*/
this.form.get('total')?.setValue(this.gym?.membership_fee?.total);
} else {
/**
* Operation type not recognized
*/
this.toast.error('Tipo di operazione non riconosciuto');
($('#editSaleModal') as any).modal('hide');
}
My current .prettierc:
{
"useTabs": true,
"tabWidth": 4,
"printWidth": 120
}
Upvotes: 5
Views: 8989
Reputation: 4780
But you can achive this behavior with ESLint:
And automaticly fix this issue for example on save in VSCode:
Check this rule for ESLinter. lines-around-comment
ESLinter gives you tonns of benefits.
Upvotes: 1
Reputation: 72867
No, prettier doesn't have that rule.
Prettier has a sparse list of options by design, and this isn't one of'm.
Upvotes: 3