Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 604 Bytes

non-control-statement-curly.md

File metadata and controls

29 lines (20 loc) · 604 Bytes

Require following curly brace conventions for non-control statements (non-control-statement-curly)

Omitting the curly braces in an IfStatement can make code clearer sometimes, such as "return early". However, in the case of non-control statements, this can easily lead to errors on subsequent modifications.

This rule may conflict with ESLint's curly in some cases, so you may need to turn off the curly rule.

This rule is fixable.

Fail

if (foo) bar()

Pass

if (foo) {
  bar()
}
if (foo) return
if (foo) throw new Error('An error occurred.')