Skip to content
Fallow home
All docs pages

Docs home

Unused component emits

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

What it reports

A Vue <script setup> defineEmits event is emitted nowhere in its own component.

Dead code explains how fallow finds it.

Why it matters

A parent can listen for an event that the component never emits. The handler of the parent never runs, and no error tells anyone.

Example

Widget.vue declares defineEmits<{ close: [] }>() but emit('close') is called nowhere in the component's script.

Fix

Remove the unused emit, or emit it in the script. If the emit is part of a deliberately-stable public component API, suppress the line with // fallow-ignore-next-line unused-component-emit.

Facts

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