Skip to content

chore: update maintenance dependencies#880

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

chore: update maintenance dependencies#880
afc163 wants to merge 18 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

  • New Features
    • 升级到 React 19 与 TypeScript 6,并同步更新开发/测试与代码质量工具。
    • 优化自动依赖更新的分组策略,降低后续维护成本。
  • Bug Fixes
    • 优化菜单/子菜单的初始状态与聚焦交互稳定性。
    • 更新类型约定:子菜单展示字段由 title 更名为 label
    • 扩充全局类型声明,增强样式与测试等场景的类型支持。
  • Documentation
    • 更新 README / README.zh-CN:Ant Design 图标外链展示,并调整本地安装/开发命令示例。

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
menu Ready Ready Preview, Comment Jul 2, 2026 3:59am

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

本次 PR 集中升级了工具链与类型环境,新增 ESLint Flat Config 和全局声明文件,统一了源码与示例中的 ref/回调类型标注,并调整了 Dependabot、README 和测试断言写法。

Changes

工具链升级与类型兼容适配

Layer / File(s) Summary
依赖版本升级
package.json
升级 React、TypeScript、ESLint 及相关测试/解析器/插件依赖。
tsconfig 与全局声明文件
tsconfig.json, global.d.ts
调整模块解析、路径映射、严格性开关和编译范围;新增测试库类型引用、模块声明、JSX 命名空间映射及 jest/vi 全局 API 声明。
ESLint Flat Config
eslint.config.mjs
新增基于 FlatCompat 的 Flat Config,归一化并过滤 @typescript-eslint 规则集,注册插件与规则覆盖。
源码与示例 ref/回调类型标注
src/Menu.tsx, src/MenuItem.tsx, src/SubMenu/PopupTrigger.tsx, src/SubMenu/index.tsx, src/hooks/useAccessibility.ts, docs/examples/customPopupRender.tsx, docs/examples/debug.tsx, docs/examples/items-ref.tsx
统一 ref 初始值与泛型标注,补充回调参数 ReactElement<any> 类型。
Dependabot 与 README 更新
.github/dependabot.yml, README.md, README.zh-CN.md
新增 npm 与 GitHub Actions 的 dependabot 分组;README 徽标改为链接形式,安装命令由 npm install 改为 ut install
测试断言格式整理
tests/Collapsed.spec.tsx
断言与事件触发调用改为更紧凑的单行写法。

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • react-component/menu#739: 同样修改 docs/examples/debug.tsxmenuRefuseRef 初始化方式。
  • react-component/menu#747: 本 PR 更新的 docs/examples/customPopupRender.tsx 类型标注与该 PR 引入的 popupRender 示例直接相关。

Suggested reviewers: zombieJ, MadCcc

Poem

小兔来把工具换,
React 十九蹦进来;
ref 归零更整齐,
ESLint 新规排成排。
文档链接轻轻跳,
测试断言也变乖 🐇

🚥 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.

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 29a441d.

@socket-security

socket-security Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​types/​jest@​29.5.14 ⏵ 30.0.01001007780100
Addednpm/​@​types/​react@​19.2.171001007995100
Addednpm/​@​eslint/​js@​9.39.410010010088100
Addednpm/​typescript@​6.0.3100100909690
Addednpm/​eslint@​9.39.49710010096100

View full report

@socket-security

socket-security Bot commented Jun 29, 2026

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

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 project dependencies to support React 19 and TypeScript 6, introduces a flat ESLint configuration, and adds compatibility type definitions. However, the changes introduce some type-safety regressions. Specifically, disabling strict compiler flags in tsconfig.json significantly weakens type safety across the codebase, and declaring Jest globals as any in global.d.ts overrides the strongly-typed definitions provided by @types/jest. It is highly recommended to maintain strict type-checking and preserve proper test 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 thread global.d.ts Outdated
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown

✅ Preview is ready!

PR preview ✅ Ready ✅ Ready
🔗 Preview https://react-component-menu-preview-pr-880.surge.sh
📝 Commit29a441d
⏱️ Build time22.906s
📦 Size2.1 MB (no change) · 94 files
🪵 LogsView logs
📱 MobileScan to open preview on mobile

↩️ Previous: ⚡️ 29a441d · react-component-menu-preview-pr-880.surge.sh (open ↗) · 2026-07-02 03:59:06 UTC

🤖 Powered by surge-preview

@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: 3

🤖 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 `@eslint.config.mjs`:
- Around line 40-48: The filtering in the eslint config is dropping most
existing `@typescript-eslint` rules from the old eslintrc setup, so keep the
current lint behavior by explicitly carrying those legacy TS rules into the flat
config instead of removing them in the Object.fromEntries/Object.entries filter.
Update the logic around next.rules in eslint.config.mjs, using the existing
recommendedTsRules handling as a base, and add the missing rules such as
`@typescript-eslint/no-empty-interface`,
`@typescript-eslint/consistent-indexed-object-style`,
`@typescript-eslint/switch-exhaustiveness-check`,
`@typescript-eslint/no-parameter-properties`, and
`@typescript-eslint/type-annotation-spacing` so they remain enabled after
migration.

In `@tsconfig.json`:
- Around line 16-22: Keep the TypeScript strictness enabled in tsconfig.json by
preserving strict and removing the broad strict* overrides so npm run tsc
continues to catch regressions, and update the JSX setting from the classic
runtime to the React 19 automatic runtime. Use the tsconfig.json settings around
strict, noImplicitAny, strictNullChecks, strictPropertyInitialization,
strictFunctionTypes, noImplicitThis, and strictBindCallApply, and change the jsx
option to react-jsx while leaving react-compat.d.ts and global.d.ts as type
supplements rather than substitutes for compiler checks.
- Around line 15-24: The tsconfig JSX runtime is still using the classic React
transform, which is incompatible with the React 19 upgrade expectation. Update
the jsx setting in tsconfig.json from the current classic runtime to the
automatic JSX transform, and keep the change limited to the TypeScript config so
the app compiles with React 19 conventions.
🪄 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: 2623c6c3-9f28-4d7f-8cd2-11689792fb31

📥 Commits

Reviewing files that changed from the base of the PR and between 4626b25 and 398893c.

📒 Files selected for processing (10)
  • .github/dependabot.yml
  • README.md
  • README.zh-CN.md
  • docs/examples/customPopupRender.tsx
  • eslint.config.mjs
  • global.d.ts
  • package.json
  • react-compat.d.ts
  • src/Menu.tsx
  • tsconfig.json

Comment thread eslint.config.mjs Outdated
Comment thread tsconfig.json Outdated
Comment thread tsconfig.json Outdated
@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 99.72%. Comparing base (4626b25) to head (29a441d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #880   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files          26       26           
  Lines         734      734           
  Branches      205      205           
=======================================
  Hits          732      732           
  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.

@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.

♻️ Duplicate comments (1)
eslint.config.mjs (1)

18-22: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

不要用 recommended 白名单过滤掉旧的 TS 规则覆盖。

这里仍然会把 .eslintrc.js 里显式关闭的 @typescript-eslint/* 规则静默丢掉;@typescript-eslint/no-empty-interface@typescript-eslint/consistent-indexed-object-style@typescript-eslint/switch-exhaustiveness-check@typescript-eslint/no-parameter-properties@typescript-eslint/no-throw-literal@typescript-eslint/type-annotation-spacing@typescript-eslint/ban-types 都不再随迁移保留。这样 compat.config(require('./.eslintrc.js')) 和旧配置的契约被打破,npm run lint 的结果会和迁移前不一致。更稳妥的做法是保留这些旧的显式 TS 规则覆盖,或只移除 plugins 而不要按 recommended 再过滤 rules

可选修正
 function normalizeConfig(config) {
   const next = { ...config };

   if (next.plugins?.['`@typescript-eslint`']) {
     next.plugins = { ...next.plugins };
     delete next.plugins['`@typescript-eslint`'];
   }

-  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;
 }
#!/bin/bash
set -euo pipefail

echo "Legacy TS rule overrides in .eslintrc.js:"
rg -n "`@typescript-eslint/`" .eslintrc.js

echo
echo "Filtering logic in eslint.config.mjs:"
sed -n '18,40p' eslint.config.mjs

Also applies to: 38-38

🤖 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 `@eslint.config.mjs` around lines 18 - 22, The current recommendedTS whitelist
logic in eslint.config.mjs is dropping legacy `@typescript-eslint` rule overrides
from compat.config(require('./.eslintrc.js')), so explicitly preserved TS rules
from .eslintrc.js are being lost during migration. Update the filtering around
recommendedTsRulesConfig/recommendedTsRulesObject/recommendedTsRules so it does
not remove old TS rule overrides; either keep the legacy `@typescript-eslint/`*
rules from the compat config or only strip plugin entries without re-filtering
rules against the recommended set.
🤖 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.

Duplicate comments:
In `@eslint.config.mjs`:
- Around line 18-22: The current recommendedTS whitelist logic in
eslint.config.mjs is dropping legacy `@typescript-eslint` rule overrides from
compat.config(require('./.eslintrc.js')), so explicitly preserved TS rules from
.eslintrc.js are being lost during migration. Update the filtering around
recommendedTsRulesConfig/recommendedTsRulesObject/recommendedTsRules so it does
not remove old TS rule overrides; either keep the legacy `@typescript-eslint/`*
rules from the compat config or only strip plugin entries without re-filtering
rules against the recommended set.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2271fa41-43b5-4b77-a539-77be1c5eac64

📥 Commits

Reviewing files that changed from the base of the PR and between b4921cd and 69b4e5c.

📒 Files selected for processing (4)
  • eslint.config.mjs
  • package.json
  • react-compat.d.ts
  • tests/Collapsed.spec.tsx
💤 Files with no reviewable changes (1)
  • react-compat.d.ts
✅ Files skipped from review due to trivial changes (1)
  • tests/Collapsed.spec.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json

@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

@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: 3

🧹 Nitpick comments (1)
eslint.config.mjs (1)

35-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

不要用 no-op 覆盖 @typescript-eslint/consistent-type-exports 这会让即使显式启用的规则也直接变成空实现,等于静默跳过检查;如果只是为了迁移兼容,保留原插件对象,并在最终 rules 里显式设为 off 即可。

🤖 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 `@eslint.config.mjs` around lines 35 - 38, The current noopRule override
effectively disables `@typescript-eslint/consistent-type-exports` by replacing the
real rule with an empty implementation. Update the ESLint config to keep the
original plugin rule object intact, and instead disable this rule explicitly in
the final rules configuration using its rule name so the intent is clear and the
check is not silently skipped.
🤖 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 93-94: The peer dependency ranges for react and react-dom are too
narrow in package.json and should be aligned with the intended React
compatibility. Update the peerDependencies entries so PackageJson declares the
broader React 19 range if no 19.2.7-specific APIs are required, or otherwise
explicitly keep the stricter version only if this release is meant to be a
breaking 19.2.7+ requirement.

In `@README.md`:
- Line 73: The install command in the README is incorrect and should be restored
to the standard npm install command. Update the affected install instructions in
README.md and the matching section in README.zh-CN.md so they use npm install
consistently with the existing Vercel configuration and do not reference ut
install.

In `@README.zh-CN.md`:
- Line 73: The install command shown in the README examples is incorrect and
should be changed back to npm install. Update the installation snippet in the
README.zh-CN.md example, and make sure the matching install example in README.md
uses the same valid command so readers can follow the documented setup
successfully.

---

Nitpick comments:
In `@eslint.config.mjs`:
- Around line 35-38: The current noopRule override effectively disables
`@typescript-eslint/consistent-type-exports` by replacing the real rule with an
empty implementation. Update the ESLint config to keep the original plugin rule
object intact, and instead disable this rule explicitly in the final rules
configuration using its rule name so the intent is clear and the check is not
silently skipped.
🪄 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: e06a83bc-8e2c-4f0f-aeb6-217e70bda280

📥 Commits

Reviewing files that changed from the base of the PR and between 69b4e5c and c9dbe4f.

📒 Files selected for processing (12)
  • README.md
  • README.zh-CN.md
  • docs/examples/debug.tsx
  • docs/examples/items-ref.tsx
  • eslint.config.mjs
  • package.json
  • src/Menu.tsx
  • src/MenuItem.tsx
  • src/SubMenu/PopupTrigger.tsx
  • src/SubMenu/index.tsx
  • src/hooks/useAccessibility.ts
  • tsconfig.json
✅ Files skipped from review due to trivial changes (2)
  • src/hooks/useAccessibility.ts
  • src/MenuItem.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Menu.tsx

Comment thread package.json Outdated
Comment thread README.md Outdated
Comment thread README.zh-CN.md Outdated
@afc163

afc163 commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Related to ant-design/ant-design#58514.

Copilot AI review requested due to automatic review settings July 2, 2026 03:55

Copilot AI 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.

Pull request overview

This PR modernizes the repo’s maintenance/tooling setup (React/TypeScript/ESLint/testing deps) and aligns the codebase with newer type expectations, while also updating documentation and automation for ongoing dependency maintenance.

Changes:

  • Upgrades core dev dependencies (React/React DOM, TypeScript, ESLint 9 + flat config, Testing Library, @types/*, etc.).
  • Updates TypeScript configuration and adds a global ambient typings file for local type support.
  • Minor code/type cleanups (typed refs, small type annotations), plus README and Dependabot configuration updates.

Reviewed changes

Copilot reviewed 22 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tsconfig.json Updates TS compiler options (notably module resolution) and include list.
package.json Bumps React/TS/ESLint/testing/lint tooling dependency versions.
eslint.config.mjs Adds ESLint 9 flat config setup to replace legacy .eslintrc.
.eslintrc.js Removes legacy ESLint config.
global.d.ts Adds ambient module declarations and common type references.
.github/dependabot.yml Enables grouped Dependabot updates for npm and GitHub Actions.
src/Menu.tsx Adjusts ref typing and adds explicit element typing in a find callback.
src/MenuItem.tsx Initializes refs with null for updated React typings.
src/SubMenu/index.tsx Initializes refs with null for updated React typings.
src/SubMenu/PopupTrigger.tsx Makes the RAF handle ref explicitly `number
src/hooks/useAccessibility.ts Makes RAF/active key refs explicitly `T
src/interface.ts Updates submenu item typings (notably title).
tests/Collapsed.spec.tsx Formatting-only test adjustments (single-line expectations/events).
tests/snapshots/Menu.spec.tsx.snap Updates snapshot header URL.
tests/snapshots/MenuItem.spec.tsx.snap Updates snapshot header URL.
tests/snapshots/Keyboard.spec.tsx.snap Updates snapshot header URL.
tests/snapshots/Options.spec.tsx.snap Updates snapshot header URL.
tests/snapshots/Responsive.spec.tsx.snap Updates snapshot header URL.
tests/snapshots/SubMenu.spec.tsx.snap Updates snapshot header URL.
README.md Links Ant Design ecosystem logo to https://ant.design.
README.zh-CN.md Links Ant Design ecosystem logo to https://ant.design.
docs/examples/items-ref.tsx Types example refs as HTMLLIElement refs initialized with null.
docs/examples/debug.tsx Types menuRef and initializes with null.
docs/examples/customPopupRender.tsx Adds explicit generics/types for ReactElement parameters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/interface.ts
Comment on lines 14 to 16
label?: React.ReactNode;
title?: string;
title?: React.ReactNode;

Comment thread eslint.config.mjs
Comment on lines +89 to +92
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
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