Avoid rc package deep imports#1071
Conversation
|
@QDyanbing is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
Walkthrough本 PR 升级了 Changes导入路径整合与依赖升级
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Around line 59-60: Update the package.json engines.node declaration to match
the minimum Node versions required by `@typescript-eslint/eslint-plugin`,
`@typescript-eslint/parser` and eslint; change the engines.node field (in
package.json) from ">=8.x" to "^12.22.0 || ^14.17.0 || >=16.0.0" so the runtime
constraint aligns with those packages and prevents incompatible Node versions
from being allowed in CI or installs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bfe79f42-be18-4fbe-8761-1ef680884fb8
📒 Files selected for processing (13)
.eslintrc.jsdocs/examples/components/TooltipSlider.tsxpackage.jsonsrc/Handles/Handle.tsxsrc/Handles/index.tsxsrc/Slider.tsxsrc/hooks/useDrag.tssrc/hooks/useRange.tssrc/index.tsxtests/Range.test.tsxtests/Slider.test.jstests/common.test.jstests/marks.test.js
| "@typescript-eslint/eslint-plugin": "^5.62.0", | ||
| "@typescript-eslint/parser": "^5.62.0", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python - <<'PY'
import json
with open('package.json','r',encoding='utf-8') as f:
pkg=json.load(f)
print("package.json engines.node =", pkg.get("engines",{}).get("node"))
for name in ["`@typescript-eslint/eslint-plugin`","`@typescript-eslint/parser`","eslint"]:
print(name, "=>", pkg.get("devDependencies",{}).get(name) or pkg.get("dependencies",{}).get(name))
PY
echo "---- published engines metadata ----"
npm view `@typescript-eslint/eslint-plugin`@5.62.0 engines --json
npm view `@typescript-eslint/parser`@5.62.0 engines --json
npm view eslint@8.54.0 engines --jsonRepository: react-component/slider
Length of output: 383
同步提升 Node 引擎声明以匹配 typescript-eslint/eslint 的最低要求
engines.node 仍为 >=8.x,但 @typescript-eslint/eslint-plugin@5.62.0、@typescript-eslint/parser@5.62.0(以及 eslint@8.54.0)的发布 engines.node 均要求 ^12.22.0 || ^14.17.0 || >=16.0.0,会导致不兼容 Node 版本被错误放行并在 lint/tsc 阶段失败。建议在本 PR 同步更新下限。
建议修改
"engines": {
- "node": ">=8.x"
+ "node": ">=12.22.0"
}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@package.json` around lines 59 - 60, Update the package.json engines.node
declaration to match the minimum Node versions required by
`@typescript-eslint/eslint-plugin`, `@typescript-eslint/parser` and eslint; change
the engines.node field (in package.json) from ">=8.x" to "^12.22.0 || ^14.17.0
|| >=16.0.0" so the runtime constraint aligns with those packages and prevents
incompatible Node versions from being allowed in CI or installs.
There was a problem hiding this comment.
Code Review
This pull request updates several dependencies, including a major version bump for React to v18, and refactors imports across the codebase to avoid deep imports from internal packages like @rc-component/util. Feedback was provided regarding the ESLint configuration change that disables the switch-exhaustiveness-check rule, noting that it reduces type safety and appears unrelated to the primary goal of the PR.
| '@typescript-eslint/no-explicit-any': 1, | ||
| '@typescript-eslint/no-empty-interface': 1, | ||
| '@typescript-eslint/no-inferrable-types': 0, | ||
| '@typescript-eslint/switch-exhaustiveness-check': 0, |
There was a problem hiding this comment.
Disabling the @typescript-eslint/switch-exhaustiveness-check rule reduces type safety by allowing switch statements on union types or enums to omit cases without a compile-time warning. This change appears unrelated to the primary goal of avoiding deep imports. If this was added to suppress errors from the newly added ESLint plugins, it is better to address the underlying issues or provide a specific reason for disabling it in the PR description.
背景
antd 侧限制继续使用 rc 包的
lib/es深路径导入,需要将 slider 中依赖的 rc 包内部路径统一改为包根入口。调整内容
@rc-component/father-plugin,使用插件统一拦截 rc 包lib/es深路径导入。@rc-component/util,改为从@rc-component/util根入口导入KeyCode、warning、raf、hooks 与测试工具。验证
npm run lintnpm run tscnpm test -- --runInBandnpm run compileSummary by CodeRabbit
发布说明