Nuxt · Architecture

NUXT0059Keep shared code runtime-neutral

Flags vue or nitro context in shared in Nuxt shared code before it leaks into runtime behavior.

Why it happens

Nuxt gives this pattern a specific contract. Staying inside that contract makes the code easier to test, refactor, and run across server and client runtimes.

Fix

Remove vue or nitro context in shared, or move it to the Nuxt runtime/API that owns that behavior.

Example

Keep shared utilities runtime-neutral

Before

export function currentPath() {
  return useRoute().path
}

After

export function currentPath(path: string) {
  return path
}

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm nuxt doctor --rules nuxt/shared/no-vue-or-nitro-context-in-shared
Copyright © 2026