requireObjectKeysOnNewLine

Requires placing object keys on new line

Types: Boolean or Object

Values:

  • true
  • Object:
    • 'allExcept' array of exceptions:
      • 'sameLine' ignores the rule if all the keys and values are on the same line

Example

"requireObjectKeysOnNewLine": true
"requireObjectKeysOnNewLine": {
    "allExcept": ["sameLine"]
}
Valid
var a = {
    b: 'b',
    c: 'c'
};
Invalid
var a = {
    b: 'b', c: 'c'
};
Valid for { "allExcept": ["sameLine"] }
var a = {
    b: 'b', c: 'c'
};
Invalid for { "allExcept": ["sameLine"] }
var a = {
    b: 'b', c: 'c',
    d: 'd'
};
Rule source
Test source