统一前后端代码格式化配置

This commit is contained in:
yml2213
2026-08-16 17:27:12 +08:00
parent 8705f6a6a1
commit 5c7c3e14e3
278 changed files with 6386 additions and 5500 deletions
+3 -12
View File
@@ -12,8 +12,7 @@ const IMAGE_UPLOAD_QUALITY: Record<string, number> = {
export async function optimizeImageForUpload(file: File, scene: string) {
if (!file.type.startsWith('image/')) return file
if (!['image/jpeg', 'image/png', 'image/webp'].includes(file.type))
return file
if (!['image/jpeg', 'image/png', 'image/webp'].includes(file.type)) return file
if (typeof document === 'undefined') return file
const maxSide = IMAGE_UPLOAD_MAX_SIDE[scene] ?? 1600
@@ -21,11 +20,7 @@ export async function optimizeImageForUpload(file: File, scene: string) {
try {
const image = await loadImage(file)
const { width, height } = fitSize(
image.naturalWidth,
image.naturalHeight,
maxSide,
)
const { width, height } = fitSize(image.naturalWidth, image.naturalHeight, maxSide)
const canvas = document.createElement('canvas')
canvas.width = width
canvas.height = height
@@ -70,11 +65,7 @@ function fitSize(width: number, height: number, maxSide: number) {
}
}
function canvasToBlob(
canvas: HTMLCanvasElement,
type: string,
quality: number,
) {
function canvasToBlob(canvas: HTMLCanvasElement, type: string, quality: number) {
return new Promise<Blob | null>((resolve) => {
canvas.toBlob(resolve, type, quality)
})