requireSpaceBeforeBlockStatements

Requires space(s) before block statements (for loops, control structures).

Type: Boolean or Integer

Values:

  • true require at least a single space
  • Integer require at least specified number of spaces

Example

"requireSpaceBeforeBlockStatements": 1
Valid
if (cond) {
    foo();
} else {
    bar();
}

for (var e in elements) {
    bar(e);
}

while (cond) {
    foo();
}
Invalid
if (cond){
    foo();
} else{
    bar();
}

for (var e in elements){
    bar(e);
}

while (cond){
    foo();
}
Rule source
Test source