requirePaddingNewLinesAfterBlocks

Requires newline after blocks

Type: Boolean or Object

Values:

  • true: always require a newline after blocks
  • Object:
    • "allExcept": Array
      • "inCallExpressions" Blocks don't need a line of padding in function argument lists
      • "inNewExpressions" Blocks don't need a line of padding in constructor argument lists
      • "inArrayExpressions" Blocks don't need a line of padding in arrays
      • "inProperties" Blocks don't need a line of padding as object properties
      • "singleLine" Blocks don't need a line of padding if they are on a single line

Example

"requirePaddingNewLinesAfterBlocks": true
"requirePaddingNewLinesAfterBlocks": {
    "allExcept": ["inCallExpressions", "inNewExpressions", "inArrayExpressions", "inProperties", "singleLine"]
}
Valid
function () {
    for (var i = 0; i < 2; i++) {
        if (true) {
            return false;
        }

        continue;
    }

    var obj = {
        foo: function() {
            return 1;
        },

        bar: function() {
            return 2;
        }
    };

    func(
         function() {
         }
    );

    var a = [
        function() {
        },

        function() {
        }
    ]

}
Valid for { "allExcept": ["inCallExpressions"] }
func(
    2,
    3,
    function() {
    }
);
Valid for { "allExcept": ["inNewExpressions"] }
new SomeClass(
    2,
    3,
    function() {
    }
);
Valid for { "allExcept": ["inArrayExpressions"] }
var foo = [
    2,
    3,
    function() {
    }
];
Valid for { "allExcept": ["inProperties"] }
var foo = {
    a: 2,
    b: function() {
    },
    c: 3
];
Valid for { "allExcept": ["singleLine"] }
for (var i = 0; i < 10; ++i) {
    if (i % 2 === 0) { continue; }
    console.log('Its getting odd in here...');
}
Invalid
function () {
    for (var i = 0; i < 2; i++) {
        if (true) {
            return false;
        }
        continue;
    }
}
Rule source
Test source