Skip to content
svelte-vitals
English
Esc
navigateopen⌘Jpreview

Correctness

Every Correctness rule svelte-vitals runs.

Svelte 5 runes and lifecycle misuse: code that compiles but behaves wrong.

Rule Severity Summary
correctness/orphan-effect 🔴 critical An $effect created outside component initialisation throws effect_orphan at runtime.
correctness/orphan-lifecycle 🔴 critical onMount, getContext and friends called outside component initialisation throw lifecycle_outside_component at runtime.
correctness/server-browser-global 🔴 critical window, document, localStorage accessed in module scope or a load/handler crash SSR with a ReferenceError.
correctness/autoplay-muted 🟡 warning Browsers block autoplay with audio, and a blocked autoplay does not error, so a <video autoplay> without muted silently never starts playing for real visitors.
correctness/base-path-navigation 🟡 warning A hardcoded root-relative link resolves against the domain root, not kit.paths.base, so under a base path it lands outside the app and 404s in production.
correctness/checkable-bind-value 🟡 warning bind on a checkbox or radio input binds the DOM value property, which checkbox/radio interaction never changes, so the bound state silently never updates.
correctness/each-index-key 🟡 warning Keying an {#each} block by its index gives items position-based identity, the same bug as no key, only masked.
correctness/each-key 🟡 warning An {#each} block over dynamic data should have a key.
correctness/effect-as-derived 🟡 warning Use $derived instead of an $effect that only assigns state.
correctness/effect-as-onmount 🟡 warning An $effect that reads no reactive value belongs in an event handler, {@attach}, or onMount instead.
correctness/instance-browser-global 🟡 warning A component’s instance script runs on the server during SSR, so window/document reads at its top level crash the render.
correctness/nonreactive-builtin-state 🟡 warning A plain Map, Set, Date, URL, or URLSearchParams in $state is not proxied, so its mutations are invisible to reactivity and the UI silently stops updating.
correctness/prop-mutation 🟡 warning Don’t mutate a prop from $props() unless it is declared $bindable.
correctness/stale-prop-derivation 🟡 warning A value computed from a prop without $derived is evaluated once, so the UI silently stops tracking the parent.
correctness/unmutated-state 🔵 info Use const (or $state.raw) for a $state that is never mutated.

See Configuration to change a rule’s severity or turn it off.