In the code above, the author almost certainly meant for both foo++ and bar++
to be executed only if foo === bar. However, they forgot braces and bar++ will be executed
no matter what. This rule could prevent such a mistake.
Notes
Has Fix
Config
One of the following options may be provided:
"as-needed" forbids any unnecessary curly braces.
"ignore-same-line" skips checking braces for control-flow statements
that are on one line and start on the same line as their control-flow keyword
In the code above, the author almost certainly meant for both foo++ and bar++
to be executed only if foo === bar. However, they forgot braces and bar++ will be executed
no matter what. This rule could prevent such a mistake.
Notes
Has Fix
Config
One of the following options may be provided:
"as-needed" forbids any unnecessary curly braces.
"ignore-same-line" skips checking braces for control-flow statements
that are on one line and start on the same line as their control-flow keyword
Enforces consistent semicolon usage at the end of every statement.
Notes
Has Fix
Config
One of the following arguments must be provided:
"always" enforces semicolons at the end of every statement.
"never" disallows semicolons at the end of every statement except for when they are necessary.
The following arguments may be optionally provided:
"ignore-interfaces" skips checking semicolons at the end of interface members.
"ignore-bound-class-methods" skips checking semicolons at the end of bound class methods.
"strict-bound-class-methods" disables any special handling of bound class methods and treats them as any
other assignment. This option overrides "ignore-bound-class-methods".