react-doctor/nextjs-no-native-script
`import Script from "next/script"` — use `strategy="afterInteractive"` for analytics or `"lazyOnload"` for widgets
- Category: Next.js
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: nextjs
- Enabled when: framework=nextjs and capabilities=nextjs
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Flags a native <script> JSX element unless its type literal is non-executable (anything other than text/javascript, application/javascript, or module — e.g. application/ld+json, text/template). Structured-data JSON-LD blocks are correctly ignored.
Fix prompt
Use this once validation confirms the diagnostic is real.
Use import Script from 'next/script' and pick a strategy: afterInteractive (default) for analytics and tag managers, lazyOnload for chat widgets and heatmaps, beforeInteractive for critical polyfills (root layout only), or worker for offloading to a web worker. https://nextjs.org/docs/app/api-reference/components/script
Related rules
More Next.js rules from the rules reference:
react-doctor/nextjs-no-polyfill-script: Next.js includes polyfills for fetch, Promise, Object.assign, Array.from, and 50+ others automaticallyreact-doctor/nextjs-no-redirect-in-try-catch: Move the redirect/notFound call outside the try block, or add `unstable_rethrow(error)` in the catchreact-doctor/nextjs-no-script-in-head: Move <Script> out of <Head>: next/script ignores head placement, so a Script nested in Head silently never loadsreact-doctor/nextjs-no-use-search-params-without-suspense: Wrap the component using useSearchParams: `<Suspense fallback={<Skeleton />}><SearchComponent /></Suspense>`react-doctor/nextjs-no-vercel-og-import: Replace the @vercel/og import with import { ImageResponse } from "next/og"