Nuxt · NUXT0022

Export data factories from scanned composable directories

Finds Nuxt fetch code that can be written with a clearer framework-supported pattern.
NUXT0022vite-doctor/nuxtfetchingerrorSuggestion

Run this rule

pnpm nuxt doctor --rules nuxt/fetch/create-usefetch-must-be-exported-in-scanned-dir

Why it matters

Nuxt data fetching relies on stable keys, payload serialization, and request context. Bypassing those contracts can duplicate requests or lose SSR data.

Use the Nuxt-supported create useFetch must be exported in scanned dir pattern instead.

Example

Use create useFetch must be exported in scanned dir

Before

const useUser = createUseFetch('/api/user')

After

export const useUser = createUseFetch('/api/user')
Copyright © 2026