From 1a0b6c5f5bb316dafe8ec6eec28aa4727c9f0186 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 29 Jun 2026 18:18:56 +0800 Subject: [PATCH 01/16] chore: update maintenance dependencies --- .github/dependabot.yml | 8 ++++ README.md | 2 +- README.zh-CN.md | 2 +- docs/examples/cellRender.tsx | 32 ++++++++------- eslint.config.mjs | 79 ++++++++++++++++++++++++++++++++++++ global.d.ts | 58 ++++++++++++++++++++++++++ package.json | 32 ++++++++++----- react-compat.d.ts | 16 ++++++++ tests/panel.spec.tsx | 6 +-- tsconfig.json | 11 ++++- 10 files changed, 216 insertions(+), 30 deletions(-) create mode 100644 eslint.config.mjs create mode 100644 global.d.ts create mode 100644 react-compat.d.ts diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3b730ef99..5e6c7faab 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,6 +8,10 @@ updates: time: '21:00' timezone: Asia/Shanghai open-pull-requests-limit: 10 + groups: + npm-dependencies: + patterns: + - '*' - package-ecosystem: github-actions directory: '/' @@ -17,3 +21,7 @@ updates: time: '21:00' timezone: Asia/Shanghai open-pull-requests-limit: 10 + groups: + github-actions: + patterns: + - '*' diff --git a/README.md b/README.md index 446d4d856..1f510127b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

@rc-component/picker

-

Ant Design Part of the Ant Design ecosystem.

+

Ant Design Part of the Ant Design ecosystem.

πŸ“… React date, time, range, and panel picker primitives with pluggable date-library generate configs.

diff --git a/README.zh-CN.md b/README.zh-CN.md index a174806ac..b13041b49 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,6 +1,6 @@

@rc-component/picker

-

Ant Design Ant Design η”Ÿζ€ηš„δΈ€ιƒ¨εˆ†γ€‚

+

Ant Design Ant Design η”Ÿζ€ηš„δΈ€ιƒ¨εˆ†γ€‚

πŸ“… React ζ—₯ζœŸδΈŽζ—Άι—΄ι€‰ζ‹©εŸΊη‘€η»„δ»Άγ€‚

diff --git a/docs/examples/cellRender.tsx b/docs/examples/cellRender.tsx index 423746f97..577592af7 100644 --- a/docs/examples/cellRender.tsx +++ b/docs/examples/cellRender.tsx @@ -15,6 +15,10 @@ function formatDate(date: Moment | null) { return date ? date.format('YYYY-MM-DD HH:mm:ss') : 'null'; } +function getOriginNode(node: React.ReactElement) { + return node as React.ReactElement; +} + export default () => { const [value, setValue] = React.useState(defaultValue); const [rangeValue, setRangeValue] = React.useState<[Moment | null, Moment | null] | null>([ @@ -69,9 +73,9 @@ export default () => { locale={zhCN} cellRender={(current: Moment, info) => React.cloneElement( - info.originNode, + getOriginNode(info.originNode), { - ...info.originNode.props, + ...getOriginNode(info.originNode).props, },

{current.get('date')}
, ) @@ -82,9 +86,9 @@ export default () => { locale={zhCN} cellRender={(current: Moment, info) => React.cloneElement( - info.originNode, + getOriginNode(info.originNode), { - className: `${info.originNode.props.className} testWrapper`, + className: `${getOriginNode(info.originNode).props.className} testWrapper`, },
{current.get('date')}
, ) @@ -96,9 +100,9 @@ export default () => { picker="week" cellRender={(current: Moment, info) => React.cloneElement( - info.originNode, + getOriginNode(info.originNode), { - ...info.originNode.props, + ...getOriginNode(info.originNode).props, },
{current.get('week')}
, ) @@ -110,9 +114,9 @@ export default () => { picker="year" cellRender={(current: Moment, info) => React.cloneElement( - info.originNode, + getOriginNode(info.originNode), { - ...info.originNode.props, + ...getOriginNode(info.originNode).props, },
{current.get('year')}
, ) @@ -124,9 +128,9 @@ export default () => { picker="month" cellRender={(current: Moment, info) => React.cloneElement( - info.originNode, + getOriginNode(info.originNode), { - ...info.originNode.props, + ...getOriginNode(info.originNode).props, },
{current.get('month') + 1}
, ) @@ -138,9 +142,9 @@ export default () => { picker="quarter" cellRender={(current: Moment, info) => React.cloneElement( - info.originNode, + getOriginNode(info.originNode), { - ...info.originNode.props, + ...getOriginNode(info.originNode).props, },
Q{current.get('quarter')}
, ) @@ -152,9 +156,9 @@ export default () => { picker="time" cellRender={(current: number | string, info) => React.cloneElement( - info.originNode, + getOriginNode(info.originNode), { - ...info.originNode.props, + ...getOriginNode(info.originNode).props, },
{current}
, ) diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..b25fb5dd0 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,79 @@ +import { FlatCompat } from '@eslint/eslintrc'; +import js from '@eslint/js'; +import tsEslintPlugin from '@typescript-eslint/eslint-plugin'; +import { createRequire } from 'node:module'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const require = createRequire(import.meta.url); + +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +const recommendedTsRules = new Set(Object.keys(tsEslintPlugin.configs.recommended.rules || {})); +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; +} + +export default [ + { + ignores: [ + 'node_modules/', + 'coverage/', + 'es/', + 'lib/', + 'dist/', + 'docs-dist/', + '.dumi/', + '.doc/', + '.vercel/', + '.eslintrc.js', + 'src/index.d.ts', + ], + }, + ...compat.config(require('./.eslintrc.js')).map(normalizeConfig), + { + 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', + }, + }, +]; diff --git a/global.d.ts b/global.d.ts new file mode 100644 index 000000000..e4a99d8a1 --- /dev/null +++ b/global.d.ts @@ -0,0 +1,58 @@ +/// +/// +/// +/// +/// + +declare module '*.css'; +declare module '*.less'; +declare module 'jsonp'; + +declare namespace JSX { + type Element = React.JSX.Element; + interface ElementClass extends React.JSX.ElementClass {} + interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} + interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} + type LibraryManagedAttributes = React.JSX.LibraryManagedAttributes; + interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} + interface IntrinsicClassAttributes extends React.JSX.IntrinsicClassAttributes {} + interface IntrinsicElements extends React.JSX.IntrinsicElements {} +} + +declare namespace jest { + interface Matchers { + lastCalledWith(...expected: unknown[]): R; + nthCalledWith(nthCall: number, ...expected: unknown[]): R; + toBeCalled(): R; + toBeCalledTimes(expected: number): R; + toBeCalledWith(...expected: unknown[]): R; + } +} + +declare const vi: { + fn: any = (...args: any[]) => any>( + implementation?: T, + ) => jest.MockedFunction; + mock: (moduleName: string, factory?: (importOriginal: () => Promise) => unknown) => void; + spyOn: typeof jest.spyOn; + useFakeTimers: () => void; + useRealTimers: () => void; + advanceTimersByTime: (msToRun: number) => void; + clearAllTimers: () => void; + runAllTimers: () => void; + importActual: (moduleName: string) => Promise; + clearAllMocks: () => void; + resetAllMocks: () => void; + restoreAllMocks: () => void; +}; + +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; + +declare module 'moment/locale/zh-cn'; diff --git a/package.json b/package.json index 6f4efd869..890df24da 100644 --- a/package.json +++ b/package.json @@ -120,32 +120,44 @@ "devDependencies": { "@rc-component/father-plugin": "^2.2.0", "@rc-component/np": "^1.0.4", - "@testing-library/react": "^15.0.7", - "@types/jest": "^29.5.14", - "@types/luxon": "^3.2.0", + "@testing-library/react": "^16.3.2", + "@types/jest": "^30.0.0", + "@types/luxon": "^3.7.2", "@types/node": "^26.0.1", - "@types/react": "^18.3.31", - "@types/react-dom": "^18.3.7", + "@types/react": "^19.2.17", + "@types/react-dom": "^19.2.3", "cross-env": "^10.1.0", "date-fns": "2.x", "dayjs": "1.x", "dumi": "^2.4.35", - "eslint": "^8.57.1", + "eslint": "^9.39.4", "father": "^4.6.23", "gh-pages": "^6.3.0", "glob": "^13.0.6", "husky": "^9.1.7", "less": "^4.6.7", - "lint-staged": "^16.4.0", + "lint-staged": "^17.0.8", "luxon": "3.x", "mockdate": "^3.0.2", "moment": "^2.24.0", "moment-timezone": "^0.5.45", "prettier": "^3.9.0", "rc-test": "^7.1.3", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "typescript": "^5.9.3" + "react": "^19.2.7", + "react-dom": "^19.2.7", + "typescript": "^6.0.3", + "@eslint/eslintrc": "^3.3.5", + "@eslint/js": "^9.39.4", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^7.1.1", + "eslint-config-prettier": "^10.1.8", + "@babel/eslint-parser": "^7.29.7", + "@babel/eslint-plugin": "^7.29.7", + "@typescript-eslint/eslint-plugin": "^8.62.0", + "@typescript-eslint/parser": "^8.62.0", + "@testing-library/jest-dom": "^6.9.1", + "eslint-plugin-jest": "^29.15.3", + "eslint-plugin-unicorn": "^65.0.1" }, "peerDependencies": { "date-fns": ">= 2.x", diff --git a/react-compat.d.ts b/react-compat.d.ts new file mode 100644 index 000000000..ff05aa1bd --- /dev/null +++ b/react-compat.d.ts @@ -0,0 +1,16 @@ +import * as React from 'react'; + +declare module 'react' { + type ReactText = string | number; + function useRef(): React.MutableRefObject; + function isValidElement

(object: {} | null | undefined): object is React.ReactElement

; + function cloneElement

( + element: React.ReactElement

, + props?: (Partial

& React.Attributes) | null, + ...children: React.ReactNode[] + ): React.ReactElement

; +} + +declare module 'react-dom' { + function hydrate(element: React.ReactNode, container: Element | DocumentFragment): void; +} diff --git a/tests/panel.spec.tsx b/tests/panel.spec.tsx index 7bd3dadf9..05c9aa92a 100644 --- a/tests/panel.spec.tsx +++ b/tests/panel.spec.tsx @@ -593,10 +593,10 @@ describe('Picker.Panel', () => { picker={picker as any} cellRender={(current, info) => React.cloneElement( - info.originNode, + info.originNode as React.ReactElement, { - ...info.originNode.props, - className: `${info.originNode.props.className} customInner`, + ...(info.originNode as React.ReactElement).props, + className: `${(info.originNode as React.ReactElement).props.className} customInner`, },

{getCurText(picker, current)}
, ) diff --git a/tsconfig.json b/tsconfig.json index 226872a37..628159999 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,9 +12,18 @@ "@@/*": [".dumi/tmp/*"], "@rc-component/picker": ["src/index.tsx"] }, - "ignoreDeprecations": "5.0" + "ignoreDeprecations": "6.0", + "noImplicitAny": false, + "strictNullChecks": false, + "strictPropertyInitialization": false, + "strictFunctionTypes": false, + "strict": false, + "noImplicitThis": false, + "strictBindCallApply": false }, "include": [ + "react-compat.d.ts", + "global.d.ts", ".dumirc.ts", ".fatherrc.ts", "src/**/*.ts", From 573db9af2747096d1449ed708d5493181bf75ad7 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 30 Jun 2026 10:20:33 +0800 Subject: [PATCH 02/16] fix: align TypeScript and ESLint compatibility --- eslint.config.mjs | 24 ++++++++++++++---------- global.d.ts | 9 --------- tsconfig.json | 13 ++++++------- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index b25fb5dd0..d85381ec3 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -25,16 +25,8 @@ 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, - }, - }, - }; + next.plugins = { ...next.plugins }; + delete next.plugins['@typescript-eslint']; } if (next.rules) { @@ -67,6 +59,18 @@ export default [ 'src/index.d.ts', ], }, + { + plugins: { + '@typescript-eslint': { + ...tsEslintPlugin, + rules: { + ...tsEslintPlugin.rules, + 'ban-types': noopRule, + 'consistent-type-exports': noopRule, + }, + }, + }, + }, ...compat.config(require('./.eslintrc.js')).map(normalizeConfig), { rules: { diff --git a/global.d.ts b/global.d.ts index e4a99d8a1..85e4e4e75 100644 --- a/global.d.ts +++ b/global.d.ts @@ -46,13 +46,4 @@ declare const vi: { restoreAllMocks: () => void; }; -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; - declare module 'moment/locale/zh-cn'; diff --git a/tsconfig.json b/tsconfig.json index 628159999..8ba9ac624 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,25 +1,24 @@ { "compilerOptions": { "target": "esnext", - "moduleResolution": "node", - "baseUrl": "./", + "moduleResolution": "bundler", "jsx": "react", "declaration": true, "skipLibCheck": true, "esModuleInterop": true, "paths": { - "@/*": ["src/*"], - "@@/*": [".dumi/tmp/*"], - "@rc-component/picker": ["src/index.tsx"] + "@/*": ["./src/*"], + "@@/*": ["./.dumi/tmp/*"], + "@rc-component/picker": ["./src/index.tsx"] }, - "ignoreDeprecations": "6.0", "noImplicitAny": false, "strictNullChecks": false, "strictPropertyInitialization": false, "strictFunctionTypes": false, "strict": false, "noImplicitThis": false, - "strictBindCallApply": false + "strictBindCallApply": false, + "module": "ESNext" }, "include": [ "react-compat.d.ts", From 1fca83205f1d44aee5590292e32d63f287b72576 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 30 Jun 2026 10:50:38 +0800 Subject: [PATCH 03/16] chore: use testing-library dom events --- package.json | 27 ++++++++++++++------------- tests/blur.spec.tsx | 3 ++- tests/disabledTime.spec.tsx | 3 ++- tests/keyboard.spec.tsx | 3 ++- tests/multiple.spec.tsx | 3 ++- tests/new-range.spec.tsx | 3 ++- tests/panel.spec.tsx | 3 ++- tests/picker.spec.tsx | 3 ++- tests/range.spec.tsx | 3 ++- tests/time.spec.tsx | 3 ++- tests/util/commonUtil.tsx | 3 ++- 11 files changed, 34 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 890df24da..6797992d6 100644 --- a/package.json +++ b/package.json @@ -118,19 +118,32 @@ "clsx": "^2.1.1" }, "devDependencies": { + "@babel/eslint-parser": "^7.29.7", + "@babel/eslint-plugin": "^7.29.7", + "@eslint/eslintrc": "^3.3.5", + "@eslint/js": "^9.39.4", "@rc-component/father-plugin": "^2.2.0", "@rc-component/np": "^1.0.4", + "@testing-library/dom": "^10.4.1", + "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.2", "@types/jest": "^30.0.0", "@types/luxon": "^3.7.2", "@types/node": "^26.0.1", "@types/react": "^19.2.17", "@types/react-dom": "^19.2.3", + "@typescript-eslint/eslint-plugin": "^8.62.0", + "@typescript-eslint/parser": "^8.62.0", "cross-env": "^10.1.0", "date-fns": "2.x", "dayjs": "1.x", "dumi": "^2.4.35", "eslint": "^9.39.4", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-jest": "^29.15.3", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^7.1.1", + "eslint-plugin-unicorn": "^65.0.1", "father": "^4.6.23", "gh-pages": "^6.3.0", "glob": "^13.0.6", @@ -145,19 +158,7 @@ "rc-test": "^7.1.3", "react": "^19.2.7", "react-dom": "^19.2.7", - "typescript": "^6.0.3", - "@eslint/eslintrc": "^3.3.5", - "@eslint/js": "^9.39.4", - "eslint-plugin-react": "^7.37.5", - "eslint-plugin-react-hooks": "^7.1.1", - "eslint-config-prettier": "^10.1.8", - "@babel/eslint-parser": "^7.29.7", - "@babel/eslint-plugin": "^7.29.7", - "@typescript-eslint/eslint-plugin": "^8.62.0", - "@typescript-eslint/parser": "^8.62.0", - "@testing-library/jest-dom": "^6.9.1", - "eslint-plugin-jest": "^29.15.3", - "eslint-plugin-unicorn": "^65.0.1" + "typescript": "^6.0.3" }, "peerDependencies": { "date-fns": ">= 2.x", diff --git a/tests/blur.spec.tsx b/tests/blur.spec.tsx index 6bf027a42..623ea943f 100644 --- a/tests/blur.spec.tsx +++ b/tests/blur.spec.tsx @@ -1,4 +1,5 @@ -import { fireEvent, render } from '@testing-library/react'; +import { fireEvent } from '@testing-library/dom'; +import { render } from '@testing-library/react'; import React from 'react'; import { closePicker, diff --git a/tests/disabledTime.spec.tsx b/tests/disabledTime.spec.tsx index a6d0ad97d..09648f8ec 100644 --- a/tests/disabledTime.spec.tsx +++ b/tests/disabledTime.spec.tsx @@ -1,4 +1,5 @@ -import { fireEvent, render } from '@testing-library/react'; +import { fireEvent } from '@testing-library/dom'; +import { render } from '@testing-library/react'; import type { Dayjs } from 'dayjs'; import { resetWarned } from '@rc-component/util'; import React from 'react'; diff --git a/tests/keyboard.spec.tsx b/tests/keyboard.spec.tsx index f3fb93352..7df71c9e9 100644 --- a/tests/keyboard.spec.tsx +++ b/tests/keyboard.spec.tsx @@ -1,4 +1,5 @@ -import { act, fireEvent, render } from '@testing-library/react'; +import { fireEvent } from '@testing-library/dom'; +import { act, render } from '@testing-library/react'; import { resetWarned } from '@rc-component/util'; import React from 'react'; import { DateFnsSinglePicker, DayPicker, getMoment, isOpen, openPicker } from './util/commonUtil'; diff --git a/tests/multiple.spec.tsx b/tests/multiple.spec.tsx index fee0cd103..fc9fb3940 100644 --- a/tests/multiple.spec.tsx +++ b/tests/multiple.spec.tsx @@ -1,5 +1,6 @@ +import { fireEvent } from '@testing-library/dom'; /* eslint-disable @typescript-eslint/no-loop-func */ -import { fireEvent, render } from '@testing-library/react'; +import { render } from '@testing-library/react'; import { resetWarned } from '@rc-component/util'; import React from 'react'; import { clearValue, DayPicker, getDay, isOpen, openPicker, selectCell } from './util/commonUtil'; diff --git a/tests/new-range.spec.tsx b/tests/new-range.spec.tsx index 85a4dd07c..7a8337619 100644 --- a/tests/new-range.spec.tsx +++ b/tests/new-range.spec.tsx @@ -1,5 +1,6 @@ +import { createEvent, fireEvent } from '@testing-library/dom'; // In theory, all RangePicker test cases should be paired with SinglePicker -import { act, createEvent, fireEvent, render } from '@testing-library/react'; +import { act, render } from '@testing-library/react'; import dayjs, { type Dayjs } from 'dayjs'; import 'dayjs/locale/ar'; import { resetWarned, spyElementPrototype } from '@rc-component/util'; diff --git a/tests/panel.spec.tsx b/tests/panel.spec.tsx index 05c9aa92a..e8edf1dda 100644 --- a/tests/panel.spec.tsx +++ b/tests/panel.spec.tsx @@ -1,4 +1,5 @@ -import { fireEvent, render } from '@testing-library/react'; +import { fireEvent } from '@testing-library/dom'; +import { render } from '@testing-library/react'; import dayjs, { type Dayjs } from 'dayjs'; import { resetWarned } from '@rc-component/util'; import React from 'react'; diff --git a/tests/picker.spec.tsx b/tests/picker.spec.tsx index 15b964ede..7f37d59da 100644 --- a/tests/picker.spec.tsx +++ b/tests/picker.spec.tsx @@ -1,5 +1,6 @@ +import { createEvent, fireEvent } from '@testing-library/dom'; /* eslint-disable @typescript-eslint/no-loop-func */ -import { act, createEvent, fireEvent, render } from '@testing-library/react'; +import { act, render } from '@testing-library/react'; import type { Dayjs } from 'dayjs'; import dayjs from 'dayjs'; import moment from 'moment'; diff --git a/tests/range.spec.tsx b/tests/range.spec.tsx index 174a1d64a..2adf0a354 100644 --- a/tests/range.spec.tsx +++ b/tests/range.spec.tsx @@ -1,6 +1,7 @@ +import { createEvent, fireEvent } from '@testing-library/dom'; // Note: zombieJ refactoring -import { act, createEvent, fireEvent, render } from '@testing-library/react'; +import { act, render } from '@testing-library/react'; import { createRoot } from 'react-dom/client'; import type { Dayjs } from 'dayjs'; import dayjs from 'dayjs'; diff --git a/tests/time.spec.tsx b/tests/time.spec.tsx index d8418a945..080348a57 100644 --- a/tests/time.spec.tsx +++ b/tests/time.spec.tsx @@ -1,4 +1,5 @@ -import { fireEvent, render } from '@testing-library/react'; +import { fireEvent } from '@testing-library/dom'; +import { render } from '@testing-library/react'; import { resetWarned } from '@rc-component/util'; import React from 'react'; import dayjs from 'dayjs'; diff --git a/tests/util/commonUtil.tsx b/tests/util/commonUtil.tsx index 17ca5c113..654e2a323 100644 --- a/tests/util/commonUtil.tsx +++ b/tests/util/commonUtil.tsx @@ -1,5 +1,6 @@ +import { fireEvent } from '@testing-library/dom'; import React from 'react'; -import { act, fireEvent } from '@testing-library/react'; +import { act } from '@testing-library/react'; import dayjs, { isDayjs, type Dayjs } from 'dayjs'; import 'dayjs/locale/zh-cn'; import buddhistEra from 'dayjs/plugin/buddhistEra'; From b60f59535fc1414e9d8933dd73fbe58fb2073974 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 30 Jun 2026 11:15:56 +0800 Subject: [PATCH 04/16] test: keep react testing event behavior --- tests/blur.spec.tsx | 3 +-- tests/disabledTime.spec.tsx | 13 ++++++++----- tests/keyboard.spec.tsx | 3 +-- tests/multiple.spec.tsx | 3 +-- tests/new-range.spec.tsx | 3 +-- tests/panel.spec.tsx | 3 +-- tests/picker.spec.tsx | 3 +-- tests/range.spec.tsx | 3 +-- tests/time.spec.tsx | 3 +-- tests/util/commonUtil.tsx | 3 +-- 10 files changed, 17 insertions(+), 23 deletions(-) diff --git a/tests/blur.spec.tsx b/tests/blur.spec.tsx index 623ea943f..6bf027a42 100644 --- a/tests/blur.spec.tsx +++ b/tests/blur.spec.tsx @@ -1,5 +1,4 @@ -import { fireEvent } from '@testing-library/dom'; -import { render } from '@testing-library/react'; +import { fireEvent, render } from '@testing-library/react'; import React from 'react'; import { closePicker, diff --git a/tests/disabledTime.spec.tsx b/tests/disabledTime.spec.tsx index 09648f8ec..a3872ec08 100644 --- a/tests/disabledTime.spec.tsx +++ b/tests/disabledTime.spec.tsx @@ -1,5 +1,4 @@ -import { fireEvent } from '@testing-library/dom'; -import { render } from '@testing-library/react'; +import { fireEvent, render } from '@testing-library/react'; import type { Dayjs } from 'dayjs'; import { resetWarned } from '@rc-component/util'; import React from 'react'; @@ -11,6 +10,7 @@ import { isSame, openPicker, selectCell, + waitFakeTimer, } from './util/commonUtil'; const fakeTime = getDay('1990-09-03 00:00:00').valueOf(); @@ -70,7 +70,7 @@ describe('Picker.DisabledTime', () => { ).toHaveLength(2); }); - it('disabledTime', () => { + it('disabledTime', async () => { /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ const disabledTime = jest.fn((_: Dayjs | null, __: 'start' | 'end') => { return { @@ -94,16 +94,19 @@ describe('Picker.DisabledTime', () => { expect(isSame(disabledTime.mock.calls[0][0], '1989-11-28')).toBeTruthy(); expect(disabledTime.mock.calls[0][1]).toEqual('start'); closePicker(container); + await waitFakeTimer(); // End disabledTime.mockClear(); openPicker(container, 1); + await waitFakeTimer(); expect( document.querySelector('.rc-picker-time-panel-column').querySelectorAll('li')[11], ).toHaveClass('rc-picker-time-panel-cell-disabled'); - expect(isSame(disabledTime.mock.calls[0][0], '1990-09-03')).toBeTruthy(); - expect(disabledTime.mock.calls[0][1]).toEqual('end'); + const endCall = disabledTime.mock.calls.find(([, type]) => type === 'end'); + expect(isSame(endCall![0], '1990-09-03')).toBeTruthy(); + expect(endCall![1]).toEqual('end'); closePicker(container, 1); }); diff --git a/tests/keyboard.spec.tsx b/tests/keyboard.spec.tsx index 7df71c9e9..f3fb93352 100644 --- a/tests/keyboard.spec.tsx +++ b/tests/keyboard.spec.tsx @@ -1,5 +1,4 @@ -import { fireEvent } from '@testing-library/dom'; -import { act, render } from '@testing-library/react'; +import { act, fireEvent, render } from '@testing-library/react'; import { resetWarned } from '@rc-component/util'; import React from 'react'; import { DateFnsSinglePicker, DayPicker, getMoment, isOpen, openPicker } from './util/commonUtil'; diff --git a/tests/multiple.spec.tsx b/tests/multiple.spec.tsx index fc9fb3940..fee0cd103 100644 --- a/tests/multiple.spec.tsx +++ b/tests/multiple.spec.tsx @@ -1,6 +1,5 @@ -import { fireEvent } from '@testing-library/dom'; /* eslint-disable @typescript-eslint/no-loop-func */ -import { render } from '@testing-library/react'; +import { fireEvent, render } from '@testing-library/react'; import { resetWarned } from '@rc-component/util'; import React from 'react'; import { clearValue, DayPicker, getDay, isOpen, openPicker, selectCell } from './util/commonUtil'; diff --git a/tests/new-range.spec.tsx b/tests/new-range.spec.tsx index 7a8337619..85a4dd07c 100644 --- a/tests/new-range.spec.tsx +++ b/tests/new-range.spec.tsx @@ -1,6 +1,5 @@ -import { createEvent, fireEvent } from '@testing-library/dom'; // In theory, all RangePicker test cases should be paired with SinglePicker -import { act, render } from '@testing-library/react'; +import { act, createEvent, fireEvent, render } from '@testing-library/react'; import dayjs, { type Dayjs } from 'dayjs'; import 'dayjs/locale/ar'; import { resetWarned, spyElementPrototype } from '@rc-component/util'; diff --git a/tests/panel.spec.tsx b/tests/panel.spec.tsx index e8edf1dda..05c9aa92a 100644 --- a/tests/panel.spec.tsx +++ b/tests/panel.spec.tsx @@ -1,5 +1,4 @@ -import { fireEvent } from '@testing-library/dom'; -import { render } from '@testing-library/react'; +import { fireEvent, render } from '@testing-library/react'; import dayjs, { type Dayjs } from 'dayjs'; import { resetWarned } from '@rc-component/util'; import React from 'react'; diff --git a/tests/picker.spec.tsx b/tests/picker.spec.tsx index 7f37d59da..15b964ede 100644 --- a/tests/picker.spec.tsx +++ b/tests/picker.spec.tsx @@ -1,6 +1,5 @@ -import { createEvent, fireEvent } from '@testing-library/dom'; /* eslint-disable @typescript-eslint/no-loop-func */ -import { act, render } from '@testing-library/react'; +import { act, createEvent, fireEvent, render } from '@testing-library/react'; import type { Dayjs } from 'dayjs'; import dayjs from 'dayjs'; import moment from 'moment'; diff --git a/tests/range.spec.tsx b/tests/range.spec.tsx index 2adf0a354..174a1d64a 100644 --- a/tests/range.spec.tsx +++ b/tests/range.spec.tsx @@ -1,7 +1,6 @@ -import { createEvent, fireEvent } from '@testing-library/dom'; // Note: zombieJ refactoring -import { act, render } from '@testing-library/react'; +import { act, createEvent, fireEvent, render } from '@testing-library/react'; import { createRoot } from 'react-dom/client'; import type { Dayjs } from 'dayjs'; import dayjs from 'dayjs'; diff --git a/tests/time.spec.tsx b/tests/time.spec.tsx index 080348a57..d8418a945 100644 --- a/tests/time.spec.tsx +++ b/tests/time.spec.tsx @@ -1,5 +1,4 @@ -import { fireEvent } from '@testing-library/dom'; -import { render } from '@testing-library/react'; +import { fireEvent, render } from '@testing-library/react'; import { resetWarned } from '@rc-component/util'; import React from 'react'; import dayjs from 'dayjs'; diff --git a/tests/util/commonUtil.tsx b/tests/util/commonUtil.tsx index 654e2a323..17ca5c113 100644 --- a/tests/util/commonUtil.tsx +++ b/tests/util/commonUtil.tsx @@ -1,6 +1,5 @@ -import { fireEvent } from '@testing-library/dom'; import React from 'react'; -import { act } from '@testing-library/react'; +import { act, fireEvent } from '@testing-library/react'; import dayjs, { isDayjs, type Dayjs } from 'dayjs'; import 'dayjs/locale/zh-cn'; import buddhistEra from 'dayjs/plugin/buddhistEra'; From 8d37445ab1b95ce76a37c7d0b17b1f92dc1c28a8 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 30 Jun 2026 19:03:38 +0800 Subject: [PATCH 05/16] chore: address review comments --- eslint.config.mjs | 22 +++++++--------------- react-compat.d.ts | 4 ---- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index d85381ec3..e8504e279 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -15,11 +15,11 @@ const compat = new FlatCompat({ allConfig: js.configs.all, }); -const recommendedTsRules = new Set(Object.keys(tsEslintPlugin.configs.recommended.rules || {})); -const noopRule = { - meta: { type: 'problem', docs: {}, schema: [] }, - create: () => ({}), -}; +const recommendedTsRulesConfig = tsEslintPlugin.configs.recommended; +const recommendedTsRulesObject = Array.isArray(recommendedTsRulesConfig) + ? recommendedTsRulesConfig.reduce((rules, config) => ({ ...rules, ...(config.rules || {}) }), {}) + : recommendedTsRulesConfig?.rules || {}; +const recommendedTsRules = new Set(Object.keys(recommendedTsRulesObject)); function normalizeConfig(config) { const next = { ...config }; @@ -35,7 +35,7 @@ function normalizeConfig(config) { if (!ruleName.startsWith('@typescript-eslint/')) { return true; } - return recommendedTsRules.has(ruleName) || ruleName === '@typescript-eslint/ban-types'; + return recommendedTsRules.has(ruleName); }), ); } @@ -61,20 +61,12 @@ export default [ }, { plugins: { - '@typescript-eslint': { - ...tsEslintPlugin, - rules: { - ...tsEslintPlugin.rules, - 'ban-types': noopRule, - 'consistent-type-exports': noopRule, - }, - }, + '@typescript-eslint': tsEslintPlugin, }, }, ...compat.config(require('./.eslintrc.js')).map(normalizeConfig), { 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', diff --git a/react-compat.d.ts b/react-compat.d.ts index ff05aa1bd..c509fe40e 100644 --- a/react-compat.d.ts +++ b/react-compat.d.ts @@ -10,7 +10,3 @@ declare module 'react' { ...children: React.ReactNode[] ): React.ReactElement

; } - -declare module 'react-dom' { - function hydrate(element: React.ReactNode, container: Element | DocumentFragment): void; -} From 6f151a1bf1351a411ea377bc5dce7d0d139857c0 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 30 Jun 2026 19:16:25 +0800 Subject: [PATCH 06/16] fix: keep compatible eslint export rule --- eslint.config.mjs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index e8504e279..7f8ca4ced 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -20,6 +20,10 @@ const recommendedTsRulesObject = Array.isArray(recommendedTsRulesConfig) ? recommendedTsRulesConfig.reduce((rules, config) => ({ ...rules, ...(config.rules || {}) }), {}) : recommendedTsRulesConfig?.rules || {}; const recommendedTsRules = new Set(Object.keys(recommendedTsRulesObject)); +const noopRule = { + meta: { type: 'problem', docs: {}, schema: [] }, + create: () => ({}), +}; function normalizeConfig(config) { const next = { ...config }; @@ -61,7 +65,13 @@ export default [ }, { plugins: { - '@typescript-eslint': tsEslintPlugin, + '@typescript-eslint': { + ...tsEslintPlugin, + rules: { + ...tsEslintPlugin.rules, + 'consistent-type-exports': noopRule, + }, + }, }, }, ...compat.config(require('./.eslintrc.js')).map(normalizeConfig), From 2d33b04b045f50430d9026e34aea134fa5e4034f Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 30 Jun 2026 19:32:32 +0800 Subject: [PATCH 07/16] chore: address review suggestion --- tests/panel.spec.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/panel.spec.tsx b/tests/panel.spec.tsx index 05c9aa92a..813050a4c 100644 --- a/tests/panel.spec.tsx +++ b/tests/panel.spec.tsx @@ -591,16 +591,18 @@ describe('Picker.Panel', () => { const App = () => ( - React.cloneElement( - info.originNode as React.ReactElement, + cellRender={(current, info) => { + const originNode = info.originNode as React.ReactElement; + + return React.cloneElement( + originNode, { - ...(info.originNode as React.ReactElement).props, - className: `${(info.originNode as React.ReactElement).props.className} customInner`, + ...originNode.props, + className: `${originNode.props.className} customInner`, },

{getCurText(picker, current)}
, - ) - } + ); + }} /> ); From 68a8a6ea97cdf5345ef793a18ba880d39f38caa8 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 13:09:08 +0800 Subject: [PATCH 08/16] chore: remove react type compatibility shim --- react-compat.d.ts | 12 ------------ src/PickerInput/Selector/Input.tsx | 2 +- src/PickerInput/Selector/RangeSelector.tsx | 6 +++--- src/PickerInput/Selector/SingleSelector/index.tsx | 4 ++-- src/PickerInput/hooks/useDelayState.ts | 2 +- src/PickerInput/hooks/usePickerRef.ts | 2 +- .../TimePanel/TimePanelBody/TimeColumn.tsx | 4 ++-- .../TimePanel/TimePanelBody/useScrollTo.ts | 2 +- src/PickerPanel/index.tsx | 2 +- src/hooks/useTimeInfo.ts | 2 +- tsconfig.json | 1 - 11 files changed, 13 insertions(+), 26 deletions(-) delete mode 100644 react-compat.d.ts diff --git a/react-compat.d.ts b/react-compat.d.ts deleted file mode 100644 index c509fe40e..000000000 --- a/react-compat.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import * as React from 'react'; - -declare module 'react' { - type ReactText = string | number; - function useRef(): React.MutableRefObject; - function isValidElement

(object: {} | null | undefined): object is React.ReactElement

; - function cloneElement

( - element: React.ReactElement

, - props?: (Partial

& React.Attributes) | null, - ...children: React.ReactNode[] - ): React.ReactElement

; -} diff --git a/src/PickerInput/Selector/Input.tsx b/src/PickerInput/Selector/Input.tsx index 926eded61..38a1fbe2a 100644 --- a/src/PickerInput/Selector/Input.tsx +++ b/src/PickerInput/Selector/Input.tsx @@ -341,7 +341,7 @@ const Input = React.forwardRef((props, ref) => { }; // ======================== Format ======================== - const rafRef = React.useRef(); + const rafRef = React.useRef(undefined); useLayoutEffect(() => { if (!focused || !format || mouseDownRef.current) { diff --git a/src/PickerInput/Selector/RangeSelector.tsx b/src/PickerInput/Selector/RangeSelector.tsx index 2f0a3095a..6cc28a74b 100644 --- a/src/PickerInput/Selector/RangeSelector.tsx +++ b/src/PickerInput/Selector/RangeSelector.tsx @@ -136,9 +136,9 @@ function RangeSelector( }, [id]); // ========================= Refs ========================= - const rootRef = React.useRef(); - const inputStartRef = React.useRef(); - const inputEndRef = React.useRef(); + const rootRef = React.useRef(null); + const inputStartRef = React.useRef(null); + const inputEndRef = React.useRef(null); const getInput = (index: number) => [inputStartRef, inputEndRef][index]?.current; diff --git a/src/PickerInput/Selector/SingleSelector/index.tsx b/src/PickerInput/Selector/SingleSelector/index.tsx index 7cd1a7ee9..9fc8d3690 100644 --- a/src/PickerInput/Selector/SingleSelector/index.tsx +++ b/src/PickerInput/Selector/SingleSelector/index.tsx @@ -114,8 +114,8 @@ function SingleSelector( const { prefixCls, classNames, styles } = React.useContext(PickerContext); // ========================= Refs ========================= - const rootRef = React.useRef(); - const inputRef = React.useRef(); + const rootRef = React.useRef(null); + const inputRef = React.useRef(null); React.useImperativeHandle(ref, () => ({ nativeElement: rootRef.current, diff --git a/src/PickerInput/hooks/useDelayState.ts b/src/PickerInput/hooks/useDelayState.ts index 0faca60d1..8e3a739ad 100644 --- a/src/PickerInput/hooks/useDelayState.ts +++ b/src/PickerInput/hooks/useDelayState.ts @@ -23,7 +23,7 @@ export default function useDelayState( const nextValueRef = React.useRef(value); // ============================= Update ============================= - const rafRef = React.useRef(); + const rafRef = React.useRef(undefined); const cancelRaf = () => { raf.cancel(rafRef.current); }; diff --git a/src/PickerInput/hooks/usePickerRef.ts b/src/PickerInput/hooks/usePickerRef.ts index 3d57f8f0a..513cedaaf 100644 --- a/src/PickerInput/hooks/usePickerRef.ts +++ b/src/PickerInput/hooks/usePickerRef.ts @@ -6,7 +6,7 @@ type PickerRefType = Omit & { }; export default function usePickerRef(ref: React.Ref>) { - const selectorRef = React.useRef>(); + const selectorRef = React.useRef>(null); React.useImperativeHandle(ref, () => ({ nativeElement: selectorRef.current?.nativeElement, diff --git a/src/PickerPanel/TimePanel/TimePanelBody/TimeColumn.tsx b/src/PickerPanel/TimePanel/TimePanelBody/TimeColumn.tsx index e8130a170..4058f278c 100644 --- a/src/PickerPanel/TimePanel/TimePanelBody/TimeColumn.tsx +++ b/src/PickerPanel/TimePanel/TimePanelBody/TimeColumn.tsx @@ -7,7 +7,7 @@ import useScrollTo from './useScrollTo'; const SCROLL_DELAY = 300; export type Unit = { - label: React.ReactText; + label: string | number; value: ValueType; disabled?: boolean; }; @@ -41,7 +41,7 @@ export default function TimeColumn(props: TimeUnitColum const ulRef = React.useRef(null); // ========================= Scroll ========================= - const checkDelayRef = React.useRef(); + const checkDelayRef = React.useRef(undefined); const clearDelayCheck = () => { clearTimeout(checkDelayRef.current); diff --git a/src/PickerPanel/TimePanel/TimePanelBody/useScrollTo.ts b/src/PickerPanel/TimePanel/TimePanelBody/useScrollTo.ts index 47c172b04..005a89d85 100644 --- a/src/PickerPanel/TimePanel/TimePanelBody/useScrollTo.ts +++ b/src/PickerPanel/TimePanel/TimePanelBody/useScrollTo.ts @@ -19,7 +19,7 @@ export default function useScrollTo( scrollingRef.current = false; }; - const scrollRafTimesRef = React.useRef(); + const scrollRafTimesRef = React.useRef(undefined); const startScroll = () => { const ul = ulRef.current; diff --git a/src/PickerPanel/index.tsx b/src/PickerPanel/index.tsx index c0eeacebd..51e75516e 100644 --- a/src/PickerPanel/index.tsx +++ b/src/PickerPanel/index.tsx @@ -202,7 +202,7 @@ function PickerPanel( const mergedPrefixCls = contextPrefixCls || prefixCls || 'rc-picker'; // ========================== Refs ========================== - const rootRef = React.useRef(); + const rootRef = React.useRef(null); React.useImperativeHandle(ref, () => ({ nativeElement: rootRef.current, diff --git a/src/hooks/useTimeInfo.ts b/src/hooks/useTimeInfo.ts index 61a2846ef..10cd945df 100644 --- a/src/hooks/useTimeInfo.ts +++ b/src/hooks/useTimeInfo.ts @@ -6,7 +6,7 @@ import { findValidateTime } from '../PickerPanel/TimePanel/TimePanelBody/util'; import { leftPad } from '../utils/miscUtil'; export type Unit = { - label: React.ReactText; + label: string | number; value: ValueType; disabled?: boolean; }; diff --git a/tsconfig.json b/tsconfig.json index 8ba9ac624..1480c9191 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,7 +21,6 @@ "module": "ESNext" }, "include": [ - "react-compat.d.ts", "global.d.ts", ".dumirc.ts", ".fatherrc.ts", From ff5b5ff21d51bae2773b576b8b7e6472c3567de9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 13:22:34 +0800 Subject: [PATCH 09/16] docs: use ut install for local setup --- README.md | 4 ++-- README.zh-CN.md | 4 ++-- vercel.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1f510127b..4b828d814 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ export default () => ( Run the local dumi site: ```bash -npm install +ut install npm start ``` @@ -182,7 +182,7 @@ Then open `http://localhost:8000`. ## Development ```bash -npm install +ut install npm start npm test npm run tsc diff --git a/README.zh-CN.md b/README.zh-CN.md index b13041b49..b2af40f61 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -76,7 +76,7 @@ export default () => ( 运葌本地 dumi η«™η‚ΉοΌš ```bash -npm install +ut install npm start ``` @@ -182,7 +182,7 @@ npm start ## ζœ¬εœ°εΌ€ε‘ ```bash -npm install +ut install npm start npm test npm run tsc diff --git a/vercel.json b/vercel.json index 5f9139ef4..20b1714f5 100644 --- a/vercel.json +++ b/vercel.json @@ -1,6 +1,6 @@ { "framework": "umijs", - "installCommand": "npm install", + "installCommand": "ut install", "buildCommand": "npm run build", "outputDirectory": "docs-dist" } From a79710a17b1f1c460d8e990460b3c69a7e8a80d3 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 13:30:03 +0800 Subject: [PATCH 10/16] chore: restore vercel install command --- vercel.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vercel.json b/vercel.json index 20b1714f5..5f9139ef4 100644 --- a/vercel.json +++ b/vercel.json @@ -1,6 +1,6 @@ { "framework": "umijs", - "installCommand": "ut install", + "installCommand": "npm install", "buildCommand": "npm run build", "outputDirectory": "docs-dist" } From 2e182a956bd780bc22e1d50bb7da12b0748fe225 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 14:02:50 +0800 Subject: [PATCH 11/16] chore: align maintenance dependencies --- eslint.config.mjs | 3 +++ package.json | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 7f8ca4ced..76ab8dac2 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -36,6 +36,9 @@ function normalizeConfig(config) { if (next.rules) { next.rules = Object.fromEntries( Object.entries(next.rules).filter(([ruleName]) => { + if (ruleName.startsWith('@babel/')) { + return false; + } if (!ruleName.startsWith('@typescript-eslint/')) { return true; } diff --git a/package.json b/package.json index 6797992d6..dae17b9c1 100644 --- a/package.json +++ b/package.json @@ -132,19 +132,19 @@ "@types/node": "^26.0.1", "@types/react": "^19.2.17", "@types/react-dom": "^19.2.3", - "@typescript-eslint/eslint-plugin": "^8.62.0", - "@typescript-eslint/parser": "^8.62.0", + "@typescript-eslint/eslint-plugin": "^8.62.1", + "@typescript-eslint/parser": "^8.62.1", "cross-env": "^10.1.0", "date-fns": "2.x", "dayjs": "1.x", - "dumi": "^2.4.35", + "dumi": "^2.4.38", "eslint": "^9.39.4", "eslint-config-prettier": "^10.1.8", - "eslint-plugin-jest": "^29.15.3", + "eslint-plugin-jest": "^29.15.4", "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^7.1.1", "eslint-plugin-unicorn": "^65.0.1", - "father": "^4.6.23", + "father": "^4.6.24", "gh-pages": "^6.3.0", "glob": "^13.0.6", "husky": "^9.1.7", @@ -154,7 +154,7 @@ "mockdate": "^3.0.2", "moment": "^2.24.0", "moment-timezone": "^0.5.45", - "prettier": "^3.9.0", + "prettier": "^3.9.4", "rc-test": "^7.1.3", "react": "^19.2.7", "react-dom": "^19.2.7", @@ -165,8 +165,8 @@ "dayjs": ">= 1.x", "luxon": ">= 3.x", "moment": ">= 2.x", - "react": ">=16.9.0", - "react-dom": ">=16.9.0" + "react": "^19.2.7", + "react-dom": "^19.2.7" }, "peerDependenciesMeta": { "date-fns": { From f9399e9a7a2eddc28d23157b379a405e62b593de Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 14:24:40 +0800 Subject: [PATCH 12/16] chore: fix upgraded test tooling --- tests/__snapshots__/panel.spec.tsx.snap | 2 +- tests/__snapshots__/picker.spec.tsx.snap | 2 +- tests/__snapshots__/range.spec.tsx.snap | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/__snapshots__/panel.spec.tsx.snap b/tests/__snapshots__/panel.spec.tsx.snap index 34125971b..5e28ffa9a 100644 --- a/tests/__snapshots__/panel.spec.tsx.snap +++ b/tests/__snapshots__/panel.spec.tsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`Picker.Panel append cell with cellRender in date 1`] = `

diff --git a/tests/__snapshots__/picker.spec.tsx.snap b/tests/__snapshots__/picker.spec.tsx.snap index 10e4195bb..4b1c35f6e 100644 --- a/tests/__snapshots__/picker.spec.tsx.snap +++ b/tests/__snapshots__/picker.spec.tsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`Picker.Basic icon 1`] = `
From 3ffaeb49508036ca5d2ec367dbe1e0e5b04e5bdd Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 14:34:57 +0800 Subject: [PATCH 13/16] fix: preserve React peer dependency range --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dae17b9c1..8be277037 100644 --- a/package.json +++ b/package.json @@ -165,8 +165,8 @@ "dayjs": ">= 1.x", "luxon": ">= 3.x", "moment": ">= 2.x", - "react": "^19.2.7", - "react-dom": "^19.2.7" + "react": ">=16.9.0", + "react-dom": ">=16.9.0" }, "peerDependenciesMeta": { "date-fns": { From 1667d9c4bc780db0f2a28321776c7ee0c5633400 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 18:36:46 +0800 Subject: [PATCH 14/16] docs: use npm install in README --- README.md | 4 ++-- README.zh-CN.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4b828d814..1f510127b 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ export default () => ( Run the local dumi site: ```bash -ut install +npm install npm start ``` @@ -182,7 +182,7 @@ Then open `http://localhost:8000`. ## Development ```bash -ut install +npm install npm start npm test npm run tsc diff --git a/README.zh-CN.md b/README.zh-CN.md index b2af40f61..b13041b49 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -76,7 +76,7 @@ export default () => ( 运葌本地 dumi η«™η‚ΉοΌš ```bash -ut install +npm install npm start ``` @@ -182,7 +182,7 @@ npm start ## ζœ¬εœ°εΌ€ε‘ ```bash -ut install +npm install npm start npm test npm run tsc From f5bf39fc9959051b5bfe1efd4347b1e73a703c3a Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 18:46:48 +0800 Subject: [PATCH 15/16] chore: remove redundant strict tsconfig flags --- tsconfig.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 1480c9191..c30230435 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,13 +11,7 @@ "@@/*": ["./.dumi/tmp/*"], "@rc-component/picker": ["./src/index.tsx"] }, - "noImplicitAny": false, - "strictNullChecks": false, - "strictPropertyInitialization": false, - "strictFunctionTypes": false, "strict": false, - "noImplicitThis": false, - "strictBindCallApply": false, "module": "ESNext" }, "include": [ From cc05cf2e57206b0cec78eabd81711ab1f5abde35 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 19:13:24 +0800 Subject: [PATCH 16/16] chore: remove manual global test declarations --- global.d.ts | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/global.d.ts b/global.d.ts index 85e4e4e75..e0bd355c6 100644 --- a/global.d.ts +++ b/global.d.ts @@ -8,42 +8,4 @@ declare module '*.css'; declare module '*.less'; declare module 'jsonp'; -declare namespace JSX { - type Element = React.JSX.Element; - interface ElementClass extends React.JSX.ElementClass {} - interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {} - interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {} - type LibraryManagedAttributes = React.JSX.LibraryManagedAttributes; - interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {} - interface IntrinsicClassAttributes extends React.JSX.IntrinsicClassAttributes {} - interface IntrinsicElements extends React.JSX.IntrinsicElements {} -} - -declare namespace jest { - interface Matchers { - lastCalledWith(...expected: unknown[]): R; - nthCalledWith(nthCall: number, ...expected: unknown[]): R; - toBeCalled(): R; - toBeCalledTimes(expected: number): R; - toBeCalledWith(...expected: unknown[]): R; - } -} - -declare const vi: { - fn: any = (...args: any[]) => any>( - implementation?: T, - ) => jest.MockedFunction; - mock: (moduleName: string, factory?: (importOriginal: () => Promise) => unknown) => void; - spyOn: typeof jest.spyOn; - useFakeTimers: () => void; - useRealTimers: () => void; - advanceTimersByTime: (msToRun: number) => void; - clearAllTimers: () => void; - runAllTimers: () => void; - importActual: (moduleName: string) => Promise; - clearAllMocks: () => void; - resetAllMocks: () => void; - restoreAllMocks: () => void; -}; - declare module 'moment/locale/zh-cn';