Skip to content

ReactDocgen: Try using the latest version of the original#33454

Merged
ndelangen merged 6 commits into
nextfrom
norbert/investigate-react-docgen-typescript-plugin
Jan 8, 2026
Merged

ReactDocgen: Try using the latest version of the original#33454
ndelangen merged 6 commits into
nextfrom
norbert/investigate-react-docgen-typescript-plugin

Conversation

@ndelangen
Copy link
Copy Markdown
Member

@ndelangen ndelangen commented Jan 2, 2026

Closes #33158

What I did

I'm researching what the best approach is to solve the above issue.

I decided the first thing I'd try was this, the most radical approach: replacing the forked with the updated original.

I assumed that this would fail in some way, but would yield insights on the differences between the fork and upstream.

The updated original seems to work, however, so that's what this PR is.

I'm hoping this means we can drop the special fork/canary version of @storybook/react-docgen-typescript-plugin.

We need to do QA on this.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

I added a modification in one of the sandboxes to force it to use this option.
That sandbox is being run in this PR, and showing no changes in it's visual regression test.
Also manually verified if the docgen types are present (controls showing up)

I'm releasing a Canary of this to verify locally some more.

I've manually verified using the canary that the docgen works as expected.
I've added a few more abstractions so test, and the react-docgen-typescript was definitely used and produced slightly more descriptive docgen:
Screenshot 2026-01-06 at 12 34 59
Screenshot 2026-01-06 at 12 35 04
Screenshot 2026-01-06 at 12 35 19
Screenshot 2026-01-06 at 12 35 39

There are also these changes detected which indicate that the sandbox-template change was done, and applied:
https://www.chromatic.com/test?appId=633c394125f29c2cbb5a4cac&id=695cfda7154daeda3a0cd6cd

🦋 Canary release

This pull request has been released as version 0.0.0-pr-33454-sha-b7cb6649. Try it out in a new sandbox by running npx storybook@0.0.0-pr-33454-sha-b7cb6649 sandbox or in an existing project with npx storybook@0.0.0-pr-33454-sha-b7cb6649 upgrade.

More information
Published version 0.0.0-pr-33454-sha-b7cb6649
Triggered by @ndelangen
Repository storybookjs/storybook
Branch norbert/investigate-react-docgen-typescript-plugin
Commit b7cb6649
Datetime Mon Jan 5 12:11:58 UTC 2026 (1767615118)
Workflow run 20714993527

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=33454

Summary by CodeRabbit

  • Chores
    • Updated TypeScript documentation generation configuration across React-based presets.
    • Migrated to a standalone TypeScript documentation plugin package for improved stability.
    • Added TypeScript-specific documentation options to Create React App template configuration.

✏️ Tip: You can customize this high-level summary in your review settings.

@ndelangen ndelangen changed the title try using the latest version of the original ReactDocgen: Try using the latest version of the original Jan 2, 2026
@ndelangen ndelangen self-assigned this Jan 2, 2026
@ndelangen ndelangen added bug typescript builder-webpack5 ci:merged Run the CI jobs that normally run when merged. docgen labels Jan 2, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jan 2, 2026

View your CI Pipeline Execution ↗ for commit 1df43a9

Command Status Duration Result
nx run-many -t compile,check,knip,test,pretty-d... ⛔ Cancelled 3h 22m 32s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-07 15:18:58 UTC

@storybook-app-bot
Copy link
Copy Markdown

storybook-app-bot Bot commented Jan 2, 2026

Package Benchmarks

Commit: 1df43a9, ran on 7 January 2026 at 12:05:42 UTC

The following packages have significant changes to their size or dependencies:

@storybook/nextjs

Before After Difference
Dependency count 538 534 🎉 -4 🎉
Self size 646 KB 646 KB 🎉 -120 B 🎉
Dependency size 59.17 MB 59.14 MB 🎉 -27 KB 🎉
Bundle Size Analyzer Link Link

@storybook/react-webpack5

Before After Difference
Dependency count 278 274 🎉 -4 🎉
Self size 24 KB 24 KB 0 B
Dependency size 44.10 MB 44.07 MB 🎉 -28 KB 🎉
Bundle Size Analyzer Link Link

@storybook/preset-create-react-app

Before After Difference
Dependency count 68 64 🎉 -4 🎉
Self size 32 KB 32 KB 🎉 -30 B 🎉
Dependency size 5.98 MB 5.95 MB 🎉 -28 KB 🎉
Bundle Size Analyzer Link Link

@storybook/preset-react-webpack

Before After Difference
Dependency count 170 166 🎉 -4 🎉
Self size 18 KB 18 KB 🎉 -76 B 🎉
Dependency size 31.24 MB 31.21 MB 🎉 -28 KB 🎉
Bundle Size Analyzer Link Link

@ndelangen ndelangen marked this pull request as ready for review January 2, 2026 14:12
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 6, 2026

📝 Walkthrough

Walkthrough

Swap Storybook-scoped @storybook/react-docgen-typescript-plugin for react-docgen-typescript-plugin@^1.0.8 across presets and add a typescript.reactDocgen entry to the CRA default-js sandbox template's features.

Changes

Cohort / File(s) Summary
Package Dependencies
code/presets/create-react-app/package.json, code/presets/react-webpack/package.json
Replace dependency @storybook/react-docgen-typescript-plugin with react-docgen-typescript-plugin@^1.0.8
React Webpack Preset Imports
code/presets/react-webpack/src/types.ts, code/presets/react-webpack/src/framework-preset-react-docs.ts, code/presets/react-webpack/src/framework-preset-react-docs.test.ts
Change import specifier from @storybook/react-docgen-typescript-plugin to react-docgen-typescript-plugin
Create React App Preset Imports
code/presets/create-react-app/src/types.ts
Update import path for RDTSPluginOptions from @storybook/react-docgen-typescript-plugin to react-docgen-typescript-plugin
CLI Sandbox Templates
code/lib/cli-storybook/src/sandbox-templates.ts
Add typescript.reactDocgen: 'react-docgen-typescript' to baseTemplates['cra/default-js'].modifications.mainConfig.features (uses as any assertion)

Sequence Diagram(s)

(omitted — changes are import/config updates and do not introduce multi-component control-flow requiring a sequence diagram)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e45162e and 1df43a9.

📒 Files selected for processing (2)
  • code/presets/create-react-app/package.json
  • code/presets/react-webpack/package.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • code/presets/react-webpack/package.json
  • code/presets/create-react-app/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: daily
  • GitHub Check: nx
  • GitHub Check: Core Unit Tests, windows-latest

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
code/lib/cli-storybook/src/sandbox-templates.ts (1)

431-434: Ensure typescript.reactDocgen configuration is consistently applied across React Webpack TypeScript templates.

The typescript.reactDocgen: 'react-docgen-typescript' configuration is present only in the react-webpack/18-ts template (lines 431-434). The identical configuration is missing from react-webpack/17-ts and react-webpack/prerelease-ts templates. Since all three templates share the same framework setup and dependencies, this configuration should either be applied consistently across all three or a comment should explain why it is specific to React 18.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f193d3 and 5e6ab80.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (7)
  • code/lib/cli-storybook/src/sandbox-templates.ts
  • code/presets/create-react-app/package.json
  • code/presets/create-react-app/src/types.ts
  • code/presets/react-webpack/package.json
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
  • code/presets/react-webpack/src/types.ts
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{js,jsx,ts,tsx,json,md,html,css,scss}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Format code using Prettier with yarn prettier --write <file>

Files:

  • code/presets/react-webpack/package.json
  • code/lib/cli-storybook/src/sandbox-templates.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
  • code/presets/create-react-app/package.json
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/types.ts
  • code/presets/create-react-app/src/types.ts
**/*.{js,jsx,json,html,ts,tsx,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Run ESLint checks using yarn lint:js:cmd <file> or the full command cross-env NODE_ENV=production eslint --cache --cache-location=../.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives to fix linting errors before committing

Files:

  • code/presets/react-webpack/package.json
  • code/lib/cli-storybook/src/sandbox-templates.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
  • code/presets/create-react-app/package.json
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/types.ts
  • code/presets/create-react-app/src/types.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Enable TypeScript strict mode across all packages

Files:

  • code/lib/cli-storybook/src/sandbox-templates.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/types.ts
  • code/presets/create-react-app/src/types.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx}: Export functions from modules if they need to be tested
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size

Files:

  • code/lib/cli-storybook/src/sandbox-templates.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/types.ts
  • code/presets/create-react-app/src/types.ts
code/{core,lib,addons,builders,frameworks,presets}/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use logger from storybook/internal/node-logger for server-side logging in Node.js code

Files:

  • code/lib/cli-storybook/src/sandbox-templates.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/types.ts
  • code/presets/create-react-app/src/types.ts
**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{test,spec}.{ts,tsx}: Test files should follow the naming pattern *.test.ts, *.test.tsx, *.spec.ts, or *.spec.tsx
Follow the spy mocking rules defined in .cursor/rules/spy-mocking.mdc for consistent mocking patterns with Vitest

Files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/spy-mocking.mdc)

**/*.test.{ts,tsx,js,jsx}: Use vi.mock() with the spy: true option for all package and file mocks in Vitest tests
Place all mocks at the top of the test file before any test cases
Use vi.mocked() to type and access the mocked functions in Vitest tests
Implement mock behaviors in beforeEach blocks in Vitest tests
Mock all required dependencies that the test subject uses
Each mock implementation should return a Promise for async functions in Vitest
Mock implementations should match the expected return type of the original function
Mock all required properties and methods that the test subject uses in Vitest tests
Avoid direct function mocking without vi.mocked() in Vitest tests
Avoid mock implementations outside of beforeEach blocks in Vitest tests
Avoid mocking without the spy: true option in Vitest tests
Avoid inline mock implementations within test cases in Vitest tests
Avoid mocking only a subset of required dependencies in Vitest tests
Mock at the highest level of abstraction needed in Vitest tests
Keep mock implementations simple and focused in Vitest tests
Use type-safe mocking with vi.mocked() in Vitest tests
Document complex mock behaviors in Vitest tests
Group related mocks together in Vitest tests

Files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{test,spec}.{ts,tsx,js,jsx}: Write meaningful unit tests that actually import and call the functions being tested, not just verify syntax patterns
Achieve high test coverage of business logic, aiming for 75%+ coverage of statements/lines
Cover all branches, conditions, edge cases, error paths, and different input variations in unit tests
Use vi.mock() to mock file system, loggers, and other external dependencies in tests

Files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
🧠 Learnings (22)
📓 Common learnings
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Select/Select.tsx:200-204
Timestamp: 2025-11-05T09:38:47.712Z
Learning: Repo: storybookjs/storybook — Guidance: Until Storybook 11 is released, do not suggest using React.useId anywhere (e.g., in code/core/src/components/components/Select/Select.tsx) to maintain compatibility with React 17 runtimes. Prefer advising: accept a caller-provided props.id and, if needed, generate a client-only fallback id to minimize SSR hydration issues — but avoid useId. Resume prompting for useId after Storybook 11.
📚 Learning: 2025-11-05T09:38:47.712Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Select/Select.tsx:200-204
Timestamp: 2025-11-05T09:38:47.712Z
Learning: Repo: storybookjs/storybook — Guidance: Until Storybook 11 is released, do not suggest using React.useId anywhere (e.g., in code/core/src/components/components/Select/Select.tsx) to maintain compatibility with React 17 runtimes. Prefer advising: accept a caller-provided props.id and, if needed, generate a client-only fallback id to minimize SSR hydration issues — but avoid useId. Resume prompting for useId after Storybook 11.

Applied to files:

  • code/presets/react-webpack/package.json
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
  • code/presets/create-react-app/package.json
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/types.ts
📚 Learning: 2025-09-17T07:31:04.432Z
Learnt from: ndelangen
Repo: storybookjs/storybook PR: 32484
File: code/core/package.json:326-326
Timestamp: 2025-09-17T07:31:04.432Z
Learning: In Storybook's core package, dependencies like `open` are bundled into the final distribution during the build process, so they should remain in devDependencies rather than being moved to dependencies. End users don't need these packages as separate runtime dependencies since they're included in the bundled code.

Applied to files:

  • code/presets/react-webpack/package.json
  • code/presets/create-react-app/package.json
📚 Learning: 2025-09-29T13:20:23.346Z
Learnt from: mrginglymus
Repo: storybookjs/storybook PR: 32556
File: code/core/package.json:309-313
Timestamp: 2025-09-29T13:20:23.346Z
Learning: The `fast-printf` dependency in Storybook's core package is bundled into the final distribution during the build process, so it should remain in devDependencies rather than being moved to dependencies, following the same pattern as other bundled dependencies like `open`.

Applied to files:

  • code/presets/react-webpack/package.json
  • code/presets/create-react-app/package.json
📚 Learning: 2025-12-22T22:03:40.123Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-22T22:03:40.123Z
Learning: Applies to **/*.{ts,tsx} : Enable TypeScript strict mode across all packages

Applied to files:

  • code/lib/cli-storybook/src/sandbox-templates.ts
  • code/presets/create-react-app/src/types.ts
📚 Learning: 2025-11-05T09:37:25.920Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/tooltip/WithTooltip.tsx:54-96
Timestamp: 2025-11-05T09:37:25.920Z
Learning: Repo: storybookjs/storybook — In code/core/src/components/components/tooltip/WithTooltip.tsx, the legacy WithTooltip implementation is intentionally reintroduced for backward compatibility and is deprecated; maintainers (per Sidnioulz) do not want maintenance or improvements on it. Prefer WithTooltipNew/Popover; avoid suggesting changes to WithTooltip.* going forward.

Applied to files:

  • code/lib/cli-storybook/src/sandbox-templates.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid mocking only a subset of required dependencies in Vitest tests

Applied to files:

  • code/lib/cli-storybook/src/sandbox-templates.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid mocking without the `spy: true` option in Vitest tests

Applied to files:

  • code/lib/cli-storybook/src/sandbox-templates.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Document complex mock behaviors in Vitest tests

Applied to files:

  • code/lib/cli-storybook/src/sandbox-templates.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-10-01T15:24:01.060Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32594
File: code/core/src/components/components/Popover/WithPopover.tsx:7-9
Timestamp: 2025-10-01T15:24:01.060Z
Learning: In the Storybook repository, "react-aria-components/patched-dist/*" (e.g., "react-aria-components/patched-dist/Dialog", "react-aria-components/patched-dist/Popover", "react-aria-components/patched-dist/Tooltip") are valid import paths created by a patch applied to the react-aria-components package. These imports should not be flagged as broken or invalid until a maintainer explicitly states they are no longer acceptable.

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/types.ts
📚 Learning: 2025-12-22T22:03:40.123Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-22T22:03:40.123Z
Learning: Use Node.js 22.21.1 (see `.nvmrc`) and Yarn 4.9.1 for development

Applied to files:

  • code/presets/create-react-app/package.json
📚 Learning: 2025-12-22T22:03:40.123Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-22T22:03:40.123Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Export functions from modules if they need to be tested

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-12-22T22:03:40.123Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-22T22:03:40.123Z
Learning: Applies to **/*.{test,spec}.{ts,tsx,js,jsx} : Write meaningful unit tests that actually import and call the functions being tested, not just verify syntax patterns

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Mock all required dependencies that the test subject uses

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Mock all required properties and methods that the test subject uses in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid inline mock implementations within test cases in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Group related mocks together in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Implement mock behaviors in `beforeEach` blocks in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `vi.mocked()` to type and access the mocked functions in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Keep mock implementations simple and focused in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid mock implementations outside of `beforeEach` blocks in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:31.838Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-24T17:49:31.838Z
Learning: Applies to code/vitest.workspace.ts : Vitest configuration is centralized in `code/vitest.workspace.ts` for workspace setup

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: merged
  • GitHub Check: nx
  • GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (7)
code/presets/react-webpack/src/framework-preset-react-docs.ts (1)

43-43: LGTM! Import path updated to upstream package.

The dynamic import path has been correctly updated from the Storybook fork to the upstream package. The plugin instantiation and options remain unchanged, preserving the existing behavior.

code/presets/create-react-app/src/types.ts (1)

3-3: LGTM! Type import path updated correctly.

The type import has been properly updated to reference the upstream package. This maintains type safety while switching to the non-forked plugin.

code/presets/react-webpack/src/framework-preset-react-docs.test.ts (1)

5-5: LGTM! Test import updated correctly.

The test import has been updated to use the upstream package. The test assertions using expect.any(ReactDocgenTypescriptPlugin) at line 102 should continue to work correctly if the default export structure is maintained.

code/presets/react-webpack/src/types.ts (1)

6-7: LGTM! Type import path updated correctly.

The type import has been properly migrated to the upstream package. The PluginOptions type will now be sourced from react-docgen-typescript-plugin instead of the Storybook fork.

code/presets/create-react-app/package.json (1)

39-39: This package version is already verified and established as production-ready.

The upstream react-docgen-typescript-plugin@1.0.8 exists on NPM with no known security vulnerabilities. The migration from the Storybook fork to this upstream package was completed in preset version 3.1.0 and is stable. The preset only imports the TypeScript type definitions from this package to expose configuration options to users; the actual plugin is instantiated by CRA's webpack configuration. No API compatibility issues have been reported, and the version constraint (^1.0.8) is appropriate for minor updates.

Likely an incorrect or invalid review comment.

code/lib/cli-storybook/src/sandbox-templates.ts (1)

432-432: The @ts-expect-error is appropriate here; no action needed.

The typescript.reactDocgen configuration is valid and correctly set to 'react-docgen-typescript' per Storybook's documentation. The error suppression is necessary because the StorybookConfigRaw type definition in core Storybook doesn't include reactDocgen in its typescript property type, even though the property is supported at runtime. Since this file intentionally uses loose typing for framework-specific properties that don't fit the main type definition, the @ts-expect-error is the appropriate pragmatic solution.

code/presets/react-webpack/package.json (1)

45-45: The package version is valid and secure.

react-docgen-typescript-plugin@1.0.8 is the latest stable version, published a year ago with no security advisories. The migration from the Storybook-specific fork to the upstream package is sound.

@ndelangen ndelangen added ci:daily Run the CI jobs that normally run in the daily job. and removed ci:merged Run the CI jobs that normally run when merged. labels Jan 6, 2026
@ndelangen ndelangen requested a review from kasperpeulen January 6, 2026 13:00
Comment on lines +431 to +433
typescript: {
reactDocgen: 'react-docgen-typescript',
} as any, // the generic type does not contain the reactDocgen property
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.

(unrelated to this PR):
Does it make sense to also test a Vite-based sandbox? @shilman, what are your thoughts on this? The main reason this PR introduces react-docgen-typescript is to see whether the non-fork version regresses in any areas. Testing showed that it does not. Still, apart from having tested it manually, do we want to have one webpack and one Vite sandbox checking react-docgen-typescript usage? I think we should, especially after the recent discussions we had about adoption.

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.

100% would be great to have react-docgen-typescript in CI for both Webpack and Vite.

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.

@valentinpalkovic AFAICS, this is not something users can even opt into with vite builder.

Notice how the size reporting only shows webpack package changes.

@ndelangen ndelangen merged commit 6401957 into next Jan 8, 2026
129 of 130 checks passed
@ndelangen ndelangen deleted the norbert/investigate-react-docgen-typescript-plugin branch January 8, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug builder-webpack5 ci:daily Run the CI jobs that normally run in the daily job. docgen typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: @storybook/react-docgen-typescript-plugin uses deprecated version of rimraf

3 participants