Nuxt · NUXT0071
Use useEventListener for DOM events
Finds VueUse project code that should use the supported useEvent listener pattern instead.
Run this rule
pnpm nuxt doctor --rules vueuse/prefer-useevent-listener
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
Use VueUse useEventListener() so the listener is removed with the component scope.
Useful links
Example
Use VueUse event listeners
Before
<script setup lang="ts">
onMounted(() => window.addEventListener('resize', onResize))
onBeforeUnmount(() => window.removeEventListener('resize', onResize))
</script>
After
<script setup lang="ts">
useEventListener(window, 'resize', onResize)
</script>