Skip to content

Avoid util deep imports#689

Open
QDyanbing wants to merge 1 commit into
react-component:masterfrom
QDyanbing:avoid-deep-imports
Open

Avoid util deep imports#689
QDyanbing wants to merge 1 commit into
react-component:masterfrom
QDyanbing:avoid-deep-imports

Conversation

@QDyanbing
Copy link
Copy Markdown

@QDyanbing QDyanbing commented May 19, 2026

变更内容

  • 升级 @rc-component/util 到当前 latest ^1.11.1
  • 升级 @rc-component/father-plugin^2.2.0,交由插件统一处理 rc 深路径 import 限制。
  • 将源码和测试中对 @rc-component/util/lib/* 的引用改为从 @rc-component/util 根入口导入。
  • 补充 src/locale/index.ts,并从根入口导出 locale,方便下游不再依赖 lib/locale/*

背景

配合 rc 包统一避免依赖其他 rc 包的 es / lib 构建产物内部路径,改为使用公开根入口 API。

验证

  • git diff --check
  • npm test

Summary by CodeRabbit

发布说明

  • 新功能

    • 新增国际化语言包的统一导出接口,支持 60+ 种语言和地区配置。
  • 依赖更新

    • 升级 @rc-component/util 至 ^1.11.1
    • 升级 @rc-component/father-plugin 至 ^2.2.0
  • 测试

    • 调整测试工具函数导入路径。

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 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 19, 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: 71c8b0c6-47a1-44e9-9c2e-46cd5890c07b

📥 Commits

Reviewing files that changed from the base of the PR and between a85aa10 and ae92314.

📒 Files selected for processing (6)
  • package.json
  • src/Options.tsx
  • src/Pagination.tsx
  • src/index.ts
  • src/locale/index.ts
  • tests/index.test.tsx

Walkthrough

该 PR 升级了 @rc-component/util 依赖版本并统一调整所有导入路径,使代码与新版本的导出接口对齐。同时引入了 locale 导出汇总机制,扩展了包的公共 API 表面。

Changes

@rc-component/util 依赖升级与导入路径统一

Layer / File(s) Summary
依赖版本升级
package.json
@rc-component/util^1.3.0 升级至 ^1.11.1@rc-component/father-plugin^2.0.2 升级至 ^2.2.0
核心组件导入路径统一
src/Options.tsx, src/Pagination.tsx
KeyCodepickAttrsuseControlledStatewarning 等工具的导入从 @rc-component/util/lib/* 改为直接从 @rc-component/util 命名导入;Options 组件中按键判定逻辑保持不变。
测试文件导入更新
tests/index.test.tsx
resetWarned 的导入路径从 @rc-component/util/lib/warning 调整为 @rc-component/util
Locale 导出汇总与包导出扩展
src/locale/index.ts, src/index.ts
新增 src/locale/index.ts 对 60+ 种语言/地区 locale 的默认导出重导出;src/index.ts 新增通配符重导出,使 locale 模块成为包的公共 API。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • react-component/pagination#635: 同样涉及 @rc-component/util 的导入迁移,包括 Options.tsx/Pagination.tsx 中的 KeyCode 和 utility helpers,以及 tests/index.test.tsx 中的 warning 导出调整。
  • react-component/pagination#657: 在 src/Pagination.tsx 中修改 useControlledState 的使用和导入方式,与本 PR 的导入路径统一工作有代码层面的关联。

Suggested reviewers

  • zombieJ

Poem

小兔轻轻跳,升级库依赖 🐰
导入路径整整齐,locale 汇总更完美 ✨
从 lib 到顶层,接口焕然一新
五十国语言,一齐向前奔 🌍

🚥 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 进行深层导入,改为使用根入口导出。
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/Pagination.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.js » /node_modules/.pnpm/@umijs+fabric@4.0.1_postcss@8.5.14/node_modules/@umijs/fabric/dist/eslint.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

src/index.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.js » /node_modules/.pnpm/@umijs+fabric@4.0.1_postcss@8.5.14/node_modules/@umijs/fabric/dist/eslint.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

src/locale/index.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.js » /node_modules/.pnpm/@umijs+fabric@4.0.1_postcss@8.5.14/node_modules/@umijs/fabric/dist/eslint.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

  • 2 others

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 the @rc-component/util dependency and refactors imports to use named exports from the main package instead of deep imports. It also introduces a centralized locale export file and exposes it through the main index. I have no feedback to provide.

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