Skip to content

Commit c117b84

Browse files
authored
chore: update maintenance dependencies (#1003)
* 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 * 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 * docs: use npm install in README * chore: remove redundant strict tsconfig flags * chore: remove manual global test declarations * chore: migrate to native eslint flat config * chore: address review comments
1 parent 2a1774b commit c117b84

13 files changed

Lines changed: 189 additions & 100 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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<h1>@rc-component/tabs</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>📑 Flexible React tabs with overflow, editable items, custom tab bars, and accessible panels.</p>
55

66
<p>
@@ -15,7 +15,6 @@
1515

1616
<p align="center">English | <a href="./README.zh-CN.md">简体中文</a></p>
1717

18-
1918
## Highlights
2019

2120
- Supports top, bottom, left, and right tab positions with RTL layouts.

README.zh-CN.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<h1>@rc-component/tabs</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>
@@ -15,7 +15,6 @@
1515

1616
<p align="center"><a href="./README.md">English</a> | 简体中文</p>
1717

18-
1918
## 特性
2019

2120
- 支持 RTL 布局的顶部、底部、左侧和右侧选项卡位置。
@@ -90,18 +89,18 @@ npm start
9089

9190
### Tab
9291

93-
| 名称 | 类型 | 默认值 | 说明 |
94-
| --- | --- | --- | --- |
95-
| `children` | React.ReactNode | - | 选项卡面板内容。 |
96-
| `className` | string | - | 面板 className。 |
97-
| `closable` | boolean | - | 是否可以在可编辑模式下关闭选项卡。 |
98-
| `closeIcon` | React.ReactNode | - | 自定义关闭图标。 |
99-
| `destroyOnHidden` | boolean | false | 销毁非活动面板。 |
100-
| `disabled` | boolean | false | 禁用该选项卡。 |
101-
| `forceRender` | boolean | false | 在面板变为活动状态之前渲染面板。 |
102-
| `key` | string | - | 需要唯一的 Tab 键。 |
103-
| `label` | React.ReactNode | - | Tab 标签内容。 |
104-
| `style` | React.CSSProperties | - | 面板样式。 |
92+
| 名称 | 类型 | 默认值 | 说明 |
93+
| ----------------- | ------------------- | ------ | ---------------------------------- |
94+
| `children` | React.ReactNode | - | 选项卡面板内容。 |
95+
| `className` | string | - | 面板 className。 |
96+
| `closable` | boolean | - | 是否可以在可编辑模式下关闭选项卡。 |
97+
| `closeIcon` | React.ReactNode | - | 自定义关闭图标。 |
98+
| `destroyOnHidden` | boolean | false | 销毁非活动面板。 |
99+
| `disabled` | boolean | false | 禁用该选项卡。 |
100+
| `forceRender` | boolean | false | 在面板变为活动状态之前渲染面板。 |
101+
| `key` | string | - | 需要唯一的 Tab 键。 |
102+
| `label` | React.ReactNode | - | Tab 标签内容。 |
103+
| `style` | React.CSSProperties | - | 面板样式。 |
105104

106105
## 本地开发
107106

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: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,40 @@
4949
"clsx": "^2.1.1"
5050
},
5151
"devDependencies": {
52+
"@eslint/js": "^9.39.4",
5253
"@rc-component/father-plugin": "^2.2.0",
5354
"@rc-component/np": "^1.0.4",
55+
"@testing-library/dom": "^10.4.1",
5456
"@testing-library/jest-dom": "^6.9.1",
55-
"@testing-library/react": "^15.0.7",
56-
"@testing-library/user-event": "14.5.2",
57-
"@types/enzyme": "^3.10.5",
58-
"@types/jest": "^29.5.14",
57+
"@testing-library/react": "^16.3.2",
58+
"@testing-library/user-event": "^14.6.1",
59+
"@types/enzyme": "^3.10.19",
60+
"@types/jest": "^30.0.0",
5961
"@types/node": "^26.0.1",
60-
"@types/react": "^18.3.31",
61-
"@types/react-dom": "^18.3.7",
62-
"@typescript-eslint/eslint-plugin": "^5.62.0",
63-
"@typescript-eslint/parser": "^5.62.0",
64-
"@umijs/fabric": "^4.0.1",
65-
"dumi": "^2.4.35",
66-
"eslint": "^8.57.1",
67-
"father": "^4.6.23",
62+
"@types/react": "^19.2.17",
63+
"@types/react-dom": "^19.2.3",
64+
"cross-env": "^10.1.0",
65+
"dumi": "^2.4.38",
66+
"eslint": "^9.39.4",
67+
"eslint-config-prettier": "^10.1.8",
68+
"eslint-plugin-jest": "^29.15.4",
69+
"eslint-plugin-react": "^7.37.5",
70+
"eslint-plugin-react-hooks": "^7.1.1",
71+
"father": "^4.6.24",
6872
"gh-pages": "^6.3.0",
73+
"globals": "^17.7.0",
6974
"husky": "^9.1.7",
7075
"less": "^4.6.7",
71-
"lint-staged": "^16.4.0",
72-
"prettier": "^3.9.0",
76+
"lint-staged": "^17.0.8",
77+
"prettier": "^3.9.4",
7378
"rc-test": "^7.1.3",
74-
"react": "^18.3.1",
79+
"react": "^19.2.7",
7580
"react-dnd": "^10.0.0",
7681
"react-dnd-html5-backend": "^10.0.0",
77-
"react-dom": "^18.3.1",
82+
"react-dom": "^19.2.7",
7883
"react-sticky": "^6.0.3",
79-
"typescript": "^5.9.3",
80-
"cross-env": "^10.1.0"
84+
"typescript": "^6.0.3",
85+
"typescript-eslint": "^8.62.1"
8186
},
8287
"peerDependencies": {
8388
"react": ">=16.9.0",

src/hooks/useIndicator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const useIndicator = (options: UseIndicatorOptions) => {
2020
const { size, align = 'center' } = indicator;
2121

2222
const [inkStyle, setInkStyle] = useState<React.CSSProperties>();
23-
const inkBarRafRef = useRef<number>();
23+
const inkBarRafRef = useRef<number | undefined>(undefined);
2424

2525
const getLength = React.useCallback(
2626
(origin: number) => {

src/hooks/useTouchMove.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function useTouchMove(
1818
const [lastTimestamp, setLastTimestamp] = useState<number>(0);
1919
const [lastTimeDiff, setLastTimeDiff] = useState<number>(0);
2020
const [lastOffset, setLastOffset] = useState<{ x: number; y: number }>();
21-
const motionRef = useRef<number>();
21+
const motionRef = useRef<number | undefined>(undefined);
2222

2323
// ========================= Events =========================
2424
// >>> Touch events
@@ -76,7 +76,7 @@ export default function useTouchMove(
7676
}
7777

7878
// >>> Wheel event
79-
const lastWheelDirectionRef = useRef<'x' | 'y'>();
79+
const lastWheelDirectionRef = useRef<'x' | 'y' | undefined>(undefined);
8080

8181
function onWheel(e: WheelEvent) {
8282
const { deltaX, deltaY } = e;

src/hooks/useUpdate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useRef, useState } from 'react';
88
export default function useUpdate(callback: VoidFunction): () => void {
99
const [count, setCount] = useState(0);
1010
const effectRef = useRef(0);
11-
const callbackRef = useRef<VoidFunction>();
11+
const callbackRef = useRef<VoidFunction | undefined>(undefined);
1212
callbackRef.current = callback;
1313

1414
// Trigger on `useLayoutEffect`

0 commit comments

Comments
 (0)