Unused load data keys
What an unused-load-data-key finding of fallow dead-code means, why it matters and how to fix it.
What it reports
A SvelteKit load() return-object key is read by no consumer.
Dead code explains how fallow finds it.
Why it matters
A SvelteKit route load() (in +page.ts / +page.server.ts and the .js variants) returns an object whose keys become the route's data prop. A returned key that NO consumer reads is dead: it runs a real server-side fetch / DB cost on every request for data nothing renders. fallow checks two channels: the sibling +page.svelte's data.<key> reads (route-pinned), and project-wide page.data.<key> (Svelte 5 $app/state) / $page.data.<key> (Svelte 4 $app/stores) reads in any component. svelte-check types data via generated $types but never flags an unread returned key. The detector abstains (never false-flags) on a spread / non-literal / multi-return / computed-key / wrapped load, on a sibling that passes the whole data object opaquely, on a +page.server.ts whose universal +page.ts sibling forwards its data, and project-wide when any whole-object use of page.data / $page.data is seen. Default warn; delete the key or wire a consumer. A load fetch can have side effects, so there is no safe auto-fix. The check runs only when the project declares @sveltejs/kit.
Example
src/routes/blog/+page.ts returns { posts, draftCount } but +page.svelte only reads data.posts and no component reads page.data.draftCount.
Fix
Delete the unused key from the load() return (and skip its fetch), or wire a consumer (read data.<key> in +page.svelte, or page.data.<key> in a shared component). If the load fetch has a side effect you must keep, suppress the line with // fallow-ignore-next-line unused-load-data-key.
Facts
| Fact | Value |
|---|---|
| Issue type | unused-load-data-key |
| Rule id in SARIF output | fallow/unused-load-data-key |
| Command | fallow dead-code |
| Default severity | warn |
Config key in rules | unused-load-data-keys |
| Filter option | --unused-load-data-keys |
| Suppression comment | // fallow-ignore-next-line unused-load-data-key |
Fixable with fallow fix | No |
| Opt-in | No |