Skip to content

feat(core): opt-in image dimension (CLS) validation#143

Merged
i-afaqrashid merged 1 commit into
mainfrom
feat/image-dimensions
May 29, 2026
Merged

feat(core): opt-in image dimension (CLS) validation#143
i-afaqrashid merged 1 commit into
mainfrom
feat/image-dimensions

Conversation

@i-afaqrashid
Copy link
Copy Markdown
Owner

What

Adds checks.images.dimensions. Reusing the existing per-provider image detection, it flags CMS image fields with no usable width/height and emits CMS-IMG-DIMENSIONS (warning).

Recognizes the common provider dimension shapes: width/height, dimensions.{width,height} (Prismic), media_details.{width,height} (WordPress), file.details.image.{width,height} (Contentful), and asset.metadata.dimensions.{width,height} (Sanity).

Why

Images without intrinsic dimensions are a top cause of layout shift (CLS), a Core Web Vital on the 2026 SEO checklist - the app can't reserve space before the image loads.

Off by default

checks.images stays a master toggle (false disables the alt check); the object form { dimensions: true } opts into this. Off by default since some providers keep dimensions out of band.

How verified

  • New scan tests: off by default; { dimensions: true } flags a dimensionless image; width/height and dimensions.* shapes pass; zero width/height is flagged.
  • pnpm verify green (219 tests).

Refs improvements/37.

Adds checks.images.dimensions. Reusing the existing image detection, it
flags CMS image fields that expose no usable width/height and emits
CMS-IMG-DIMENSIONS (warning) - a common cause of layout shift (CLS),
since the app cannot reserve space before the image loads.

Understands the common provider dimension shapes (width/height,
dimensions.*, media_details.*, file.details.image.*, and Sanity
asset.metadata.dimensions.*). Off by default; adds an images report group
for the new code in HTML and JUnit output.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cms-lab-site Ready Ready Preview, Comment May 29, 2026 9:29am

@i-afaqrashid i-afaqrashid merged commit da05f82 into main May 29, 2026
12 checks passed
@i-afaqrashid i-afaqrashid deleted the feat/image-dimensions branch May 29, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant