Vue · VUE0019
Call onWatcherCleanup synchronously
Flags onwatchercleanup after await in Vue watch code before it leaks into runtime behavior.
vue/watch/no-onwatchercleanup-after-awaitsrc/rule-packs/vue/rules/vue/no-on-watcher-cleanup-after-await.ts Upstream docs Run this rule
pnpm vite-doctor . --framework vue --rules vue/watch/no-onwatchercleanup-after-await
Why it matters
Effects that outlive their component create leaks and stale updates. Register cleanup where Vue or VueUse can dispose it automatically.
Recommended fix
Remove onwatchercleanup after await, or move it to the Vue runtime/API that owns that behavior.
Useful links
Example
Register watcher cleanup before await
Before
<script setup lang="ts">
watch(id, async () => {
await loadUser()
onWatcherCleanup(cancelLoad)
})
</script>
After
<script setup lang="ts">
watch(id, async () => {
onWatcherCleanup(cancelLoad)
await loadUser()
})
</script>