I've been scouring the Eslint rule docs and cannot figure out how to enforce newlines between blocks.
For example, in jscs I can reject these for having no separating new line:
if (!rows.length) {
// code
}
var pagination;
if (something) {
// code
}
"space-before-blocks" sounded like it's what I wanted but it applies only to spaces, not newlines.
Response is a bit late but you can now use the padding-line-between-statements
rule for this: http://eslint.org/docs/rules/padding-line-between-statements
I think the config you'd want would be something like
"padding-line-between-statements": [
"warn",
{ blankLine: 'always', prev: '*', next: 'block' },
{ blankLine: 'always', prev: 'block', next: '*' },
{ blankLine: 'always', prev: '*', next: 'block-like' },
{ blankLine: 'always', prev: 'block-like', next: '*' },
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With