Skip to content
Advertisement

How to add multiple lines between code blocks with Prettier?

I started using Prettier, but discovered that it doesn’t have an option to control the number of blank lines between code blocks, and defaults to one.

I want 2 blank lines:

JavaScript

But it defaults to 1 blank line:

JavaScript

How can I achieve this with Prettier?

(Or perhaps there is another way to do this. I was surprised how few configurable options are available in Prettier. I was hoping for more control.)

Advertisement

Answer

How to add multiple lines between code blocks with Prettier?

You can’t.

I was surprised how few configurable options are available in Prettier. I was hoping for more control

That is very intentional. Prettier is an opinionated code formatter. One of those opinions is 1 line is enough 🌹

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement