Skip to content

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented May 26, 2025

Summary by CodeRabbit

  • Chores
    • Updated dependency versions for several packages, including "@eslint-react/eslint-plugin", "@inquirer/prompts", "@rspress/core", "tinyglobby", "@swc/core", "@types/react", "eslint-import-resolver-typescript", and "eslint-plugin-import-x".
    • Changed Node.js version in CI configuration from 18 to 20.
    • Removed "access": "public" from package.json publish configuration.
    • Reformatted .changeset/config.json for better clarity and changed "access" to "public".
    • Updated changelog metadata to indicate a patch release for "@alauda/doom".
  • Refactor
    • Replaced dynamic component imports with static imports across multiple components (JsonViewer, K8sCrd, K8sPermissionTable, OpenAPIPath, OpenAPIRef, TermsTable, _HeadingTitle, _Markdown, _RefLink), removing use of getCustomMDXComponent and useState.
    • Simplified components by directly importing shared elements (X) from local modules instead of managing them via state.
    • Removed redundant state management and commented-out code, streamlining rendering logic.
  • Documentation
    • Updated release notes to reflect dependency updates, configuration changes, and refactored components for static imports.

@JounQin JounQin requested a review from Copilot May 26, 2025 08:45
@JounQin JounQin self-assigned this May 26, 2025
@JounQin JounQin added the dependencies Pull requests that update a dependency file label May 26, 2025
@changeset-bot
Copy link

changeset-bot bot commented May 26, 2025

🦋 Changeset detected

Latest commit: dd0dd41

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@alauda/doom Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented May 26, 2025

Walkthrough

This update refactors multiple React components to replace dynamic state-based initialization of a custom MDX component with a direct static import. Several dependencies are updated, configuration files are adjusted for Node.js and formatting, and a new utility file is introduced to centralize the MDX component logic. Minor metadata and configuration changes are also included.

Changes

File(s) Change Summary
.changeset/config.json Reformatted the changelog array for clarity and changed "access" from "restricted" to "public".
.changeset/eight-cougars-agree.md Added patch release metadata and updated @rspress/core version in YAML front matter.
.codesandbox/ci.json Updated Node.js version from 18 to 20 in CI configuration.
.prettierignore Removed dist from ignore list, so Prettier will now process files in dist.
package.json Updated multiple dependency versions and removed access from publishConfig.
src/runtime/components/JsonViewer.tsx Replaced commented-out state with direct use of CodeBlockRuntime; simplified imports.
src/runtime/components/K8sCrd.tsx Removed stateful MDX component initialization; now uses static import of X.
src/runtime/components/K8sPermissionTable.tsx Replaced state-based MDX component with direct import of X in two components.
src/runtime/components/OpenAPIPath.tsx Removed state-based MDX component; replaced dynamic JSX tags with standard HTML elements.
src/runtime/components/OpenAPIRef.tsx Replaced stateful MDX component with direct import of X in OpenAPIProperties.
src/runtime/components/TermsTable.tsx Removed stateful MDX component and now uses direct import of X.
src/runtime/components/_HeadingTitle.tsx Removed stateful MDX component; now uses direct import of X for heading elements.
src/runtime/components/_Markdown.tsx Replaced state-based MDX components with static import of X for ReactMarkdown.
src/runtime/components/_RefLink.tsx Removed stateful MDX component; now uses direct import of X.
src/runtime/components/_X.tsx New file: Exports X as the result of getCustomMDXComponent() for shared use.

Sequence Diagram(s)

sequenceDiagram
    participant Component as Any Component (e.g., TermsTable)
    participant X as _X.js (Custom MDX Component)
    Note over Component,X: Before: Component initializes X via useState(getCustomMDXComponent)
    Component->>X: import { X } from './_X.js'
    Component->>Component: Use <X.*> elements directly in render
Loading

Suggested labels

ci

Poem

In the warren, code hops anew,
No more stateful X to chew!
With imports clear and logic neat,
Our MDX is now elite.
Dependencies rise, configs align—
Oh, what a hoppy, streamlined time!
🥕✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae807d5 and dd0dd41.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (16)
  • .changeset/config.json (1 hunks)
  • .changeset/eight-cougars-agree.md (1 hunks)
  • .codesandbox/ci.json (1 hunks)
  • .prettierignore (0 hunks)
  • eslint.config.js (1 hunks)
  • package.json (3 hunks)
  • src/runtime/components/JsonViewer.tsx (2 hunks)
  • src/runtime/components/K8sCrd.tsx (2 hunks)
  • src/runtime/components/K8sPermissionTable.tsx (2 hunks)
  • src/runtime/components/OpenAPIPath.tsx (1 hunks)
  • src/runtime/components/OpenAPIRef.tsx (1 hunks)
  • src/runtime/components/TermsTable.tsx (1 hunks)
  • src/runtime/components/_HeadingTitle.tsx (1 hunks)
  • src/runtime/components/_Markdown.tsx (1 hunks)
  • src/runtime/components/_RefLink.tsx (1 hunks)
  • src/runtime/components/_X.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • .prettierignore
🚧 Files skipped from review as they are similar to previous changes (2)
  • .codesandbox/ci.json
  • .changeset/eight-cougars-agree.md
🧰 Additional context used
🧠 Learnings (1)
src/runtime/components/K8sCrd.tsx (3)
Learnt from: JounQin
PR: alauda/doom#30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T08:59:41.467Z
Learning: In @rspress/core v2.0.0-beta.7, the '/theme' export is available in the package exports field as `"./theme": { "default": "./theme.ts" }`, so imports like `import { Badge, Button } from '@rspress/core/theme'` are valid even if ESLint shows resolution errors.
Learnt from: JounQin
PR: alauda/doom#30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T09:09:21.308Z
Learning: JounQin has mentioned multiple times that the alauda/doom project uses yarn v4, and there are no ESLint import resolution errors for @rspress/core subpath imports.
Learnt from: JounQin
PR: alauda/doom#30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T09:09:21.308Z
Learning: The alauda/doom project uses yarn v4 for dependency management, which handles package exports and module resolution correctly, so imports like `@rspress/core/theme` work without any ESLint errors.
🪛 ESLint
src/runtime/components/_HeadingTitle.tsx

[error] 2-2: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

src/runtime/components/OpenAPIRef.tsx

[error] 4-4: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

src/runtime/components/_Markdown.tsx

[error] 1-1: Unable to resolve path to module 'react'.

(import-x/no-unresolved)


[error] 2-2: Unable to resolve path to module 'react-markdown'.

(import-x/no-unresolved)


[error] 3-3: Unable to resolve path to module 'remark-gfm'.

(import-x/no-unresolved)

src/runtime/components/K8sPermissionTable.tsx

[error] 5-5: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

src/runtime/components/K8sCrd.tsx

[error] 5-5: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)

src/runtime/components/JsonViewer.tsx

[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)

src/runtime/components/OpenAPIPath.tsx

[error] 2-2: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)


[error] 5-5: Unable to resolve path to module 'github-slugger'.

(import-x/no-unresolved)


[error] 6-6: Unable to resolve path to module 'openapi-types'.

(import-x/no-unresolved)


[error] 7-7: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

src/runtime/components/_X.tsx

[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)

🔇 Additional comments (19)
src/runtime/components/_HeadingTitle.tsx (2)

2-4: LGTM! Excellent refactoring to static imports.

The refactoring from dynamic useState(getCustomMDXComponent) to static import of X is a great improvement. This eliminates unnecessary state management, reduces potential re-renders, and centralizes the MDX component creation logic.

🧰 Tools
🪛 ESLint

[error] 2-2: Unable to resolve path to module 'react'.

(import-x/no-unresolved)


19-21: Good practice: Correct dependency array for useMemo.

The dependency array correctly includes X in the useMemo hook, ensuring the HeadingComponents array is properly memoized based on the X component.

src/runtime/components/_X.tsx (1)

1-3: Excellent centralization pattern for MDX components.

Creating a dedicated _X.tsx module to export the result of getCustomMDXComponent() is a smart architectural decision. This provides:

  • Single source of truth for the MDX component
  • Consistent import pattern across all components
  • Elimination of redundant getCustomMDXComponent calls
  • Simplified component logic by removing state management

This pattern significantly improves maintainability and performance.

🧰 Tools
🪛 ESLint

[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)

eslint.config.js (1)

5-5: Correct import syntax update for eslint-plugin-import-x.

The change from default import to named import aligns with the plugin update from v4.12.2 to v4.13.3. This syntax change is necessary to work with the updated plugin's export structure.

.changeset/config.json (2)

3-8: Good formatting improvement for readability.

The multiline formatting of the changelog array enhances readability and maintainability of the configuration.


12-12: Verify the access level change from "restricted" to "public".

The change from "restricted" to "public" affects package publishing visibility. Please confirm this change is intentional and aligns with the project's publishing strategy.

package.json (2)

60-61: LGTM! Dependency updates align with PR objectives.

The dependency updates look good and align with the PR objective of bumping @rspress/core to v2.0.0-beta.7. The other dependency updates appear to be routine maintenance for keeping the project current with latest versions.

Also applies to: 66-66, 97-97, 109-109, 115-115, 120-121, 123-123


132-134: Verify the impact of removing publishConfig access property.

The publishConfig object no longer includes the "access": "public" property. Ensure this change is intentional and won't affect package publishing visibility.

src/runtime/components/_Markdown.tsx (2)

5-5: LGTM! Improved performance with static import.

The refactoring to use a static import of X from ./_X.js instead of dynamic state initialization is excellent. This eliminates unnecessary re-renders and state management overhead while centralizing the MDX component logic.


12-12: Consistent with project-wide refactoring pattern.

The direct usage of the imported X component aligns well with the project-wide refactoring to replace dynamic getCustomMDXComponent() calls with static imports.

src/runtime/components/TermsTable.tsx (1)

4-4: LGTM! Consistent refactoring pattern.

The static import of X from ./_X.js follows the project-wide refactoring pattern and improves performance by eliminating the need for state management of the MDX component.

src/runtime/components/OpenAPIRef.tsx (2)

4-4: LGTM! Streamlined imports.

Removing useState from the React import is appropriate since the component no longer needs state management for the X component.

🧰 Tools
🪛 ESLint

[error] 4-4: Unable to resolve path to module 'react'.

(import-x/no-unresolved)


11-11: Excellent refactoring to static import.

The static import of X from ./_X.js eliminates unnecessary state management and aligns with the project-wide refactoring pattern for better performance and code clarity.

src/runtime/components/_RefLink.tsx (1)

3-3: Excellent refactoring to static import!

Great improvement replacing the dynamic useState(getCustomMDXComponent) pattern with a direct static import. This eliminates unnecessary state management and potential re-renders while maintaining the exact same functionality.

src/runtime/components/K8sCrd.tsx (1)

14-14: Consistent refactoring pattern - well done!

Perfect implementation of the same clean refactoring pattern, replacing state-based X initialization with a static import. This maintains functionality while improving code clarity and performance.

src/runtime/components/K8sPermissionTable.tsx (1)

14-14: Great continuation of the refactoring pattern!

Excellent work maintaining consistency across components by eliminating the useState(getCustomMDXComponent) pattern in both RolesPermission and K8sPermissionTable components. This simplifies the code while preserving all functionality.

src/runtime/components/OpenAPIPath.tsx (2)

15-15: Clean refactoring with consistent pattern!

Perfect implementation of the static import pattern, removing the need for useState(getCustomMDXComponent) in the OpenAPIParameters, OpenAPIResponses, and OpenAPIPath components.


40-64: Note: AI summary inconsistency detected.

The AI summary incorrectly states that <X.ul>, <X.li>, and <X.p> elements were "replaced with standard HTML elements <ul>, <li>, and <p>". However, the actual code still uses X.ul, X.li, and X.p throughout the file, which is the correct approach for this refactoring.

Likely an incorrect or invalid review comment.

src/runtime/components/JsonViewer.tsx (1)

1-1: LGTM! Import statement correctly updated for the refactoring.

The import statement properly brings in the required components (CodeBlockRuntime, Tab, Tabs) directly from @rspress/core/theme, which aligns with the PR's objective to replace dynamic component initialization with static imports.

🧰 Tools
🪛 ESLint

[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Copilot AI left a 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 bumps @rspress/core to v2.0.0-beta.7 and refactors how MDX components are initialized and consumed across runtime components.

  • Introduce a shared X object from getCustomMDXComponent() in a new _X.tsx
  • Replace local useState(getCustomMDXComponent) hooks with imports of X in all relevant components
  • Swap out custom <X.pre>/<X.code> blocks in JsonViewer for CodeBlockRuntime and bump various dependencies

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/runtime/components/_X.tsx New file exporting X via getCustomMDXComponent()
src/runtime/components/_RefLink.tsx Import X instead of using state hook for MDX components
src/runtime/components/_Markdown.tsx Use X for ReactMarkdown components prop
src/runtime/components/_HeadingTitle.tsx Remove state hook; use X.h1X.h6 for heading elements
src/runtime/components/TermsTable.tsx Import X and drop local MDX state hook
src/runtime/components/OpenAPIRef.tsx Swap out MDX state hook for X
src/runtime/components/OpenAPIPath.tsx Replace MDX state hook with X
src/runtime/components/K8sPermissionTable.tsx Use shared X, remove state hook
src/runtime/components/K8sCrd.tsx Import X in place of per-component MDX hook
src/runtime/components/JsonViewer.tsx Replace <X.pre>/<X.code> with CodeBlockRuntime
package.json Bumped @rspress/core and other dependencies
.prettierignore Removed redundant ignore entries
.codesandbox/ci.json Updated Node version from 18 to 20
.changeset/config.json Reformatted changelog entry and set access to public
Comments suppressed due to low confidence (2)

src/runtime/components/_HeadingTitle.tsx:21

  • The dependency array for useMemo includes X, which is a static import and will never change. Consider using an empty array [] to avoid unnecessary re-computations.
    }, [X])

src/runtime/components/_X.tsx:3

  • [nitpick] The name X is very generic and may reduce readability. Consider renaming it to something more descriptive, such as MDXComponents or CustomComponents.
export const X = getCustomMDXComponent()

Copy link

@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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f10952 and ae807d5.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (15)
  • .changeset/config.json (1 hunks)
  • .changeset/eight-cougars-agree.md (1 hunks)
  • .codesandbox/ci.json (1 hunks)
  • .prettierignore (0 hunks)
  • package.json (3 hunks)
  • src/runtime/components/JsonViewer.tsx (2 hunks)
  • src/runtime/components/K8sCrd.tsx (2 hunks)
  • src/runtime/components/K8sPermissionTable.tsx (2 hunks)
  • src/runtime/components/OpenAPIPath.tsx (1 hunks)
  • src/runtime/components/OpenAPIRef.tsx (1 hunks)
  • src/runtime/components/TermsTable.tsx (1 hunks)
  • src/runtime/components/_HeadingTitle.tsx (1 hunks)
  • src/runtime/components/_Markdown.tsx (1 hunks)
  • src/runtime/components/_RefLink.tsx (1 hunks)
  • src/runtime/components/_X.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • .prettierignore
🧰 Additional context used
🪛 ESLint
src/runtime/components/_Markdown.tsx

[error] 1-1: Unable to resolve path to module 'react'.

(import-x/no-unresolved)


[error] 2-2: Unable to resolve path to module 'react-markdown'.

(import-x/no-unresolved)


[error] 3-3: Unable to resolve path to module 'remark-gfm'.

(import-x/no-unresolved)

src/runtime/components/_X.tsx

[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)

src/runtime/components/JsonViewer.tsx

[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)

src/runtime/components/K8sCrd.tsx

[error] 5-5: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)

src/runtime/components/_HeadingTitle.tsx

[error] 2-2: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

src/runtime/components/OpenAPIPath.tsx

[error] 2-2: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)


[error] 5-5: Unable to resolve path to module 'github-slugger'.

(import-x/no-unresolved)


[error] 6-6: Unable to resolve path to module 'openapi-types'.

(import-x/no-unresolved)


[error] 7-7: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

src/runtime/components/OpenAPIRef.tsx

[error] 4-4: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

src/runtime/components/K8sPermissionTable.tsx

[error] 5-5: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

🔇 Additional comments (19)
.codesandbox/ci.json (1)

2-2: LGTM! Node.js version update aligns with project requirements.

The update from Node.js 18 to 20 is consistent with the engines field in package.json which supports ">=18.17.0 <20 || >=20.1.0". This ensures the CodeSandbox environment uses a supported Node.js version.

src/runtime/components/_X.tsx (1)

1-3: Excellent refactoring to centralize MDX component logic.

This utility file follows the DRY principle by centralizing the getCustomMDXComponent logic, allowing other components to import X statically instead of managing it as state. This approach improves performance by eliminating unnecessary re-renders and simplifies component logic across the codebase.

The static analysis warning about the unresolved import path is likely a false positive, as @rspress/core/theme is a valid import from the updated @rspress/core@2.0.0-beta.7 dependency.

🧰 Tools
🪛 ESLint

[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)

.changeset/config.json (2)

3-8: Good formatting improvement for readability.

The multi-line formatting of the changelog array enhances readability and maintainability of the configuration.


12-12: Access change aligns with publishing configuration updates.

Changing access from "restricted" to "public" is consistent with the removal of the access property from package.json's publishConfig, indicating a coordinated move towards public package publishing.

package.json (3)

60-61: Dependency updates look good and support the MDX refactoring.

The key update to @rspress/core@2.0.0-beta.7 enables the new MDX component pattern seen in _X.tsx and other components. The other dependency updates appear to be minor version bumps with bug fixes and improvements.

Also applies to: 66-66, 97-97


109-109: Dev dependency updates are appropriate.

The updates to development dependencies like @swc/core, @types/react, and ESLint plugins maintain compatibility with the latest tooling and type definitions.

Also applies to: 115-115, 120-124


132-134: PublishConfig simplification aligns with changeset configuration.

Removing the access: "public" property from publishConfig is consistent with the access change in .changeset/config.json, indicating a coordinated approach to publishing configuration.

.changeset/eight-cougars-agree.md (1)

1-6: LGTM! Standard changeset documentation.

The changeset follows the proper format and clearly documents the purpose of bumping @rspress/core to v2.0.0-beta.7.

src/runtime/components/K8sCrd.tsx (1)

14-14: LGTM! Consistent refactoring to static import pattern.

The change from useState(getCustomMDXComponent) to direct import of X from ./_X.js is well-executed. This eliminates unnecessary React state management and should improve performance by avoiding re-renders when the component doesn't actually change.

Also applies to: 184-187

src/runtime/components/TermsTable.tsx (2)

4-4: LGTM! Consistent static import pattern.

The refactoring follows the same pattern as other components, replacing dynamic component resolution with a clean static import from ./_X.js.


19-26: LGTM! All X. component usages are preserved correctly.*

The extensive use of X-prefixed components (X.ul, X.li, X.table, X.tr, X.th, X.td) throughout the terms table rendering logic remains consistent and functional. The refactoring doesn't affect the component's ability to render tables with conditional columns and bad case lists.

Also applies to: 29-53

src/runtime/components/_RefLink.tsx (1)

3-3: LGTM! Clean and consistent refactoring.

The static import of X and its usage in <X.a> follows the established pattern perfectly. The component's core functionality for processing OpenAPI $ref links remains intact while benefiting from the simplified import structure.

Also applies to: 16-16

src/runtime/components/_Markdown.tsx (1)

1-1: Good refactoring to static imports.

The change from dynamic state-based component initialization to static imports simplifies the component logic and eliminates unnecessary state management.

Also applies to: 5-5

🧰 Tools
🪛 ESLint

[error] 1-1: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

src/runtime/components/_HeadingTitle.tsx (1)

2-2: Excellent refactoring that improves performance.

Replacing the useState(getCustomMDXComponent) with a direct static import eliminates unnecessary state management and potential re-renders. The useMemo dependency on [X] remains appropriate for the static import.

Also applies to: 4-4

🧰 Tools
🪛 ESLint

[error] 2-2: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

src/runtime/components/OpenAPIRef.tsx (1)

4-4: Consistent refactoring approach.

The removal of useState(getCustomMDXComponent) and replacement with static import of X is consistent with the broader refactoring pattern. This simplifies the OpenAPIProperties component logic.

Also applies to: 11-11

🧰 Tools
🪛 ESLint

[error] 4-4: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

src/runtime/components/JsonViewer.tsx (2)

1-1: Good simplification of imports.

The removal of unused getCustomMDXComponent and useState imports streamlines the component dependencies.

🧰 Tools
🪛 ESLint

[error] 1-1: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)


13-14: Appropriate use of TypeScript suppress comments.

The @ts-expect-error comments reference a specific GitHub issue (web-infra-dev/rspress/pull/2205), indicating that the typing issues are known and being addressed. This is a proper way to handle temporary type incompatibilities during the transition period.

Also applies to: 17-18

src/runtime/components/K8sPermissionTable.tsx (1)

5-5: Good refactoring to static imports!

The removal of useState and migration to a static import of the X component from ./_X.js is a solid improvement. This eliminates unnecessary re-renders and state management overhead.

Also applies to: 14-14

🧰 Tools
🪛 ESLint

[error] 5-5: Unable to resolve path to module 'react'.

(import-x/no-unresolved)

src/runtime/components/OpenAPIPath.tsx (1)

2-2: Consistent refactoring pattern applied!

The changes here follow the same pattern as in K8sPermissionTable.tsx:

  • Removed getCustomMDXComponent import
  • Removed useState from React imports
  • Added static import of X from ./_X.js

This maintains consistency across the codebase and provides the same performance benefits.

Also applies to: 7-7, 15-15

🧰 Tools
🪛 ESLint

[error] 2-2: Unable to resolve path to module '@rspress/core/theme'.

(import-x/no-unresolved)

@pkg-pr-new
Copy link

pkg-pr-new bot commented May 26, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@alauda/doom@30

commit: dd0dd41

@JounQin JounQin enabled auto-merge (squash) May 26, 2025 10:22
@JounQin JounQin disabled auto-merge May 26, 2025 10:22
@JounQin JounQin merged commit cf044cb into main May 26, 2025
16 checks passed
@JounQin JounQin deleted the chore/deps branch May 26, 2025 10:22
github-actions bot pushed a commit that referenced this pull request May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants