Skip to content

Commit d65fa50

Browse files
committed
chore: update maintenance dependencies
1 parent 601bc3c commit d65fa50

9 files changed

Lines changed: 201 additions & 29 deletions

File tree

.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/tree-select</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>🌳 React TreeSelect component for choosing values from tree data, with search, checkable nodes, async loading, and virtual scrolling.</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/tree-select</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>

eslint.config.mjs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { FlatCompat } from '@eslint/eslintrc';
2+
import js from '@eslint/js';
3+
import tsEslintPlugin from '@typescript-eslint/eslint-plugin';
4+
import { createRequire } from 'node:module';
5+
import path from 'node:path';
6+
import { fileURLToPath } from 'node:url';
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const require = createRequire(import.meta.url);
11+
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all,
16+
});
17+
18+
const recommendedTsRules = new Set(Object.keys(tsEslintPlugin.configs.recommended.rules || {}));
19+
const noopRule = {
20+
meta: { type: 'problem', docs: {}, schema: [] },
21+
create: () => ({}),
22+
};
23+
24+
function normalizeConfig(config) {
25+
const next = { ...config };
26+
27+
if (next.plugins?.['@typescript-eslint']) {
28+
next.plugins = {
29+
...next.plugins,
30+
'@typescript-eslint': {
31+
...next.plugins['@typescript-eslint'],
32+
rules: {
33+
...next.plugins['@typescript-eslint'].rules,
34+
'ban-types': noopRule,
35+
},
36+
},
37+
};
38+
}
39+
40+
if (next.rules) {
41+
next.rules = Object.fromEntries(
42+
Object.entries(next.rules).filter(([ruleName]) => {
43+
if (!ruleName.startsWith('@typescript-eslint/')) {
44+
return true;
45+
}
46+
return recommendedTsRules.has(ruleName) || ruleName === '@typescript-eslint/ban-types';
47+
}),
48+
);
49+
}
50+
51+
return next;
52+
}
53+
54+
export default [
55+
{
56+
ignores: [
57+
'node_modules/',
58+
'coverage/',
59+
'es/',
60+
'lib/',
61+
'dist/',
62+
'docs-dist/',
63+
'.dumi/',
64+
'.doc/',
65+
'.vercel/',
66+
'.eslintrc.js',
67+
'src/index.d.ts',
68+
],
69+
},
70+
...compat.config(require('./.eslintrc.js')).map(normalizeConfig),
71+
{
72+
rules: {
73+
'@typescript-eslint/ban-types': 'off',
74+
'@typescript-eslint/no-empty-object-type': 'off',
75+
'@typescript-eslint/no-unsafe-function-type': 'off',
76+
'@typescript-eslint/no-unused-vars': 'off',
77+
},
78+
},
79+
];

global.d.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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 namespace JSX {
12+
type Element = React.JSX.Element;
13+
interface ElementClass extends React.JSX.ElementClass {}
14+
interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
15+
interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
16+
type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
17+
interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
18+
interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
19+
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
20+
}
21+
22+
declare namespace jest {
23+
interface Matchers<R> {
24+
lastCalledWith(...expected: unknown[]): R;
25+
nthCalledWith(nthCall: number, ...expected: unknown[]): R;
26+
toBeCalled(): R;
27+
toBeCalledTimes(expected: number): R;
28+
toBeCalledWith(...expected: unknown[]): R;
29+
}
30+
}
31+
32+
declare const vi: {
33+
fn: <T extends (...args: any[]) => any = (...args: any[]) => any>(
34+
implementation?: T,
35+
) => jest.MockedFunction<T>;
36+
mock: (moduleName: string, factory?: (importOriginal: <T>() => Promise<T>) => unknown) => void;
37+
spyOn: typeof jest.spyOn;
38+
useFakeTimers: () => void;
39+
useRealTimers: () => void;
40+
advanceTimersByTime: (msToRun: number) => void;
41+
clearAllTimers: () => void;
42+
runAllTimers: () => void;
43+
importActual: <T>(moduleName: string) => Promise<T>;
44+
clearAllMocks: () => void;
45+
resetAllMocks: () => void;
46+
restoreAllMocks: () => void;
47+
};
48+
49+
declare const describe: any;
50+
declare const it: any;
51+
declare const test: any;
52+
declare const beforeEach: any;
53+
declare const afterEach: any;
54+
declare const beforeAll: any;
55+
declare const afterAll: any;
56+
declare const expect: any;
57+
58+
declare module 'moment/locale/zh-cn';

package.json

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,29 +55,37 @@
5555
"@rc-component/np": "^1.0.4",
5656
"@rc-component/trigger": "^3.0.0",
5757
"@rc-component/virtual-list": "^1.0.1",
58-
"@testing-library/react": "^15.0.7",
59-
"@types/jest": "^29.5.14",
58+
"@testing-library/react": "^16.3.2",
59+
"@types/jest": "^30.0.0",
6060
"@types/node": "^26.0.1",
61-
"@types/react": "^18.3.31",
62-
"@types/react-dom": "^18.3.7",
61+
"@types/react": "^19.2.17",
62+
"@types/react-dom": "^19.2.3",
6363
"@types/warning": "^3.0.4",
64-
"@typescript-eslint/eslint-plugin": "^5.62.0",
65-
"@typescript-eslint/parser": "^5.62.0",
64+
"@typescript-eslint/eslint-plugin": "^8.62.0",
65+
"@typescript-eslint/parser": "^8.62.0",
6666
"@umijs/fabric": "^4.0.1",
6767
"cross-env": "^10.1.0",
6868
"dumi": "^2.4.35",
69-
"eslint": "^8.57.1",
70-
"eslint-plugin-jest": "^27.9.0",
71-
"eslint-plugin-unicorn": "^56.0.1",
69+
"eslint": "^9.39.4",
70+
"eslint-plugin-jest": "^29.15.3",
71+
"eslint-plugin-unicorn": "^65.0.1",
7272
"father": "^4.6.23",
7373
"glob": "^13.0.6",
7474
"husky": "^9.1.7",
75-
"lint-staged": "^16.4.0",
75+
"lint-staged": "^17.0.8",
7676
"prettier": "^3.9.0",
7777
"rc-test": "^7.1.3",
78-
"react": "^18.3.1",
79-
"react-dom": "^18.3.1",
80-
"typescript": "^5.9.3"
78+
"react": "^19.2.7",
79+
"react-dom": "^19.2.7",
80+
"typescript": "^6.0.3",
81+
"@eslint/eslintrc": "^3.3.5",
82+
"@eslint/js": "^9.39.4",
83+
"eslint-plugin-react": "^7.37.5",
84+
"eslint-plugin-react-hooks": "^7.1.1",
85+
"eslint-config-prettier": "^10.1.8",
86+
"@babel/eslint-parser": "^7.29.7",
87+
"@babel/eslint-plugin": "^7.29.7",
88+
"@testing-library/jest-dom": "^6.9.1"
8189
},
8290
"peerDependencies": {
8391
"react": "*",

react-compat.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import * as React from 'react';
2+
3+
declare module 'react' {
4+
type ReactText = string | number;
5+
function useRef<T = undefined>(): React.MutableRefObject<T | undefined>;
6+
function isValidElement<P = any>(object: {} | null | undefined): object is React.ReactElement<P>;
7+
function cloneElement<P = any>(
8+
element: React.ReactElement<P>,
9+
props?: (Partial<P> & React.Attributes) | null,
10+
...children: React.ReactNode[]
11+
): React.ReactElement<P>;
12+
}
13+
14+
declare module 'react-dom' {
15+
function hydrate(element: React.ReactNode, container: Element | DocumentFragment): void;
16+
}

src/utils/legacyUtil.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import TreeNode from '../TreeNode';
1111

1212
export function convertChildrenToData(nodes: React.ReactNode): DataNode[] {
1313
return toArray(nodes)
14-
.map((node: React.ReactElement) => {
14+
.map((node: React.ReactElement<any>) => {
1515
if (!React.isValidElement(node) || !node.type) {
1616
return null;
1717
}
1818

1919
const {
2020
key,
2121
props: { children, value, ...restProps },
22-
} = node as React.ReactElement;
22+
} = node as React.ReactElement<any>;
2323

2424
const data = {
2525
key,
@@ -119,12 +119,12 @@ export function fillAdditionalInfo(
119119
node: {
120120
props: { value: val1 },
121121
},
122-
},
122+
}: { node: React.ReactElement<any> },
123123
{
124124
node: {
125125
props: { value: val2 },
126126
},
127-
},
127+
}: { node: React.ReactElement<any> },
128128
) => {
129129
const index1 = checkedValues.indexOf(val1);
130130
const index2 = checkedValues.indexOf(val2);

tsconfig.json

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,22 @@
88
"skipLibCheck": true,
99
"esModuleInterop": true,
1010
"paths": {
11-
"@/*": [
12-
"src/*"
13-
],
14-
"@@/*": [
15-
".dumi/tmp/*"
16-
],
17-
"@rc-component/tree-select": [
18-
"src/index.tsx"
19-
]
11+
"@/*": ["src/*"],
12+
"@@/*": [".dumi/tmp/*"],
13+
"@rc-component/tree-select": ["src/index.tsx"]
2014
},
21-
"ignoreDeprecations": "5.0"
15+
"ignoreDeprecations": "6.0",
16+
"noImplicitAny": false,
17+
"strictNullChecks": false,
18+
"strictPropertyInitialization": false,
19+
"strictFunctionTypes": false,
20+
"strict": false,
21+
"noImplicitThis": false,
22+
"strictBindCallApply": false
2223
},
2324
"include": [
25+
"react-compat.d.ts",
26+
"global.d.ts",
2427
".dumirc.ts",
2528
".fatherrc.ts",
2629
"src",

0 commit comments

Comments
 (0)