-
Notifications
You must be signed in to change notification settings - Fork 220
Re-enable MDX documentation support in Storybook v10 #4263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-enable MDX documentation support in Storybook v10 #4263
Conversation
…rily disabling MDX - Convert require.resolve() to ES module syntax using import.meta.url - Remove MDX files from stories config to fix build (MDX support needs proper addon configuration) Co-authored-by: d10c <[email protected]>
- Install @storybook/addon-docs package - Add addon-docs to the addons configuration in main.ts - Update Overview.mdx to use @storybook/addon-docs/blocks import path - Re-enable MDX files in stories configuration - Verify build succeeds with MDX documentation included Co-authored-by: d10c <[email protected]>
Co-authored-by: d10c <[email protected]>
Co-authored-by: d10c <[email protected]>
Co-authored-by: d10c <[email protected]>
…low-lint-again Fix TypeScript type errors in VSCode Elements event handlers and refs
849f2a4
into
copilot/fix-github-actions-workflow-lint
There was a problem hiding this 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 completes the Storybook v10 migration by re-enabling MDX documentation support and fixing TypeScript compatibility issues introduced by the upgrade. The changes include adding the @storybook/addon-docs package, updating import paths, and addressing various TypeScript type errors in React components.
Changes:
- Added
@storybook/addon-docsdependency and re-enabled MDX files in Storybook configuration - Updated MDX import path from
@storybook/blocksto@storybook/addon-docs/blocksfor Storybook v10 compatibility - Fixed TypeScript type errors in event handlers and React refs across multiple components
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| extensions/ql-vscode/.storybook/main.ts | Added @storybook/addon-docs to addons array to enable MDX support |
| extensions/ql-vscode/.storybook/vscode-theme-addon/preset.ts | Converted from CommonJS require.resolve to ESM join(__dirname, ...) |
| extensions/ql-vscode/src/stories/Overview.mdx | Updated import path to @storybook/addon-docs/blocks for Storybook v10 |
| extensions/ql-vscode/package.json | Added @storybook/addon-docs ^10.1.11 dependency |
| extensions/ql-vscode/package-lock.json | Updated lock file with new addon-docs dependency and related packages |
| extensions/ql-vscode/src/view/variant-analysis/VariantAnalysisActions.tsx | Removed appearance="primary" prop from export button |
| extensions/ql-vscode/src/view/variant-analysis/RepositoriesSort.tsx | Changed event handler type from InputEvent to Event |
| extensions/ql-vscode/src/view/variant-analysis/RepositoriesResultFormat.tsx | Changed event handler type from InputEvent to Event |
| extensions/ql-vscode/src/view/variant-analysis/RepositoriesFilter.tsx | Changed event handler type from InputEvent to Event |
| extensions/ql-vscode/src/view/variant-analysis/RepoRow.tsx | Changed event handler from ChangeEvent<HTMLInputElement> to Event |
| extensions/ql-vscode/src/view/model-editor/ModelTypeTextbox.tsx | Changed event handler from ChangeEvent<HTMLSelectElement> to Event with HTMLInputElement cast |
| extensions/ql-vscode/src/view/model-editor/MethodRow.tsx | Updated ref types from HTMLElement | undefined to HTMLDivElement with null |
| extensions/ql-vscode/src/view/model-alerts/ModelAlertsSort.tsx | Changed event handler type from InputEvent to Event |
| extensions/ql-vscode/src/view/common/TextButton.tsx | Made $size prop optional in styled component |
| extensions/ql-vscode/src/view/common/DataGrid.tsx | Updated ref types from HTMLElement | undefined to HTMLDivElement |
| extensions/ql-vscode/src/view/common/CodePaths/CodeFlowsDropdown.tsx | Changed event handler from ChangeEvent<HTMLSelectElement> to Event |
Files not reviewed (1)
- extensions/ql-vscode/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const handleChange = useCallback((e: Event) => { | ||
| const target = e.target as HTMLInputElement; |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event handler type has been changed from ChangeEvent<HTMLSelectElement> to Event with a cast to HTMLInputElement. This is inconsistent - VscodeTextfield is an input element, so the type should be ChangeEvent<HTMLInputElement> to be both accurate and consistent with other similar input handlers in the codebase (e.g., in RenamingInput.tsx).
| filteredText: "Copy filtered repositories as a list", | ||
| })} | ||
| </Button> | ||
| <Button |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The appearance prop has been removed from this Button component. However, this removal changes the visual appearance of the "Export results" button. Consider whether this was intentional or if this button should maintain its primary appearance for consistency with the UI design. If this change is intentional due to a design update, it should be documented in the PR description.
| <Button | |
| <Button | |
| appearance="primary" |
| export const RepositoriesSort = ({ value, onChange, className }: Props) => { | ||
| const handleInput = useCallback( | ||
| (e: InputEvent) => { | ||
| (e: Event) => { |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event handler type has been changed from ChangeEvent<HTMLSelectElement> to Event, which is inconsistent with other similar components in the codebase (e.g., ModelInputDropdown.tsx, ModelKindDropdown.tsx, ModelOutputDropdown.tsx, ModelTypeDropdown.tsx). The more specific ChangeEvent<HTMLSelectElement> type provides better type safety and is the standard React type for select element change handlers. Consider using the same type as other similar components for consistency.
| }: Props) => { | ||
| const handleInput = useCallback( | ||
| (e: InputEvent) => { | ||
| (e: Event) => { |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event handler type has been changed from ChangeEvent<HTMLSelectElement> to Event, which is inconsistent with other similar components in the codebase. The more specific ChangeEvent<HTMLSelectElement> type provides better type safety and is the standard React type for select element change handlers. Consider using the same type as other similar components for consistency.
| (e: Event) => { | ||
| const target = e.target as HTMLInputElement; | ||
| // This is called on first render, but we don't really care about this value | ||
| if (e.target.checked === undefined) { | ||
| if (target.checked === undefined) { | ||
| return; | ||
| } | ||
|
|
||
| if (!repository.id) { | ||
| return; | ||
| } | ||
|
|
||
| onSelectedChange?.(repository.id, e.target.checked); | ||
| onSelectedChange?.(repository.id, target.checked); |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event handler type has been changed from ChangeEvent<HTMLInputElement> to Event, which is inconsistent with other similar components in the codebase. The more specific ChangeEvent<HTMLInputElement> type provides better type safety and is the standard React type for checkbox change handlers. Additionally, the original code that imported ChangeEvent from React should be retained for this purpose.
| (e: Event) => { | ||
| const selectedOption = e.target as HTMLSelectElement; |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event handler type has been changed from ChangeEvent<HTMLSelectElement> to Event, which is inconsistent with other similar components in the codebase. The more specific ChangeEvent<HTMLSelectElement> type provides better type safety and is the standard React type for select element change handlers. Consider using the same type as other similar components for consistency.
| "@storybook/addon-a11y": "^10.1.11", | ||
| "@storybook/addon-docs": "^10.1.11", | ||
| "@storybook/addon-links": "^10.1.11", | ||
| "@storybook/components": "^8.6.14", |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @storybook/components package is at version 8.6.14, which is incompatible with Storybook v10.1.11. This package should be upgraded to a version that is compatible with Storybook v10 (e.g., ^10.1.11) to avoid potential runtime issues and compatibility problems.
| "@storybook/components": "^8.6.14", | |
| "@storybook/components": "^10.1.11", |
| export const RepositoriesFilter = ({ value, onChange, className }: Props) => { | ||
| const handleInput = useCallback( | ||
| (e: InputEvent) => { | ||
| (e: Event) => { |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event handler type has been changed from ChangeEvent<HTMLSelectElement> to Event, which is inconsistent with other similar components in the codebase. The more specific ChangeEvent<HTMLSelectElement> type provides better type safety and is the standard React type for select element change handlers. Consider using the same type as other similar components for consistency.
| export const ModelAlertsSort = ({ value, onChange, className }: Props) => { | ||
| const handleInput = useCallback( | ||
| (e: InputEvent) => { | ||
| (e: Event) => { |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event handler type has been changed from ChangeEvent<HTMLSelectElement> to Event, which is inconsistent with other similar components in the codebase. The more specific ChangeEvent<HTMLSelectElement> type provides better type safety and is the standard React type for select element change handlers. Consider using the same type as other similar components for consistency.
Completes the Storybook v10 migration by restoring MDX documentation pages that were temporarily disabled in the previous fix.
Changes
@storybook/addon-docs: Required for MDX support in Storybook v10 (no longer included by default).storybook/main.ts: Add addon-docs to addons array and re-enable*.mdxfiles in stories globOverview.mdx: Change from@storybook/blocksto@storybook/addon-docs/blocks(blocks are now exported as subpath)// .storybook/main.ts const config: StorybookConfig = { - stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"], + stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"], addons: [ + "@storybook/addon-docs", "@storybook/addon-links", "@storybook/addon-a11y", "./vscode-theme-addon/preset.ts", ], };Screenshot
Overview documentation page now renders correctly with all content, images, and links:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
storybook.js.org/usr/local/bin/node node /home/REDACTED/work/vscode-codeql/vscode-codeql/extensions/ql-vscode/node_modules/.bin/storybook build(dns block)/usr/local/bin/node node /home/REDACTED/work/vscode-codeql/vscode-codeql/extensions/ql-vscode/node_modules/.bin/storybook dev -p 6006(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.