From cf674eb8106aa6d21ce44fe1bd07f6c307ae75f1 Mon Sep 17 00:00:00 2001 From: yiling Date: Mon, 8 Jun 2026 20:07:36 +0800 Subject: [PATCH] fix(s3): fix linting errors in s3 service and tests --- packages/api/src/api/s3.test.ts | 9 ++++++--- packages/core/src/s3/s3.ts | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/api/src/api/s3.test.ts b/packages/api/src/api/s3.test.ts index ddde0aa4..9a89d76f 100644 --- a/packages/api/src/api/s3.test.ts +++ b/packages/api/src/api/s3.test.ts @@ -1,5 +1,4 @@ import { describe, it, expect, vi, beforeEach } from 'vitest' -import { s3Service } from '@shumai/core/src/s3/s3' import { Hono } from 'hono' const { mockServeStatic } = vi.hoisted(() => ({ @@ -42,9 +41,13 @@ describe('S3 API', () => { it('GET /files/* with filename query parameter sets Content-Disposition header', async () => { // We need to capture the onFound callback from serveStatic options - let onFoundCallback: Function | undefined + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let onFoundCallback: ((path: string, c: any) => void) | undefined + // eslint-disable-next-line @typescript-eslint/no-explicit-any mockServeStatic.mockImplementationOnce((options: any) => { - onFoundCallback = options.onFound + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onFoundCallback = (options as any).onFound + // eslint-disable-next-line @typescript-eslint/no-explicit-any return (c: any) => c.text('static-file') }) diff --git a/packages/core/src/s3/s3.ts b/packages/core/src/s3/s3.ts index 9b421ea9..993bcfd2 100644 --- a/packages/core/src/s3/s3.ts +++ b/packages/core/src/s3/s3.ts @@ -2,7 +2,6 @@ import { ObjectInfo } from '@shumai/dtos' import { S3Client } from 'bun' import * as crypto from 'crypto' import * as fs from 'fs' -import { readFileSync, statSync } from 'fs' import * as path from 'path' import { ulid } from 'ulid' import { LruTtlCache } from '../cache/lru-ttl-cache' @@ -218,9 +217,11 @@ export class S3StorageService implements S3Service { if (cached) return cached } + // eslint-disable-next-line @typescript-eslint/no-explicit-any const options: any = { bucket, expiresIn: expiresInSeconds, + // eslint-disable-next-line @typescript-eslint/no-explicit-any method: method as any, }