From bff78d96b43a89c8c0d7db78747f4548da99659d Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Tue, 7 Apr 2026 01:32:14 +0800 Subject: [PATCH] chore: migrate formatter from prettier to biome --- .prettierignore | 13 --- .prettierrc | 5 - biome.json | 46 +++++++++ package.json | 15 ++- pnpm-lock.yaml | 124 +++++++++++++++++++------ src/components/profile/profile-box.tsx | 101 ++++++++++---------- src/types/global.d.ts | 3 +- 7 files changed, 199 insertions(+), 108 deletions(-) delete mode 100644 .prettierignore delete mode 100644 .prettierrc create mode 100644 biome.json diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 4d850583e..000000000 --- a/.prettierignore +++ /dev/null @@ -1,13 +0,0 @@ -# README.md -# Changelog.md -# CONTRIBUTING.md - -.changelog_backups -pnpm-lock.yaml - -src-tauri/target/ -src-tauri/gen/ - -target -Cargo.lock -.github/workflows/*.lock.yml diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 6cf386b1e..000000000 --- a/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "semi": false, - "singleQuote": true, - "plugins": ["prettier-plugin-toml"] -} diff --git a/biome.json b/biome.json new file mode 100644 index 000000000..388aa612b --- /dev/null +++ b/biome.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.4.10/schema.json", + "assist": { + "actions": { + "source": { + "organizeImports": "off" + } + } + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 2, + "lineWidth": 80 + }, + "javascript": { + "formatter": { + "quoteStyle": "single", + "trailingCommas": "all", + "semicolons": "asNeeded" + } + }, + "files": { + "includes": [ + "**", + "!dist", + "!node_modules", + "!src-tauri/target", + "!src-tauri/gen", + "!target", + "!Cargo.lock", + "!pnpm-lock.yaml", + "!README.md", + "!Changelog.md", + "!CONTRIBUTING.md", + "!.changelog_backups", + "!.github/workflows/*.lock.yml" + ] + } +} diff --git a/package.json b/package.json index 2ff31bbe4..d899d03e9 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "publish-version": "node scripts/publish-version.mjs", "lint": "eslint -c eslint.config.ts --max-warnings=0 --cache --cache-location .eslintcache src", "lint:fix": "eslint -c eslint.config.ts --max-warnings=0 --cache --cache-location .eslintcache --fix src", - "format": "prettier --write .", - "format:check": "prettier --check .", + "format": "biome format --write .", + "format:check": "biome format .", "i18n:check": "node scripts/cleanup-unused-i18n.mjs", "i18n:format": "node scripts/cleanup-unused-i18n.mjs --align --apply", "i18n:types": "node scripts/generate-i18n-keys.mjs", @@ -81,6 +81,7 @@ }, "devDependencies": { "@actions/github": "^9.0.0", + "@biomejs/biome": "^2.4.10", "@eslint-react/eslint-plugin": "^4.0.0", "@eslint/js": "^10.0.1", "@tauri-apps/cli": "2.10.1", @@ -112,8 +113,6 @@ "jiti": "^2.6.1", "lint-staged": "^16.4.0", "node-fetch": "^3.3.2", - "prettier": "^3.8.1", - "prettier-plugin-toml": "^2.0.6", "sass": "^1.98.0", "tar": "^7.5.12", "terser": "^5.46.1", @@ -123,12 +122,12 @@ "vite-plugin-svgr": "^5.0.0" }, "lint-staged": { - "*.{ts,tsx}": [ + "*.{ts,tsx,js,mjs}": [ "eslint --fix --max-warnings=0", - "prettier --write" + "biome format --write" ], - "*.{js,mjs,css,scss,json,md,toml,yaml,yml}": [ - "prettier --write" + "*.{css,scss,json,md,yaml,yml}": [ + "biome format --write" ] }, "type": "module", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 28525f9ab..649d72130 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -144,6 +144,9 @@ importers: '@actions/github': specifier: ^9.0.0 version: 9.0.0 + '@biomejs/biome': + specifier: ^2.4.10 + version: 2.4.10 '@eslint-react/eslint-plugin': specifier: ^4.0.0 version: 4.2.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2) @@ -237,12 +240,6 @@ importers: node-fetch: specifier: ^3.3.2 version: 3.3.2 - prettier: - specifier: ^3.8.1 - version: 3.8.1 - prettier-plugin-toml: - specifier: ^2.0.6 - version: 2.0.6(prettier@3.8.1) sass: specifier: ^1.98.0 version: 1.98.0 @@ -775,6 +772,63 @@ packages: resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==} engines: {node: '>=6.9.0'} + '@biomejs/biome@2.4.10': + resolution: {integrity: sha512-xxA3AphFQ1geij4JTHXv4EeSTda1IFn22ye9LdyVPoJU19fNVl0uzfEuhsfQ4Yue/0FaLs2/ccVi4UDiE7R30w==} + engines: {node: '>=14.21.3'} + hasBin: true + + '@biomejs/cli-darwin-arm64@2.4.10': + resolution: {integrity: sha512-vuzzI1cWqDVzOMIkYyHbKqp+AkQq4K7k+UCXWpkYcY/HDn1UxdsbsfgtVpa40shem8Kax4TLDLlx8kMAecgqiw==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [darwin] + + '@biomejs/cli-darwin-x64@2.4.10': + resolution: {integrity: sha512-14fzASRo+BPotwp7nWULy2W5xeUyFnTaq1V13Etrrxkrih+ez/2QfgFm5Ehtf5vSjtgx/IJycMMpn5kPd5ZNaA==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [darwin] + + '@biomejs/cli-linux-arm64-musl@2.4.10': + resolution: {integrity: sha512-WrJY6UuiSD/Dh+nwK2qOTu8kdMDlLV3dLMmychIghHPAysWFq1/DGC1pVZx8POE3ZkzKR3PUUnVrtZfMfaJjyQ==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@biomejs/cli-linux-arm64@2.4.10': + resolution: {integrity: sha512-7MH1CMW5uuxQ/s7FLST63qF8B3Hgu2HRdZ7tA1X1+mk+St4JOuIrqdhIBnnyqeyWJNI+Bww7Es5QZ0wIc1Cmkw==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@biomejs/cli-linux-x64-musl@2.4.10': + resolution: {integrity: sha512-kDTi3pI6PBN6CiczsWYOyP2zk0IJI08EWEQyDMQWW221rPaaEz6FvjLhnU07KMzLv8q3qSuoB93ua6inSQ55Tw==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + libc: [musl] + + '@biomejs/cli-linux-x64@2.4.10': + resolution: {integrity: sha512-tZLvEEi2u9Xu1zAqRjTcpIDGVtldigVvzug2fTuPG0ME/g8/mXpRPcNgLB22bGn6FvLJpHHnqLnwliOu8xjYrg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@biomejs/cli-win32-arm64@2.4.10': + resolution: {integrity: sha512-umwQU6qPzH+ISTf/eHyJ/QoQnJs3V9Vpjz2OjZXe9MVBZ7prgGafMy7yYeRGnlmDAn87AKTF3Q6weLoMGpeqdQ==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [win32] + + '@biomejs/cli-win32-x64@2.4.10': + resolution: {integrity: sha512-aW/JU5GuyH4uxMrNYpoC2kjaHlyJGLgIa3XkhPEZI0uKhZhJZU8BuEyJmvgzSPQNGozBwWjC972RaNdcJ9KyJg==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [win32] + '@dnd-kit/accessibility@3.1.1': resolution: {integrity: sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==} peerDependencies: @@ -1462,12 +1516,6 @@ packages: '@tanstack/virtual-core@3.13.23': resolution: {integrity: sha512-zSz2Z2HNyLjCplANTDyl3BcdQJc2k1+yyFoKhNRmCr7V7dY8o8q5m8uFTI1/Pg1kL+Hgrz6u3Xo6eFUB7l66cg==} - '@taplo/core@0.2.0': - resolution: {integrity: sha512-r8bl54Zj1In3QLkiW/ex694bVzpPJ9EhwqT9xkcUVODnVUGirdB1JTsmiIv0o1uwqZiwhi8xNnTOQBRQCpizrQ==} - - '@taplo/lib@0.5.0': - resolution: {integrity: sha512-+xIqpQXJco3T+VGaTTwmhxLa51qpkQxCjRwezjFZgr+l21ExlywJFcDfTrNmL6lG6tqb0h8GyJKO3UPGPtSCWg==} - '@tauri-apps/api@2.10.1': resolution: {integrity: sha512-hKL/jWf293UDSUN09rR69hrToyIXBb8CjGaWC7gfinvnQrBVvnLr08FeFi38gxtugAVyVcTa5/FD/Xnkb1siBw==} @@ -3084,12 +3132,6 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - prettier-plugin-toml@2.0.6: - resolution: {integrity: sha512-12N/wBuHa9jd/KVy9pRP20NMKxQfQLMseQCt66lIbLaPLItvGUcSIryE1eZZMJ7loSws6Ig3M2Elc2EreNh76w==} - engines: {node: '>=16.0.0'} - peerDependencies: - prettier: ^3.0.3 - prettier@3.8.1: resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==} engines: {node: '>=14'} @@ -4304,6 +4346,41 @@ snapshots: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.28.5 + '@biomejs/biome@2.4.10': + optionalDependencies: + '@biomejs/cli-darwin-arm64': 2.4.10 + '@biomejs/cli-darwin-x64': 2.4.10 + '@biomejs/cli-linux-arm64': 2.4.10 + '@biomejs/cli-linux-arm64-musl': 2.4.10 + '@biomejs/cli-linux-x64': 2.4.10 + '@biomejs/cli-linux-x64-musl': 2.4.10 + '@biomejs/cli-win32-arm64': 2.4.10 + '@biomejs/cli-win32-x64': 2.4.10 + + '@biomejs/cli-darwin-arm64@2.4.10': + optional: true + + '@biomejs/cli-darwin-x64@2.4.10': + optional: true + + '@biomejs/cli-linux-arm64-musl@2.4.10': + optional: true + + '@biomejs/cli-linux-arm64@2.4.10': + optional: true + + '@biomejs/cli-linux-x64-musl@2.4.10': + optional: true + + '@biomejs/cli-linux-x64@2.4.10': + optional: true + + '@biomejs/cli-win32-arm64@2.4.10': + optional: true + + '@biomejs/cli-win32-x64@2.4.10': + optional: true + '@dnd-kit/accessibility@3.1.1(react@19.2.4)': dependencies: react: 19.2.4 @@ -4986,12 +5063,6 @@ snapshots: '@tanstack/virtual-core@3.13.23': {} - '@taplo/core@0.2.0': {} - - '@taplo/lib@0.5.0': - dependencies: - '@taplo/core': 0.2.0 - '@tauri-apps/api@2.10.1': {} '@tauri-apps/cli-darwin-arm64@2.10.1': @@ -6797,11 +6868,6 @@ snapshots: prelude-ls@1.2.1: {} - prettier-plugin-toml@2.0.6(prettier@3.8.1): - dependencies: - '@taplo/lib': 0.5.0 - prettier: 3.8.1 - prettier@3.8.1: {} prop-types@15.8.1: diff --git a/src/components/profile/profile-box.tsx b/src/components/profile/profile-box.tsx index e89376819..edc60d61b 100644 --- a/src/components/profile/profile-box.tsx +++ b/src/components/profile/profile-box.tsx @@ -1,58 +1,57 @@ import { alpha, Box, styled } from '@mui/material' -export const ProfileBox = styled(Box)(({ - theme, - 'aria-selected': selected, -}) => { - const { mode, primary, text } = theme.palette - const key = `${mode}-${!!selected}` +export const ProfileBox = styled(Box)( + ({ theme, 'aria-selected': selected }) => { + const { mode, primary, text } = theme.palette + const key = `${mode}-${!!selected}` - const backgroundColor = mode === 'light' ? '#ffffff' : '#282A36' + const backgroundColor = mode === 'light' ? '#ffffff' : '#282A36' - const color = { - 'light-true': text.secondary, - 'light-false': text.secondary, - 'dark-true': alpha(text.secondary, 0.65), - 'dark-false': alpha(text.secondary, 0.65), - }[key]! + const color = { + 'light-true': text.secondary, + 'light-false': text.secondary, + 'dark-true': alpha(text.secondary, 0.65), + 'dark-false': alpha(text.secondary, 0.65), + }[key]! - const h2color = { - 'light-true': primary.main, - 'light-false': text.primary, - 'dark-true': primary.main, - 'dark-false': text.primary, - }[key]! + const h2color = { + 'light-true': primary.main, + 'light-false': text.primary, + 'dark-true': primary.main, + 'dark-false': text.primary, + }[key]! - const borderSelect = { - 'light-true': { - borderLeft: `3px solid ${primary.main}`, - width: `calc(100% + 3px)`, - marginLeft: `-3px`, - }, - 'light-false': { - width: '100%', - }, - 'dark-true': { - borderLeft: `3px solid ${primary.main}`, - width: `calc(100% + 3px)`, - marginLeft: `-3px`, - }, - 'dark-false': { - width: '100%', - }, - }[key] + const borderSelect = { + 'light-true': { + borderLeft: `3px solid ${primary.main}`, + width: `calc(100% + 3px)`, + marginLeft: `-3px`, + }, + 'light-false': { + width: '100%', + }, + 'dark-true': { + borderLeft: `3px solid ${primary.main}`, + width: `calc(100% + 3px)`, + marginLeft: `-3px`, + }, + 'dark-false': { + width: '100%', + }, + }[key] - return { - position: 'relative', - display: 'block', - cursor: 'pointer', - textAlign: 'left', - padding: '8px 16px', - boxSizing: 'border-box', - backgroundColor, - ...borderSelect, - borderRadius: '8px', - color, - '& h2': { color: h2color }, - } -}) + return { + position: 'relative', + display: 'block', + cursor: 'pointer', + textAlign: 'left', + padding: '8px 16px', + boxSizing: 'border-box', + backgroundColor, + ...borderSelect, + borderRadius: '8px', + color, + '& h2': { color: h2color }, + } + }, +) diff --git a/src/types/global.d.ts b/src/types/global.d.ts index ac7c5c0cd..6fe8a3401 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -841,8 +841,7 @@ interface IProxySnellConfig extends IProxyBaseConfig { version?: number } interface IProxyConfig - extends - IProxyBaseConfig, + extends IProxyBaseConfig, IProxyDirectConfig, IProxyDnsConfig, IProxyHttpConfig,