VSCode's formatter doesn't do anything to the following snippet:

function funciton1() { ... } function function2() { ... }

How do I get it to insert a newline after the function block?

function funciton1() { ... } function function2() { ... }

I do not want that to happen with the following snippet though:

if (...) { ... } else { ... }

gargoylebident's user avatar

VS Code's formatter itself doesn't control rules like this. That kind of formatting logic typically comes from ESLint.
You can add this rule to your ESLint config to achieve the intended behavior:

{ "rules": { "padding-line-between-statements": [ "error", { "blankLine": "always", "prev": "function", "next": "function" } ] } }

d4c4n's user avatar

New contributor

d4c4n is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.