Skip to content

Add Gatsby image validation check#7782

Open
KatalKavya96 wants to merge 1 commit into
layer5io:masterfrom
KatalKavya96:fix/check-gatsby-images
Open

Add Gatsby image validation check#7782
KatalKavya96 wants to merge 1 commit into
layer5io:masterfrom
KatalKavya96:fix/check-gatsby-images

Conversation

@KatalKavya96
Copy link
Copy Markdown
Member

Description

This PR fixes #7650

This PR adds a Gatsby image validation guardrail through a new make check-images target.

The validation script scans Gatsby/React source files and reports <GatsbyImage /> components that are missing an explicit image prop. It supports both full project validation and scoped validation for a specific folder or file.

Example:

make check-images
make check-images -- src/pages/community

If missing image props are found, the command prints the file path and location, then exits with code 1.

Notes for Reviewers

Changes made:

  • Added scripts/find-missing-gatsby-images.js
  • Added check:images npm script
  • Added check-images Makefile target
  • Added support for scoped checks using folder/file paths

Tested with:

npm run check:images
make check-images
make check-images -- src/pages/community

Also manually tested with a temporary invalid <GatsbyImage /> missing the image prop, and the script correctly reported the issue with exit code 1.

Signed commits

  • Yes, I signed my commits.

Signed-off-by: Kavya Katal <kavyakatal09@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 4, 2026

🚀 Preview deployment: https://layer5.io/pr-preview/pr-7782/

Note: Preview may take a moment (GitHub Pages deployment in progress). Please wait and refresh. Track deployment here

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.

Add image validation for Gatsby components and enhance error handling

1 participant