2 * @fileoverview Rule to flag use of unary increment and decrement operators.
3 * @author Ian Christian Myers
4 * @author Brody McKee (github.com/mrmckeb)
9 //------------------------------------------------------------------------------
11 //------------------------------------------------------------------------------
18 description: "disallow the unary operators `++` and `--`",
19 category: "Stylistic Issues",
21 url: "https://eslint.org/docs/rules/no-plusplus"
28 allowForLoopAfterthoughts: {
33 additionalProperties: false
40 const config = context.options[0];
41 let allowInForAfterthought = false;
43 if (typeof config === "object") {
44 allowInForAfterthought = config.allowForLoopAfterthoughts === true;
49 UpdateExpression(node) {
50 if (allowInForAfterthought && node.parent.type === "ForStatement") {
55 message: "Unary operator '{{operator}}' used.",
57 operator: node.operator