Add Gatsby image validation check#7782
Conversation
Signed-off-by: Kavya Katal <kavyakatal09@gmail.com>
|
🚀 Preview deployment: https://layer5.io/pr-preview/pr-7782/
|
|
I have two minor suggestions to make it more robust:
|
Signed-off-by: Kavya Katal <kavyakatal09@gmail.com>
|
@Junnygram Updated the PR based on the suggestions:
|
| @@ -118,6 +119,8 @@ | |||
| "devDependencies": { | |||
| "@babel/core": "^7.29.0", | |||
There was a problem hiding this comment.
Can you please check and update this?
Babel packages are using different versions. (Latest version is 8.0.0.)
Can you align all Babel packages to the same version to avoid any compatibility issues?
There was a problem hiding this comment.
@Sbragul26 I tried moving the Babel packages to 8.0.0, but the checks started failing because the current setup still depends on Babel 7 tooling. @babel/preset-env requires Babel ^7.0.0-0, while Babel 8 was being loaded.
So I will keep the Babel packages aligned within the Babel 7 range for this PR. Moving to Babel 8 would need a broader migration separately.
Description
This PR fixes #7650
This PR adds a Gatsby image validation guardrail through a new
make check-imagestarget.The validation script scans Gatsby/React source files and reports
<GatsbyImage />components that are missing an explicitimageprop. It supports both full project validation and scoped validation for a specific folder or file.Example:
If missing image props are found, the command prints the file path and location, then exits with code
1.Notes for Reviewers
Changes made:
scripts/find-missing-gatsby-images.jscheck:imagesnpm scriptcheck-imagesMakefile targetTested with:
Also manually tested with a temporary invalid
<GatsbyImage />missing theimageprop, and the script correctly reported the issue with exit code1.Signed commits