> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# no-interpolation-in-snapshots

[Added in v0.8.0](https://github.com/web-infra-dev/rslint/releases/tag/v0.8.0)
## Configuration

| Preset                             | Configured Value |
| ---------------------------------- | ---------------- |
| ✅ rstestPlugin.configs.all         | `"warn"`         |
| ✅ rstestPlugin.configs.recommended | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, rstestPlugin } from '@rslint/core';

export default defineConfig([
  rstestPlugin.configs.recommended,
  {
    rules: {
      'rstest/no-interpolation-in-snapshots': 'error',
    },
  },
]);
```

## Rule Details

Disallows interpolation inside inline snapshots. Updating a snapshot rewrites the literal in the source file, so interpolated values can be silently lost.

Only `toMatchInlineSnapshot` and `toThrowErrorMatchingInlineSnapshot` are checked. Other snapshot matchers keep their expected value outside the source file and are not affected by snapshot updates in the same way.

## Incorrect

```ts
expect(user).toMatchInlineSnapshot(`
  {
    "id": ${user.id},
  }
`);
```

## Correct

```ts
expect(user).toMatchInlineSnapshot(`
  {
    "id": 1,
  }
`);

expect(user).toMatchInlineSnapshot({ id: expect.any(Number) });
```
