disallowSpaceAfterObjectKeys

Disallows space after object keys.

Types: Boolean, String, or Object

Values:

  • true
  • "ignoreSingleLine" ignores objects if the object only takes up a single line (deprecated use "allExcept": [ "singleline" ])
  • "ignoreMultiLine" ignores objects if the object takes up multiple lines (deprecated use "allExcept": [ "multiline" ])
  • Object:
    • "allExcept": array of exceptions:
      • "singleline" ignores objects if the object only takes up a single line
      • "multiline" ignores objects if the object takes up multiple lines
      • "aligned" ignores aligned object properties
      • "method" ignores method declarations

Example

"disallowSpaceAfterObjectKeys": true
Valid for true
var x = {a: 1};
var y = {
    a: 1,
    b: 2
}
Valid for { allExcept: ['singleline'] }
var x = {a : 1};
var y = {
    a: 1,
    b: 2
}
Valid for { allExcept: ['multiline'] }
var x = {a: 1};
var y = {
    a  : 1,
    b   : 2
}
Valid for { allExcept: ['aligned'] }
var y = {
    abc: 1,
    d  : 2
}
Valid for { allExcept: ['method'] }
var y = {
    fn () {
       return 42;
    }
}
Invalid
var x = {a : 1};
Rule source
Test source