Svelte
svelte/kit-app-state
Read page, navigating and updated from $app/state, not the $app/stores module that SvelteKit 3 removed.
moderatestaticfe-sveltekit
Why
$app/stores was the Svelte 4 store version of the page state. SvelteKit 3 removed it, so an import breaks the build after the upgrade, and on Kit 2 the store does not take part in Svelte 5's fine-grained reactivity. Agents still write $page from older examples.
Fix
import { page, navigating, updated } from '$app/state' and drop the $ prefix: $page.url.pathname becomes page.url.pathname. These are read-only state objects, so read them in markup or in $derived. npx sv migrate sveltekit-3 rewrites most imports.
Examples
<!-- bad -->
<script>
import { page } from '$app/stores'
</script>
<a href="/docs" aria-current={$page.url.pathname === '/docs' ? 'page' : undefined}>Docs</a>
<!-- good -->
<script>
import { page } from '$app/state'
</script>
<a href="/docs" aria-current={page.url.pathname === '/docs' ? 'page' : undefined}>Docs</a>Sources
Facts
- Id
svelte/kit-app-state- Severity
- moderate
- Check
- static checked in the source by
audit - Applies to
sveltejsx- Only in projects with
sveltekit- Taught by the skill
fe-sveltekitSvelteKit apps- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain svelte/kit-app-state