From 85f06d6d32638940b4843346e89388f40efccf8e Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 10:03:30 +0800
Subject: [PATCH 01/15] chore: standardize repository maintenance
---
.github/FUNDING.yml | 2 +
.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 | 118 +++++++++++++++-------------
README.zh-CN.md | 77 ++++++++++++++++++
docs/shadow-dom.tsx | 6 +-
now.json | 11 ---
package.json | 41 +++++-----
tsconfig.json | 3 +-
vercel.json | 6 ++
13 files changed, 328 insertions(+), 97 deletions(-)
create mode 100644 .github/FUNDING.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
delete mode 100644 now.json
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
index 3a3cce5..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/github/administering-a-repository/configuration-options-for-dependency-updates
-
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..54244f7
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,43 @@
+name: 'CodeQL'
+
+on:
+ push:
+ branches: ['main']
+ pull_request:
+ branches: ['main']
+ 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..20e282c
--- /dev/null
+++ b/.github/workflows/react-doctor.yml
@@ -0,0 +1,22 @@
+name: React Doctor
+
+on:
+ pull_request:
+ push:
+ branches: [main]
+
+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..1f076bc
--- /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: .doc
+ 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..ac9a11d
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,16 @@
+name: ✅ test
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+
+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 5184461..9752186 100644
--- a/README.md
+++ b/README.md
@@ -1,67 +1,79 @@
-# @rc-component/dom-align
-
----
-
-Align source html element with target html element flexibly.
-
-[![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]
-[![bundle size][bundlephobia-image]][bundlephobia-url]
-[![dumi][dumi-image]][dumi-url]
-
-[npm-image]: http://img.shields.io/npm/v/@rc-component/dom-align.svg?style=flat-square
-[npm-url]: http://npmjs.org/package/@rc-component/dom-align
-[travis-image]: https://img.shields.io/travis/react-component/dom-align/main?style=flat-square
-[travis-url]: https://travis-ci.com/react-component/dom-align
-[github-actions-image]: https://github.com/react-component/dom-align/actions/workflows/ci.yml/badge.svg
-[github-actions-url]: https://github.com/react-component/dom-align/actions/workflows/ci.yml
-[codecov-image]: https://img.shields.io/codecov/c/github/react-component/dom-align/main.svg?style=flat-square
-[codecov-url]: https://app.codecov.io/gh/react-component/dom-align
-[david-url]: https://david-dm.org/react-component/dom-align
-[david-image]: https://david-dm.org/react-component/dom-align/status.svg?style=flat-square
-[david-dev-url]: https://david-dm.org/react-component/dom-align?type=dev
-[david-dev-image]: https://david-dm.org/react-component/dom-align/dev-status.svg?style=flat-square
-[download-image]: https://img.shields.io/npm/dm/@rc-component/dom-align.svg?style=flat-square
-[download-url]: https://npmjs.org/package/@rc-component/dom-align
-[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/dom-align
-[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/dom-align
-[dumi-url]: https://github.com/umijs/dumi
-[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
-
-## Screenshot
-
-
+
+
@rc-component/dom-align
+
Part of the Ant Design ecosystem.
+
📐 DOM alignment utility for positioning one element against another.
+
+
+
+
+
+
+
+
+
+
+
+English | [简体中文](./README.zh-CN.md)
+
+## Highlights
+
+| Area | Support |
+| ------- | ------------------------------------------------------------------ |
+| Purpose | DOM alignment utility for positioning one element against another. |
+| Package | `@rc-component/dom-align` |
+| Release | `@rc-component/np` / `rc-np` |
## Install
-[](https://npmjs.org/package/@rc-component/dom-align)
-
-## Feature
-
-- support Edge Chrome Firefox
-- support align points and offset
-- support auto adjust according to visible area
+```bash
+npm install @rc-component/dom-align
+```
## Usage
-```js
+```tsx | pure
import domAlign from '@rc-component/dom-align';
-// use domAlign
-// sourceNode's initial style should be position:absolute;left:-9999px;top:-9999px;
+domAlign(sourceNode, targetNode, {
+ points: ['tl', 'tr'],
+ offset: [10, 20],
+ overflow: { adjustX: true, adjustY: true },
+});
+```
+
+## API
+
+| Option | Description |
+| --- | --- |
+| `points` | Source and target alignment points. |
+| `offset` | Source node offset. |
+| `targetOffset` | Target node offset. |
+| `overflow` | Auto-adjust behavior when the source overflows viewport. |
+| `useCssRight` / `useCssBottom` / `useCssTransform` | Choose CSS positioning strategy. |
-const alignConfig = {
- points: ['tl', 'tr'], // align top left point of sourceNode with top right point of targetNode
- offset: [10, 20], // the offset sourceNode by 10px in x and 20px in y,
- targetOffset: ['30%', '40%'], // the offset targetNode by 30% of targetNode width in x and 40% of targetNode height in y,
- overflow: { adjustX: true, adjustY: true }, // auto adjust position when sourceNode is overflowed
-};
+## Development
-domAlign(sourceNode, targetNode, alignConfig);
+```bash
+npm install
+npm start
+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.
+
+## Detailed API
+
## API
### void domAlign(source: HTMLElement, target: HTMLElement, alignConfig: Object):Function
@@ -138,4 +150,4 @@ http://localhost:8000/
## License
-@rc-component/dom-align is released under the MIT license.
+@rc-component/dom-align 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..63b2ff3
--- /dev/null
+++ b/README.zh-CN.md
@@ -0,0 +1,77 @@
+
+
@rc-component/dom-align
+
Ant Design 生态的一部分。
+
📐 用于将一个 DOM 元素相对另一个元素定位的对齐工具。
+
+
+
+
+
+
+
+
+
+
+
+简体中文 | [English](./README.md)
+
+## 亮点
+
+| 方向 | 支持 |
+| ---- | ------------------------------------------------- |
+| 定位 | 用于将一个 DOM 元素相对另一个元素定位的对齐工具。 |
+| 包名 | `@rc-component/dom-align` |
+| 发布 | `@rc-component/np` / `rc-np` |
+
+## 安装
+
+```bash
+npm install @rc-component/dom-align
+```
+
+## 用法
+
+```tsx | pure
+import domAlign from '@rc-component/dom-align';
+
+domAlign(sourceNode, targetNode, {
+ points: ['tl', 'tr'],
+ offset: [10, 20],
+ overflow: { adjustX: true, adjustY: true },
+});
+```
+
+## API
+
+| 名称 | 说明 |
+| -------------------------------------------------- | -------------------------------- |
+| `points` | 源节点和目标节点的对齐点。 |
+| `offset` | 源节点偏移。 |
+| `targetOffset` | 目标节点偏移。 |
+| `overflow` | 源节点超出视口时的自动调整行为。 |
+| `useCssRight` / `useCssBottom` / `useCssTransform` | 选择 CSS 定位策略。 |
+
+## 本地开发
+
+```bash
+npm install
+npm start
+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/dom-align 基于 [MIT](./LICENSE.md) 协议发布。
diff --git a/docs/shadow-dom.tsx b/docs/shadow-dom.tsx
index abfd752..6887e69 100644
--- a/docs/shadow-dom.tsx
+++ b/docs/shadow-dom.tsx
@@ -1,6 +1,6 @@
-import React, { useEffect } from 'react';
import domAlign from '@rc-component/dom-align';
-import ReactDOM from 'react-dom';
+import React, { useEffect } from 'react';
+import { createRoot } from 'react-dom/client';
class Test extends React.Component {
align() {
@@ -44,7 +44,7 @@ export default () => {
const div = document.createElement('div');
const shadowRoot = div.attachShadow({ mode: 'open' });
divRef.current.appendChild(div);
- ReactDOM.render( , shadowRoot);
+ createRoot(shadowRoot).render( );
}, []);
return
;
};
diff --git a/now.json b/now.json
deleted file mode 100644
index e257770..0000000
--- a/now.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "version": 2,
- "name": "@rc-component/dom-align",
- "builds": [
- {
- "src": "package.json",
- "use": "@now/static-build",
- "config": { "distDir": ".doc" }
- }
- ]
-}
diff --git a/package.json b/package.json
index 10725ea..f9730e3 100644
--- a/package.json
+++ b/package.json
@@ -1,16 +1,21 @@
{
"name": "@rc-component/dom-align",
"version": "2.0.1",
- "description": "Align DOM Node Flexibly ",
- "packageManager": "pnpm@8.9.0",
- "engines": {
- "node": ">=14.x"
- },
+ "description": "📐 DOM alignment utility for positioning one element against another.",
"keywords": [
"react",
"react-component",
"dom-align"
],
+ "homepage": "https://github.com/react-component/dom-align",
+ "bugs": {
+ "url": "https://github.com/react-component/dom-align/issues"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git@github.com:react-component/dom-align.git"
+ },
+ "license": "MIT",
"main": "./lib/index",
"module": "./es/index",
"types": "./lib/index.d.ts",
@@ -18,34 +23,24 @@
"es",
"lib"
],
- "homepage": "https://github.com/react-component/dom-align",
- "repository": {
- "type": "git",
- "url": "git@github.com:react-component/dom-align.git"
- },
- "bugs": {
- "url": "https://github.com/react-component/dom-align/issues"
- },
- "license": "MIT",
"scripts": {
- "start": "dumi dev",
"build": "dumi build",
"compile": "father build",
- "prepublishOnly": "npm run compile && np --yolo --no-publish",
"lint": "eslint src/ docs/ --ext .tsx,.ts,.jsx,.js",
+ "prepublishOnly": "npm run compile && rc-np",
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
+ "start": "dumi dev",
"test": "cypress run --component && echo ''",
"test:ci": "cypress run --component --record --key $CYPRESS_RECORD_KEY",
- "tsc": "tsc --noEmit",
- "now-build": "npm run build"
+ "tsc": "tsc --noEmit"
},
"nyc": {
- "excludeAfterRemap": true,
"exclude": [
"**/node_modules/**/*",
"**/.pnpm/**/*",
"**/cypress/**/*"
],
+ "excludeAfterRemap": true,
"reporter": [
"text",
"lcov"
@@ -56,7 +51,8 @@
},
"devDependencies": {
"@cypress/code-coverage": "~3.12.45",
- "@rc-component/father-plugin": "^1.1.0",
+ "@rc-component/father-plugin": "^2.2.0",
+ "@rc-component/np": "^1.0.4",
"@types/node": "^20.16.1",
"@types/react": "~18.3.4",
"@types/react-dom": "~18.3.0",
@@ -69,13 +65,16 @@
"markdown-it": "^14.1.0",
"next": "~14.2.6",
"normalize.css": "^8.0.1",
- "np": "^7.7.0",
"prettier": "^2.8.8",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"swc-plugin-coverage-instrument": "0.0.21",
"typescript": "~5.5.4"
},
+ "packageManager": "pnpm@8.9.0",
+ "engines": {
+ "node": ">=14.x"
+ },
"publishConfig": {
"access": "public"
}
diff --git a/tsconfig.json b/tsconfig.json
index 86cca09..326ce35 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -12,5 +12,6 @@
"@@/*": ["src/.umi/*"],
"@rc-component/dom-align": ["src/index.ts"]
}
- }
+ },
+ "include": ["**/*.ts", "**/*.tsx", ".dumirc.ts"]
}
diff --git a/vercel.json b/vercel.json
new file mode 100644
index 0000000..fe70e76
--- /dev/null
+++ b/vercel.json
@@ -0,0 +1,6 @@
+{
+ "framework": "umijs",
+ "installCommand": "npm install",
+ "buildCommand": "npm run build",
+ "outputDirectory": ".doc"
+}
From 0eef85cf4f6d2d5b393a3f66723e961a250c67fe Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 10:09:42 +0800
Subject: [PATCH 02/15] chore: align reusable test workflow
---
.github/workflows/ci.yml | 6 ------
1 file changed, 6 deletions(-)
delete mode 100644 .github/workflows/ci.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
From 4f98aad1405d4aeecdf4e4f43f01bcb09135d1e5 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 11:59:55 +0800
Subject: [PATCH 03/15] chore: address review feedback
---
.github/workflows/surge-preview.yml | 2 +-
README.md | 10 ++++------
README.zh-CN.md | 4 ++--
docs/shadow-dom.tsx | 9 ++++++++-
package.json | 2 --
vercel.json | 2 +-
6 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml
index 1f076bc..a3d1e67 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 9752186..0b20d17 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
-English | [简体中文](./README.zh-CN.md)
+English | 简体中文
## Highlights
@@ -54,7 +54,7 @@ domAlign(sourceNode, targetNode, {
## Development
```bash
-npm install
+ut install
npm start
npm test
npm run lint
@@ -74,8 +74,6 @@ The release flow is handled by `@rc-component/np` through the `rc-np` command wh
## Detailed API
-## API
-
### void domAlign(source: HTMLElement, target: HTMLElement, alignConfig: Object):Function
#### alignConfig object details
@@ -140,8 +138,8 @@ The release flow is handled by `@rc-component/np` through the `rc-np` command wh
## Development
```
-pnpm install
-pnpm start
+ut install
+npm start
```
## Example
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 63b2ff3..4f00657 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -13,7 +13,7 @@
-简体中文 | [English](./README.md)
+简体中文 | English
## 亮点
@@ -54,7 +54,7 @@ domAlign(sourceNode, targetNode, {
## 本地开发
```bash
-npm install
+ut install
npm start
npm test
npm run lint
diff --git a/docs/shadow-dom.tsx b/docs/shadow-dom.tsx
index 6887e69..9f4c3ad 100644
--- a/docs/shadow-dom.tsx
+++ b/docs/shadow-dom.tsx
@@ -43,8 +43,15 @@ export default () => {
useEffect(() => {
const div = document.createElement('div');
const shadowRoot = div.attachShadow({ mode: 'open' });
+ const root = createRoot(shadowRoot);
+
divRef.current.appendChild(div);
- createRoot(shadowRoot).render( );
+ root.render( );
+
+ return () => {
+ root.unmount();
+ div.remove();
+ };
}, []);
return
;
};
diff --git a/package.json b/package.json
index f9730e3..f19abdf 100644
--- a/package.json
+++ b/package.json
@@ -37,7 +37,6 @@
"nyc": {
"exclude": [
"**/node_modules/**/*",
- "**/.pnpm/**/*",
"**/cypress/**/*"
],
"excludeAfterRemap": true,
@@ -71,7 +70,6 @@
"swc-plugin-coverage-instrument": "0.0.21",
"typescript": "~5.5.4"
},
- "packageManager": "pnpm@8.9.0",
"engines": {
"node": ">=14.x"
},
diff --git a/vercel.json b/vercel.json
index fe70e76..f623ddd 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1,6 +1,6 @@
{
"framework": "umijs",
- "installCommand": "npm install",
+ "installCommand": "ut install",
"buildCommand": "npm run build",
"outputDirectory": ".doc"
}
From a020ff440c6db849c6d39af09714d028a3a3105e Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 12:04:29 +0800
Subject: [PATCH 04/15] 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 a3d1e67..18227e7 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 28e22e10e9635520c210199e032e9cc8438ee3da Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 13:32:20 +0800
Subject: [PATCH 05/15] 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 f623ddd..fe70e76 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1,6 +1,6 @@
{
"framework": "umijs",
- "installCommand": "ut install",
+ "installCommand": "npm install",
"buildCommand": "npm run build",
"outputDirectory": ".doc"
}
From 9b3b968baafb7c21bc425c9dcd99cf009bde2e90 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:01:22 +0800
Subject: [PATCH 06/15] chore: align maintenance dependencies
---
package.json | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/package.json b/package.json
index f19abdf..328a992 100644
--- a/package.json
+++ b/package.json
@@ -46,29 +46,29 @@
]
},
"dependencies": {
- "@babel/runtime": "^7.25.4"
+ "@babel/runtime": "^7.29.7"
},
"devDependencies": {
"@cypress/code-coverage": "~3.12.45",
"@rc-component/father-plugin": "^2.2.0",
"@rc-component/np": "^1.0.4",
- "@types/node": "^20.16.1",
- "@types/react": "~18.3.4",
- "@types/react-dom": "~18.3.0",
+ "@types/node": "^26.0.1",
+ "@types/react": "^19.2.17",
+ "@types/react-dom": "^19.2.3",
"@umijs/fabric": "^4.0.1",
"cypress": "^13.13.3",
- "dumi": "^2.4.7",
- "eslint": "^8.57.0",
- "father": "^4.5.0",
+ "dumi": "^2.4.38",
+ "eslint": "^9.39.4",
+ "father": "^4.6.24",
"jsonp": "^0.2.1",
"markdown-it": "^14.1.0",
"next": "~14.2.6",
"normalize.css": "^8.0.1",
- "prettier": "^2.8.8",
- "react": "^18.3.1",
- "react-dom": "^18.3.1",
+ "prettier": "^3.9.4",
+ "react": "^19.2.7",
+ "react-dom": "^19.2.7",
"swc-plugin-coverage-instrument": "0.0.21",
- "typescript": "~5.5.4"
+ "typescript": "^6.0.3"
},
"engines": {
"node": ">=14.x"
From 3aa8fbc43b1d2718b604a622d63112ce8dddaaa5 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:23:43 +0800
Subject: [PATCH 07/15] chore: fix upgraded test tooling
---
eslint.config.mjs | 64 +++++++++++++++++++++++++++++++++++++++++++++++
package.json | 13 ++++++++--
2 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 328a992..d0d414d 100644
--- a/package.json
+++ b/package.json
@@ -62,13 +62,22 @@
"father": "^4.6.24",
"jsonp": "^0.2.1",
"markdown-it": "^14.1.0",
- "next": "~14.2.6",
+ "next": "^16.2.9",
"normalize.css": "^8.0.1",
"prettier": "^3.9.4",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"swc-plugin-coverage-instrument": "0.0.21",
- "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 1fd62816c8313045203402e7a4203ee8abd4bfd0 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:26:29 +0800
Subject: [PATCH 08/15] 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 4f00657..a644503 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -13,7 +13,7 @@
-简体中文 | English
+English | 简体中文
## 亮点
From 0d57f7cf822095d387995e1e1ac3e0e59fd62bfc Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:44:57 +0800
Subject: [PATCH 09/15] chore: fix upgraded tooling checks
---
app/body-overflow/page.tsx | 8 ++++----
app/fail/page.tsx | 6 +++---
app/shadow-dom/page.tsx | 10 +++++-----
docs/shadow-dom.tsx | 13 ++++++++-----
global.d.ts | 1 +
tsconfig.json | 3 +++
6 files changed, 24 insertions(+), 17 deletions(-)
create mode 100644 global.d.ts
diff --git a/app/body-overflow/page.tsx b/app/body-overflow/page.tsx
index 9cb0471..19a95f6 100644
--- a/app/body-overflow/page.tsx
+++ b/app/body-overflow/page.tsx
@@ -4,11 +4,11 @@ import React, { useRef, useEffect } from 'react';
import domAlign from '../../src';
export default function Overflow() {
- const source = useRef();
- const target = useRef();
- const timer = useRef();
+ const source = useRef(null);
+ const target = useRef(null);
+ const timer = useRef | null>(null);
const align = () => {
- const ret = domAlign(source.current, target.current, {
+ const ret = domAlign(source.current!, target.current!, {
points: ['tl', 'bl'],
overflow: {
adjustY: 1,
diff --git a/app/fail/page.tsx b/app/fail/page.tsx
index 308cdf8..bd2f6fc 100644
--- a/app/fail/page.tsx
+++ b/app/fail/page.tsx
@@ -4,11 +4,11 @@ import React, { useRef, useEffect } from 'react';
import domAlign from '../../src';
export default function Fail() {
- const source = useRef();
- const target = useRef();
+ const source = useRef(null);
+ const target = useRef(null);
function align() {
- const ret = domAlign(source.current, target.current, {
+ const ret = domAlign(source.current!, target.current!, {
points: ['bl', 'bl'],
overflow: {
adjustY: 1,
diff --git a/app/shadow-dom/page.tsx b/app/shadow-dom/page.tsx
index e4f88e4..c1ccea0 100644
--- a/app/shadow-dom/page.tsx
+++ b/app/shadow-dom/page.tsx
@@ -5,10 +5,10 @@ import ReactDOM from 'react-dom/client';
import domAlign from '../../src';
function Test() {
- const source = useRef();
- const target = useRef();
+ const source = useRef(null);
+ const target = useRef(null);
function align() {
- const ret = domAlign(source.current, target.current, {
+ const ret = domAlign(source.current!, target.current!, {
points: ['bl', 'bl'],
overflow: {
adjustY: 1,
@@ -40,10 +40,10 @@ function Test() {
}
export default function ShadowDom() {
- const source = useRef();
+ const source = useRef(null);
useEffect(() => {
- const shadowRoot = source.current.attachShadow({ mode: 'open' });
+ const shadowRoot = source.current!.attachShadow({ mode: 'open' });
ReactDOM.createRoot(shadowRoot).render( );
}, []);
diff --git a/docs/shadow-dom.tsx b/docs/shadow-dom.tsx
index 9f4c3ad..b21fe71 100644
--- a/docs/shadow-dom.tsx
+++ b/docs/shadow-dom.tsx
@@ -3,8 +3,11 @@ import React, { useEffect } from 'react';
import { createRoot } from 'react-dom/client';
class Test extends React.Component {
+ sourceRef = React.createRef();
+ targetRef = React.createRef();
+
align() {
- const ret = domAlign(this.refs.source, this.refs.target, {
+ const ret = domAlign(this.sourceRef.current!, this.targetRef.current!, {
points: ['bl', 'bl'],
overflow: {
adjustY: 1,
@@ -16,14 +19,14 @@ class Test extends React.Component {
render() {
return (
-
target
+
target
align
{
- const divRef = React.useRef(null);
+ const divRef = React.useRef
(null);
useEffect(() => {
const div = document.createElement('div');
const shadowRoot = div.attachShadow({ mode: 'open' });
const root = createRoot(shadowRoot);
- divRef.current.appendChild(div);
+ divRef.current!.appendChild(div);
root.render( );
return () => {
diff --git a/global.d.ts b/global.d.ts
new file mode 100644
index 0000000..35306c6
--- /dev/null
+++ b/global.d.ts
@@ -0,0 +1 @@
+declare module '*.css';
diff --git a/tsconfig.json b/tsconfig.json
index 326ce35..098cac8 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": "preserve",
From adee6e86c66c431a2a261a99ecbfa6132f95357c Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 14:56:13 +0800
Subject: [PATCH 10/15] chore: align TypeScript 6 tooling checks
---
tsconfig.json | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/tsconfig.json b/tsconfig.json
index 098cac8..372a11c 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": "preserve",
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"paths": {
- "@/*": ["src/*"],
- "@@/*": ["src/.umi/*"],
- "@rc-component/dom-align": ["src/index.ts"]
+ "@/*": ["./src/*"],
+ "@@/*": ["./src/.umi/*"],
+ "@rc-component/dom-align": ["./src/index.ts"]
}
},
"include": ["**/*.ts", "**/*.tsx", ".dumirc.ts"]
From 080faeadbef4763b16e42ec592c3b37cf308b022 Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 15:24:46 +0800
Subject: [PATCH 11/15] test: fix cypress webpack config
---
cypress.config.js | 48 +++++++++++++++++++++++++++++++++++++++++++++++
cypress.config.ts | 15 ---------------
package.json | 9 +++++++++
3 files changed, 57 insertions(+), 15 deletions(-)
create mode 100644 cypress.config.js
delete mode 100644 cypress.config.ts
diff --git a/cypress.config.js b/cypress.config.js
new file mode 100644
index 0000000..99a7e05
--- /dev/null
+++ b/cypress.config.js
@@ -0,0 +1,48 @@
+const { defineConfig } = require('cypress');
+const codeCoverage = require('@cypress/code-coverage/task');
+
+module.exports = defineConfig({
+ projectId: 'bfy1u3',
+ component: {
+ setupNodeEvents(on, config) {
+ codeCoverage(on, config);
+ return config;
+ },
+ devServer: {
+ framework: 'react',
+ bundler: 'webpack',
+ webpackConfig: {
+ module: {
+ rules: [
+ {
+ test: /\.[jt]sx?$/,
+ exclude: /node_modules/,
+ use: {
+ loader: require.resolve('babel-loader'),
+ options: {
+ presets: [
+ require.resolve('@babel/preset-env'),
+ [
+ require.resolve('@babel/preset-react'),
+ {
+ runtime: 'automatic',
+ },
+ ],
+ require.resolve('@babel/preset-typescript'),
+ ],
+ },
+ },
+ },
+ {
+ test: /\.css$/,
+ use: [require.resolve('style-loader'), require.resolve('css-loader')],
+ },
+ ],
+ },
+ resolve: {
+ extensions: ['.ts', '.tsx', '.js', '.jsx'],
+ },
+ },
+ },
+ },
+});
diff --git a/cypress.config.ts b/cypress.config.ts
deleted file mode 100644
index 2e86987..0000000
--- a/cypress.config.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { defineConfig } from 'cypress';
-import codeCoverage from '@cypress/code-coverage/task';
-export default defineConfig({
- projectId: 'bfy1u3',
- component: {
- setupNodeEvents(on, config) {
- codeCoverage(on, config)
- return config;
- },
- devServer: {
- framework: 'next',
- bundler: 'webpack',
- },
- },
-});
diff --git a/package.json b/package.json
index d0d414d..d4de95e 100644
--- a/package.json
+++ b/package.json
@@ -49,6 +49,10 @@
"@babel/runtime": "^7.29.7"
},
"devDependencies": {
+ "@babel/core": "^8.0.1",
+ "@babel/preset-env": "^8.0.2",
+ "@babel/preset-react": "^8.0.1",
+ "@babel/preset-typescript": "^8.0.1",
"@cypress/code-coverage": "~3.12.45",
"@rc-component/father-plugin": "^2.2.0",
"@rc-component/np": "^1.0.4",
@@ -56,6 +60,9 @@
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
"@umijs/fabric": "^4.0.1",
+ "ajv": "^8.20.0",
+ "babel-loader": "^10.1.1",
+ "css-loader": "^7.1.2",
"cypress": "^13.13.3",
"dumi": "^2.4.38",
"eslint": "^9.39.4",
@@ -67,8 +74,10 @@
"prettier": "^3.9.4",
"react": "^19.2.7",
"react-dom": "^19.2.7",
+ "style-loader": "^4.0.0",
"swc-plugin-coverage-instrument": "0.0.21",
"typescript": "^6.0.3",
+ "webpack": "^5.108.3",
"@eslint/eslintrc": "^3.3.5",
"@eslint/js": "^9.39.4",
"@typescript-eslint/eslint-plugin": "^8.62.1",
From cbf4e4150ce723a5ec4d5f416deb846bf86228fe Mon Sep 17 00:00:00 2001
From: afc163
Date: Wed, 1 Jul 2026 15:32:57 +0800
Subject: [PATCH 12/15] docs: set button types in shadow demo
---
docs/shadow-dom.tsx | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/docs/shadow-dom.tsx b/docs/shadow-dom.tsx
index b21fe71..f824eba 100644
--- a/docs/shadow-dom.tsx
+++ b/docs/shadow-dom.tsx
@@ -19,11 +19,15 @@ class Test extends React.Component {
render() {
return (
-
target
+
+ target
+
-
align
+
+ align
+
Date: Wed, 1 Jul 2026 18:35:25 +0800
Subject: [PATCH 13/15] docs: use npm install in README
---
README.md | 4 ++--
README.zh-CN.md | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 0b20d17..5dfddd9 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,7 @@ domAlign(sourceNode, targetNode, {
## Development
```bash
-ut install
+npm install
npm start
npm test
npm run lint
@@ -138,7 +138,7 @@ The release flow is handled by `@rc-component/np` through the `rc-np` command wh
## Development
```
-ut install
+npm install
npm start
```
diff --git a/README.zh-CN.md b/README.zh-CN.md
index a644503..c82f009 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -54,7 +54,7 @@ domAlign(sourceNode, targetNode, {
## 本地开发
```bash
-ut install
+npm install
npm start
npm test
npm run lint
From 87d09f92ce7f0def787ee1bd0161e8b9390b5139 Mon Sep 17 00:00:00 2001
From: afc163
Date: Thu, 2 Jul 2026 11:53:59 +0800
Subject: [PATCH 14/15] 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 f6ac4bb..0000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const base = require('@umijs/fabric/dist/eslint');
-const path = require('path');
-
-module.exports = {
- ...base,
- rules: {
- ...base.rules,
- 'react/no-string-refs': 0,
- 'react/no-deprecated': 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 d4de95e..a780b35 100644
--- a/package.json
+++ b/package.json
@@ -54,19 +54,26 @@
"@babel/preset-react": "^8.0.1",
"@babel/preset-typescript": "^8.0.1",
"@cypress/code-coverage": "~3.12.45",
+ "@eslint/js": "^9.39.4",
"@rc-component/father-plugin": "^2.2.0",
"@rc-component/np": "^1.0.4",
"@types/node": "^26.0.1",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
- "@umijs/fabric": "^4.0.1",
"ajv": "^8.20.0",
"babel-loader": "^10.1.1",
"css-loader": "^7.1.2",
"cypress": "^13.13.3",
"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",
"jsonp": "^0.2.1",
"markdown-it": "^14.1.0",
"next": "^16.2.9",
@@ -77,16 +84,8 @@
"style-loader": "^4.0.0",
"swc-plugin-coverage-instrument": "0.0.21",
"typescript": "^6.0.3",
- "webpack": "^5.108.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",
+ "webpack": "^5.108.3"
},
"engines": {
"node": ">=14.x"
From e1703940c38cab2a9459083ce06db3b7298ac46b Mon Sep 17 00:00:00 2001
From: afc163
Date: Fri, 3 Jul 2026 10:58:04 +0800
Subject: [PATCH 15/15] chore: address review comments
---
README.md | 7 -------
eslint.config.mjs | 10 +++++++---
package.json | 2 --
3 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 5dfddd9..de6ac56 100644
--- a/README.md
+++ b/README.md
@@ -135,13 +135,6 @@ The release flow is handled by `@rc-component/np` through the `rc-np` command wh
-## Development
-
-```
-npm install
-npm start
-```
-
## Example
http://localhost:8000/
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 a780b35..4938a6e 100644
--- a/package.json
+++ b/package.json
@@ -67,9 +67,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",