Nuxt · NUXT0066

Use VueUse scroll and element composables

Finds VueUse project code that should use the supported use scroll and element pattern instead.
NUXT0066vite-doctor/vueusebrowser-apiinfoSuggestion
vueuse/prefer-use-scroll-and-elementsrc/rule-packs/nuxt/rules/vueuse.ts Upstream docs

Run this rule

pnpm nuxt doctor --rules vueuse/prefer-use-scroll-and-element

Why it matters

VueUse scroll helpers provide reactive coordinates and manage listeners across mounting, target changes, and disposal.

Use the VueUse-supported use scroll and element pattern instead.

Example

Use VueUse scroll helpers

Before

<script setup lang="ts">
const y = ref(window.scrollY)
window.addEventListener('scroll', () => { y.value = window.scrollY })
</script>

After

<script setup lang="ts">
const { y } = useWindowScroll()
</script>
Copyright © 2026