Nuxt · NUXT0012

Use Nuxt Scripts instead of useHead for third-party scripts

Flags third party usehead script in Nuxt project code before it leaks into runtime behavior.
NUXT0012vite-doctor/nuxt-scriptsscriptswarnSuggestion
nuxt-scripts/no-third-party-usehead-scriptsrc/rule-packs/nuxt/rules/nuxt-scripts.ts Upstream docs

Run this rule

pnpm nuxt doctor --rules nuxt-scripts/no-third-party-usehead-script

Why it matters

Untrusted HTML and scripts are high-risk rendering surfaces. Keep them explicit, constrained, and routed through framework APIs that encode intent.

Remove third party usehead script, or move it to the Nuxt runtime/API that owns that behavior.

Example

Avoid third party usehead script

Before

useHead({
  script: [{ src: 'https://example.com/widget.js' }],
})

After

useHeadSafe({
  script: [{ src: trustedWidgetUrl }],
})
Copyright © 2026