Skip to content

Commit e84323e

Browse files
authored
chore: update maintenance dependencies (#880)
* chore: update maintenance dependencies * fix: align TypeScript and ESLint compatibility * chore: use testing-library dom events * test: keep react testing event behavior * chore: address review comments * fix: keep compatible eslint export rule * chore: preserve local eslint rule overrides * docs: use ut install for local setup * chore: restore vercel install command * chore: align maintenance dependencies * chore: fix upgraded test tooling * fix: preserve React peer dependency range * fix: keep submenu item title type compatible * docs: use npm install in README * chore: remove redundant strict tsconfig flags * chore: remove manual global test declarations * fix: address review type compatibility * chore: migrate to native eslint flat config * chore: address review comments
1 parent 4626b25 commit e84323e

23 files changed

Lines changed: 209 additions & 133 deletions

.eslintrc.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ updates:
88
time: '21:00'
99
timezone: Asia/Shanghai
1010
open-pull-requests-limit: 10
11+
groups:
12+
npm-dependencies:
13+
patterns:
14+
- '*'
1115

1216
- package-ecosystem: github-actions
1317
directory: '/'
@@ -17,3 +21,7 @@ updates:
1721
time: '21:00'
1822
timezone: Asia/Shanghai
1923
open-pull-requests-limit: 10
24+
groups:
25+
github-actions:
26+
patterns:
27+
- '*'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<h1>@rc-component/menu</h1>
3-
<p><sub><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /> Part of the Ant Design ecosystem.</sub></p>
3+
<p><sub><a href="https://ant.design"><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /></a> Part of the Ant Design ecosystem.</sub></p>
44
<p>🧭 Accessible React menu primitives for navigation, command surfaces, and nested item trees.</p>
55

66
<p>

README.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<h1>@rc-component/menu</h1>
3-
<p><sub><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /> Ant Design 生态的一部分。</sub></p>
3+
<p><sub><a href="https://ant.design"><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /></a> Ant Design 生态的一部分。</sub></p>
44
<p>🧭 React 菜单组件,支持水平、垂直、内联、分组和子菜单。</p>
55

66
<p>

docs/examples/customPopupRender.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ const NavigationDemo = () => {
6767
],
6868
},
6969
];
70-
const popupRender = (node: ReactElement) => (
70+
const popupRender = (node: ReactElement<any>) => (
7171
<div className="navigation-popup">
7272
<div className="navigation-grid">
73-
{React.Children.map(node.props.children.props.children, child => (
73+
{React.Children.map(node.props.children.props.children, (child: ReactElement<any>) => (
7474
<div className="navigation-item">
7575
{React.cloneElement(child, {
7676
className: `${child.props.className || ''} navigation-menu-item`,
@@ -85,13 +85,13 @@ const NavigationDemo = () => {
8585
};
8686

8787
const MixedPanelDemo = () => {
88-
const totalPopupRender = (node: ReactElement, info: { item: any; keys: string[] }) => {
88+
const totalPopupRender = (node: ReactElement<any>, info: { item: any; keys: string[] }) => {
8989
const isSecondLevel = info.keys.length == 2;
9090
if (isSecondLevel) {
9191
return (
9292
<div className="navigation-popup">
9393
<div className="navigation-grid">
94-
{React.Children.map(node.props.children.props.children, child => (
94+
{React.Children.map(node.props.children.props.children, (child: ReactElement<any>) => (
9595
<div className="navigation-item">
9696
{React.cloneElement(child, {
9797
className: `${child.props.className || ''} navigation-menu-item`,

docs/examples/debug.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default () => {
5252
const [inlineCollapsed, setInlineCollapsed] = React.useState(false);
5353
const [forceRender, setForceRender] = React.useState(false);
5454
const [openKeys, setOpenKeys] = React.useState<string[]>([]);
55-
const menuRef = useRef<MenuRef>();
55+
const menuRef = useRef<MenuRef>(null);
5656

5757
const onRootClick = (info: MenuInfo) => {
5858
console.log('Root Menu Item Click:', info);

docs/examples/items-ref.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import '../../assets/index.less';
55
import Menu from '../../src';
66

77
export default () => {
8-
const ref1 = useRef();
9-
const ref2 = useRef();
10-
const ref3 = useRef();
11-
const ref4 = useRef();
12-
const ref5 = useRef();
13-
const ref6 = useRef();
14-
const ref7 = useRef();
8+
const ref1 = useRef<HTMLLIElement>(null);
9+
const ref2 = useRef<HTMLLIElement>(null);
10+
const ref3 = useRef<HTMLLIElement>(null);
11+
const ref4 = useRef<HTMLLIElement>(null);
12+
const ref5 = useRef<HTMLLIElement>(null);
13+
const ref6 = useRef<HTMLLIElement>(null);
14+
const ref7 = useRef<HTMLLIElement>(null);
1515

1616
return (
1717
<>

eslint.config.mjs

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import js from '@eslint/js';
2+
import { defineConfig } from 'eslint/config';
3+
import { dirname } from 'node:path';
4+
import { fileURLToPath } from 'node:url';
5+
import prettier from 'eslint-config-prettier';
6+
import jest from 'eslint-plugin-jest';
7+
import react from 'eslint-plugin-react';
8+
import reactHooks from 'eslint-plugin-react-hooks';
9+
import globals from 'globals';
10+
import tseslint from 'typescript-eslint';
11+
12+
const tsconfigRootDir = dirname(fileURLToPath(import.meta.url));
13+
14+
export default defineConfig([
15+
{
16+
plugins: {
17+
'@typescript-eslint': tseslint.plugin,
18+
},
19+
},
20+
{
21+
linterOptions: {
22+
reportUnusedDisableDirectives: 'warn',
23+
},
24+
},
25+
{
26+
ignores: [
27+
'node_modules/',
28+
'coverage/',
29+
'es/',
30+
'lib/',
31+
'dist/',
32+
'docs-dist/',
33+
'.docs-dist/',
34+
'.dumi/',
35+
'.doc/',
36+
'.vercel/',
37+
],
38+
},
39+
{
40+
files: ['**/*.{js,jsx,ts,tsx}'],
41+
extends: [
42+
js.configs.recommended,
43+
react.configs.flat.recommended,
44+
react.configs.flat['jsx-runtime'],
45+
prettier,
46+
],
47+
plugins: {
48+
'react-hooks': reactHooks,
49+
},
50+
languageOptions: {
51+
globals: {
52+
...globals.browser,
53+
...globals.node,
54+
},
55+
},
56+
settings: {
57+
react: {
58+
version: 'detect',
59+
},
60+
},
61+
rules: {
62+
'no-async-promise-executor': 'off',
63+
'no-empty-pattern': 'off',
64+
'no-irregular-whitespace': 'off',
65+
'no-prototype-builtins': 'off',
66+
'no-useless-escape': 'off',
67+
'no-extra-boolean-cast': 'off',
68+
'no-undef': 'off',
69+
'no-unused-vars': 'off',
70+
'react/no-find-dom-node': 'off',
71+
'react/display-name': 'off',
72+
'react/no-unknown-property': 'off',
73+
'react/prop-types': 'off',
74+
'react-hooks/exhaustive-deps': 'warn',
75+
'react-hooks/rules-of-hooks': 'error',
76+
},
77+
},
78+
{
79+
files: ['**/*.{ts,tsx}'],
80+
extends: [...tseslint.configs.recommended],
81+
rules: {
82+
'@typescript-eslint/ban-ts-comment': 'off',
83+
'@typescript-eslint/no-empty-object-type': 'off',
84+
'@typescript-eslint/no-explicit-any': 'off',
85+
'@typescript-eslint/no-unsafe-function-type': 'off',
86+
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
87+
'@typescript-eslint/no-unused-vars': 'off',
88+
},
89+
},
90+
{
91+
files: ['src/**/*.{ts,tsx}'],
92+
languageOptions: {
93+
parserOptions: {
94+
projectService: true,
95+
tsconfigRootDir,
96+
},
97+
},
98+
},
99+
{
100+
files: ['tests/**/*.{js,jsx,ts,tsx}', '**/*.{test,spec}.{js,jsx,ts,tsx}'],
101+
extends: [jest.configs['flat/recommended']],
102+
rules: {
103+
'jest/no-disabled-tests': 'off',
104+
'jest/no-done-callback': 'off',
105+
'jest/no-identical-title': 'off',
106+
'jest/expect-expect': 'off',
107+
'jest/no-alias-methods': 'off',
108+
'jest/no-conditional-expect': 'off',
109+
'jest/no-export': 'off',
110+
'jest/no-standalone-expect': 'off',
111+
'jest/valid-expect': 'off',
112+
'jest/valid-title': 'off',
113+
},
114+
},
115+
]);

global.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/// <reference types="jest" />
2+
/// <reference types="node" />
3+
/// <reference types="react" />
4+
/// <reference types="react-dom" />
5+
/// <reference types="@testing-library/jest-dom" />
6+
7+
declare module '*.css';
8+
declare module '*.less';
9+
declare module 'jsonp';
10+
11+
declare module 'moment/locale/zh-cn';

package.json

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,36 @@
5353
"clsx": "^2.1.1"
5454
},
5555
"devDependencies": {
56+
"@eslint/js": "^9.39.4",
5657
"@rc-component/father-plugin": "^2.2.0",
5758
"@rc-component/np": "^1.0.4",
59+
"@testing-library/dom": "^10.4.1",
5860
"@testing-library/jest-dom": "^6.9.1",
59-
"@testing-library/react": "^15.0.7",
60-
"@types/jest": "^29.5.14",
61+
"@testing-library/react": "^16.3.2",
62+
"@types/jest": "^30.0.0",
6163
"@types/node": "^26.0.1",
62-
"@types/react": "^18.3.31",
63-
"@types/react-dom": "^18.3.7",
64+
"@types/react": "^19.2.17",
65+
"@types/react-dom": "^19.2.3",
6466
"@types/warning": "^3.0.4",
65-
"@umijs/fabric": "^4.0.1",
6667
"cross-env": "^10.1.0",
67-
"dumi": "^2.4.35",
68-
"eslint": "^8.57.1",
69-
"father": "^4.6.23",
68+
"dumi": "^2.4.38",
69+
"eslint": "^9.39.4",
70+
"eslint-config-prettier": "^10.1.8",
71+
"eslint-plugin-jest": "^29.15.4",
72+
"eslint-plugin-react": "^7.37.5",
73+
"eslint-plugin-react-hooks": "^7.1.1",
74+
"father": "^4.6.24",
7075
"gh-pages": "^6.3.0",
76+
"globals": "^17.7.0",
7177
"husky": "^9.1.7",
7278
"less": "^4.6.7",
73-
"lint-staged": "^16.4.0",
74-
"prettier": "^3.9.0",
79+
"lint-staged": "^17.0.8",
80+
"prettier": "^3.9.4",
7581
"rc-test": "^7.1.3",
76-
"react": "^18.3.1",
77-
"react-dom": "^18.3.1",
78-
"typescript": "^5.9.3"
82+
"react": "^19.2.7",
83+
"react-dom": "^19.2.7",
84+
"typescript": "^6.0.3",
85+
"typescript-eslint": "^8.62.1"
7986
},
8087
"peerDependencies": {
8188
"react": ">=16.9.0",

0 commit comments

Comments
 (0)