Skip to content

Storybook: Type-check manifest post-processing scripts - #85769

Merged
ciampo merged 2 commits into
trunkfrom
codex/typecheck-storybook-manifest-scripts
Oct 28, 2026
Merged

ciampo merged 2 commits into
trunkfrom
codex/typecheck-storybook-manifest-scripts

Conversation

@ciampo

@ciampo ciampo commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Follow-up to aduth's feedback on #82023.

What?

Include both Storybook manifest post-processing scripts in type-checking.

Why?

The sanitizer added in #82023 and the older legacy adapter were excluded, leaving their code unchecked.

How?

Clear the script exclusions and add JSDoc types for the manifest data and recursive component functions. Keep an explicit empty exclude list so the shared configuration does not exclude Storybook stories. Runtime behavior is unchanged.

Testing Instructions

  1. Run npm run storybook:build to build Gutenberg and run both manifest scripts.
  2. Run npm run typecheck -- storybook. Both scripts should pass without exclusions.
  3. Run npm run storybook:manifest-snapshot. The manifest snapshot and description allowlist should remain unchanged.

Use of AI Tools

Codex assessed the feedback, added the type annotations, and ran verification.

@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: ciampo <mciampini@git.wordpress.org>
Co-authored-by: aduth <aduth@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: -36 B (0%)

Total Size: 8.56 MB

📦 View Changed
Filename Size Change
build/styles/block-library/classic-rtl.css 402 B -10 B (-2.43%)
build/styles/block-library/classic-rtl.min.css 358 B -8 B (-2.19%)
build/styles/block-library/classic.css 402 B -10 B (-2.43%)
build/styles/block-library/classic.min.css 358 B -8 B (-2.19%)

47a4bb4 Run

@ciampo ciampo self-assigned this Oct 27, 2026
@ciampo ciampo added the [Type] Build Tooling Issues or PRs related to build tooling label Oct 27, 2026
@ciampo
ciampo requested a balanced review from Copilot October 27, 2026 17:25
@ciampo
ciampo marked this pull request as ready for review October 27, 2026 17:25
@ciampo
ciampo requested review from a team and Mamaduka October 27, 2026 17:25

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

Static review found no blocking issues in these annotation and configuration changes; build and type-check commands were not run.

No open issues 🎉

What changed in this PR

Extends Storybook type-checking to both manifest post-processing scripts without changing runtime behavior.

Changes:

  • Removes script exclusions while preserving an explicit empty exclude list so stories remain type-checked.
  • Adds JSDoc types for manifest data and recursive component processing.
File Description
storybook/​tsconfig.json Includes both manifest scripts in type-checking.
storybook/​scripts/​sanitize-components-manifest.mjs Types manifest nodes and recursive sanitization.
storybook/​scripts/​inject-legacy-docgen.mjs Types manifest nodes and recursive legacy adaptation.

Review effort: Balanced

@aduth aduth left a comment

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.

Thanks 👍 It's on my radar to remove inject-legacy-docgen.mjs altogether since it was only meant to be temporary for a single package release months ago, so not strictly needed, but also not worth backing out either at this point 😄

@aduth

aduth commented Oct 27, 2026

Copy link
Copy Markdown
Member

Since it's an internal package, we could probably also author sanitize-components-manifest.mjs as .ts or .mts and lean on native type-stripping available in newer Node?

Maybe something I can put in an agent context somewhere so that agents apply it more consistently if we want to see that as the default for internal packages.

@aduth

aduth commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Maybe something I can put in an agent context somewhere so that agents apply it more consistently if we want to see that as the default for internal packages.

Actually, this is probably better served by the new gutenberg/use-typescript rule added by @manzoorwanijk in #84829, we just need to extend it to cover our internal packages. I'll put together a pull request.

@aduth

aduth commented Oct 27, 2026

Copy link
Copy Markdown
Member

Maybe something I can put in an agent context somewhere so that agents apply it more consistently if we want to see that as the default for internal packages.

Actually, this is probably better served by the new gutenberg/use-typescript rule added by @manzoorwanijk in #84829, we just need to extend it to cover our internal packages. I'll put together a pull request.

PR at #85774

@aduth

aduth commented Oct 27, 2026

Copy link
Copy Markdown
Member

It's on my radar to remove inject-legacy-docgen.mjs altogether since it was only meant to be temporary

Removing in #85778

@ciampo
ciampo force-pushed the codex/typecheck-storybook-manifest-scripts branch from b8d6040 to b412c4a Compare October 28, 2026 01:10
@ciampo
ciampo force-pushed the codex/typecheck-storybook-manifest-scripts branch from 73e548a to 47a4bb4 Compare October 28, 2026 09:47
@ciampo
ciampo enabled auto-merge (squash) October 28, 2026 09:51
@ciampo
ciampo merged commit b1251a2 into trunk Oct 28, 2026
58 checks passed
@ciampo
ciampo deleted the codex/typecheck-storybook-manifest-scripts branch October 28, 2026 10:06
@github-actions github-actions Bot added this to the Gutenberg 24.4 milestone Oct 28, 2026
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