Skip to content

Refactor validation tools and update related scripts#77522

Open
kushagra-goyal-14 wants to merge 5 commits intoWordPress:trunkfrom
kushagra-goyal-14:try/migrate-validation-tools-to-workspace
Open

Refactor validation tools and update related scripts#77522
kushagra-goyal-14 wants to merge 5 commits intoWordPress:trunkfrom
kushagra-goyal-14:try/migrate-validation-tools-to-workspace

Conversation

@kushagra-goyal-14
Copy link
Copy Markdown
Contributor

What?

Part of #75041

Why?

The issue provides more context, but in short, this PR ensures the workspace package does not rely on root dependencies once dependency isolation is enforced.

How?

This PR converts validation tools into a new workspace @wordpress/validation-tools while still relating the functionality.

Testing Instructions

Testing Instructions for Keyboard

npm run lint:lockfile
npm run lint:tsconfig
npm run other:check-local-changes
npm run other:check-licenses

or

npm run lint

@kushagra-goyal-14 kushagra-goyal-14 marked this pull request as ready for review April 22, 2026 06:22
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 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: kushagra-goyal-14 <kush123@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>

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

@kushagra-goyal-14
Copy link
Copy Markdown
Contributor Author

Hi @manzoorwanijk
I've addressed the argument issue flagged in #77063 (comment). Could you take a look and let me know if anything was missed or needs further adjustment?

@manzoorwanijk
Copy link
Copy Markdown
Member

manzoorwanijk commented Apr 22, 2026

As I mentioned in the reported PR, I already have a simpler fix for it - #77541

EDIT: Never mind. I thought this PR is trying to fix that same issue.

@manzoorwanijk
Copy link
Copy Markdown
Member

Could you take a look and let me know if anything was missed or needs further adjustment?

Thanks. I’ll have a look at this soon.

Copy link
Copy Markdown
Member

@manzoorwanijk manzoorwanijk left a comment

Choose a reason for hiding this comment

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

Thank you for working on this. Let us tidy things a bit.

Comment on lines +26 to +31
"ajv": "8.17.1",
"chalk": "4.1.1",
"cross-spawn": "^7.0.6",
"glob": "7.1.2",
"jsonc-parser": "3.3.1",
"simple-git": "3.24.0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let us use the version ranges here and remove the deps that are not used in the workspace.

Suggested change
"ajv": "8.17.1",
"chalk": "4.1.1",
"cross-spawn": "^7.0.6",
"glob": "7.1.2",
"jsonc-parser": "3.3.1",
"simple-git": "3.24.0"
"chalk": "^4.1.1",
"glob": "^7.1.2",
"jsonc-parser": "^3.3.1",
"simple-git": "^3.24.0"

collectDeps,
readPackageJson,
} from '../packages/scripts/utils/license.js';
} from '../../packages/scripts/utils/license.js';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let us add @wordpress/scripts as a dev dependency to this workspace and the use @wordpress/scripts/utils/license.js here.

"gutenberg",
"api-docs"
],
"homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/tools/validation/README.md",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The README doesn't exist.

"keywords": [
"wordpress",
"gutenberg",
"api-docs"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This keyword doesn't seem to be relevant.

Comment thread package.json
"test/unit",
"tools/api-docs"
"tools/api-docs",
"tools/validation"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Once you update this branch from trunk, you won't need this change here.

Comment thread package.json
Comment on lines +157 to +158
"lint:lockfile": "npm run validate-package-lock --workspace @wordpress/validation-tools --",
"lint:tsconfig": "npm run validate-tsconfig --workspace @wordpress/validation-tools --",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's better to have --workspace argument before the other arguments, just in case the script accepts arguments.

import JSONC from 'jsonc-parser';
import { readFileSync } from 'fs';

let hasErrors = false;

const rootTsconfigJson = JSON.parse( readFileSync( 'tsconfig.json', 'utf8' ) );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am surprised we had this here as tsconfig can have comments which JSON.parse cannot handle.

@@ -0,0 +1,42 @@
{
"name": "@wordpress/validation-tools",
"version": "1.0.0",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let us use version 0

Suggested change
"version": "1.0.0",
"version": "0.0.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants