Skip to content

Enhance json-lint command with Blueprint support#2363

Merged
westonruter merged 2 commits intotrunkfrom
update/json-lint
Jan 29, 2026
Merged

Enhance json-lint command with Blueprint support#2363
westonruter merged 2 commits intotrunkfrom
update/json-lint

Conversation

@westonruter
Copy link
Member

I took the bin/validate-json-schema.js which was introduced in #2325 and incorporated it into my post-date-modified plugin. I then iterated on it there in westonruter/post-date-modified#23 to:

  • Add Blueprint support for additional requirements imposed on the dotorg directory.
  • Generalize the script so it is explicitly for syntax checking in addition to schema validation.
  • Improve types.
  • Improve output by consistently putting filename at the beginning of the line.

Look at 05033f3 for a better diff of the changes, prior to renaming the file.

Before

$ npm run lint-json

> lint-json
> node bin/validate-json-schema.js

Validating .wp-env.json against schema: https://schemas.wp.org/trunk/wp-env.json
Validating .wp-env.override.json against schema: https://schemas.wp.org/trunk/wp-env.json
Validating package.json against schema: https://www.schemastore.org/package.json
Validating tsconfig.json against schema: https://www.schemastore.org/tsconfig.json
Validating plugins/performance-lab/.wordpress-org/blueprints/blueprint.json against schema: https://playground.wordpress.net/blueprint-schema.json
Validating plugins/view-transitions/.wordpress-org/blueprints/blueprint.json against schema: https://playground.wordpress.net/blueprint-schema.json

After

$ npm run lint-json

> lint-json
> node bin/validate-json.js

.wp-env.json: Valid against <https://schemas.wp.org/trunk/wp-env.json>. ✅
.wp-env.override.json: Valid against <https://schemas.wp.org/trunk/wp-env.json>. ✅
composer.json: Skipping schema validation since no $schema property found. Syntax validated only. ✅
package-lock.json: Skipping schema validation since no $schema property found. Syntax validated only. ✅
package.json: Valid against <https://www.schemastore.org/package.json>. ✅
plugins.json: Skipping schema validation since no $schema property found. Syntax validated only. ✅
tsconfig.json: Valid against <https://www.schemastore.org/tsconfig.json>. ✅
plugins/view-transitions/.wordpress-org/blueprints/blueprint.json: Valid against <https://playground.wordpress.net/blueprint-schema.json>. ✅
plugins/performance-lab/.wordpress-org/blueprints/blueprint.json: Valid against <https://playground.wordpress.net/blueprint-schema.json>. ✅
plugins/image-prioritizer/tests/test-cases/preload-links-with-one-half-stale-group/url-metrics.json: Skipping schema validation since no $schema property found. Syntax validated only. ✅
plugins/optimization-detective/tests/data/url-metrics/tablet-viewport-half-stale.json: Skipping schema validation since no $schema property found. Syntax validated only. ✅

Use of AI Tools

Copilot and Gemini were both used to help author some changes. See commits at westonruter/post-date-modified#23

westonruter and others added 2 commits January 27, 2026 09:09
See westonruter/post-date-modified#23

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature no milestone PRs that do not have a defined milestone for release skip changelog PRs that should not be mentioned in changelogs labels Jan 27, 2026
@westonruter westonruter requested a review from Copilot January 27, 2026 17:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the JSON validation script to support Blueprint-specific requirements and improves the overall user experience. The script is renamed from validate-json-schema.js to validate-json.js to better reflect its dual purpose of JSON syntax validation and schema validation.

Changes:

  • Renamed script from validate-json-schema.js to validate-json.js with enhanced functionality
  • Added Blueprint file size validation (max 100 KB) to meet WordPress.org plugin directory requirements
  • Improved error handling to collect all errors before exiting instead of failing on first error
  • Enhanced output formatting with consistent filename-first messages and status emojis

Reviewed changes

Copilot reviewed 1 out of 3 changed files in this pull request and generated no comments.

File Description
package.json Updated lint-json script reference to point to renamed validate-json.js
bin/validate-json.js New enhanced validation script with Blueprint support, better error handling, improved types, timeout protection for schema fetching, and comprehensive JSON syntax validation
bin/validate-json-schema.js Removed old validation script (replaced by validate-json.js)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.17%. Comparing base (509ad26) to head (1fcf606).
⚠️ Report is 23 commits behind head on trunk.

Additional details and impacted files
@@           Coverage Diff           @@
##            trunk    #2363   +/-   ##
=======================================
  Coverage   69.17%   69.17%           
=======================================
  Files          90       90           
  Lines        7708     7708           
=======================================
  Hits         5332     5332           
  Misses       2376     2376           
Flag Coverage Δ
multisite 69.17% <ø> (ø)
single 35.39% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

github-actions bot commented Jan 27, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: adamsilverstein <adamsilverstein@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@adamsilverstein adamsilverstein self-requested a review January 27, 2026 17:50
Copy link
Member

@adamsilverstein adamsilverstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Left some small feedback, otherwise looks good to me.

@westonruter
Copy link
Member Author

@adamsilverstein Thanks! I don't see the feedback though.

@westonruter westonruter merged commit ce9cee4 into trunk Jan 29, 2026
47 checks passed
@westonruter westonruter deleted the update/json-lint branch January 29, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no milestone PRs that do not have a defined milestone for release skip changelog PRs that should not be mentioned in changelogs [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants