Disallow the unary operators ++
and --
Because the unary ++
and --
operators are subject to automatic semicolon insertion, differences in whitespace can change semantics of source code.
This rule disallows the unary operators ++
and --
.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
This rule has an object option.
"allowForLoopAfterthoughts": true
allows unary operators ++
and --
in the afterthought (final expression) of a for
loop.Examples of correct code for this rule with the { "allowForLoopAfterthoughts": true }
option:
Examples of incorrect code for this rule with the { "allowForLoopAfterthoughts": true }
option:
This rule was introduced in ESLint v0.0.9.
© OpenJS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/latest/rules/no-plusplus