From c7de3bbd4d0fc592091ddea89b925b44f1ef277d Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 10:03:30 +0800
Subject: [PATCH 01/13] chore: standardize repository maintenance
---
.github/FUNDING.yml | 15 +---
.github/dependabot.yml | 32 +++++--
.github/workflows/codeql.yml | 43 +++++++++
.github/workflows/react-doctor.yml | 22 +++++
.github/workflows/surge-preview.yml | 48 ++++++++++
.github/workflows/test.yml | 16 ++++
README.md | 133 +++++++++++++---------------
README.zh-CN.md | 78 ++++++++++++++++
package.json | 10 +--
tsconfig.json | 3 +-
vercel.json | 6 ++
11 files changed, 309 insertions(+), 97 deletions(-)
create mode 100644 .github/workflows/codeql.yml
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
create mode 100644 vercel.json
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index deb72e8..758659a 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,15 +1,2 @@
-# These are supported funding model platforms
-
github: ant-design
-patreon: # Replace with a single Patreon username
-open_collective: # 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']
+open_collective: ant-design
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 5f0889c..5e6c7fa 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,11 +1,27 @@
-# To get started with Dependabot version updates, you'll need to specify which
-# package ecosystems to update and where the package manifests are located.
-# Please see the documentation for all configuration options:
-# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
-
version: 2
updates:
- - package-ecosystem: "npm" # See documentation for possible values
- directory: "/" # Location of package manifests
+ - package-ecosystem: npm
+ directory: '/'
+ schedule:
+ interval: weekly
+ day: monday
+ time: '21:00'
+ timezone: Asia/Shanghai
+ open-pull-requests-limit: 10
+ groups:
+ npm-dependencies:
+ patterns:
+ - '*'
+
+ - package-ecosystem: github-actions
+ directory: '/'
schedule:
- interval: "weekly"
+ 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
new file mode 100644
index 0000000..6082fc6
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,43 @@
+name: 'CodeQL'
+
+on:
+ push:
+ branches: ['master']
+ pull_request:
+ branches: ['master']
+ schedule:
+ - cron: '36 13 * * 3'
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [javascript-typescript]
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
+ with:
+ languages: ${{ matrix.language }}
+ queries: +security-and-quality
+
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
+
+ - name: Perform CodeQL Analysis
+ 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..7812fda
--- /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 ad1f295..dccf76f 100644
--- a/README.md
+++ b/README.md
@@ -1,85 +1,80 @@
-# @rc-component/async-validator
-
-[![NPM version][npm-image]][npm-url]
-[![npm download][download-image]][download-url]
-[![build status][github-actions-image]][github-actions-url]
-[![Codecov][codecov-image]][codecov-url]
-[![dumi][dumi-image]][dumi-url]
-
-[npm-image]: http://img.shields.io/npm/v/@rc-component/async-validator.svg?style=flat-square
-[npm-url]: http://npmjs.org/package/@rc-component/async-validator
-[travis-image]: https://img.shields.io/travis/react-component/async-validator/master?style=flat-square
-[travis-url]: https://travis-ci.com/react-component/async-validator
-[github-actions-image]: https://github.com/react-component/async-validator/actions/workflows/ci.yml/badge.svg
-[github-actions-url]: https://github.com/react-component/async-validator/actions/workflows/ci.yml
-[codecov-image]: https://img.shields.io/codecov/c/github/react-component/async-validator/master.svg?style=flat-square
-[codecov-url]: https://app.codecov.io/gh/react-component/async-validator
-[david-url]: https://david-dm.org/react-component/async-validator
-[david-image]: https://david-dm.org/react-component/async-validator/status.svg?style=flat-square
-[david-dev-url]: https://david-dm.org/react-component/async-validator?type=dev
-[david-dev-image]: https://david-dm.org/react-component/async-validator/dev-status.svg?style=flat-square
-[download-image]: https://img.shields.io/npm/dm/@rc-component/async-validator.svg?style=flat-square
-[download-url]: https://npmjs.org/package/@rc-component/async-validator
-[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/async-validator
-[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/async-validator
-[dumi-url]: https://github.com/umijs/dumi
-[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
-
-Validate form asynchronous. A variation of https://github.com/freeformsystems/async-validate
+
+
@rc-component/async-validator
+
Part of the Ant Design ecosystem.
+
✅ Async validation engine for schema-based form rules.
+
+
+
+
+
+
+
+
+
+
+
+English | [简体中文](./README.zh-CN.md)
+
+## Highlights
+
+| Area | Support |
+| ------- | ---------------------------------------------------- |
+| Purpose | Async validation engine for schema-based form rules. |
+| Package | `@rc-component/async-validator` |
+| Release | `@rc-component/np` / `rc-np` |
## Install
```bash
-npm i @rc-component/async-validator
+npm install @rc-component/async-validator
```
## Usage
-Basic usage involves defining a descriptor, assigning it to a schema and passing the object to be validated and a callback function to the `validate` method of the schema:
-
-```js
+```tsx | pure
import Schema from '@rc-component/async-validator';
-const descriptor = {
- name: {
- type: 'string',
- required: true,
- validator: (rule, value) => value === 'muji',
- },
- age: {
- type: 'number',
- asyncValidator: (rule, value) => {
- return new Promise((resolve, reject) => {
- if (value < 18) {
- reject('too young'); // reject with error message
- } else {
- resolve();
- }
- });
- },
- },
-};
-const validator = new Schema(descriptor);
-validator.validate({ name: 'muji' }, (errors, fields) => {
- if (errors) {
- // validation failed, errors is an array of all errors
- // fields is an object keyed by field name with an array of
- // errors per field
- return handleErrors(errors, fields);
- }
+
+const validator = new Schema({
+ name: { type: 'string', required: true },
+});
+
+validator.validate({ name: 'Ant Design' }).then(() => {
// validation passed
});
+```
-// PROMISE USAGE
-validator
- .validate({ name: 'muji', age: 16 })
- .then(() => {
- // validation passed or without error message
- })
- .catch(({ errors, fields }) => {
- return handleErrors(errors, fields);
- });
+## API
+
+| API | Description |
+| --------------------------------------- | ------------------------------------------ |
+| `new Schema(descriptor)` | Create a validator from a rule descriptor. |
+| `validate(source, options?, callback?)` | Validate source data and return a Promise. |
+| `messages` | Customize validation messages. |
+
+## Development
+
+```bash
+npm install
+npm start
+npm test
+npm run coverage
+npm run lint
+npm run tsc
+npm run compile
+```
+
+The dumi site runs at `http://localhost:8000`.
+
+## Release
+
+```bash
+npm run prepublishOnly
```
+The release flow is handled by `@rc-component/np` through the `rc-np` command when the package uses the shared release flow.
+
+## Detailed API
+
## API
### Validate
@@ -478,4 +473,4 @@ Open coverage/ dir
## License
-Everything is [MIT](https://en.wikipedia.org/wiki/MIT_License).
+@rc-component/async-validator is released under the [MIT](./LICENSE.md) license.
diff --git a/README.zh-CN.md b/README.zh-CN.md
new file mode 100644
index 0000000..c25aa74
--- /dev/null
+++ b/README.zh-CN.md
@@ -0,0 +1,78 @@
+
+
@rc-component/async-validator
+
Ant Design 生态的一部分。
+
✅ 基于规则描述的异步表单校验引擎。
+
+
+
+
+
+
+
+
+
+
+
+简体中文 | [English](./README.md)
+
+## 亮点
+
+| 方向 | 支持 |
+| ---- | -------------------------------- |
+| 定位 | 基于规则描述的异步表单校验引擎。 |
+| 包名 | `@rc-component/async-validator` |
+| 发布 | `@rc-component/np` / `rc-np` |
+
+## 安装
+
+```bash
+npm install @rc-component/async-validator
+```
+
+## 用法
+
+```tsx | pure
+import Schema from '@rc-component/async-validator';
+
+const validator = new Schema({
+ name: { type: 'string', required: true },
+});
+
+validator.validate({ name: 'Ant Design' }).then(() => {
+ // validation passed
+});
+```
+
+## API
+
+| 名称 | 说明 |
+| --------------------------------------- | -------------------------- |
+| `new Schema(descriptor)` | 根据规则描述创建校验器。 |
+| `validate(source, options?, callback?)` | 校验源数据并返回 Promise。 |
+| `messages` | 自定义校验提示。 |
+
+## 本地开发
+
+```bash
+npm install
+npm start
+npm test
+npm run coverage
+npm run lint
+npm run tsc
+npm run compile
+```
+
+本地 dumi 站点默认运行在 `http://localhost:8000`.
+
+## 发布
+
+```bash
+npm run prepublishOnly
+```
+
+发布流程通过 `@rc-component/np` 提供的 `rc-np` 命令处理。
+
+## 许可证
+
+@rc-component/async-validator 基于 [MIT](./LICENSE.md) 协议发布。
diff --git a/package.json b/package.json
index 7c03918..3e68826 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@rc-component/async-validator",
"version": "6.0.0",
- "description": "Validate form asynchronous",
+ "description": "✅ Async validation engine for schema-based form rules.",
"keywords": [
"async-validator",
"form"
@@ -28,14 +28,14 @@
"docs:deploy": "gh-pages -d .docs-dist",
"gh-pages": "npm run docs:build && npm run docs:deploy",
"lint": "eslint src --ext .tsx,.ts,.jsx,.js",
- "now-build": "npm run docs:build",
"prepublishOnly": "npm run compile && rc-np",
"prettier": "prettier . --write",
"postpublish": "npm run gh-pages",
"start": "dumi dev",
"test": "rc-test",
"coverage": "rc-test --coverage",
- "tsc": "tsc --noEmit"
+ "tsc": "tsc --noEmit",
+ "build": "dumi build"
},
"pre-commit": [
"lint-staged"
@@ -50,7 +50,7 @@
},
"devDependencies": {
"@rc-component/father-plugin": "^2.2.0",
- "@rc-component/np": "^1.0.3",
+ "@rc-component/np": "^1.0.4",
"@types/jest": "^29.5.12",
"@types/react": "18.x",
"@types/react-dom": "18.x",
@@ -61,7 +61,7 @@
"gh-pages": "^6.1.1",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
- "rc-test": "^7.0.15",
+ "rc-test": "^7.1.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "5.x"
diff --git a/tsconfig.json b/tsconfig.json
index 7f6ba30..e7077c7 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -12,5 +12,6 @@
"@@/*": ["src/.umi/*"],
"@rc-component/async-validator": ["src/index.ts"]
}
- }
+ },
+ "include": ["**/*.ts", "**/*.tsx", ".dumirc.ts"]
}
diff --git a/vercel.json b/vercel.json
new file mode 100644
index 0000000..9a78ae0
--- /dev/null
+++ b/vercel.json
@@ -0,0 +1,6 @@
+{
+ "framework": "umijs",
+ "installCommand": "npm install",
+ "buildCommand": "npm run build",
+ "outputDirectory": ".docs-dist"
+}
From 310863366dd7e79a7ea8e3f2479d2a4bfc76eb5d Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 10:09:39 +0800
Subject: [PATCH 02/13] chore: align reusable test workflow
---
.github/workflows/ci.yml | 6 -----
.github/workflows/codeql.yml | 43 ------------------------------------
2 files changed, 49 deletions(-)
delete mode 100644 .github/workflows/ci.yml
delete mode 100644 .github/workflows/codeql.yml
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
deleted file mode 100644
index f860ff1..0000000
--- a/.github/workflows/ci.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
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
deleted file mode 100644
index 6082fc6..0000000
--- a/.github/workflows/codeql.yml
+++ /dev/null
@@ -1,43 +0,0 @@
-name: 'CodeQL'
-
-on:
- push:
- branches: ['master']
- pull_request:
- branches: ['master']
- schedule:
- - cron: '36 13 * * 3'
-
-jobs:
- analyze:
- name: Analyze
- runs-on: ubuntu-latest
- permissions:
- actions: read
- contents: read
- security-events: write
-
- strategy:
- fail-fast: false
- matrix:
- language: [javascript-typescript]
-
- steps:
- - name: Checkout
- uses: actions/checkout@v7
- with:
- persist-credentials: false
-
- - name: Initialize CodeQL
- uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
- with:
- languages: ${{ matrix.language }}
- queries: +security-and-quality
-
- - name: Autobuild
- uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
- with:
- category: '/language:${{ matrix.language }}'
From ed0d914998ba7989721c52f121693d18b0076c0d Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 11:59:52 +0800
Subject: [PATCH 03/13] chore: address review feedback
---
.github/workflows/surge-preview.yml | 2 +-
README.md | 6 ++----
README.zh-CN.md | 4 ++--
vercel.json | 2 +-
4 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml
index 7812fda..92e6629 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 dccf76f..bc0eb52 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
-English | [简体中文](./README.zh-CN.md)
+English | 简体中文
## Highlights
@@ -54,7 +54,7 @@ validator.validate({ name: 'Ant Design' }).then(() => {
## Development
```bash
-npm install
+ut install
npm start
npm test
npm run coverage
@@ -75,8 +75,6 @@ The release flow is handled by `@rc-component/np` through the `rc-np` command wh
## Detailed API
-## API
-
### Validate
```js
diff --git a/README.zh-CN.md b/README.zh-CN.md
index c25aa74..be4ec65 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -13,7 +13,7 @@
-简体中文 | [English](./README.md)
+简体中文 | English
## 亮点
@@ -54,7 +54,7 @@ validator.validate({ name: 'Ant Design' }).then(() => {
## 本地开发
```bash
-npm install
+ut install
npm start
npm test
npm run coverage
diff --git a/vercel.json b/vercel.json
index 9a78ae0..3e7cd5c 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 391b3b52f86e167d3ad99e6b4d4f95ff555db631 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 12:04:25 +0800
Subject: [PATCH 04/13] 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 92e6629..960a646 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 de21585f0d6831200f35bea4700ff0f9ea128ac5 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 13:32:15 +0800
Subject: [PATCH 05/13] 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 3e7cd5c..9a78ae0 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 a48f7083b644a7c6e6a8443c0e1e81c879030156 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:00:46 +0800
Subject: [PATCH 06/13] chore: align maintenance dependencies
---
package.json | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/package.json b/package.json
index 3e68826..f66f9e2 100644
--- a/package.json
+++ b/package.json
@@ -46,25 +46,25 @@
]
},
"dependencies": {
- "@babel/runtime": "^7.24.4"
+ "@babel/runtime": "^7.29.7"
},
"devDependencies": {
"@rc-component/father-plugin": "^2.2.0",
"@rc-component/np": "^1.0.4",
- "@types/jest": "^29.5.12",
- "@types/react": "18.x",
- "@types/react-dom": "18.x",
+ "@types/jest": "^30.0.0",
+ "@types/react": "^19.2.17",
+ "@types/react-dom": "^19.2.3",
"@umijs/fabric": "^4.0.1",
- "dumi": "^2.2.17",
- "eslint": "^8.0.0",
- "father": "^4.4.0",
+ "dumi": "^2.4.38",
+ "eslint": "^9.39.4",
+ "father": "^4.6.24",
"gh-pages": "^6.1.1",
- "lint-staged": "^15.2.2",
- "prettier": "^3.2.5",
+ "lint-staged": "^17.0.8",
+ "prettier": "^3.9.4",
"rc-test": "^7.1.3",
- "react": "^18.2.0",
- "react-dom": "^18.2.0",
- "typescript": "5.x"
+ "react": "^19.2.7",
+ "react-dom": "^19.2.7",
+ "typescript": "^6.0.3"
},
"engines": {
"node": ">=14.x"
From ec6fd0f6391dab51409e6b4ef9d6134867ae63e1 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:23:19 +0800
Subject: [PATCH 07/13] chore: fix upgraded test tooling
---
eslint.config.mjs | 64 +++++++++++++++++++++++++++++++++++++++++++++++
package.json | 11 +++++++-
2 files changed, 74 insertions(+), 1 deletion(-)
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 f66f9e2..5c7e761 100644
--- a/package.json
+++ b/package.json
@@ -64,7 +64,16 @@
"rc-test": "^7.1.3",
"react": "^19.2.7",
"react-dom": "^19.2.7",
- "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"
},
"engines": {
"node": ">=14.x"
From 550d412d5d851de9eb7cd2e7e83877bdd195ae86 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:26:22 +0800
Subject: [PATCH 08/13] 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 be4ec65..4642693 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -13,7 +13,7 @@
-简体中文 | English
+English | 简体中文
## 亮点
From 4ea6dd28aa831bc161cfe40f238ecf044f980daf Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:44:56 +0800
Subject: [PATCH 09/13] chore: fix upgraded tooling checks
---
tsconfig.json | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tsconfig.json b/tsconfig.json
index e7077c7..d80822f 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,9 @@
{
"compilerOptions": {
"target": "esnext",
+ "ignoreDeprecations": "6.0",
+ "strict": false,
+ "types": ["node", "jest"],
"moduleResolution": "node",
"baseUrl": "./",
"jsx": "react",
From 2313c27bf618db6dc26a946dde08e6ca3af3a165 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:56:03 +0800
Subject: [PATCH 10/13] chore: align TypeScript 6 tooling checks
---
src/index.ts | 2 +-
tsconfig.json | 10 ++++------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/index.ts b/src/index.ts
index 57e2e17..9738645 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -19,7 +19,7 @@ import { messages as defaultMessages, newMessages } from './messages';
import { asyncMap, complementError, convertFieldsError, deepMerge, format, warning } from './util';
import validators from './validator/index';
-export * from './interface';
+export type * from './interface';
/**
* Encapsulates a validation schema.
diff --git a/tsconfig.json b/tsconfig.json
index d80822f..1eb98ca 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,19 +1,17 @@
{
"compilerOptions": {
"target": "esnext",
- "ignoreDeprecations": "6.0",
"strict": false,
"types": ["node", "jest"],
- "moduleResolution": "node",
- "baseUrl": "./",
+ "moduleResolution": "bundler",
"jsx": "react",
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"paths": {
- "@/*": ["src/*"],
- "@@/*": ["src/.umi/*"],
- "@rc-component/async-validator": ["src/index.ts"]
+ "@/*": ["./src/*"],
+ "@@/*": ["./src/.umi/*"],
+ "@rc-component/async-validator": ["./src/index.ts"]
}
},
"include": ["**/*.ts", "**/*.tsx", ".dumirc.ts"]
From 0ae84fc2f8796ed5008403ff82664b066faa45cd Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 18:34:52 +0800
Subject: [PATCH 11/13] 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 bc0eb52..78231d6 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,7 @@ validator.validate({ name: 'Ant Design' }).then(() => {
## Development
```bash
-ut install
+npm install
npm start
npm test
npm run coverage
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 4642693..466afdf 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -54,7 +54,7 @@ validator.validate({ name: 'Ant Design' }).then(() => {
## 本地开发
```bash
-ut install
+npm install
npm start
npm test
npm run coverage
From fdfd4c438406de6c6e7309402e203b5ababc2003 Mon Sep 17 00:00:00 2001
From: afc163
Date: Thu, 2 Jul 2026 11:53:57 +0800
Subject: [PATCH 12/13] chore: migrate to native eslint flat config
---
.eslintrc.js | 8 ---
eslint.config.mjs | 131 +++++++++++++++++++++++++++++++---------------
package.json | 19 ++++---
3 files changed, 98 insertions(+), 60 deletions(-)
delete mode 100644 .eslintrc.js
diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644
index 1fe6f50..0000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const base = require('@umijs/fabric/dist/eslint');
-
-module.exports = {
- ...base,
- rules: {
- ...base.rules,
- },
-};
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 5c7e761..b0018f4 100644
--- a/package.json
+++ b/package.json
@@ -49,31 +49,30 @@
"@babel/runtime": "^7.29.7"
},
"devDependencies": {
+ "@eslint/js": "^9.39.4",
"@rc-component/father-plugin": "^2.2.0",
"@rc-component/np": "^1.0.4",
"@types/jest": "^30.0.0",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
- "@umijs/fabric": "^4.0.1",
"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",
"gh-pages": "^6.1.1",
+ "globals": "^17.7.0",
"lint-staged": "^17.0.8",
"prettier": "^3.9.4",
"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",
- "@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"
},
"engines": {
"node": ">=14.x"
From 8b5ce6c57431d9253275ddb1f2cbaab4ea192333 Mon Sep 17 00:00:00 2001
From: afc163
Date: Fri, 3 Jul 2026 10:58:01 +0800
Subject: [PATCH 13/13] 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 b0018f4..c8b9677 100644
--- a/package.json
+++ b/package.json
@@ -58,9 +58,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",