Skip to content

Rule · Lint

Image without width/height (or fill / aspect-ratio)

lint/img-missing-dimensionswarnvoid lintupdated

Why it matters

The browser can't reserve space for an unsized image, so content jumps when it loads (CLS). next/image with a string src and no dimensions fails at runtime.

How to fix it

Add width and height attributes matching the intrinsic aspect ratio (CSS can still resize), use fill inside a sized parent, statically import the image, or set an aspect-* class.

Example

tsx
<img src="/avatar.webp" width={96} height={96} alt="Ada" className="size-12" />

References

void lint reports 67 rules in this category. Static source checks with no browser: Tailwind v4 silent failures, Next.js 16 API traps, React render-body bugs, accessibility markup, SEO files and motion hygiene.