Nuxt · NUXT0052
Return navigateTo in route middleware
Finds Nuxt routing code that calls navigateto in middleware without returning the result.
nuxt/routing/return-navigateto-in-middlewaresrc/rule-packs/nuxt/rules/nuxt/return-navigate-to-in-middleware.ts Upstream docs Run this rule
pnpm nuxt doctor --rules nuxt/routing/return-navigateto-in-middleware
Why it matters
Navigation helpers only work correctly in the runtime they were designed for. Returning the navigation result keeps redirects and aborts observable to Nuxt.
Recommended fix
Return navigateTo() from route middleware so Nuxt can apply the redirect.
Useful links
Example
Return navigateTo
Before
export default defineNuxtRouteMiddleware(() => {
navigateTo('/login')
})
After
export default defineNuxtRouteMiddleware(() => {
return navigateTo('/login')
})