# useSvelteRequireEachKey

Rule `biome/useSvelteRequireEachKey`. Require keyed `{#each}` blocks in Svelte templates.

- Source: biome
- Technologies: Svelte
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 30.6M weekly downloads of presets that enable it
- Trend: +109.3% last quarter
- Rank: #611 by reach, #246 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `nursery/useSvelteRequireEachKey` | yes | no | group nursery, since 2.5.0 | [docs](https://biomejs.dev/linter/rules/use-svelte-require-each-key/) |

## Code examples

### Incorrect: the rule reports this

```svelte
{#each items as item}
  <div>{item}</div>
{/each}
```

### Correct: the rule accepts this

```svelte
{#each items as item (item.id)}
  <div>{item}</div>
{/each}
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "useSvelteRequireEachKey": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |

## Related rules

- [biome/useSvelteReactiveClasses](https://lintradar.dev/rules/biome/useSvelteReactiveClasses.md): Require the reactive classes from `svelte/reactivity` instead of built-in objects that are modified.
- [biome/useSvelteShorthandDirective](https://lintradar.dev/rules/biome/useSvelteShorthandDirective.md): Enforce the shorthand syntax for Svelte `bind:`, `class:`, and `style:` directives.
- [biome/useSvelteKitRuneImports](https://lintradar.dev/rules/biome/useSvelteKitRuneImports.md): Require importing SvelteKit's app state from `$app/state` instead of `$app/stores`.
- [biome/useTailwindVariablesShorthand](https://lintradar.dev/rules/biome/useTailwindVariablesShorthand.md): Enforce the shorthand syntax for CSS variables in Tailwind CSS classes.
- [biome/useSvelteKitResolve](https://lintradar.dev/rules/biome/useSvelteKitResolve.md): Require internal navigation in SvelteKit apps to use paths built with `resolve()`.
- [biome/useTanstackQueryExhaustiveDependencies](https://lintradar.dev/rules/biome/useTanstackQueryExhaustiveDependencies.md): Require query keys to include every value that the query function uses.

---

Web page: https://lintradar.dev/rules/biome/useSvelteRequireEachKey. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
