useSvelteRequireEachKey
Summary
Section titled “Summary”- Diagnostic Category:
lint/nursery/useSvelteRequireEachKey - This rule doesn’t have a fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
- Same as
svelte/require-each-key
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useSvelteRequireEachKey": "error" } } }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”{#each items as item} <div>{item}</div>{/each}{#each items as item (item.id)} <div>{item}</div>{/each}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.