NUXT0080Match composable exports to their file name
Why it happens
Nuxt auto-imports named exports from top-level composables/ files under their own names, and a default export under a name derived from the file name. When useCart.ts exports useShoppingCart, or fetch-user.ts default-exports a function that becomes fetchUser, readers cannot find a composable from its name or tell it is a composable at all.
Fix
Name the main export after the file (useCart.ts exports useCart; use-cart.ts also maps to useCart), and name files with default exports so the derived name starts with use. Run Nuxt prepare with the Doctor module to capture current composable scan evidence. Only files in that inventory are checked, respecting resolved layer source directories, disabled scanning, and ignored files. Index files, files without use* exports, and files where any use* export matches are not reported.
Example
Export the composable the file name promises
Before
// app/composables/useCart.ts
export function useShoppingCart() {
return useState('cart', () => [])
}
After
// app/composables/useCart.ts
export function useCart() {
return useState('cart', () => [])
}
Name default-export files with use
Before
// app/composables/fetch-user.ts (auto-imported as fetchUser)
export default function () {
return useFetch('/api/user')
}
After
// app/composables/use-user.ts (auto-imported as useUser)
export default function () {
return useFetch('/api/user')
}
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm nuxt doctor --extends auto,nuxt/strict --rules nuxt/composables/export-name-matches-file