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
| Fact | Value |
|---|---|
| Issue type | unused-component-emit |
| Rule id in SARIF output | fallow/unused-component-emit |
| Command | fallow dead-code |
| Default severity | warn |
Config key in rules | unused-component-emits |
| Filter option | --unused-component-emits |
| Suppression comment | // fallow-ignore-next-line unused-component-emit |
Fixable with fallow fix | No |
| Opt-in | No |