requireSpacesInsideParentheses

Requires space after opening round bracket and before closing.

Types: String or Object

Values:

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

Example

"requireSpacesInsideParentheses": "all"
"requireSpacesInsideParentheses": {
    "all": true,
    "except": [ "{", "}", "\"" ]
}
Valid for mode "all"
var x = Math.pow( ( 1 + 2 ), ( 3 + 4 ) );
Valid for mode { "all": true, "except": [ "(", ")" ] } or "allButNested"
var x = Math.pow(( 1 + 2 ), ( 3 + 4 ));
Valid for mode { "all": true, "ignoreParenthesizedExpression": true }
if ( !("foo" in obj) ) {}
Valid for mode { "all": true, "except": [ "{", "}" ] }
var x = Math.pow( foo({ test: 1 }) );
Valid for mode { "all": true, "except": [ "\"" ] }
var x = foo("string");
var x = foo( 1 );
Invalid
var x = Math.pow(1 + 2, 3 + 4);
Rule source
Test source