Skip to content
Fallow home
All docs pages

Docs home

Unused Svelte events

What an unused-svelte-event finding of fallow dead-code means, why it matters and how to fix it.

What it reports

A Svelte component dispatches a createEventDispatcher event whose name is listened to nowhere in the project.

Dead code explains how fallow finds it.

Why it matters

The component dispatches an event that no parent handles, so the action that the event reports has no effect. Readers assume that some parent reacts to it.

Example

Child.svelte calls const dispatch = createEventDispatcher(); dispatch('dead'), but no parent listens for it (no <Child on:dead> anywhere in the project).

Fix

Remove the dispatched event, or listen for it on the component (<Child on:dead={...}> or forward it via <Child on:dead>). If the event is dispatched reflectively (a dynamic name) or is part of a deliberately-stable public component API, suppress the line with // fallow-ignore-next-line unused-svelte-event.

Facts

FactValue
Issue typeunused-svelte-event
Rule id in SARIF outputfallow/unused-svelte-event
Commandfallow dead-code
Default severitywarn
Config key in rulesunused-svelte-events
Filter option--unused-svelte-events
Suppression comment// fallow-ignore-next-line unused-svelte-event
Fixable with fallow fixNo
Opt-inNo