requireSpacesInsideObjectBrackets

Requires space after opening object curly brace and before closing.

Types: String or Object

Values:

  • String
    • "all": strict mode
    • "allButNested": (deprecated use Object version with "allExcept": ['}']) ignores nested closing object braces in a row
  • Object:
    • "allExcept": Array specifying list of tokens that can occur after an opening object brace or before a closing object brace without a space

Example

"requireSpacesInsideObjectBrackets": {
    "allExcept": [ "}", ")" ]
}
"requireSpacesInsideObjectBrackets": "all"
Valid for mode "all"
var x = { a: { b: 1 } };
Valid for mode { "allExcept": [ "}" ] } or "allButNested"
var x = { a: { b: 1 }};
Valid for mode "allExcept": [ "}", ")" ]
var x = { a: (b ? 1 : 2)};
var x = { a: { b: 1 }};
Invalid
var x = {a: 1};
Rule source
Test source