Skip to content

Avoid rc package deep imports#519

Open
QDyanbing wants to merge 3 commits into
react-component:masterfrom
QDyanbing:avoid-deep-imports
Open

Avoid rc package deep imports#519
QDyanbing wants to merge 3 commits into
react-component:masterfrom
QDyanbing:avoid-deep-imports

Conversation

@QDyanbing
Copy link
Copy Markdown

@QDyanbing QDyanbing commented May 22, 2026

背景

antd 侧限制继续使用 rc 包的 lib / es 深路径导入,需要将 tooltip 中对 rc 包内部路径的依赖迁移到包根入口。

调整内容

  • 升级 @rc-component/father-plugin,使用插件统一拦截 rc 包 lib / es 深路径导入。
  • 升级 @rc-component/util
  • 将源码中对 @rc-component/util@rc-component/trigger 内部路径的引用改为从包根入口导入。
  • 调整示例中 OffsetType 的来源,避免继续依赖 trigger 内部 interface 路径。

验证

  • 本次按本地核对后的改动提交。

Summary by CodeRabbit

发布说明

  • New Features

    • 导出项扩展:新增导出组件的属性类型与 placements 命名导出,便于类型使用和定位配置。
  • Chores

    • 升级若干依赖以改善兼容性与稳定性。
    • 示例与组件内调整类型引用方式并在示例中新增本地类型声明,接口与运行行为不变。

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

@QDyanbing is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8cda1a80-afbd-49c4-8686-b69db6a7ea74

📥 Commits

Reviewing files that changed from the base of the PR and between 640fd82 and a7e116d.

📒 Files selected for processing (1)
  • src/index.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/index.tsx

Walkthrough

升级依赖并统一导入路径:将子路径导入改为命名导出,调整 Tooltip 组件与示例的类型/工具导入,并在入口文件扩展类型与命名导出。

变更内容

导入重构与依赖升级

Layer / File(s) Summary
依赖版本更新
package.json
@rc-component/util^1.3.0 升级至 ^1.11.1@rc-component/father-plugin^2.0.1 升级至 ^2.2.0
Tooltip 组件导入与接口重构
src/Tooltip.tsx
集中并重写 @rc-component/trigger 的类型导入,将 useId 的导入改为 import { useId } from '@rc-component/util';调整 TooltipProps extends Pick<TriggerProps, ...> 的格式,属性集合不变。
示例文件导入调整
docs/examples/simple.tsx
ActionType 的导入来源改为 @rc-component/trigger,移除外部 OffsetType 导入并在文件内新增 `type OffsetType = string
入口导出扩展
src/index.tsx
新增导出类型 TooltipProps,并新增命名导出 placements

🎯 3 (Moderate) | ⏱️ ~20 minutes

可能关联的 PR

建议审阅者

  • zombieJ

诗歌

🐰 小兔捧着变更箱,
路径轻移不慌张,
依赖小幅悄然长,
类型本地又一行,
鼓掌为你合声唱。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题'Avoid rc package deep imports'准确概括了本次变更的核心目标:避免从rc包的内部路径(lib/es目录)进行深层导入。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/index.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


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

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

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates dependencies for @rc-component/util and @rc-component/father-plugin, and refactors imports across the project to use top-level package exports instead of internal paths. Feedback was provided regarding the complexity of a new type definition in the example documentation, suggesting a simpler alternative to improve readability.

Comment thread docs/examples/simple.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant