Skip to content

Automated Testing: Extend TypeScript requirement to all internal packages - #85774

Merged
aduth merged 3 commits into
trunkfrom
update/require-ts-internal-packages
Nov 5, 2026
Merged

aduth merged 3 commits into
trunkfrom
update/require-ts-internal-packages

Conversation

@aduth

@aduth aduth commented Oct 27, 2026

Copy link
Copy Markdown
Member

What?

Updates the project's ESLint configuration to extend expectation of TypeScript authoring to all workspace packages listed in package.json workspaces.

Builds on #84829
Related discussion: #85769 (comment)

Why?

Same rationale as in #84829. The expectation of TypeScript should extend to internal packages, since the required Node.js version supports erasable TypeScript syntax.

How?

Rather than opting in specific packages, the implementation here uses workspaces as a source of truth, so that new packages added over time opt in to this behavior by default.

Existing issues are added as suppressions to suppressions.json to be fixed over time, as they were in #84829.

Testing Instructions

npm run lint:js should pass.

Use of AI Tools

Researched and implemented with Claude Code + Opus 5.5, with manual revisions to user-facing content in coding-guidelines.md and code comments.

@aduth
aduth requested a review from ciampo October 27, 2026 19:09
@aduth aduth added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

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: aduth <aduth@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: 0 B

Total Size: 8.61 MB

3530d2a Run

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the change extending TypeScript authoring requirements to internal workspaces.

No open issues 🎉

What changed in this PR

Extends Gutenberg’s existing TypeScript authoring requirement to internal workspaces, using the root package.json workspace list so newly added workspaces are covered automatically.

Changes:

  • Derives ESLint coverage and workspace exclusions from workspaces, while preserving package-specific and runtime exceptions.
  • Adds suppressions for existing JavaScript files in newly covered workspaces.
  • Updates contributor and ESLint documentation to explain the expanded requirement.
File Description
tools/​eslint/​suppressions.json Records existing JavaScript violations in newly covered workspaces.
tools/​eslint/​README.md Documents workspace-wide TypeScript enforcement.
tools/​eslint/​config.mjs Derives rule scope from workspaces and exempts Storybook’s ESLint tooling.
docs/​contributors/​code/​coding-guidelines.md Clarifies TypeScript requirements for internal workspaces and repository scripts.

Review effort: Balanced

@aduth

aduth commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

The rebase updates suppressions to account for changes in #85769 (remove storybook/scripts/sanitize-components-manifest.mjs) and #85757 (add storybook/scripts/add-agent-docs-note.mjs).

@ciampo ciampo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No further blocking comments 🚀

Comment thread tools/eslint/README.md Outdated
- **`import-resolver.cjs`** — Custom import resolver that maps `@wordpress/*` package imports to source files (`src/`) instead of built files (`build-module/`), so linting works without a build step.
- **`lint-js.cjs`** — Wrapper around `wp-scripts lint-js` used by `npm run lint:js`. Streams ESLint output through, detects the "stale suppressions" hint, and formats `suppressions.json` after `--prune-suppressions` runs.
- **`rules/`**: local rules that only make sense in this repository, such as `use-typescript`, which `config.mjs` scopes to the `src` and `test` trees of every package with a `tsconfig.json`, to routes and to tools, so that new files there must be TypeScript.
- **`rules/`**: local rules that only make sense in this repository, such as `use-typescript`, which `config.mjs` scopes to the `src` and `test` trees of every package and workspace with a `tsconfig.json`, so that new files there must be TypeScript.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Internal workspaces are checked from their root, so the src/test wording understates the rule's scope. Could we reserve that wording for packages/?

@aduth aduth Nov 4, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I updated the wording here in 4c2456f. I chose to simplify the phrasing to avoid referencing details about this rule, since the bullet point is more about rules/ containing custom lint rules applying specifically to the project, and not about the implementation details of our TypeScript enforcement rule.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the expanded TypeScript authoring requirement for internal workspaces.

No open issues 🎉

Review effort: Balanced

@aduth
aduth force-pushed the update/require-ts-internal-packages branch from b2984cc to 4c2456f Compare November 4, 2026 15:42
@aduth

aduth commented Nov 4, 2026

Copy link
Copy Markdown
Member Author

During rebase I had to add 5 more suppressions for issues added since the pull request was opened, which is a good indication that this is an ongoing problem to get ahead of.

@aduth
aduth enabled auto-merge (squash) November 4, 2026 16:04
aduth added 3 commits November 5, 2026 08:49
It's incidental which files we cover for TypeScript. The point of the bullet is about what `rules/` contains and how those apply specifically to the project.
@aduth
aduth force-pushed the update/require-ts-internal-packages branch from 4c2456f to 3530d2a Compare November 5, 2026 13:49
@aduth
aduth merged commit 81c3b91 into trunk Nov 5, 2026
59 checks passed
@aduth
aduth deleted the update/require-ts-internal-packages branch November 5, 2026 14:09
@github-actions github-actions Bot added this to the Gutenberg 24.5 milestone Nov 5, 2026
@aduth

aduth commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

This was a good candidate for "Require PR update" but I missed adding it before auto-merge merged the pull request. Instead, I triggered a manual run of the "Required changes from trunk" workflow with move-baseline action.

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

Labels

[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants