Avoid rc package deep imports#327
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
总体说明该 PR 升级了 变更概览依赖版本升级与导入路径迁移
代码审查工作量估计🎯 2 (Simple) | ⏱️ ~8 分钟 可能相关的 PR
建议审核人
诗篇
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #327 +/- ##
==========================================
- Coverage 99.40% 99.39% -0.02%
==========================================
Files 2 2
Lines 167 164 -3
Branches 42 42
==========================================
- Hits 166 163 -3
Misses 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request updates the @rc-component/util and @rc-component/father-plugin dependencies and refactors imports in src/MotionThumb.tsx and src/index.tsx to use the main @rc-component/util package instead of internal paths. Feedback was provided to reorder imports in both files to place the React core library at the top for better consistency and readability.
| import { composeRef, omit, useControlledState } from '@rc-component/util'; | ||
| import { clsx } from 'clsx'; | ||
| import * as React from 'react'; |
There was a problem hiding this comment.
建议调整导入顺序,将 react 核心库置于顶部,随后是外部第三方库(如 @rc-component/util 和 clsx)。这符合 React 开发的通用最佳实践,有助于提高代码的可读性和一致性。
| import { composeRef, omit, useControlledState } from '@rc-component/util'; | |
| import { clsx } from 'clsx'; | |
| import * as React from 'react'; | |
| import * as React from 'react'; | |
| import { composeRef, omit, useControlledState } from '@rc-component/util'; | |
| import { clsx } from 'clsx'; |
| import CSSMotion from '@rc-component/motion'; | ||
| import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; | ||
| import { composeRef } from '@rc-component/util/lib/ref'; | ||
| import { composeRef, useLayoutEffect } from '@rc-component/util'; | ||
| import { clsx } from 'clsx'; | ||
| import * as React from 'react'; |
There was a problem hiding this comment.
建议调整导入顺序,将 react 核心库置于顶部。保持一致的导入顺序(React -> 外部库 -> 本地文件)可以提升代码质量和维护性。
| import CSSMotion from '@rc-component/motion'; | |
| import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; | |
| import { composeRef } from '@rc-component/util/lib/ref'; | |
| import { composeRef, useLayoutEffect } from '@rc-component/util'; | |
| import { clsx } from 'clsx'; | |
| import * as React from 'react'; | |
| import * as React from 'react'; | |
| import CSSMotion from '@rc-component/motion'; | |
| import { composeRef, useLayoutEffect } from '@rc-component/util'; | |
| import { clsx } from 'clsx'; |
背景
antd 侧限制继续使用 rc 包的
lib/es深路径导入,需要将 segmented 中对 rc 包内部路径的依赖迁移到包根入口。调整内容
@rc-component/father-plugin,使用插件统一拦截 rc 包lib/es深路径导入。@rc-component/util。useLayoutEffect、composeRef、useControlledState、omit等内部路径引用改为从@rc-component/util根入口导入。验证
npm run lintnpm run type:checknpm test -- --runInBandnpm run compileSummary by CodeRabbit
Chores
@rc-component/util版本至 ^1.11.1@rc-component/father-plugin版本至 ^2.2.0