---
title: "mutating-macro-argument"
description: "Reports a state update inside an argument of style() or another macro."
image: "https://stillwind.dev/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://stillwind.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# mutating-macro-argument

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

```tsx
let count = 0;
style({ "--count": count++ });
```

> mutating-macro-argument: macro arguments must be pure; perform assignments, updates, and deletes before the macro call
> 
> Example:2:20

## Fixed

```tsx
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](/docs/macros/style#side-effects-in-arguments).

## Rule settings

| Preset | Severity |
| --- | --- |
| `recommended` | deny |
| `strict` | deny |
| `stylistic` | off |

[Configure lint](/docs/configuration#lint) to change the severity or options.

Source: https://stillwind.dev/docs/lints/mutating-macro-argument/index.mdx
