From 9e1f0823b44e2a51d1670ecd196fe7164a2c799a Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 10:03:30 +0800 Subject: [PATCH 01/12] chore: standardize repository maintenance --- .github/FUNDING.yml | 17 +--- .github/dependabot.yml | 43 +++++----- .github/workflows/codeql.yml | 14 +-- .github/workflows/react-doctor.yml | 22 +++++ .github/workflows/surge-preview.yml | 48 +++++++++++ .github/workflows/test.yml | 16 ++++ README.md | 128 +++++++++++----------------- README.zh-CN.md | 86 +++++++++++++++++++ package.json | 9 +- tsconfig.json | 3 +- vercel.json | 5 +- 11 files changed, 264 insertions(+), 127 deletions(-) create mode 100644 .github/workflows/react-doctor.yml create mode 100644 .github/workflows/surge-preview.yml create mode 100644 .github/workflows/test.yml create mode 100644 README.zh-CN.md diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 33b1999..758659a 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,15 +1,2 @@ -# These are supported funding model platforms - -github: ant-design # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: # Replace with a single Patreon username -open_collective: ant-design # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry -polar: # Replace with a single Polar username -buy_me_a_coffee: # Replace with a single Buy Me a Coffee username -thanks_dev: # Replace with a single thanks.dev username -custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +github: ant-design +open_collective: ant-design diff --git a/.github/dependabot.yml b/.github/dependabot.yml index dcc7623..5e6c7fa 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,28 +3,25 @@ updates: - package-ecosystem: npm directory: '/' schedule: - interval: daily + interval: weekly + day: monday time: '21:00' + timezone: Asia/Shanghai open-pull-requests-limit: 10 - ignore: - - dependency-name: np - versions: - - 7.2.0 - - 7.3.0 - - 7.4.0 - - dependency-name: '@types/react-dom' - versions: - - 17.0.0 - - 17.0.1 - - 17.0.2 - - dependency-name: '@types/react' - versions: - - 17.0.0 - - 17.0.1 - - 17.0.2 - - 17.0.3 - - dependency-name: typescript - versions: - - 4.1.3 - - 4.1.4 - - 4.1.5 + groups: + npm-dependencies: + patterns: + - '*' + + - package-ecosystem: github-actions + directory: '/' + schedule: + interval: weekly + day: monday + time: '21:00' + timezone: Asia/Shanghai + open-pull-requests-limit: 10 + groups: + github-actions: + patterns: + - '*' diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d7208a4..6082fc6 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -6,7 +6,7 @@ on: pull_request: branches: ['master'] schedule: - - cron: '40 12 * * 0' + - cron: '36 13 * * 3' jobs: analyze: @@ -20,22 +20,24 @@ jobs: strategy: fail-fast: false matrix: - language: [javascript] + language: [javascript-typescript] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v7 + with: + persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with: languages: ${{ matrix.language }} queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with: category: '/language:${{ matrix.language }}' diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml new file mode 100644 index 0000000..29d6f76 --- /dev/null +++ b/.github/workflows/react-doctor.yml @@ -0,0 +1,22 @@ +name: React Doctor + +on: + pull_request: + push: + branches: [master] + +permissions: + contents: read + pull-requests: write + issues: write + statuses: write + +jobs: + react-doctor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + persist-credentials: false + - uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3 diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml new file mode 100644 index 0000000..394f2b0 --- /dev/null +++ b/.github/workflows/surge-preview.yml @@ -0,0 +1,48 @@ +name: Surge Preview + +on: + pull_request: + +permissions: + contents: read + pull-requests: write + checks: write + +jobs: + preview: + runs-on: ubuntu-latest + concurrency: + group: surge-preview-${{ github.event.pull_request.number }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Check Surge token + id: surge-token + env: + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} + run: | + if [ -n "$SURGE_TOKEN" ]; then + echo "enabled=true" >> "$GITHUB_OUTPUT" + else + echo "enabled=false" >> "$GITHUB_OUTPUT" + fi + - name: Build preview + if: ${{ steps.surge-token.outputs.enabled == 'true' }} + run: | + npm install + npm run build + - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec + if: ${{ steps.surge-token.outputs.enabled == 'true' }} + env: + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} + with: + surge_token: ${{ env.SURGE_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + dist: docs-dist + failOnError: false + setCommitStatus: false + - name: Skip Surge preview + if: ${{ steps.surge-token.outputs.enabled != 'true' }} + run: echo "SURGE_TOKEN is not configured; skip Surge preview." diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..10c0ebb --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,16 @@ +name: ✅ test + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + test: + uses: react-component/rc-test/.github/workflows/test-utoo.yml@main + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index e44bd05..a86c58e 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,43 @@ -# @rc-component/Listy - -React Listy Component - -[![NPM version][npm-image]][npm-url] -[![npm download][download-image]][download-url] -[![build status][github-actions-image]][github-actions-url] -[![Test coverage][codecov-image]][codecov-url] -[![bundle size][bundlephobia-image]][bundlephobia-url] -[![dumi][dumi-image]][dumi-url] - -[npm-image]: http://img.shields.io/npm/v/@rc-component/listy.svg?style=flat-square -[npm-url]: http://npmjs.org/package/@rc-component/listy -[github-actions-image]: https://github.com/react-component/listy/workflows/CI/badge.svg -[github-actions-url]: https://github.com/react-component/listy/actions -[codecov-image]: https://img.shields.io/codecov/c/github/react-component/listy/master.svg?style=flat-square -[codecov-url]: https://codecov.io/gh/react-component/listy/branch/master -[david-url]: https://david-dm.org/react-component/listy -[david-image]: https://david-dm.org/react-component/listy/status.svg?style=flat-square -[david-dev-url]: https://david-dm.org/react-component/listy?type=dev -[david-dev-image]: https://david-dm.org/react-component/listy/dev-status.svg?style=flat-square -[download-image]: https://img.shields.io/npm/dm/@rc-component/listy.svg?style=flat-square -[download-url]: https://npmjs.org/package/@rc-component/listy -[bundlephobia-url]: https://bundlephobia.com/result?p=@rc-component/listy -[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/listy -[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square -[dumi-url]: https://github.com/umijs/dumi +
+

@rc-component/listy

+

Ant Design Part of the Ant Design ecosystem.

+

📜 Virtualized React list component with grouping and sticky header support.

+ +

+ NPM version + npm downloads + build status + Codecov + bundle size + dumi +

+
+ +

English | [简体中文](./README.zh-CN.md)

+ +## Highlights + +| Area | Support | +| --- | --- | +| Purpose | Virtualized React list component with grouping and sticky header support. | +| Package | `@rc-component/listy` | +| Release | `@rc-component/np` / `rc-np` | ## Install -[![@rc-component/listy](https://nodei.co/npm/@rc-component/listy.png)](https://npmjs.org/package/@rc-component/listy) +```bash +npm install @rc-component/listy +``` ## Usage -Include the default [styling](https://github.com/react-component/listy/blob/master/assets/index.less#L4:L11) and then: - -```js -import React from 'react'; -import ReactDOM from 'react-dom/client'; +```tsx | pure import Listy from '@rc-component/listy'; +import '@rc-component/listy/assets/index.css'; -const items = Array.from({ length: 100 }, (_, index) => ({ - id: index, - name: `Item ${index}`, -})); +const items = Array.from({ length: 100 }, (_, index) => ({ id: index, name: `Item ${index}` })); -const App = () => ( +export default () => ( ( itemRender={(item) =>
{item.name}
} /> ); - -ReactDOM.createRoot(container).render(); ``` -## Compatibility - -| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Electron](http://godban.github.io/browsers-support-badges/)
Electron | -| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions | - -## Example +## API -http://localhost:9001 +| Prop | Description | +| --- | --- | +| `items` | List data source. | +| `rowKey` | Resolve item identity. | +| `itemRender` | Render each item. | +| `height` | Viewport height. | +| `itemHeight` | Estimated item height. | +| `group` | Group configuration. | +| `sticky` | Enable sticky group headers. | +| `virtual` | Enable virtual scrolling. | ## Development -``` +```bash npm install npm start +npm test +npm run lint +npm run compile ``` -## API - -### props - -| name | type | default | description | -| --- | --- | --- | --- | -| items | `T[]` | `[]` | 列表数据源,虚拟滚动会基于此计算高度。 | -| rowKey | `keyof T \| (item: T) => React.Key` | required | 返回每一项的唯一标识,用于缓存高度与滚动定位。 | -| itemRender | `(item: T, index: number) => React.ReactNode` | required | 渲染单行内容的函数。 | -| height | `number` | - | 列表可视区域高度。 | -| itemHeight | `number` | - | 每行的基础高度,虚拟滚动会以此做初始估算。 | -| group | `{ key: ((item: T) => K) \| K; title: (groupKey: K, items: T[]) => React.ReactNode }` | - | 提供分组 key 与标题渲染,开启后会生成组头。 | -| sticky | `boolean` | `false` | 为分组头启用粘性悬停效果。 | -| virtual | `boolean` | `true` | 是否启用虚拟列表模式,可根据需要关闭。 | -| onScroll | `React.UIEventHandler` | - | 滚动时触发,透传内部滚动容器的滚动事件。 | -| prefixCls | `string` | `rc-listy` | 组件样式前缀,方便自定义样式隔离。 | - -### ListyRef +The dumi site runs at `http://localhost:8000`. -- `scrollTo(config?: number | null | { left?: number; top?: number } | { key: React.Key; align?: 'top' | 'bottom' | 'auto'; offset?: number } | { groupKey: React.Key; align?: 'top' | 'bottom' | 'auto'; offset?: number })` - - 传入 `groupKey` 时会直接滚动到对应组头(需启用 `group`) +## Release -## Test Case - -``` -npm test -npm run coverage +```bash +npm run prepublishOnly ``` -open coverage/ dir +The release flow is handled by `@rc-component/np` through the `rc-np` command when the package uses the shared release flow. ## License -@rc-component/listy is released under the MIT license. +@rc-component/listy is released under the [MIT](./LICENSE) license. diff --git a/README.zh-CN.md b/README.zh-CN.md new file mode 100644 index 0000000..a175eed --- /dev/null +++ b/README.zh-CN.md @@ -0,0 +1,86 @@ +
+

@rc-component/listy

+

Ant Design Ant Design 生态的一部分。

+

📜 支持虚拟滚动、分组与粘性组头的 React 列表组件。

+ +

+ NPM version + npm downloads + build status + Codecov + bundle size + dumi +

+
+ +

简体中文 | [English](./README.md)

+ +## 亮点 + +| 方向 | 支持 | +| --- | --- | +| 定位 | 支持虚拟滚动、分组与粘性组头的 React 列表组件。 | +| 包名 | `@rc-component/listy` | +| 发布 | `@rc-component/np` / `rc-np` | + +## 安装 + +```bash +npm install @rc-component/listy +``` + +## 用法 + +```tsx | pure +import Listy from '@rc-component/listy'; +import '@rc-component/listy/assets/index.css'; + +const items = Array.from({ length: 100 }, (_, index) => ({ id: index, name: `Item ${index}` })); + +export default () => ( +
{item.name}
} + /> +); +``` + +## API + +| 名称 | 说明 | +| --- | --- | +| `items` | 列表数据源。 | +| `rowKey` | 解析列表项唯一标识。 | +| `itemRender` | 渲染每一项。 | +| `height` | 可视区域高度。 | +| `itemHeight` | 预估项高度。 | +| `group` | 分组配置。 | +| `sticky` | 启用粘性组头。 | +| `virtual` | 启用虚拟滚动。 | + +## 本地开发 + +```bash +npm install +npm start +npm test +npm run lint +npm run compile +``` + +本地 dumi 站点默认运行在 `http://localhost:8000`. + +## 发布 + +```bash +npm run prepublishOnly +``` + +发布流程通过 `@rc-component/np` 提供的 `rc-np` 命令处理。 + +## 许可证 + +@rc-component/listy 基于 [MIT](./LICENSE) 协议发布。 diff --git a/package.json b/package.json index 1bfafcd..87766f2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@rc-component/listy", "version": "1.2.1", - "description": "React Listy Component", + "description": "📜 Virtualized React list component with grouping and sticky header support.", "keywords": [ "react", "react-component", @@ -35,8 +35,7 @@ "lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js", "test": "rc-test", "prettier": "prettier --write .", - "coverage": "rc-test --coverage", - "now-build": "npm run build" + "coverage": "rc-test --coverage" }, "dependencies": { "@rc-component/motion": "^1.1.4", @@ -47,7 +46,7 @@ "@rc-component/virtual-list": "^1.2.0" }, "devDependencies": { - "@rc-component/father-plugin": "^2.1.3", + "@rc-component/father-plugin": "^2.2.0", "@rc-component/np": "^1.0.4", "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^16.3.0", @@ -63,7 +62,7 @@ "father": "^4.6.7", "less": "^4.4.2", "prettier": "^3.6.2", - "rc-test": "^7.1.2", + "rc-test": "^7.1.3", "react": "^19.2.0", "react-dom": "^19.2.0", "regenerator-runtime": "^0.14.1", diff --git a/tsconfig.json b/tsconfig.json index 39898e6..d4875c5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,5 +13,6 @@ "@rc-component/listy": ["./src/index.ts"] }, "types": ["@testing-library/jest-dom", "node"] - } + }, + "include": ["**/*.ts", "**/*.tsx", ".dumirc.ts"] } diff --git a/vercel.json b/vercel.json index cc12e40..5f9139e 100644 --- a/vercel.json +++ b/vercel.json @@ -1,3 +1,6 @@ { - "framework": "umijs" + "framework": "umijs", + "installCommand": "npm install", + "buildCommand": "npm run build", + "outputDirectory": "docs-dist" } From 47d60527dbb08bd818d3270a192d6dbd6ad8851c Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 10:09:36 +0800 Subject: [PATCH 02/12] chore: align reusable test workflow --- .github/workflows/main.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index f860ff1..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: ✅ test -on: [push, pull_request] -jobs: - test: - uses: react-component/rc-test/.github/workflows/test.yml@main - secrets: inherit From de6d540da943fe58a17181e09b961cf7f1603d91 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 11:59:49 +0800 Subject: [PATCH 03/12] chore: address review feedback --- .github/workflows/surge-preview.yml | 2 +- README.md | 30 ++++++++++++++++++----------- README.zh-CN.md | 30 ++++++++++++++++++----------- tsconfig.json | 3 ++- vercel.json | 2 +- 5 files changed, 42 insertions(+), 25 deletions(-) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 394f2b0..67305c5 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -31,7 +31,7 @@ jobs: - name: Build preview if: ${{ steps.surge-token.outputs.enabled == 'true' }} run: | - npm install + ut install npm run build - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec if: ${{ steps.surge-token.outputs.enabled == 'true' }} diff --git a/README.md b/README.md index a86c58e..bb4717b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@

-

English | [简体中文](./README.zh-CN.md)

+

English | 简体中文

## Highlights @@ -50,21 +50,29 @@ export default () => ( ## API -| Prop | Description | +| Prop | Description | Type | Default | +| --- | --- | --- | --- | +| `items` | List data source. | `T[]` | `[]` | +| `rowKey` | Resolve item identity. | `keyof T \| (item: T) => React.Key` | required | +| `itemRender` | Render each item. | `(item: T, index: number) => React.ReactNode` | required | +| `height` | Viewport height. | `number` | - | +| `itemHeight` | Estimated item height. | `number` | - | +| `group` | Group configuration. | `{ key: (item: T) => K; title: (groupKey: K, items: T[]) => React.ReactNode }` | - | +| `sticky` | Enable sticky group headers. | `boolean` | `false` | +| `virtual` | Enable virtual scrolling. | `boolean` | `true` | +| `onScroll` | Triggered when the inner scroll container scrolls. | `React.UIEventHandler` | - | +| `prefixCls` | Component class name prefix. | `string` | `rc-listy` | + +### ListyRef + +| Method | Description | | --- | --- | -| `items` | List data source. | -| `rowKey` | Resolve item identity. | -| `itemRender` | Render each item. | -| `height` | Viewport height. | -| `itemHeight` | Estimated item height. | -| `group` | Group configuration. | -| `sticky` | Enable sticky group headers. | -| `virtual` | Enable virtual scrolling. | +| `scrollTo(config)` | Scroll to a position, item key, or group key. | ## Development ```bash -npm install +ut install npm start npm test npm run lint diff --git a/README.zh-CN.md b/README.zh-CN.md index a175eed..3a34a70 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -13,7 +13,7 @@

-

简体中文 | [English](./README.md)

+

简体中文 | English

## 亮点 @@ -50,21 +50,29 @@ export default () => ( ## API -| 名称 | 说明 | +| 名称 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| `items` | 列表数据源。 | `T[]` | `[]` | +| `rowKey` | 解析列表项唯一标识。 | `keyof T \| (item: T) => React.Key` | 必填 | +| `itemRender` | 渲染每一项。 | `(item: T, index: number) => React.ReactNode` | 必填 | +| `height` | 可视区域高度。 | `number` | - | +| `itemHeight` | 预估项高度。 | `number` | - | +| `group` | 分组配置。 | `{ key: (item: T) => K; title: (groupKey: K, items: T[]) => React.ReactNode }` | - | +| `sticky` | 启用粘性组头。 | `boolean` | `false` | +| `virtual` | 启用虚拟滚动。 | `boolean` | `true` | +| `onScroll` | 内部滚动容器滚动时触发。 | `React.UIEventHandler` | - | +| `prefixCls` | 组件样式前缀。 | `string` | `rc-listy` | + +### ListyRef + +| 方法 | 说明 | | --- | --- | -| `items` | 列表数据源。 | -| `rowKey` | 解析列表项唯一标识。 | -| `itemRender` | 渲染每一项。 | -| `height` | 可视区域高度。 | -| `itemHeight` | 预估项高度。 | -| `group` | 分组配置。 | -| `sticky` | 启用粘性组头。 | -| `virtual` | 启用虚拟滚动。 | +| `scrollTo(config)` | 滚动到指定位置、列表项 key 或分组 key。 | ## 本地开发 ```bash -npm install +ut install npm start npm test npm run lint diff --git a/tsconfig.json b/tsconfig.json index d4875c5..cbbdbae 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,5 +14,6 @@ }, "types": ["@testing-library/jest-dom", "node"] }, - "include": ["**/*.ts", "**/*.tsx", ".dumirc.ts"] + "include": ["**/*.ts", "**/*.tsx", ".dumirc.ts"], + "exclude": ["node_modules", "es", "lib", "dist", "docs-dist", ".doc", ".dumi/tmp", "coverage"] } diff --git a/vercel.json b/vercel.json index 5f9139e..20b1714 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 c58a0d1c0a9cbad1b594d2874698991ae354030a Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 12:04:21 +0800 Subject: [PATCH 04/12] chore: set up utoo for preview builds --- .github/workflows/surge-preview.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 67305c5..ba9f1dd 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -28,6 +28,10 @@ jobs: else echo "enabled=false" >> "$GITHUB_OUTPUT" fi + - name: Setup utoo + if: ${{ steps.surge-token.outputs.enabled == 'true' }} + uses: utooland/setup-utoo@v1 + - name: Build preview if: ${{ steps.surge-token.outputs.enabled == 'true' }} run: | From 7bec3074e5e0ea1e6f595ed879496e2158e6b165 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 13:32:23 +0800 Subject: [PATCH 05/12] chore: use npm install for vercel preview --- vercel.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vercel.json b/vercel.json index 20b1714..5f9139e 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 8802bc3ec4db42d7b1719f51d2652f38641cc679 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 14:02:02 +0800 Subject: [PATCH 06/12] chore: align maintenance dependencies --- package.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 87766f2..c5e4258 100644 --- a/package.json +++ b/package.json @@ -49,27 +49,27 @@ "@rc-component/father-plugin": "^2.2.0", "@rc-component/np": "^1.0.4", "@testing-library/jest-dom": "^6.9.1", - "@testing-library/react": "^16.3.0", + "@testing-library/react": "^16.3.2", "@types/classnames": "^2.3.4", "@types/jest": "^30.0.0", - "@types/node": "^24.10.0", - "@types/react": "^19.2.2", - "@types/react-dom": "^19.2.2", + "@types/node": "^26.0.1", + "@types/react": "^19.2.17", + "@types/react-dom": "^19.2.3", "@umijs/fabric": "^4.0.1", "cross-env": "^10.1.0", - "dumi": "^2.4.21", - "eslint": "^8.57.1", - "father": "^4.6.7", - "less": "^4.4.2", - "prettier": "^3.6.2", + "dumi": "^2.4.38", + "eslint": "^9.39.4", + "father": "^4.6.24", + "less": "^4.6.7", + "prettier": "^3.9.4", "rc-test": "^7.1.3", - "react": "^19.2.0", - "react-dom": "^19.2.0", + "react": "^19.2.7", + "react-dom": "^19.2.7", "regenerator-runtime": "^0.14.1", "typescript": "^6.0.3" }, "peerDependencies": { - "react": ">=18.0.0", - "react-dom": ">=18.0.0" + "react": "^19.2.7", + "react-dom": "^19.2.7" } } From b5548003af0bfa7b27b034c0e8710cf1a502f8a9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 14:24:07 +0800 Subject: [PATCH 07/12] chore: fix upgraded test tooling --- eslint.config.mjs | 64 +++++++++++++++++++++++++ package.json | 11 ++++- tests/__snapshots__/listy.test.tsx.snap | 2 +- 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 eslint.config.mjs diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..8291c83 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,64 @@ +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 supportedTsRules = new Set( + Object.keys(tsEslintPlugin.rules).map(ruleName => `@typescript-eslint/${ruleName}`), +); + +function normalizeConfig(config) { + const next = { ...config }; + + if (next.rules) { + next.rules = Object.fromEntries( + Object.entries(next.rules).filter(([ruleName]) => { + if (ruleName.startsWith('@babel/')) { + return false; + } + return !ruleName.startsWith('@typescript-eslint/') || supportedTsRules.has(ruleName); + }), + ); + } + + return next; +} + +export default [ + { + ignores: [ + 'node_modules/', + 'coverage/', + 'es/', + 'lib/', + 'dist/', + 'docs-dist/', + '.dumi/', + '.doc/', + '.vercel/', + '.eslintrc.js', + ], + }, + ...compat.config(require('./.eslintrc.js')).map(normalizeConfig), + { + rules: { + '@typescript-eslint/no-empty-object-type': 'off', + '@typescript-eslint/no-unsafe-function-type': 'off', + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-useless-constructor': 'off', + '@typescript-eslint/consistent-indexed-object-style': 'off', + }, + }, +]; diff --git a/package.json b/package.json index c5e4258..fd15cb5 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,16 @@ "react": "^19.2.7", "react-dom": "^19.2.7", "regenerator-runtime": "^0.14.1", - "typescript": "^6.0.3" + "typescript": "^6.0.3", + "@eslint/eslintrc": "^3.3.5", + "@eslint/js": "^9.39.4", + "@typescript-eslint/eslint-plugin": "^8.62.1", + "@typescript-eslint/parser": "^8.62.1", + "eslint-plugin-import": "^2.32.0", + "eslint-plugin-jest": "^29.15.4", + "eslint-plugin-jsx-a11y": "^6.10.2", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^7.1.1" }, "peerDependencies": { "react": "^19.2.7", diff --git a/tests/__snapshots__/listy.test.tsx.snap b/tests/__snapshots__/listy.test.tsx.snap index 639da46..18f3cfc 100644 --- a/tests/__snapshots__/listy.test.tsx.snap +++ b/tests/__snapshots__/listy.test.tsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`Listy should match snapshot 1`] = ` From af3a3bc2e94a6730edca7184f9b782cee7d13773 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 14:26:35 +0800 Subject: [PATCH 08/12] docs: align Chinese README language switch --- README.zh-CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index 3a34a70..7a08e82 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -13,7 +13,7 @@

-

简体中文 | English

+

English | 简体中文

## 亮点 From 03d38237963b44476d5e798e39059e359a380d22 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 14:34:26 +0800 Subject: [PATCH 09/12] 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 fd15cb5..ac7355d 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "eslint-plugin-react-hooks": "^7.1.1" }, "peerDependencies": { - "react": "^19.2.7", - "react-dom": "^19.2.7" + "react": ">=18.0.0", + "react-dom": ">=18.0.0" } } From 73dda67f594ed8fda666d3d02f5106780c40b935 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Jul 2026 18:36:07 +0800 Subject: [PATCH 10/12] docs: use npm install in README --- README.md | 2 +- README.zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bb4717b..5196fc5 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ export default () => ( ## Development ```bash -ut install +npm install npm start npm test npm run lint diff --git a/README.zh-CN.md b/README.zh-CN.md index 7a08e82..8e274b6 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -72,7 +72,7 @@ export default () => ( ## 本地开发 ```bash -ut install +npm install npm start npm test npm run lint From 7f6a7e104aa75225c419512bbd7653b68781dc62 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 2 Jul 2026 11:54:01 +0800 Subject: [PATCH 11/12] chore: migrate to native eslint flat config --- .eslintrc.js | 19 ------- eslint.config.mjs | 131 +++++++++++++++++++++++++++++++--------------- package.json | 19 ++++--- 3 files changed, 98 insertions(+), 71 deletions(-) delete mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 15621ba..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - extends: [require.resolve('@umijs/fabric/dist/eslint')], - rules: { - 'default-case': 0, - 'import/no-extraneous-dependencies': 0, - 'react-hooks/exhaustive-deps': 0, - 'react/no-find-dom-node': 0, - 'react/no-did-update-set-state': 0, - 'react/no-unused-state': 1, - 'react/sort-comp': 0, - 'jsx-a11y/label-has-for': 0, - 'jsx-a11y/label-has-associated-control': 0, - '@typescript-eslint/consistent-indexed-object-style': 0, - '@typescript-eslint/no-parameter-properties': 0, - '@typescript-eslint/ban-types': 0, - '@typescript-eslint/type-annotation-spacing': 0, - '@typescript-eslint/no-throw-literal': 0, - }, -}; diff --git a/eslint.config.mjs b/eslint.config.mjs index 8291c83..d19be2a 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,42 +1,23 @@ -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'; +import { defineConfig } from 'eslint/config'; +import prettier from 'eslint-config-prettier'; +import jest from 'eslint-plugin-jest'; +import react from 'eslint-plugin-react'; +import reactHooks from 'eslint-plugin-react-hooks'; +import globals from 'globals'; +import tseslint from 'typescript-eslint'; -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 supportedTsRules = new Set( - Object.keys(tsEslintPlugin.rules).map(ruleName => `@typescript-eslint/${ruleName}`), -); - -function normalizeConfig(config) { - const next = { ...config }; - - if (next.rules) { - next.rules = Object.fromEntries( - Object.entries(next.rules).filter(([ruleName]) => { - if (ruleName.startsWith('@babel/')) { - return false; - } - return !ruleName.startsWith('@typescript-eslint/') || supportedTsRules.has(ruleName); - }), - ); - } - - return next; -} - -export default [ +export default defineConfig([ + { + plugins: { + '@typescript-eslint': tseslint.plugin, + }, + }, + { + linterOptions: { + reportUnusedDisableDirectives: 'off', + }, + }, { ignores: [ 'node_modules/', @@ -48,17 +29,83 @@ export default [ '.dumi/', '.doc/', '.vercel/', - '.eslintrc.js', + 'src/index.d.ts', ], }, - ...compat.config(require('./.eslintrc.js')).map(normalizeConfig), { + files: ['**/*.{js,jsx,ts,tsx}'], + extends: [ + js.configs.recommended, + react.configs.flat.recommended, + react.configs.flat['jsx-runtime'], + prettier, + ], + plugins: { + 'react-hooks': reactHooks, + }, + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + }, + }, + settings: { + react: { + version: 'detect', + }, + }, rules: { + 'no-async-promise-executor': 'off', + 'no-empty-pattern': 'off', + 'no-irregular-whitespace': 'off', + 'no-prototype-builtins': 'off', + 'no-useless-escape': 'off', + 'no-extra-boolean-cast': 'off', + 'no-undef': 'off', + 'no-unused-vars': 'off', + 'react/no-find-dom-node': 'off', + 'react/display-name': 'off', + 'react/no-unknown-property': 'off', + 'react/prop-types': 'off', + 'react-hooks/exhaustive-deps': 'warn', + 'react-hooks/rules-of-hooks': 'error', + }, + }, + { + files: ['**/*.{ts,tsx}'], + extends: [...tseslint.configs.recommended], + rules: { + '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-empty-object-type': 'off', + '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-unsafe-function-type': 'off', + '@typescript-eslint/no-unnecessary-type-constraint': 'off', '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/no-useless-constructor': 'off', - '@typescript-eslint/consistent-indexed-object-style': 'off', }, }, -]; + { + files: ['src/**/*.{ts,tsx}'], + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + }, + { + files: ['tests/**/*.{js,jsx,ts,tsx}', '**/*.{test,spec}.{js,jsx,ts,tsx}'], + extends: [jest.configs['flat/recommended']], + rules: { + 'jest/no-disabled-tests': 'off', + 'jest/no-done-callback': 'off', + 'jest/no-identical-title': 'off', + 'jest/expect-expect': 'off', + 'jest/no-alias-methods': 'off', + 'jest/no-conditional-expect': 'off', + 'jest/no-export': 'off', + 'jest/no-standalone-expect': 'off', + 'jest/valid-expect': 'off', + 'jest/valid-title': 'off', + }, + }, +]); diff --git a/package.json b/package.json index ac7355d..2a15b1f 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@rc-component/virtual-list": "^1.2.0" }, "devDependencies": { + "@eslint/js": "^9.39.4", "@rc-component/father-plugin": "^2.2.0", "@rc-component/np": "^1.0.4", "@testing-library/jest-dom": "^6.9.1", @@ -55,11 +56,17 @@ "@types/node": "^26.0.1", "@types/react": "^19.2.17", "@types/react-dom": "^19.2.3", - "@umijs/fabric": "^4.0.1", "cross-env": "^10.1.0", "dumi": "^2.4.38", "eslint": "^9.39.4", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-import": "^2.32.0", + "eslint-plugin-jest": "^29.15.4", + "eslint-plugin-jsx-a11y": "^6.10.2", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^7.1.1", "father": "^4.6.24", + "globals": "^17.7.0", "less": "^4.6.7", "prettier": "^3.9.4", "rc-test": "^7.1.3", @@ -67,15 +74,7 @@ "react-dom": "^19.2.7", "regenerator-runtime": "^0.14.1", "typescript": "^6.0.3", - "@eslint/eslintrc": "^3.3.5", - "@eslint/js": "^9.39.4", - "@typescript-eslint/eslint-plugin": "^8.62.1", - "@typescript-eslint/parser": "^8.62.1", - "eslint-plugin-import": "^2.32.0", - "eslint-plugin-jest": "^29.15.4", - "eslint-plugin-jsx-a11y": "^6.10.2", - "eslint-plugin-react": "^7.37.5", - "eslint-plugin-react-hooks": "^7.1.1" + "typescript-eslint": "^8.62.1" }, "peerDependencies": { "react": ">=18.0.0", From 897e3e77188e0d43f4b5627314b4942b3601c572 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 3 Jul 2026 10:58:07 +0800 Subject: [PATCH 12/12] chore: address review comments --- eslint.config.mjs | 10 +++++++--- package.json | 2 -- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index d19be2a..40f08ec 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,5 +1,7 @@ import js from '@eslint/js'; import { defineConfig } from 'eslint/config'; +import { dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; import prettier from 'eslint-config-prettier'; import jest from 'eslint-plugin-jest'; import react from 'eslint-plugin-react'; @@ -7,6 +9,8 @@ import reactHooks from 'eslint-plugin-react-hooks'; import globals from 'globals'; import tseslint from 'typescript-eslint'; +const tsconfigRootDir = dirname(fileURLToPath(import.meta.url)); + export default defineConfig([ { plugins: { @@ -15,7 +19,7 @@ export default defineConfig([ }, { linterOptions: { - reportUnusedDisableDirectives: 'off', + reportUnusedDisableDirectives: 'warn', }, }, { @@ -26,10 +30,10 @@ export default defineConfig([ 'lib/', 'dist/', 'docs-dist/', + '.docs-dist/', '.dumi/', '.doc/', '.vercel/', - 'src/index.d.ts', ], }, { @@ -88,7 +92,7 @@ export default defineConfig([ languageOptions: { parserOptions: { projectService: true, - tsconfigRootDir: import.meta.dirname, + tsconfigRootDir, }, }, }, diff --git a/package.json b/package.json index 2a15b1f..55ddb19 100644 --- a/package.json +++ b/package.json @@ -60,9 +60,7 @@ "dumi": "^2.4.38", "eslint": "^9.39.4", "eslint-config-prettier": "^10.1.8", - "eslint-plugin-import": "^2.32.0", "eslint-plugin-jest": "^29.15.4", - "eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-react": "^7.37.5", "eslint-plugin-react-hooks": "^7.1.1", "father": "^4.6.24",