requirePaddingNewLinesBeforeLineComments

Requires newline before line comments

Types: Boolean or Object

Values:

  • true: always require a newline before line comments
  • Object:
    • "allExcept": "firstAfterCurly" Comments may be first line of block without extra padding

Examples

"requirePaddingNewLinesBeforeLineComments": true
"requirePaddingNewLinesBeforeLineComments": { "allExcept": "firstAfterCurly" }
Valid for true
var a = 2;
var b = 3; // comment

// comment
return a;

function() {

  // comment
}
Valid for { "allExcept": "firstAfterCurly" }
var a = 2;

// comment
return a;

function() {
  // comment
}
Invalid
var a = 2;
//comment
return a;

function() {
  // comment
}
Rule source
Test source