Skip to content

Avoid rc deep imports#434

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

Avoid rc deep imports#434
QDyanbing wants to merge 2 commits into
react-component:masterfrom
QDyanbing:avoid-deep-imports

Conversation

@QDyanbing
Copy link
Copy Markdown

@QDyanbing QDyanbing commented May 20, 2026

调整内容

  • 将项目内对 @rc-component/util/lib/* 的引用调整为从 @rc-component/util 根入口导入。
  • 升级 @rc-component/util^1.11.1,升级 @rc-component/father-plugin^2.2.0
  • 为当前 lint 依赖解析结果补充旧 @typescript-eslint 规则的关闭配置,避免升级后 lint 报 rule not found。

背景

为了避免 rc 包之间依赖 es / lib 构建产物内部路径,统一改为依赖公开根入口。后续深路径限制由 @rc-component/father-plugin 统一处理。

验证

  • npm run lint

Summary by CodeRabbit

发布说明

  • Chores

    • 升级了依赖版本,提升代码库的稳定性和兼容性。
    • 优化了 ESLint 配置,增强代码质量检查。
  • Refactor

    • 调整了模块导入结构,改进代码组织方式。

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 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
Contributor

coderabbitai Bot commented May 20, 2026

Warning

Rate limit exceeded

@QDyanbing has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 46 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d5bf637f-82cf-4c36-8e56-fba45b794916

📥 Commits

Reviewing files that changed from the base of the PR and between e769af5 and 49ba9fd.

📒 Files selected for processing (2)
  • .eslintrc.js
  • src/Collapse.tsx

概览

该 PR 通过升级 @rc-component/util 依赖版本,统一调整项目中多个源码和测试文件的导入方式,从子路径导入改为从包主入口导入。同时扩展 ESLint 配置,在顶层和 override 中一致地应用 TypeScript 规则禁用映射。

变更

导入路径迁移与 ESLint 配置

层级 / 文件 摘要
依赖版本更新
package.json
@rc-component/util^1.3.0 升级至 ^1.11.1,将 @rc-component/father-plugin^2.0.1 升级至 ^2.2.0
源码文件导入路径统一
src/Collapse.tsx, src/Panel.tsx, src/hooks/useItems.tsx, tests/index.spec.tsx
Collapse 和 Panel 中的 pickAttrswarningKeyCode 导入,以及 useItems 中的 toArray 导入,均从 @rc-component/util/lib/* 子路径改为从 @rc-component/util 主包口进行命名导入;测试文件中的 KeyCode 导入同步更新。
ESLint TypeScript 规则配置
.eslintrc.js
新增 disabledTypeScriptRules 常量映射一组 TypeScript 规则关闭值,通过对 base.overrides 进行映射将该规则集合注入各覆盖项,同时在顶层 rules 中展开该常量,确保顶层与 overrides 中的 TypeScript 规则禁用保持一致。

估计代码审查工作量

🎯 2 (Simple) | ⏱️ ~10 分钟

可能相关的 PR

  • react-component/collapse#360: 来自主 PR 对 Collapse.tsx、Panel.tsx 和 src/hooks/useItems.tsx 的导入路径迁移(将 warning/pickAttrs/KeyCode/toArray 等切换至新的包导出风格)直接相关,反映了对 @rc-component/util 依赖迁移的一致性更新。

建议审查者

  • zombieJ

庆祝诗

🐰 导入归一整整齐,
新版工具包来相聚。
ESLint 规则配置优,
依赖升级齐步走。
迁移完成无遗漏! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题清晰准确地反映了变更的核心内容:将所有深层路径导入(如 @rc-component/util/lib/*)改为从包根目录导入,这是本 PR 的主要目标。
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

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

@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 the @rc-component/util and @rc-component/father-plugin dependencies and refactors the codebase to use named imports from the root package instead of deep imports. Additionally, the ESLint configuration was updated to disable several TypeScript rules. Review feedback suggests merging imports from the same package in Collapse.tsx for conciseness and adding a defensive check in .eslintrc.js to prevent errors if base.overrides is undefined.

Comment thread src/Collapse.tsx Outdated
Comment thread .eslintrc.js Outdated
@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 20, 2026

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