Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
Prettier - new line between function and comment

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
}
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

No, prettier doesn't have that rule.

Prettier has a sparse list of options by design, and this isn't one of'm.

over 4 years ago · Santiago Trujillo Report

0

But you can achive this behavior with ESLint:

enter image description here

And automaticly fix this issue for example on save in VSCode:

enter image description here

Check this rule for ESLinter. lines-around-comment

ESLinter gives you tonns of benefits.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!