Rule: increment-decrement

Enforces using explicit += 1 or -= 1 operators.

Rationale

It’s easy to type +i or -i instead of –i or ++i, and won’t always result in invalid code. Prefer standardizing small arithmetic operations with the explicit += and -= operators.

Config

If no arguments are provided, both pre- and post-unary operators are banned. If "allow-post" is provided, post-unary operators will be allowed.

Config examples
"increment-decrement": true
"increment-decrement": [true, "allow-post"]
Schema
{
  "items": {
    "enum": [
      "allow-post"
    ],
    "type": "string"
  },
  "maxLength": 1,
  "minLength": 0,
  "type": "array"
}