react-doctor/nextjs-image-missing-sizes
Add sizes for responsive behavior: `sizes="(max-width: 768px) 100vw, 50vw"` matching your layout breakpoints
- 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 JSX element named Image with the fill prop but no sizes prop. False positive if Image is a custom component rather than next/image — check the import. Also low-impact when the image renders at a fixed pixel size since the browser still picks a sensible source.
Fix prompt
Use this once validation confirms the diagnostic is real.
Add a sizes prop matching your layout breakpoints, e.g. sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw". Without it Next.js falls back to 100vw and the browser downloads the largest source from the generated srcset. https://nextjs.org/docs/app/api-reference/components/image#sizes
Related rules
More Next.js rules from the rules reference:
react-doctor/nextjs-inline-script-missing-id: Add `id="descriptive-name"` so Next.js can track, deduplicate, and re-execute the script correctlyreact-doctor/nextjs-missing-metadata: Add `export const metadata = { title: '...', description: '...' }` or `export async function generateMetadata()`react-doctor/nextjs-no-a-element: `import Link from 'next/link'` — enables client-side navigation, prefetching, and preserves scroll positionreact-doctor/nextjs-no-client-fetch-for-server-data: Remove 'use client' and fetch directly in the Server Component — no API round-trip, secrets stay on serverreact-doctor/nextjs-no-client-side-redirect: Avoid redirects inside useEffect. Use an event handler, middleware, or server-side redirect (App Router: redirect() from next/navigation; Pages Router: getServerSideProps redirect)