chore: migrate formatter from prettier to biome

This commit is contained in:
Tunglies 2026-04-07 01:32:14 +08:00
parent 1005baabe6
commit bff78d96b4
No known key found for this signature in database
GPG Key ID: B9B01B389469B3E8
7 changed files with 199 additions and 108 deletions

View File

@ -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

View File

@ -1,5 +0,0 @@
{
"semi": false,
"singleQuote": true,
"plugins": ["prettier-plugin-toml"]
}

46
biome.json Normal file
View File

@ -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"
]
}
}

View File

@ -26,8 +26,8 @@
"publish-version": "node scripts/publish-version.mjs", "publish-version": "node scripts/publish-version.mjs",
"lint": "eslint -c eslint.config.ts --max-warnings=0 --cache --cache-location .eslintcache src", "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", "lint:fix": "eslint -c eslint.config.ts --max-warnings=0 --cache --cache-location .eslintcache --fix src",
"format": "prettier --write .", "format": "biome format --write .",
"format:check": "prettier --check .", "format:check": "biome format .",
"i18n:check": "node scripts/cleanup-unused-i18n.mjs", "i18n:check": "node scripts/cleanup-unused-i18n.mjs",
"i18n:format": "node scripts/cleanup-unused-i18n.mjs --align --apply", "i18n:format": "node scripts/cleanup-unused-i18n.mjs --align --apply",
"i18n:types": "node scripts/generate-i18n-keys.mjs", "i18n:types": "node scripts/generate-i18n-keys.mjs",
@ -81,6 +81,7 @@
}, },
"devDependencies": { "devDependencies": {
"@actions/github": "^9.0.0", "@actions/github": "^9.0.0",
"@biomejs/biome": "^2.4.10",
"@eslint-react/eslint-plugin": "^4.0.0", "@eslint-react/eslint-plugin": "^4.0.0",
"@eslint/js": "^10.0.1", "@eslint/js": "^10.0.1",
"@tauri-apps/cli": "2.10.1", "@tauri-apps/cli": "2.10.1",
@ -112,8 +113,6 @@
"jiti": "^2.6.1", "jiti": "^2.6.1",
"lint-staged": "^16.4.0", "lint-staged": "^16.4.0",
"node-fetch": "^3.3.2", "node-fetch": "^3.3.2",
"prettier": "^3.8.1",
"prettier-plugin-toml": "^2.0.6",
"sass": "^1.98.0", "sass": "^1.98.0",
"tar": "^7.5.12", "tar": "^7.5.12",
"terser": "^5.46.1", "terser": "^5.46.1",
@ -123,12 +122,12 @@
"vite-plugin-svgr": "^5.0.0" "vite-plugin-svgr": "^5.0.0"
}, },
"lint-staged": { "lint-staged": {
"*.{ts,tsx}": [ "*.{ts,tsx,js,mjs}": [
"eslint --fix --max-warnings=0", "eslint --fix --max-warnings=0",
"prettier --write" "biome format --write"
], ],
"*.{js,mjs,css,scss,json,md,toml,yaml,yml}": [ "*.{css,scss,json,md,yaml,yml}": [
"prettier --write" "biome format --write"
] ]
}, },
"type": "module", "type": "module",

124
pnpm-lock.yaml generated
View File

@ -144,6 +144,9 @@ importers:
'@actions/github': '@actions/github':
specifier: ^9.0.0 specifier: ^9.0.0
version: 9.0.0 version: 9.0.0
'@biomejs/biome':
specifier: ^2.4.10
version: 2.4.10
'@eslint-react/eslint-plugin': '@eslint-react/eslint-plugin':
specifier: ^4.0.0 specifier: ^4.0.0
version: 4.2.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2) version: 4.2.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2)
@ -237,12 +240,6 @@ importers:
node-fetch: node-fetch:
specifier: ^3.3.2 specifier: ^3.3.2
version: 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: sass:
specifier: ^1.98.0 specifier: ^1.98.0
version: 1.98.0 version: 1.98.0
@ -775,6 +772,63 @@ packages:
resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==} resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==}
engines: {node: '>=6.9.0'} 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': '@dnd-kit/accessibility@3.1.1':
resolution: {integrity: sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==} resolution: {integrity: sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==}
peerDependencies: peerDependencies:
@ -1462,12 +1516,6 @@ packages:
'@tanstack/virtual-core@3.13.23': '@tanstack/virtual-core@3.13.23':
resolution: {integrity: sha512-zSz2Z2HNyLjCplANTDyl3BcdQJc2k1+yyFoKhNRmCr7V7dY8o8q5m8uFTI1/Pg1kL+Hgrz6u3Xo6eFUB7l66cg==} 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': '@tauri-apps/api@2.10.1':
resolution: {integrity: sha512-hKL/jWf293UDSUN09rR69hrToyIXBb8CjGaWC7gfinvnQrBVvnLr08FeFi38gxtugAVyVcTa5/FD/Xnkb1siBw==} resolution: {integrity: sha512-hKL/jWf293UDSUN09rR69hrToyIXBb8CjGaWC7gfinvnQrBVvnLr08FeFi38gxtugAVyVcTa5/FD/Xnkb1siBw==}
@ -3084,12 +3132,6 @@ packages:
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'} 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: prettier@3.8.1:
resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==} resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==}
engines: {node: '>=14'} engines: {node: '>=14'}
@ -4304,6 +4346,41 @@ snapshots:
'@babel/helper-string-parser': 7.27.1 '@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.28.5 '@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)': '@dnd-kit/accessibility@3.1.1(react@19.2.4)':
dependencies: dependencies:
react: 19.2.4 react: 19.2.4
@ -4986,12 +5063,6 @@ snapshots:
'@tanstack/virtual-core@3.13.23': {} '@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/api@2.10.1': {}
'@tauri-apps/cli-darwin-arm64@2.10.1': '@tauri-apps/cli-darwin-arm64@2.10.1':
@ -6797,11 +6868,6 @@ snapshots:
prelude-ls@1.2.1: {} 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: {} prettier@3.8.1: {}
prop-types@15.8.1: prop-types@15.8.1:

View File

@ -1,58 +1,57 @@
import { alpha, Box, styled } from '@mui/material' import { alpha, Box, styled } from '@mui/material'
export const ProfileBox = styled(Box)(({ export const ProfileBox = styled(Box)(
theme, ({ theme, 'aria-selected': selected }) => {
'aria-selected': selected, const { mode, primary, text } = theme.palette
}) => { const key = `${mode}-${!!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 = { const color = {
'light-true': text.secondary, 'light-true': text.secondary,
'light-false': text.secondary, 'light-false': text.secondary,
'dark-true': alpha(text.secondary, 0.65), 'dark-true': alpha(text.secondary, 0.65),
'dark-false': alpha(text.secondary, 0.65), 'dark-false': alpha(text.secondary, 0.65),
}[key]! }[key]!
const h2color = { const h2color = {
'light-true': primary.main, 'light-true': primary.main,
'light-false': text.primary, 'light-false': text.primary,
'dark-true': primary.main, 'dark-true': primary.main,
'dark-false': text.primary, 'dark-false': text.primary,
}[key]! }[key]!
const borderSelect = { const borderSelect = {
'light-true': { 'light-true': {
borderLeft: `3px solid ${primary.main}`, borderLeft: `3px solid ${primary.main}`,
width: `calc(100% + 3px)`, width: `calc(100% + 3px)`,
marginLeft: `-3px`, marginLeft: `-3px`,
}, },
'light-false': { 'light-false': {
width: '100%', width: '100%',
}, },
'dark-true': { 'dark-true': {
borderLeft: `3px solid ${primary.main}`, borderLeft: `3px solid ${primary.main}`,
width: `calc(100% + 3px)`, width: `calc(100% + 3px)`,
marginLeft: `-3px`, marginLeft: `-3px`,
}, },
'dark-false': { 'dark-false': {
width: '100%', width: '100%',
}, },
}[key] }[key]
return { return {
position: 'relative', position: 'relative',
display: 'block', display: 'block',
cursor: 'pointer', cursor: 'pointer',
textAlign: 'left', textAlign: 'left',
padding: '8px 16px', padding: '8px 16px',
boxSizing: 'border-box', boxSizing: 'border-box',
backgroundColor, backgroundColor,
...borderSelect, ...borderSelect,
borderRadius: '8px', borderRadius: '8px',
color, color,
'& h2': { color: h2color }, '& h2': { color: h2color },
} }
}) },
)

View File

@ -841,8 +841,7 @@ interface IProxySnellConfig extends IProxyBaseConfig {
version?: number version?: number
} }
interface IProxyConfig interface IProxyConfig
extends extends IProxyBaseConfig,
IProxyBaseConfig,
IProxyDirectConfig, IProxyDirectConfig,
IProxyDnsConfig, IProxyDnsConfig,
IProxyHttpConfig, IProxyHttpConfig,