Has ESlint a rule about blank line before the first statement in function?
The padded-blocks rule allows you to require newlines at the start and end of blocks, including function bodies. In addition to function bodies, it also covers the bodies of if
statements, for
and while
loops, and other block-like structures, which you may or may not want.
Try pasting the following code in the demo to see if it works for you:
/* eslint padded-blocks: "error" */
function foo(bar) {
if (bar) {
foo();
}
}
If you only want to check function bodies, you could follow @Dhananjay's suggestion and edit the rule's source code into your own custom rule.
I don't think there is such a rule available out of the box based on the list of available rules You can try to add a custom rule for this check as explained here