Nuxt · NUXT0072
Use useWindowSize for reactive viewport size
Finds VueUse project code that should use the supported useWindow size pattern instead.
Run this rule
pnpm nuxt doctor --rules vueuse/prefer-usewindow-size
Why it matters
Reading window dimensions directly misses later resizes unless the component owns listener setup and cleanup; useWindowSize() maintains reactive dimensions.
Recommended fix
Use VueUse useWindowSize() instead of reading window dimensions by hand.
Useful links
Example
Use VueUse window size
Before
<script setup lang="ts">
const width = ref(window.innerWidth)
window.addEventListener('resize', () => { width.value = window.innerWidth })
</script>
After
<script setup lang="ts">
const { width } = useWindowSize()
</script>