From 1548aabc30457111549bbf1a8a2e06fde4e4d353 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 28 Apr 2026 21:28:00 +0800 Subject: [PATCH] chore: migrate to rslint and prettier --- .github/renovate.json5 | 12 +- .github/workflows/release.yml | 6 +- .github/workflows/test.yml | 2 +- .prettierignore | 5 + .prettierrc | 3 + .vscode/extensions.json | 2 +- .vscode/settings.json | 16 +-- README.md | 6 +- biome.json | 32 ------ package.json | 13 ++- playground/rsbuild/src/env.d.ts | 4 +- pnpm-lock.yaml | 188 ++++++++++++++++---------------- rslint.config.ts | 3 + test/rsbuild/src/env.d.ts | 4 +- test/rslib/src/env.d.ts | 4 +- 15 files changed, 127 insertions(+), 173 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc delete mode 100644 biome.json create mode 100644 rslint.config.ts diff --git a/.github/renovate.json5 b/.github/renovate.json5 index dadf8d2..f95e117 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,10 +1,6 @@ { - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:recommended", - "schedule:monthly", - "group:allNonMajor" - ], - "rangeStrategy": "bump", - "packageRules": [{ "depTypeList": ["peerDependencies"], "enabled": false }] + $schema: 'https://docs.renovatebot.com/renovate-schema.json', + extends: ['config:recommended', 'schedule:monthly', 'group:allNonMajor'], + rangeStrategy: 'bump', + packageRules: [{ depTypeList: ['peerDependencies'], enabled: false }], } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a83229..87fabeb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: # Trigger on version tags or run manually. push: tags: - - "v*" + - 'v*' workflow_dispatch: @@ -28,7 +28,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: 22 - cache: "pnpm" + cache: 'pnpm' - name: Install Dependencies run: pnpm install @@ -42,4 +42,4 @@ jobs: - name: Create GitHub Release uses: ncipollo/release-action@v1 with: - generateReleaseNotes: "true" + generateReleaseNotes: 'true' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60d59c5..06b9ab7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: 22 - cache: "pnpm" + cache: 'pnpm' - name: Install Dependencies run: pnpm install && npx playwright install chromium diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..eae8a16 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +# Ignore artifacts: +dist +dist-* +test/rslib/index.test.ts-snapshots +pnpm-lock.yaml diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..544138b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 699ed73..f172f18 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,3 +1,3 @@ { - "recommendations": ["biomejs.biome"] + "recommendations": ["rstack.rslint", "esbenp.prettier-vscode"] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 58f2f56..770e0e6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,18 +1,4 @@ { "search.useIgnoreFiles": true, - "[json]": { - "editor.defaultFormatter": "biomejs.biome" - }, - "[typescript]": { - "editor.defaultFormatter": "biomejs.biome" - }, - "[javascript]": { - "editor.defaultFormatter": "biomejs.biome" - }, - "[javascriptreact]": { - "editor.defaultFormatter": "biomejs.biome" - }, - "[css]": { - "editor.defaultFormatter": "biomejs.biome" - } + "editor.defaultFormatter": "esbenp.prettier-vscode" } diff --git a/README.md b/README.md index 89a1e83..49afb5a 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,11 @@ Add plugin to your `rsbuild.config.ts`: ```ts // rsbuild.config.ts / rslib.config.ts -import { pluginUnpluginVue } from 'rsbuild-plugin-unplugin-vue' +import { pluginUnpluginVue } from 'rsbuild-plugin-unplugin-vue'; export default { plugins: [pluginUnpluginVue()], -} +}; ``` ## Options @@ -49,7 +49,7 @@ pluginUnpluginVue({ unpluginVueOptions: { include: ['**/*.vue'], }, -}) +}); ``` ## License diff --git a/biome.json b/biome.json deleted file mode 100644 index 8448b83..0000000 --- a/biome.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "$schema": "https://biomejs.dev/schemas/2.4.7/schema.json", - "assist": { "actions": { "source": { "organizeImports": "on" } } }, - "vcs": { - "enabled": true, - "defaultBranch": "main", - "clientKind": "git", - "useIgnoreFile": true - }, - "files": { - "includes": ["**", "!test/rslib/index.test.ts-snapshots"] - }, - "formatter": { - "indentStyle": "space" - }, - "javascript": { - "formatter": { - "quoteStyle": "single" - } - }, - "css": { - "formatter": { - "enabled": true - } - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true - } - } -} diff --git a/package.json b/package.json index ce9b694..a64948a 100644 --- a/package.json +++ b/package.json @@ -20,25 +20,26 @@ "scripts": { "build": "rslib build", "dev": "rslib build --watch", - "format": "biome check . --write --unsafe", - "lint": "biome check .", - "lint:write": "biome check . --write", - "prepare": "simple-git-hooks && npm run build", + "format": "prettier -w .", + "lint": "rslint && prettier -c .", + "lint:write": "rslint --fix && prettier -w .", + "prepare": "simple-git-hooks && pnpm run build", "test": "playwright test", "bump": "bumpp" }, "simple-git-hooks": { - "pre-commit": "npm run format" + "pre-commit": "pnpm run lint:write" }, "devDependencies": { - "@biomejs/biome": "^2.4.7", "@playwright/test": "^1.58.2", "@rsbuild/core": "2.0.0-beta.8", "@rsbuild/core-v1": "npm:@rsbuild/core@^1.7.3", "@rslib/core": "^0.20.0", + "@rslint/core": "^0.5.0", "@types/node": "^25.5.0", "bumpp": "^11.0.1", "playwright": "^1.58.2", + "prettier": "^3.8.3", "simple-git-hooks": "^2.13.1", "typescript": "^5.9.3", "vue": "^3.5.30" diff --git a/playground/rsbuild/src/env.d.ts b/playground/rsbuild/src/env.d.ts index 992774e..21fa329 100644 --- a/playground/rsbuild/src/env.d.ts +++ b/playground/rsbuild/src/env.d.ts @@ -3,8 +3,6 @@ declare module '*.vue' { import type { DefineComponent } from 'vue'; - // biome-ignore lint/complexity/noBannedTypes: reason - // biome-ignore lint/suspicious/noExplicitAny: Vue component typings use `any` here. - const component: DefineComponent<{}, {}, any>; + const component: DefineComponent; export default component; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bb60400..0ea05b0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,9 +12,6 @@ importers: specifier: ^7.1.1 version: 7.1.1(@types/node@25.5.0)(jiti@2.6.1)(vue@3.5.30(typescript@5.9.3))(yaml@2.8.2) devDependencies: - '@biomejs/biome': - specifier: ^2.4.7 - version: 2.4.7 '@playwright/test': specifier: ^1.58.2 version: 1.58.2 @@ -27,6 +24,9 @@ importers: '@rslib/core': specifier: ^0.20.0 version: 0.20.0(core-js@3.47.0)(typescript@5.9.3) + '@rslint/core': + specifier: ^0.5.0 + version: 0.5.1(jiti@2.6.1) '@types/node': specifier: ^25.5.0 version: 25.5.0 @@ -36,6 +36,9 @@ importers: playwright: specifier: ^1.58.2 version: 1.58.2 + prettier: + specifier: ^3.8.3 + version: 3.8.3 simple-git-hooks: specifier: ^2.13.1 version: 2.13.1 @@ -161,59 +164,6 @@ packages: resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==} engines: {node: '>=6.9.0'} - '@biomejs/biome@2.4.7': - resolution: {integrity: sha512-vXrgcmNGZ4lpdwZSpMf1hWw1aWS6B+SyeSYKTLrNsiUsAdSRN0J4d/7mF3ogJFbIwFFSOL3wT92Zzxia/d5/ng==} - engines: {node: '>=14.21.3'} - hasBin: true - - '@biomejs/cli-darwin-arm64@2.4.7': - resolution: {integrity: sha512-Oo0cF5mHzmvDmTXw8XSjhCia8K6YrZnk7aCS54+/HxyMdZMruMO3nfpDsrlar/EQWe41r1qrwKiCa2QDYHDzWA==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [darwin] - - '@biomejs/cli-darwin-x64@2.4.7': - resolution: {integrity: sha512-I+cOG3sd/7HdFtvDSnF9QQPrWguUH7zrkIMMykM3PtfWU9soTcS2yRb9Myq6MHmzbeCT08D1UmY+BaiMl5CcoQ==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [darwin] - - '@biomejs/cli-linux-arm64-musl@2.4.7': - resolution: {integrity: sha512-I2NvM9KPb09jWml93O2/5WMfNR7Lee5Latag1JThDRMURVhPX74p9UDnyTw3Ae6cE1DgXfw7sqQgX7rkvpc0vw==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [linux] - - '@biomejs/cli-linux-arm64@2.4.7': - resolution: {integrity: sha512-om6FugwmibzfP/6ALj5WRDVSND4H2G9X0nkI1HZpp2ySf9lW2j0X68oQSaHEnls6666oy4KDsc5RFjT4m0kV0w==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [linux] - - '@biomejs/cli-linux-x64-musl@2.4.7': - resolution: {integrity: sha512-00kx4YrBMU8374zd2wHuRV5wseh0rom5HqRND+vDldJPrWwQw+mzd/d8byI9hPx926CG+vWzq6AeiT7Yi5y59g==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [linux] - - '@biomejs/cli-linux-x64@2.4.7': - resolution: {integrity: sha512-bV8/uo2Tj+gumnk4sUdkerWyCPRabaZdv88IpbmDWARQQoA/Q0YaqPz1a+LSEDIL7OfrnPi9Hq1Llz4ZIGyIQQ==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [linux] - - '@biomejs/cli-win32-arm64@2.4.7': - resolution: {integrity: sha512-hOUHBMlFCvDhu3WCq6vaBoG0dp0LkWxSEnEEsxxXvOa9TfT6ZBnbh72A/xBM7CBYB7WgwqboetzFEVDnMxelyw==} - engines: {node: '>=14.21.3'} - cpu: [arm64] - os: [win32] - - '@biomejs/cli-win32-x64@2.4.7': - resolution: {integrity: sha512-qEpGjSkPC3qX4ycbMUthXvi9CkRq7kZpkqMY1OyhmYlYLnANnooDQ7hDerM8+0NJ+DZKVnsIc07h30XOpt7LtQ==} - engines: {node: '>=14.21.3'} - cpu: [x64] - os: [win32] - '@emnapi/core@1.9.0': resolution: {integrity: sha512-0DQ98G9ZQZOxfUcQn1waV2yS8aWdZ6kJMbYCJB3oUBecjWYO1fqJ+a1DRfPF3O5JEkwqwP1A9QEN/9mYm2Yd0w==} @@ -401,6 +351,45 @@ packages: typescript: optional: true + '@rslint/core@0.5.1': + resolution: {integrity: sha512-UGcalhkpNvm4zN7E2DiQsuwM10LMi3CazOiANVevf5hn+NB7WKEMWYKn3bFySptg7Ll042IKMUlIXaFQjWs9lQ==} + hasBin: true + peerDependencies: + jiti: ^2.0.0 + peerDependenciesMeta: + jiti: + optional: true + + '@rslint/darwin-arm64@0.5.1': + resolution: {integrity: sha512-grbPKhrRv0BTKvdByIIlS5avc4ttF9vylaStJh/TTYS96cTkjCcTv7RAUv/ZI3VSaSZdRBcW4f6wW9pPWpt41w==} + cpu: [arm64] + os: [darwin] + + '@rslint/darwin-x64@0.5.1': + resolution: {integrity: sha512-v7P5AYWzm4Xrly5nl5yXSAyHn6j9pwZyFFUTD9UCOodZMEVmBxW3WxdL9iq8PfnG5n8GXHqTqBSYwWfG1WWD0g==} + cpu: [x64] + os: [darwin] + + '@rslint/linux-arm64@0.5.1': + resolution: {integrity: sha512-czDNVvgea0LpTlqaRvZHulJn8RmmDso2DufIWedxIA9yfK+nEK4H0tANNVQL4NBTHiv/6cqQw8NveP3KD5I93g==} + cpu: [arm64] + os: [linux] + + '@rslint/linux-x64@0.5.1': + resolution: {integrity: sha512-D0isbtok26OSjSQkWDDfTWPLQDqrufbTbiihMFxkDlIRKDGcU9HvnfTlEmgnwzkxt6Jm7CBZZiXdFtyhPgnWEg==} + cpu: [x64] + os: [linux] + + '@rslint/win32-arm64@0.5.1': + resolution: {integrity: sha512-XnU369fuTR9EqFhRMmbg+rHO3T/gwC+VV2AC1HAvZ62/pgNjFQmlK6IEsU293sgXHOUnRIQ6IsC9J0imyrCMXQ==} + cpu: [arm64] + os: [win32] + + '@rslint/win32-x64@0.5.1': + resolution: {integrity: sha512-7++ELodvfVPFDSYEMVWb7OA+BD2JeONXtwXP/vmbrcawBTff7E/6VREB8dGPYCNh/ypBuSQ2WYXUtYAxQxwSiQ==} + cpu: [x64] + os: [win32] + '@rspack/binding-darwin-arm64@1.7.8': resolution: {integrity: sha512-KS6SRc+4VYRdX1cKr1j1HEuMNyEzt7onBS0rkenaiCRRYF0z4WNZNyZqRiuxgM3qZ3TISF7gdmgJQyd4ZB43ig==} cpu: [arm64] @@ -755,6 +744,10 @@ packages: resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} engines: {node: '>=12'} + picomatch@4.0.4: + resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} + engines: {node: '>=12'} + playwright-core@1.58.2: resolution: {integrity: sha512-yZkEtftgwS8CsfYo7nm0KE8jsvm6i/PTgVtB8DL726wNf6H2IMsDuxCpJj59KDaxCtSnrWan2AeDqM7JBaultg==} engines: {node: '>=18'} @@ -773,6 +766,11 @@ packages: resolution: {integrity: sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==} engines: {node: ^10 || ^12 || >=14} + prettier@3.8.3: + resolution: {integrity: sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==} + engines: {node: '>=14'} + hasBin: true + quansync@1.0.0: resolution: {integrity: sha512-5xZacEEufv3HSTPQuchrvV6soaiACMFnq1H8wkVioctoH3TRha9Sz66lOxRwPK/qZj7HPiSveih9yAyh98gvqA==} @@ -982,41 +980,6 @@ snapshots: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.28.5 - '@biomejs/biome@2.4.7': - optionalDependencies: - '@biomejs/cli-darwin-arm64': 2.4.7 - '@biomejs/cli-darwin-x64': 2.4.7 - '@biomejs/cli-linux-arm64': 2.4.7 - '@biomejs/cli-linux-arm64-musl': 2.4.7 - '@biomejs/cli-linux-x64': 2.4.7 - '@biomejs/cli-linux-x64-musl': 2.4.7 - '@biomejs/cli-win32-arm64': 2.4.7 - '@biomejs/cli-win32-x64': 2.4.7 - - '@biomejs/cli-darwin-arm64@2.4.7': - optional: true - - '@biomejs/cli-darwin-x64@2.4.7': - optional: true - - '@biomejs/cli-linux-arm64-musl@2.4.7': - optional: true - - '@biomejs/cli-linux-arm64@2.4.7': - optional: true - - '@biomejs/cli-linux-x64-musl@2.4.7': - optional: true - - '@biomejs/cli-linux-x64@2.4.7': - optional: true - - '@biomejs/cli-win32-arm64@2.4.7': - optional: true - - '@biomejs/cli-win32-x64@2.4.7': - optional: true - '@emnapi/core@1.9.0': dependencies: '@emnapi/wasi-threads': 1.2.0 @@ -1182,6 +1145,37 @@ snapshots: - '@typescript/native-preview' - core-js + '@rslint/core@0.5.1(jiti@2.6.1)': + dependencies: + picomatch: 4.0.4 + tinyglobby: 0.2.15 + optionalDependencies: + '@rslint/darwin-arm64': 0.5.1 + '@rslint/darwin-x64': 0.5.1 + '@rslint/linux-arm64': 0.5.1 + '@rslint/linux-x64': 0.5.1 + '@rslint/win32-arm64': 0.5.1 + '@rslint/win32-x64': 0.5.1 + jiti: 2.6.1 + + '@rslint/darwin-arm64@0.5.1': + optional: true + + '@rslint/darwin-x64@0.5.1': + optional: true + + '@rslint/linux-arm64@0.5.1': + optional: true + + '@rslint/linux-x64@0.5.1': + optional: true + + '@rslint/win32-arm64@0.5.1': + optional: true + + '@rslint/win32-x64@0.5.1': + optional: true + '@rspack/binding-darwin-arm64@1.7.8': optional: true @@ -1447,9 +1441,9 @@ snapshots: estree-walker@2.0.2: {} - fdir@6.5.0(picomatch@4.0.3): + fdir@6.5.0(picomatch@4.0.4): optionalDependencies: - picomatch: 4.0.3 + picomatch: 4.0.4 fsevents@2.3.2: optional: true @@ -1528,6 +1522,8 @@ snapshots: picomatch@4.0.3: {} + picomatch@4.0.4: {} + playwright-core@1.58.2: {} playwright@1.58.2: @@ -1548,6 +1544,8 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 + prettier@3.8.3: {} + quansync@1.0.0: {} rolldown@1.0.0-rc.9: @@ -1588,8 +1586,8 @@ snapshots: tinyglobby@0.2.15: dependencies: - fdir: 6.5.0(picomatch@4.0.3) - picomatch: 4.0.3 + fdir: 6.5.0(picomatch@4.0.4) + picomatch: 4.0.4 tslib@2.8.1: {} diff --git a/rslint.config.ts b/rslint.config.ts new file mode 100644 index 0000000..5055b09 --- /dev/null +++ b/rslint.config.ts @@ -0,0 +1,3 @@ +import { defineConfig, ts } from '@rslint/core'; + +export default defineConfig([ts.configs.recommended]); diff --git a/test/rsbuild/src/env.d.ts b/test/rsbuild/src/env.d.ts index 992774e..21fa329 100644 --- a/test/rsbuild/src/env.d.ts +++ b/test/rsbuild/src/env.d.ts @@ -3,8 +3,6 @@ declare module '*.vue' { import type { DefineComponent } from 'vue'; - // biome-ignore lint/complexity/noBannedTypes: reason - // biome-ignore lint/suspicious/noExplicitAny: Vue component typings use `any` here. - const component: DefineComponent<{}, {}, any>; + const component: DefineComponent; export default component; } diff --git a/test/rslib/src/env.d.ts b/test/rslib/src/env.d.ts index 992774e..21fa329 100644 --- a/test/rslib/src/env.d.ts +++ b/test/rslib/src/env.d.ts @@ -3,8 +3,6 @@ declare module '*.vue' { import type { DefineComponent } from 'vue'; - // biome-ignore lint/complexity/noBannedTypes: reason - // biome-ignore lint/suspicious/noExplicitAny: Vue component typings use `any` here. - const component: DefineComponent<{}, {}, any>; + const component: DefineComponent; export default component; }