Nuxt · NUXT0018
Do not register mutating requests as async data
Finds Nuxt project code that can be written with a clearer framework-supported pattern.
nuxt/async-data-no-mutation-methodssrc/rule-packs/nuxt/rules/nuxt/async-data-no-mutation-methods.ts Upstream docs Run this rule
pnpm nuxt doctor --rules nuxt/async-data-no-mutation-methods
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.
Recommended fix
Use the Nuxt-supported async data no mutation methods pattern instead.
Useful links
Example
Keep mutations out of useFetch
Before
const { data } = await useFetch('/api/orders', {
method: 'POST',
body: { status: 'draft' },
})
After
async function createOrder() {
return await $fetch('/api/orders', {
method: 'POST',
body: { status: 'draft' },
})
}