noDecrementDo not use standalone `--`. Use `-= 1` instead.small-rules/no-increment-decrementDisallow standalone `++` and `--` statements and for-loop update clauses.
This matches the reason Swift removed these operators in Swift 3.
Low utility relative to the readability loss: these operators only save a few characters compared to
value += 1 or value -= 1. That trade is seldom useful.
Prefix vs postfix confusion: having both ++value and value++ is confusing. It can also lead to
fun subtle bugs, especially when you nest them inside larger expressions where evaluation order matters.
Redundancy: the increment and decrement operators repeat what += and -= already do. You can add
or subtract any value, not just 1.
Clarity over brevity: explicit code is the goal. Writing value += 1 makes the intent immediately
clear without requiring anyone to puzzle over operator precedence.
Swift bans the operators outright. This rule still allows array[size++] = value. That form beats
array.push(value) when the extra call costs too much, and the increment is a short spelling for that one
case. The native Oxlint rule has no such exception.
noDecrementDo not use standalone `--`. Use `-= 1` instead.noIncrementDo not use standalone `++`. Use `+= 1` instead.This rule accepts one options object after the severity.
size++;After auto-fix
size += 1;size += 1;