fix: resolve lint, typecheck, and tsconfig deprecation errors

This commit is contained in:
yiling
2026-06-07 11:10:27 +08:00
parent a7e714c7d0
commit e790df2812
9 changed files with 22 additions and 26 deletions
+3 -3
View File
@@ -316,7 +316,7 @@ export class LocalStorageService implements S3Service {
return stats.size return stats.size
} catch (e: unknown) { } catch (e: unknown) {
if (e instanceof Error && (e as NodeJS.ErrnoException).code === 'ENOENT') { if (e instanceof Error && (e as NodeJS.ErrnoException).code === 'ENOENT') {
throw new Error(`NoSuchKey: The specified key does not exist.`) throw new Error(`NoSuchKey: The specified key does not exist.`, { cause: e })
} }
throw e throw e
} }
@@ -347,7 +347,7 @@ export class LocalStorageService implements S3Service {
} }
} catch (e: unknown) { } catch (e: unknown) {
if (e instanceof Error && (e as NodeJS.ErrnoException).code === 'ENOENT') { if (e instanceof Error && (e as NodeJS.ErrnoException).code === 'ENOENT') {
throw new Error(`NoSuchKey: The specified key does not exist.`) throw new Error(`NoSuchKey: The specified key does not exist.`, { cause: e })
} }
throw e throw e
} }
@@ -424,7 +424,7 @@ export class LocalStorageService implements S3Service {
} }
} catch (e: unknown) { } catch (e: unknown) {
if (e instanceof Error && (e as NodeJS.ErrnoException).code === 'ENOENT') { if (e instanceof Error && (e as NodeJS.ErrnoException).code === 'ENOENT') {
throw new Error(`NoSuchKey: The specified key does not exist.`) throw new Error(`NoSuchKey: The specified key does not exist.`, { cause: e })
} }
throw e throw e
} }
+4 -7
View File
@@ -16,13 +16,10 @@ export class SearchService {
) {} ) {}
async search(folderId: string, req: SearchRequest): Promise<PaginatedData<AssetInfo[]>> { async search(folderId: string, req: SearchRequest): Promise<PaginatedData<AssetInfo[]>> {
let targetFolderIds: string[] = [] const targetFolderIds =
req.recursively === false
if (req.recursively === false) { ? [folderId]
targetFolderIds = [folderId] : await this.assetSvc.getDescendantFolderIds(folderId)
} else {
targetFolderIds = await this.assetSvc.getDescendantFolderIds(folderId)
}
const targetTypes = const targetTypes =
req.assetType === 'folder' ? [AssetType.folder] : [AssetType.file, AssetType.version_stack] req.assetType === 'folder' ? [AssetType.folder] : [AssetType.file, AssetType.version_stack]
+2 -6
View File
@@ -30,12 +30,8 @@ export class UploadService {
req: CreateUploadTaskRequest, req: CreateUploadTaskRequest,
): Promise<CreateUploadTaskResponse> { ): Promise<CreateUploadTaskResponse> {
const visibleFiles = req.files.filter((f) => !f.name.startsWith('.')) const visibleFiles = req.files.filter((f) => !f.name.startsWith('.'))
let taskName = '' const taskName =
if (visibleFiles.length === 1) { visibleFiles.length === 1 ? visibleFiles[0].name : `${visibleFiles.length} Items`
taskName = visibleFiles[0].name
} else {
taskName = `${visibleFiles.length} Items`
}
let total = 0 let total = 0
const countTotalFiles = (nodes: FileNode[]) => { const countTotalFiles = (nodes: FileNode[]) => {
@@ -300,8 +300,8 @@ function resolutionToDimensions(
const targetLongSide = RESOLUTION_LONG_SIDES[resolution] const targetLongSide = RESOLUTION_LONG_SIDES[resolution]
if (!targetLongSide) return [0, 0] if (!targetLongSide) return [0, 0]
let width = 0 let width: number
let height = 0 let height: number
if (originalWidth >= originalHeight) { if (originalWidth >= originalHeight) {
// Landscape or square: width is the long side // Landscape or square: width is the long side
@@ -363,12 +363,10 @@ export const MessageCard: React.FC<MessageCardProps> = ({
return ( return (
<div className="mt-1 space-y-1.5 pt-3"> <div className="mt-1 space-y-1.5 pt-3">
{Object.entries(obj).map(([key, value]) => { {Object.entries(obj).map(([key, value]) => {
let valueStr = '' const valueStr =
if (value && typeof value === 'object') { value && typeof value === 'object'
valueStr = JSON.stringify(value, null, 2) ? JSON.stringify(value, null, 2)
} else { : String(value)
valueStr = String(value)
}
return ( return (
<div key={key} className="text-xs leading-relaxed break-words"> <div key={key} className="text-xs leading-relaxed break-words">
<span className="font-semibold text-violet-600 dark:text-violet-400"> <span className="font-semibold text-violet-600 dark:text-violet-400">
+1 -1
View File
@@ -27,7 +27,7 @@ function UploadTaskItem({ task }: { task: TaskInfo }) {
const isCompleted = task.uploaded === task.total const isCompleted = task.uploaded === task.total
const percent = task.total > 0 ? (task.uploaded / task.total) * 100 : 0 const percent = task.total > 0 ? (task.uploaded / task.total) * 100 : 0
let formattedTime = '' let formattedTime: string
try { try {
formattedTime = formatTimeAgo(task.createdAt) formattedTime = formatTimeAgo(task.createdAt)
} catch { } catch {
+4
View File
@@ -0,0 +1,4 @@
declare module "*.css" {
const content: { [className: string]: string };
export default content;
}
+1 -1
View File
@@ -129,7 +129,7 @@ console.log(' Working directory clean\n')
// 2. Determine version // 2. Determine version
const rootPkg = JSON.parse(readFileSync('package.json', 'utf-8')) const rootPkg = JSON.parse(readFileSync('package.json', 'utf-8'))
const currentVersion = rootPkg.version || '0.1.0' const currentVersion = rootPkg.version || '0.1.0'
let newVersion = '' let newVersion: string
if (bumpTypes.has(releaseTarget)) { if (bumpTypes.has(releaseTarget)) {
newVersion = incrementVersion(currentVersion, releaseTarget as 'major' | 'minor' | 'patch') newVersion = incrementVersion(currentVersion, releaseTarget as 'major' | 'minor' | 'patch')
+1
View File
@@ -9,6 +9,7 @@
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"noEmit": true, "noEmit": true,
"skipLibCheck": true, "skipLibCheck": true,
"ignoreDeprecations": "6.0",
"baseUrl": ".", "baseUrl": ".",
"types": ["bun"], "types": ["bun"],
"paths": { "paths": {