requirePaddingNewlinesBeforeKeywords

Requires an empty line above the specified keywords unless the keyword is the first expression in a block.

Types: Boolean or Array

Values:

  • true specifies that the spacedKeywords found in the utils module require an empty line above it
  • Array specifies quoted keywords which require an empty line above it

Example

"requirePaddingNewlinesBeforeKeywords": [
    "do",
    "for",
    "if",
    "else"
    // etc
]
Valid for mode true
function(a) {
    if (!a) {
        return false;
    }

    for (var i = 0; i < b; i++) {
        if (!a[i]) {
            return false;
        }
    }

    while (a) {
        a = false;
    }
    return true;
}
Invalid
function(a) {
    if (!a) {
        return false;
    }
    for (var i = 0; i < b; i++) {
        if (!a[i]) {
            return false;
        }
    }
    while (a) {
        a = false;
    }
    return true;
}
Valid for mode ['if', for']
function(a) {
    if (!a) {
        return false;
    }

    for (var i = 0; i < b; i++) {
        if (!a[i]) {
            return false;
        }
    }
    while (a) {
        a = false;
    }
    return true;
}
Invalid
function(a) {
    if (!a) {
        return false;
    }
    for (var i = 0; i < b; i++) {
        if (!a[i]) {
            return false;
        }
    }
    while (a) {
        a = false;
    }
    return true;
}
Rule source
Test source