dokgu
dokgu

Reputation: 6060

How to force empty line between code blocks in Prettier

I'm using Prettier to format my codebase and I want to add a space between code blocks like loops, if/case statements, functions, etc.

So right now Prettier leaves the following alone:

// ----- FUNCTIONS -----
const foo = () => {
  // code
}
const bar = () => {
  // code
}

// ----- LOOPS -----
for (let i = 0; i < 5; i++) {
  // code
}
return true;

// ----- IF STATEMENTS -----
if (true) {
  // code
}
return true;

And so on and so forth. What I want is to have Prettier format these as:

// ----- FUNCTIONS -----
const foo = () => {
  // code
}

const bar = () => {
  // code
}

// ----- LOOPS -----
for (let i = 0; i < 5; i++) {
  // code
}

return true;

// ----- IF STATEMENTS -----
if (true) {
  // code
}

return true;

I've been looking around for a configuration for Prettier but didn't find any.

Upvotes: 1

Views: 115

Answers (0)

Related Questions