From e135b993509783b3331d1f0c5c297867b213f6c3 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 10:03:30 +0800
Subject: [PATCH 01/14] chore: standardize repository maintenance
---
.github/FUNDING.yml | 2 +
.github/dependabot.yml | 27 ++++++++++
.github/workflows/codeql.yml | 43 +++++++++++++++
.github/workflows/react-doctor.yml | 22 ++++++++
.github/workflows/surge-preview.yml | 48 +++++++++++++++++
.github/workflows/test.yml | 16 ++++++
README.md | 81 ++++++++++++++++++++---------
README.zh-CN.md | 73 ++++++++++++++++++++++++++
package.json | 9 ++--
vercel.json | 6 +++
10 files changed, 297 insertions(+), 30 deletions(-)
create mode 100644 .github/FUNDING.yml
create mode 100644 .github/dependabot.yml
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
new file mode 100644
index 0000000..758659a
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,2 @@
+github: ant-design
+open_collective: ant-design
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..5e6c7fa
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,27 @@
+version: 2
+updates:
+ - 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
+ 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..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 9d43240..8fe1f44 100644
--- a/README.md
+++ b/README.md
@@ -1,44 +1,73 @@
-# @rc-component/mini-decimal
+
+
@rc-component/mini-decimal
+
Part of the Ant Design ecosystem.
+
🧮 Small decimal calculator for precise string-based arithmetic.
-A mini decimal calculator which only support `add`, `multi` or compare operation for mini bundle size.
+
+
+
+
+
+
+
+
+
-[![NPM version][npm-image]][npm-url] [](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![npm download][download-image]][download-url]
+English | [简体中文](./README.zh-CN.md)
-[npm-image]: http://img.shields.io/npm/v/@rc-component/mini-decimal.svg?style=flat-square
-[npm-url]: http://npmjs.org/package/@rc-component/mini-decimal
-[github-actions-image]: https://github.com/react-component/mini-decimal/workflows/CI/badge.svg
-[github-actions-url]: https://github.com/react-component/mini-decimal/actions
-[codecov-image]: https://img.shields.io/codecov/c/github/react-component/mini-decimal/master.svg?style=flat-square
-[codecov-url]: https://codecov.io/gh/react-component/mini-decimal/branch/master
-[download-image]: https://img.shields.io/npm/dm/@rc-component/mini-decimal.svg?style=flat-square
-[download-url]: https://npmjs.org/package/@rc-component/mini-decimal
+## Highlights
-## Development
+| Area | Support |
+| ------- | ------------------------------------------------------------- |
+| Purpose | Small decimal calculator for precise string-based arithmetic. |
+| Package | `@rc-component/mini-decimal` |
+| Release | `@rc-component/np` / `rc-np` |
+
+## Install
```bash
-npm install
-npm test
+npm install @rc-component/mini-decimal
```
## Usage
-```tsx
+```tsx | pure
import getMiniDecimal from '@rc-component/mini-decimal';
-// Add
getMiniDecimal('0.1').add('0.2').toString(); // 0.3
-
-// Multi
getMiniDecimal('0.1').multi('0.2').toString(); // 0.02
+```
+
+## API
-// Negate
-getMiniDecimal('0.1').negate().toString(); // -0.1
+| Method | Description |
+| ------------------- | ---------------------------------- |
+| `add(value)` | Add another decimal value. |
+| `multi(value)` | Multiply by another decimal value. |
+| `negate()` | Return the negated value. |
+| `equal(value)` | Check equality. |
+| `lessEquals(value)` | Compare two decimal values. |
-// Equal
-getMiniDecimal('0.1').equal('0.1'); // true
-getMiniDecimal('0.1').equal('0.2'); // false
+## Development
-// Less Equals
-getMiniDecimal('0.1').lessEquals('0.2'); // true
-getMiniDecimal('0.1').lessEquals('0.1'); // false
+```bash
+npm install
+npm test
+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.
+
+## License
+
+@rc-component/mini-decimal 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..f447024
--- /dev/null
+++ b/README.zh-CN.md
@@ -0,0 +1,73 @@
+
+
@rc-component/mini-decimal
+
Ant Design 生态的一部分。
+
🧮 用于精确字符串小数运算的轻量计算工具。
+
+
+
+
+
+
+
+
+
+
+
+简体中文 | [English](./README.md)
+
+## 亮点
+
+| 方向 | 支持 |
+| ---- | -------------------------------------- |
+| 定位 | 用于精确字符串小数运算的轻量计算工具。 |
+| 包名 | `@rc-component/mini-decimal` |
+| 发布 | `@rc-component/np` / `rc-np` |
+
+## 安装
+
+```bash
+npm install @rc-component/mini-decimal
+```
+
+## 用法
+
+```tsx | pure
+import getMiniDecimal from '@rc-component/mini-decimal';
+
+getMiniDecimal('0.1').add('0.2').toString(); // 0.3
+getMiniDecimal('0.1').multi('0.2').toString(); // 0.02
+```
+
+## API
+
+| 名称 | 说明 |
+| ------------------- | ------------------ |
+| `add(value)` | 加上另一个小数值。 |
+| `multi(value)` | 乘以另一个小数值。 |
+| `negate()` | 返回相反数。 |
+| `equal(value)` | 判断是否相等。 |
+| `lessEquals(value)` | 比较两个小数值。 |
+
+## 本地开发
+
+```bash
+npm install
+npm test
+npm run lint
+npm run tsc
+npm run compile
+```
+
+本地 dumi 站点默认运行在 `http://localhost:8000`.
+
+## 发布
+
+```bash
+npm run prepublishOnly
+```
+
+发布流程通过 `@rc-component/np` 提供的 `rc-np` 命令处理。
+
+## 许可证
+
+@rc-component/mini-decimal 基于 [MIT](./LICENSE) 协议发布。
diff --git a/package.json b/package.json
index 4b192ba..0549da0 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@rc-component/mini-decimal",
"version": "1.1.4",
- "description": "Lite lib to only support decimal add calculation",
+ "description": "🧮 Small decimal calculator for precise string-based arithmetic.",
"keywords": [
"decimal"
],
@@ -30,12 +30,13 @@
"coverage": "rc-test --coverage",
"lint": "eslint src/ --ext .tsx,.ts",
"lint:tsc": "tsc -p tsconfig.json --noEmit",
- "now-build": "npm run docs:build",
"prepublishOnly": "npm run compile && rc-np",
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
"start": "dumi dev",
"test": "rc-test",
- "watch": "father dev"
+ "watch": "father dev",
+ "build": "dumi build",
+ "tsc": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@babel/runtime": "^7.18.0"
@@ -57,7 +58,7 @@
"prettier": "^3.3.3",
"react": "^18.0.0",
"react-dom": "^18.0.0",
- "rc-test": "^7.0.15",
+ "rc-test": "^7.1.3",
"typescript": "^5.4.5"
},
"engines": {
diff --git a/vercel.json b/vercel.json
new file mode 100644
index 0000000..5f9139e
--- /dev/null
+++ b/vercel.json
@@ -0,0 +1,6 @@
+{
+ "framework": "umijs",
+ "installCommand": "npm install",
+ "buildCommand": "npm run build",
+ "outputDirectory": "docs-dist"
+}
From 61d8f304f00da4b2bbedbe0f813829dd0168018d Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 10:09:34 +0800
Subject: [PATCH 02/14] chore: align reusable test workflow
---
.github/workflows/main.yml | 8 --------
1 file changed, 8 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 1426eec..0000000
--- a/.github/workflows/main.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-name: ✅ test
-
-on: [push, pull_request]
-
-jobs:
- test:
- uses: react-component/rc-test/.github/workflows/test.yml@main
- secrets: inherit
From 972695fecf5c61c12b09bf1dcd1a6b1189aae1c2 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 11:59:46 +0800
Subject: [PATCH 03/14] chore: address review feedback
---
.github/workflows/surge-preview.yml | 2 +-
README.md | 6 +++---
README.zh-CN.md | 6 +++---
package.json | 2 +-
vercel.json | 2 +-
5 files changed, 9 insertions(+), 9 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 8fe1f44..5b113da 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
-English | [简体中文](./README.zh-CN.md)
+English | 简体中文
## Highlights
@@ -46,12 +46,12 @@ getMiniDecimal('0.1').multi('0.2').toString(); // 0.02
| `multi(value)` | Multiply by another decimal value. |
| `negate()` | Return the negated value. |
| `equal(value)` | Check equality. |
-| `lessEquals(value)` | Compare two decimal values. |
+| `lessEquals(value)` | Check whether the current value is less than or equal to another decimal value. |
## Development
```bash
-npm install
+ut install
npm test
npm run lint
npm run tsc
diff --git a/README.zh-CN.md b/README.zh-CN.md
index f447024..de6a495 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -13,7 +13,7 @@
-简体中文 | [English](./README.md)
+简体中文 | English
## 亮点
@@ -46,12 +46,12 @@ getMiniDecimal('0.1').multi('0.2').toString(); // 0.02
| `multi(value)` | 乘以另一个小数值。 |
| `negate()` | 返回相反数。 |
| `equal(value)` | 判断是否相等。 |
-| `lessEquals(value)` | 比较两个小数值。 |
+| `lessEquals(value)` | 判断当前值是否小于或等于另一个小数值。 |
## 本地开发
```bash
-npm install
+ut install
npm test
npm run lint
npm run tsc
diff --git a/package.json b/package.json
index 0549da0..214ebac 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,7 @@
"test": "rc-test",
"watch": "father dev",
"build": "dumi build",
- "tsc": "tsc -p tsconfig.json --noEmit"
+ "tsc": "npm run lint:tsc"
},
"dependencies": {
"@babel/runtime": "^7.18.0"
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 d5836c92c31763aa94d2cf6e96a3a3ad5aaec35a Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 12:04:19 +0800
Subject: [PATCH 04/14] 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 8ff23c1e44841b77c3cf8ac5592ffd6998f50f15 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 13:32:26 +0800
Subject: [PATCH 05/14] 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 5cb68b8858df269ab4933c5c6319a0a8b4e99640 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:02:17 +0800
Subject: [PATCH 06/14] chore: align maintenance dependencies
---
package.json | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/package.json b/package.json
index 214ebac..70169fa 100644
--- a/package.json
+++ b/package.json
@@ -39,27 +39,27 @@
"tsc": "npm run lint:tsc"
},
"dependencies": {
- "@babel/runtime": "^7.18.0"
+ "@babel/runtime": "^7.29.7"
},
"devDependencies": {
"@rc-component/father-plugin": "^2.2.0",
"@rc-component/np": "^1.0.4",
- "@testing-library/jest-dom": "^6.1.5",
- "@testing-library/react": "^16.1.0",
- "@types/jest": "^29.5.12",
- "@types/node": "^22.1.0",
- "@types/react": "^18.3.12",
- "@types/react-dom": "^18.3.1",
+ "@testing-library/jest-dom": "^6.9.1",
+ "@testing-library/react": "^16.3.2",
+ "@types/jest": "^30.0.0",
+ "@types/node": "^26.0.1",
+ "@types/react": "^19.2.17",
+ "@types/react-dom": "^19.2.3",
"@umijs/fabric": "^4.0.1",
- "dumi": "^2.3.8",
- "eslint": "^8.57.0",
- "father": "^4.4.4",
+ "dumi": "^2.4.38",
+ "eslint": "^9.39.4",
+ "father": "^4.6.24",
"gh-pages": "^6.1.1",
- "prettier": "^3.3.3",
- "react": "^18.0.0",
- "react-dom": "^18.0.0",
+ "prettier": "^3.9.4",
+ "react": "^19.2.7",
+ "react-dom": "^19.2.7",
"rc-test": "^7.1.3",
- "typescript": "^5.4.5"
+ "typescript": "^6.0.3"
},
"engines": {
"node": ">=8.x"
From 4517fccc0d147c01bc19a8e51b1f3845519f0ca1 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:24:19 +0800
Subject: [PATCH 07/14] 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 70169fa..2315e01 100644
--- a/package.json
+++ b/package.json
@@ -59,7 +59,16 @@
"react": "^19.2.7",
"react-dom": "^19.2.7",
"rc-test": "^7.1.3",
- "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": ">=8.x"
From 0bf15f42f46b8f523ec2e38b45f0edf45b571a15 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:26:38 +0800
Subject: [PATCH 08/14] 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 de6a495..274aab1 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -13,7 +13,7 @@
-简体中文 | English
+English | 简体中文
## 亮点
From 24bdd3772ab3f30238bc243759f44a1d2cb1ec85 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:45:46 +0800
Subject: [PATCH 09/14] chore: fix upgraded tooling checks
---
tsconfig.json | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tsconfig.json b/tsconfig.json
index 5fbc200..32a6043 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,8 @@
{
"compilerOptions": {
"target": "esnext",
+ "ignoreDeprecations": "6.0",
+ "strict": false,
"moduleResolution": "node",
"baseUrl": "./",
"jsx": "preserve",
From 1b5f8eeda8d8eb963908ce927b48c264d60bd1bb Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:56:18 +0800
Subject: [PATCH 10/14] chore: align TypeScript 6 tooling checks
---
src/MiniDecimal.ts | 9 +++++----
src/index.ts | 2 ++
tsconfig.json | 10 ++++------
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/MiniDecimal.ts b/src/MiniDecimal.ts
index 34e47d6..90ff97d 100644
--- a/src/MiniDecimal.ts
+++ b/src/MiniDecimal.ts
@@ -1,13 +1,14 @@
-/* eslint-disable max-classes-per-file */
+/* eslint @typescript-eslint/consistent-type-exports: off */
-import BigIntDecimal from './BigIntDecimal';
-import NumberDecimal from './NumberDecimal';
+import BigIntDecimalBase from './BigIntDecimal';
+import NumberDecimalBase from './NumberDecimal';
import type { DecimalClass, ValueType } from './interface';
import { trimNumber } from './numberUtil';
import { supportBigInt } from './supportUtil';
// Still support origin export
-export { NumberDecimal, BigIntDecimal };
+export const NumberDecimal = NumberDecimalBase;
+export const BigIntDecimal = BigIntDecimalBase;
export type { DecimalClass, ValueType };
diff --git a/src/index.ts b/src/index.ts
index c63a3a2..ae3e66d 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,3 +1,5 @@
+/* eslint @typescript-eslint/consistent-type-exports: off */
+
import getMiniDecimal from './MiniDecimal';
export * from './MiniDecimal';
import {
diff --git a/tsconfig.json b/tsconfig.json
index 32a6043..05144a8 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,19 +1,17 @@
{
"compilerOptions": {
"target": "esnext",
- "ignoreDeprecations": "6.0",
"strict": false,
- "moduleResolution": "node",
- "baseUrl": "./",
+ "moduleResolution": "bundler",
"jsx": "preserve",
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"types": ["@testing-library/jest-dom", "node", "jest"],
"paths": {
- "@/*": ["src/*"],
- "@@/*": ["src/.umi/*"],
- "@rc-component/portal": ["src/Portal.tsx"]
+ "@/*": ["./src/*"],
+ "@@/*": ["./src/.umi/*"],
+ "@rc-component/portal": ["./src/Portal.tsx"]
}
},
"include": [
From bf7fb9d3bb7d5e9eb39100fc5fbe335a96f07b4c Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 18:36:19 +0800
Subject: [PATCH 11/14] 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 5b113da..3a5f7fd 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ getMiniDecimal('0.1').multi('0.2').toString(); // 0.02
## Development
```bash
-ut install
+npm install
npm test
npm run lint
npm run tsc
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 274aab1..b8595d4 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -51,7 +51,7 @@ getMiniDecimal('0.1').multi('0.2').toString(); // 0.02
## 本地开发
```bash
-ut install
+npm install
npm test
npm run lint
npm run tsc
From ff1aefbb241e80afe7be8ea39e5ae70320009fd3 Mon Sep 17 00:00:00 2001
From: afc163
Date: Thu, 2 Jul 2026 11:54:02 +0800
Subject: [PATCH 12/14] chore: migrate to native eslint flat config
---
.eslintrc.js | 11 ----
eslint.config.mjs | 131 +++++++++++++++++++++++++++++++---------------
package.json | 21 ++++----
3 files changed, 99 insertions(+), 64 deletions(-)
delete mode 100644 .eslintrc.js
diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644
index 59511d8..0000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const config = {
- extends: [require.resolve('@umijs/fabric/dist/eslint')],
- rules: {
- 'react/no-did-update-set-state': 0,
- 'react/no-find-dom-node': 0,
- 'import/no-extraneous-dependencies': 0,
- 'react/sort-comp': 0,
- },
-};
-
-module.exports = config;
\ No newline at end of file
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 2315e01..aa12c64 100644
--- a/package.json
+++ b/package.json
@@ -42,6 +42,7 @@
"@babel/runtime": "^7.29.7"
},
"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",
@@ -50,25 +51,23 @@
"@types/node": "^26.0.1",
"@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",
"prettier": "^3.9.4",
+ "rc-test": "^7.1.3",
"react": "^19.2.7",
"react-dom": "^19.2.7",
- "rc-test": "^7.1.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"
+ "typescript-eslint": "^8.62.1"
},
"engines": {
"node": ">=8.x"
From 410816423b8311c998e8ba66780a200bd4692469 Mon Sep 17 00:00:00 2001
From: afc163
Date: Fri, 3 Jul 2026 10:58:08 +0800
Subject: [PATCH 13/14] chore: address review comments
---
.github/workflows/surge-preview.yml | 2 +-
eslint.config.mjs | 10 +++++++---
package.json | 2 --
vercel.json | 2 +-
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml
index ba9f1dd..f9e3639 100644
--- a/.github/workflows/surge-preview.yml
+++ b/.github/workflows/surge-preview.yml
@@ -44,7 +44,7 @@ jobs:
with:
surge_token: ${{ env.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- dist: docs-dist
+ dist: dist
failOnError: false
setCommitStatus: false
- name: Skip Surge preview
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 aa12c64..54345fd 100644
--- a/package.json
+++ b/package.json
@@ -54,9 +54,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",
diff --git a/vercel.json b/vercel.json
index 5f9139e..e884e1b 100644
--- a/vercel.json
+++ b/vercel.json
@@ -2,5 +2,5 @@
"framework": "umijs",
"installCommand": "npm install",
"buildCommand": "npm run build",
- "outputDirectory": "docs-dist"
+ "outputDirectory": "dist"
}
From fd173ff1fb39fb74bf52d22c3ad6a74aa3e868c6 Mon Sep 17 00:00:00 2001
From: afc163
Date: Fri, 3 Jul 2026 11:34:19 +0800
Subject: [PATCH 14/14] ci: remove legacy preview workflow
---
.github/workflows/preview.yml | 20 --------------------
1 file changed, 20 deletions(-)
delete mode 100644 .github/workflows/preview.yml
diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml
deleted file mode 100644
index d02059a..0000000
--- a/.github/workflows/preview.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-name: 🔂 Surge PR Preview
-
-on: [pull_request]
-
-jobs:
- preview:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - uses: afc163/surge-preview@v1
- id: preview_step
- with:
- surge_token: ${{ secrets.SURGE_TOKEN }}
- github_token: ${{ secrets.GITHUB_TOKEN }}
- dist: .doc
- build: |
- npm install
- npm run docs:build
- - name: Get the preview_url
- run: echo "url => ${{ steps.preview_step.outputs.preview_url }}"