requireSpacesInsideArrayBrackets

Requires space after opening array square bracket and before closing. Reports only on arrays, not on property accessors. Use requireSpacesInsideBrackets to report on all brackets.

Types: String or Object

Values:

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

Example

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