Skip to content

useSvelteRequireEachKey

biome.json
{
"linter": {
"rules": {
"nursery": {
"useSvelteRequireEachKey": "error"
}
}
}
}

Require keyed {#each} blocks in Svelte templates.

Svelte uses keyed each blocks to track list items across updates. Without a key, Svelte updates items by position, which can cause state to move between items when the list changes.

For more information, see the Svelte documentation on keyed each blocks.

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