requireCurlyBraces

Requires curly braces after statements.

Types: Array or Boolean or Object

Values:

  • Array of quoted keywords
  • true to require curly braces after the following keywords
  • Object
    • 'keywords'
      • Array of quoted keywords
    • 'allExcept'
      • Array of keywords inside of the block that would allow curly braces
      • Ex: ["return" , "continue", "break"]

JSHint: curly

Example

"requireCurlyBraces": [
    "if",
    "else",
    "for",
    "while",
    "do",
    "try",
    "catch",
    "case",
    "default"
]
Valid
if (x) {
    x++;
}
Invalid
if (x) x++;
Rule source
Test source