Skip to content

feat: adjust @rc-component/util imports to root path#565

Merged
zombieJ merged 2 commits into
react-component:masterfrom
EmilyyyLiu:feat/adjust-util-imports
Jun 5, 2026
Merged

feat: adjust @rc-component/util imports to root path#565
zombieJ merged 2 commits into
react-component:masterfrom
EmilyyyLiu:feat/adjust-util-imports

Conversation

@EmilyyyLiu

@EmilyyyLiu EmilyyyLiu commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

背景

项目中有多个文件使用非根路径方式引入 @rc-component/util 的模块,为了统一代码风格并遵循 eslint
规则(no-restricted-imports),将所有引入调整为从包根路径导入。

主要改动

  • src/Dialog/index.tsx: 将 contains, useId, pickAttrs, warning 的引入从子路径调整为根路径引入
  • src/Dialog/Content/Panel.tsx: 将 useComposeRef, useLockFocus, pickAttrs 的引入从子路径调整为根路径引入
  • src/IDialogPropTypes.ts: 将 GetContainer 类型的引入从子路径调整为根路径引入
  • tests/focus.spec.tsx: 更新 jest mock 路径

Summary by CodeRabbit

  • Refactor
    • 统一并简化了内部工具的导入方式以改进代码组织(对外行为保持不变)。
  • Tests
    • 调整了测试的模拟实现以匹配新的内部导入方式,测试逻辑和断言未修改。
  • Chores
    • 更新了一个依赖包的版本以保持依赖项现代化。

- src/Dialog/index.tsx: import contains, useId, pickAttrs, warning from root
- src/Dialog/Content/Panel.tsx: import useComposeRef, useLockFocus, pickAttrs from root
- src/IDialogPropTypes.ts: import GetContainer from root
- tests/focus.spec.tsx: update jest mock path
- src/Dialog/Content/index.tsx: add eslint-disable for CSSMotionRef import (not exported from root)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

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: a5f61807-1c26-4d8e-a2c5-ffc5047afc98

📥 Commits

Reviewing files that changed from the base of the PR and between f18bf93 and 076da42.

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

Walkthrough

统一将代码和测试中对 @rc-component/util 的子路径导入改为从包入口按命名/类型导入,更新相应的 Jest mock 实现,并把 @rc-component/motion 的依赖版本从 ^1.1.3 升级为 ^1.3.3。

变更

导入路径统一重构

Layer / File(s) Summary
源代码导入路径整合
src/Dialog/Content/Panel.tsx, src/Dialog/index.tsx, src/IDialogPropTypes.ts, src/Dialog/Content/index.tsx
useComposeRefuseLockFocuspickAttrscontainsuseIdwarningGetContainer 类型的导入从 @rc-component/util/lib/... 或子模块路径统一改为从 @rc-component/util 入口按命名/类型导入。
测试 mock 目标更新
tests/focus.spec.tsx
Jest mock 目标由 @rc-component/util/lib/Dom/focus 改为 @rc-component/util,mock 中通过 requireActual 保留真实实现并覆盖 useLockFocus
依赖版本更新
package.json
@rc-component/motion 版本从 ^1.1.3 升级为 ^1.3.3(仅依赖声明变更)。

代码审查工作量评估

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

可能相关的 PR

建议审查人

  • zombieJ

🐰 入口统一敲一敲,
子路径纷纷归一条,
测试 mock 也并肩跑,
版本轻升一小步,
代码整齐又欢笑。

🚥 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 标题准确总结了主要变更:将 @rc-component/util 的多个子路径导入调整为根路径导入,这是整个 PR 的核心改动。
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/Dialog/Content/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.

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

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.

Code Review

This pull request consolidates imports from @rc-component/util subpaths (such as /lib/ref, /lib/Dom/focus, /lib/pickAttrs, and /lib/warning) to import directly from the main @rc-component/util package entry point across several files, including Panel.tsx, index.tsx, IDialogPropTypes.ts, and the corresponding test mock in focus.spec.tsx. I have no feedback to provide as the changes are clean and correct.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.92%. Comparing base (16c0f83) to head (076da42).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #565   +/-   ##
=======================================
  Coverage   98.92%   98.92%           
=======================================
  Files           8        8           
  Lines         186      186           
  Branches       67       67           
=======================================
  Hits          184      184           
  Misses          2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zombieJ zombieJ merged commit 9105b08 into react-component:master Jun 5, 2026
9 of 10 checks passed
@EmilyyyLiu EmilyyyLiu deleted the feat/adjust-util-imports branch June 5, 2026 06:58
EmilyyyLiu added a commit to EmilyyyLiu/dialog that referenced this pull request Jun 5, 2026
…#565)

* feat: adjust @rc-component/util imports to root path

- src/Dialog/index.tsx: import contains, useId, pickAttrs, warning from root
- src/Dialog/Content/Panel.tsx: import useComposeRef, useLockFocus, pickAttrs from root
- src/IDialogPropTypes.ts: import GetContainer from root
- tests/focus.spec.tsx: update jest mock path
- src/Dialog/Content/index.tsx: add eslint-disable for CSSMotionRef import (not exported from root)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat: update @rc-component/motion dependency to version 1.3.3 and adjust import path

---------

Co-authored-by: 刘欢 <lh01217311@antgroup.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants