This rule reports an assignment or another state update inside an argument of
style() or another macro. The compiler can evaluate arguments in any order and
can skip arguments whose result is not used, so the update may run in a
different order or not at all.
Reported
let count = 0;
style({ "--count": count++ });mutating-macro-argument: macro arguments must be pure; perform assignments, updates, and deletes before the macro callFixed
let count = 0;
const previous = count++;
style({ "--count": previous });How to fix
- Run the update before the call, and pass the result, as in the example.
- The rule detects updates that it can see in the source. A function that changes state internally is not reported, so keep such calls out of the arguments too.
See Side effects in arguments.
Rule settings
| Preset | Severity |
|---|---|
recommended | deny |
strict | deny |
stylistic | off |
Configure lint to change the severity or options.