Skip to content

chore: update maintenance dependencies#790

Open
afc163 wants to merge 7 commits into
masterfrom
codex/update-maintenance-deps
Open

chore: update maintenance dependencies#790
afc163 wants to merge 7 commits into
masterfrom
codex/update-maintenance-deps

Conversation

@afc163

@afc163 afc163 commented Jun 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Link the Ant Design ecosystem logo in README files to https://ant.design
  • Update React, React DOM, TypeScript, ESLint, Testing Library, @types/, @typescript-eslint/, lint-staged, and related lint dependencies
  • Add ESLint flat config compatibility for ESLint 9 and TypeScript ESLint 8
  • Use grouped Dependabot updates for npm and GitHub Actions

Test Plan

  • npm run lint
  • npm run tsc

Summary by CodeRabbit

  • 新功能

    • 更新了项目的开发与构建配置,增强了对较新 React/TypeScript 生态的支持。
    • README 顶部图标现在可点击跳转到官网。
  • Bug 修复

    • 调整了类型声明与测试预期,改善在新版本 React 下的兼容性。
    • 更新了 lint 配置,减少部分代码检查误报。
  • 文档

    • 中英文 README 的顶部展示体验更统一。

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/react-component?upgradeToPro=build-rate-limit

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@afc163, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 096960c2-14f1-4aa5-978d-2d62866babaf

📥 Commits

Reviewing files that changed from the base of the PR and between 45b4e35 and 418f841.

📒 Files selected for processing (3)
  • eslint.config.mjs
  • react-compat.d.ts
  • src/test/domHook.ts

Walkthrough

将 React 升级至 19.x、TypeScript 升级至 6.x、ESLint 升级至 9.x,新增 react-compat.d.tsglobal.d.ts 兼容类型声明,迁移至 ESLint Flat Config,更新 tsconfig.json 编译选项,并在相关测试中针对 React 19 行为差异添加条件断言。

Changes

工具链升级与 React 19 兼容

Layer / File(s) Summary
依赖版本升级与 tsconfig 调整
package.json, tsconfig.json
package.json 升级 React/ReactDOM 至 19.x、TypeScript 至 6.x、ESLint 至 9.x 及相关类型包;tsconfig.json 切换 moduleResolutionbundlermoduleESNext,重写 paths 映射,并将新声明文件加入 include
React 19 兼容类型声明与全局类型补充
react-compat.d.ts, global.d.ts
新增 react-compat.d.ts 补充 ReactTextuseRefisValidElementcloneElementhydrate 等在 React 19 下缺失的类型签名;新增 global.d.ts 补充样式模块声明、JSX 命名空间、jest.Matchers 扩展及全局 vi 类型。
ESLint Flat Config 迁移
eslint.config.mjs
新增 eslint.config.mjs,使用 FlatCompat.eslintrc.js 适配为 ESLint 9 Flat Config,实现 normalizeConfig 过滤 @typescript-eslint 插件与规则,并显式关闭若干已废弃规则。
React 19 条件断言更新
tests/hooks-17.test.tsx, tests/ref.test.tsx
新增 isReact19 标识,将 supportRefsupportNodeRefgetNodeRefuseId hydrate 相关的固定断言改为基于 React.version 的条件断言。
Dependabot 分组与 README 图标链接
.github/dependabot.yml, README.md, README.zh-CN.md
dependabot.yml 为 npm 和 github-actions 更新源新增 groups 分组配置;README 中顶部 Ant Design 图标包裹为指向 https://ant.design 的外链形式。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • react-component/util#593: 同样涉及 tests/ref.test.tsx 中针对 React 19 的 supportRef/supportNodeRef/getNodeRef 断言更新。
  • react-component/util#623: 修改 src/ref.tssupportRef 对 React 19.x 的逻辑,与本 PR 的测试条件断言直接对应。
  • react-component/util#602: 涉及 getNodeRef 的 null 处理与返回类型变更,与本 PR 新增的 getNodeRef(null) 断言相关。

Suggested reviewers

  • zombieJ

🐰 代码升级春风来,
React 十九展新颜,
类型声明添兼容,
断言随版本而变,
工具链焕然一新天!

🚥 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 标题准确概括了本次以维护性依赖和相关工具链升级为主的变更。
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/update-maintenance-deps

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.

@socket-security

socket-security Bot commented Jun 29, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm @typescript-eslint/eslint-plugin is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: package.jsonnpm/@typescript-eslint/eslint-plugin@8.62.1

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@typescript-eslint/eslint-plugin@8.62.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@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 upgrades the project's development dependencies to support React 19 and TypeScript 6.0, introduces a flat ESLint configuration (eslint.config.mjs), adds global type declarations, and configures Dependabot grouping. Feedback on these changes focuses on maintaining type safety and configuration cleanliness: the reviewer advises against disabling strict type-checking flags in tsconfig.json, suggests avoiding declaring standard testing globals as any in global.d.ts to preserve proper Jest types, and recommends simplifying the ESLint configuration by removing obsolete workarounds for @typescript-eslint/ban-types.

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.

Comment thread tsconfig.json Outdated
Comment on lines +37 to +43
"noImplicitAny": false,
"strictNullChecks": false,
"strictPropertyInitialization": false,
"strictFunctionTypes": false,
"strict": false,
"noImplicitThis": false,
"strictBindCallApply": false

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.

high

Disabling strict type-checking options (such as strict, strictNullChecks, noImplicitAny, etc.) significantly reduces type safety and makes the codebase more prone to runtime errors (e.g., TypeError: Cannot read properties of undefined). For a widely used utility library like @rc-component/util, maintaining strict type safety is crucial. Please consider keeping these strict checks enabled and resolving any type errors introduced by the React 19 or TypeScript 6.0 upgrades instead of disabling them globally.

    "strict": true

Comment thread eslint.config.mjs
Comment on lines +19 to +52
const noopRule = {
meta: { type: 'problem', docs: {}, schema: [] },
create: () => ({}),
};

function normalizeConfig(config) {
const next = { ...config };

if (next.plugins?.['@typescript-eslint']) {
next.plugins = {
...next.plugins,
'@typescript-eslint': {
...next.plugins['@typescript-eslint'],
rules: {
...next.plugins['@typescript-eslint'].rules,
'ban-types': noopRule,
},
},
};
}

if (next.rules) {
next.rules = Object.fromEntries(
Object.entries(next.rules).filter(([ruleName]) => {
if (!ruleName.startsWith('@typescript-eslint/')) {
return true;
}
return recommendedTsRules.has(ruleName) || ruleName === '@typescript-eslint/ban-types';
}),
);
}

return next;
}

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.

medium

Since @typescript-eslint/ban-types has been completely removed in @typescript-eslint v8, we can simplify this configuration. Instead of creating a dummy noopRule and mutating the plugin's rules, we can simply filter out @typescript-eslint/ban-types from the legacy rules in normalizeConfig and avoid referencing it in the flat config. This keeps the configuration clean and avoids hacky plugin mutations.

function normalizeConfig(config) {
  const next = { ...config };

  if (next.rules) {
    next.rules = Object.fromEntries(
      Object.entries(next.rules).filter(([ruleName]) => {
        if (!ruleName.startsWith('@typescript-eslint/')) {
          return true;
        }
        return recommendedTsRules.has(ruleName);
      }),
    );
  }

  return next;
}

Comment thread eslint.config.mjs
Comment on lines +71 to +78
{
rules: {
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
},

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.

medium

Since @typescript-eslint/ban-types is removed in v8 and filtered out in normalizeConfig, we do not need to configure it as 'off' here. Removing it simplifies the configuration.

  {
    rules: {
      '@typescript-eslint/no-empty-object-type': 'off',
      '@typescript-eslint/no-unsafe-function-type': 'off',
      '@typescript-eslint/no-unused-vars': 'off',
    },
  },

Comment thread global.d.ts Outdated
Comment on lines +47 to +54
declare const describe: any;
declare const it: any;
declare const test: any;
declare const beforeEach: any;
declare const afterEach: any;
declare const beforeAll: any;
declare const afterAll: any;
declare const expect: any;

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.

medium

Declaring standard testing globals (describe, it, test, expect, etc.) as any overrides the proper types provided by @types/jest (referenced on line 1). This completely disables type safety and autocompletion in test files. If there are type conflicts, it is better to resolve them via tsconfig.json types configuration or by using explicit imports rather than casting these globals to any globally.

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
util Error Error Jun 30, 2026 11:23am

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

❌ Deploy failed

PR preview ❌ Failed ❌ Failed
🔗 Preview https://react-component-util-preview-pr-790.surge.sh (may be unavailable)
📝 Commit418f841
🪵 LogsView logs
📋 Build log (last lines)
npm warn exec The following package was not found and will be installed: surge@0.27.4

   Running as afc163@gmail.com (Student)

        project: ./docs-dist
         domain: react-component-util-preview-pr-790.surge.sh
           size: 45 files, 1.7 MB


   Error - Deployment did not succeed.

🤖 Powered by surge-preview

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

React Doctor found 1 issue in 1 file · 1 error · score 40 / 100 (Critical) · vs master

Errors

Reviewed by React Doctor for commit 418f841. See inline comments for fixes.

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/afc163s-projects?upgradeToPro=build-rate-limit

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.42%. Comparing base (3de2f3c) to head (418f841).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #790   +/-   ##
=======================================
  Coverage   86.42%   86.42%           
=======================================
  Files          39       39           
  Lines        1068     1068           
  Branches      373      388   +15     
=======================================
  Hits          923      923           
  Misses        143      143           
  Partials        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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
global.d.ts (1)

11-20: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

尽量不要在这里继续声明全局 JSX 命名空间。 仓库里已经没有其他 JSX.* 旧引用,兼容层可以收敛到 React.JSX / declare module 'react'

🤖 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 `@global.d.ts` around lines 11 - 20, Remove the remaining global JSX namespace
declaration in the ambient typings and migrate this compatibility layer to
React.JSX or a declare module 'react' augmentation instead. Update the
JSX-related type aliases/interfaces currently defined in global.d.ts so they no
longer reopen global JSX, and keep the existing React.JSX symbols as the source
of truth for Element, IntrinsicElements, and related types.
tests/ref.test.tsx (1)

14-14: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

把版本判断改成按 major version 解析。 React.version.startsWith('19') 只覆盖 19.x,升级到 React 20 后这些断言会回落到旧分支;这里改成 isReact19OrNewer,与 src/ref.tsReactMajorVersion >= 19 保持一致。

🤖 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 `@tests/ref.test.tsx` at line 14, The React version check in the test file is
too narrow because React.version.startsWith('19') only matches 19.x, so update
the test’s version gate to parse the major version and rename it to align with
src/ref.ts’s ReactMajorVersion >= 19 logic. Locate the existing isReact19
constant in tests/ref.test.tsx and replace it with an isReact19OrNewer-style
check based on the parsed major version so the assertions follow the same branch
as the production code for React 20+.
🤖 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 `@react-compat.d.ts`:
- Around line 14-16: Remove the legacy react-dom hydrate compatibility
declaration from react-compat.d.ts so TypeScript no longer exposes an API that
is unavailable in React/ReactDOM 19. Update any callers that rely on this
declaration to use hydrateRoot from react-dom/client instead, and verify the
ReactDOM typings align with the new client-based hydration entry point.

---

Nitpick comments:
In `@global.d.ts`:
- Around line 11-20: Remove the remaining global JSX namespace declaration in
the ambient typings and migrate this compatibility layer to React.JSX or a
declare module 'react' augmentation instead. Update the JSX-related type
aliases/interfaces currently defined in global.d.ts so they no longer reopen
global JSX, and keep the existing React.JSX symbols as the source of truth for
Element, IntrinsicElements, and related types.

In `@tests/ref.test.tsx`:
- Line 14: The React version check in the test file is too narrow because
React.version.startsWith('19') only matches 19.x, so update the test’s version
gate to parse the major version and rename it to align with src/ref.ts’s
ReactMajorVersion >= 19 logic. Locate the existing isReact19 constant in
tests/ref.test.tsx and replace it with an isReact19OrNewer-style check based on
the parsed major version so the assertions follow the same branch as the
production code for React 20+.
🪄 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: 4031d7ea-5dae-4dee-b58e-e3cc0318287c

📥 Commits

Reviewing files that changed from the base of the PR and between 3de2f3c and 45b4e35.

📒 Files selected for processing (10)
  • .github/dependabot.yml
  • README.md
  • README.zh-CN.md
  • eslint.config.mjs
  • global.d.ts
  • package.json
  • react-compat.d.ts
  • tests/hooks-17.test.tsx
  • tests/ref.test.tsx
  • tsconfig.json

Comment thread react-compat.d.ts Outdated
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