From 52b8a6fd52ca03e8b1a19e8df354c713510cf123 Mon Sep 17 00:00:00 2001 From: Philzen Date: Mon, 6 Jan 2025 04:02:25 +0100 Subject: [PATCH] Fix @typescript-eslint/await-thenable rule violations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These gave actual errors > Unexpected `for await...of` of a value that is not async iterable.eslint … for a good reason. This rule was properly introduced in @typescript/eslint v8.8.0, see https://github.com/typescript-eslint/typescript-eslint/pull/10008 --- packages/storage/src/createSavers.ts | 2 +- packages/storage/src/prismaExtension.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/storage/src/createSavers.ts b/packages/storage/src/createSavers.ts index 45c314a3e495..a50781d4e20f 100644 --- a/packages/storage/src/createSavers.ts +++ b/packages/storage/src/createSavers.ts @@ -64,7 +64,7 @@ export const createUploadSavers = ( savers[saverKey] = async (data, overrideSaveOptions) => { const updatedFields = {} as Record - for await (const field of currentModelUploadFields) { + for (const field of currentModelUploadFields) { if (data[field]) { const file = data[field] diff --git a/packages/storage/src/prismaExtension.ts b/packages/storage/src/prismaExtension.ts index 9794dcb1fec2..f66e1ac4d7a3 100644 --- a/packages/storage/src/prismaExtension.ts +++ b/packages/storage/src/prismaExtension.ts @@ -101,7 +101,7 @@ export const createUploadsExtension = ( const createDatas = args.data as [] // If the create fails, we need to delete the uploaded files - for await (const createData of createDatas) { + for (const createData of createDatas) { await removeUploadedFiles(uploadFields, createData) } @@ -258,7 +258,7 @@ export const createUploadsExtension = ( return async () => { const base64UploadFields: Record = {} - for await (const field of uploadFields) { + for (const field of uploadFields) { base64UploadFields[field] = await fileToDataUri( modelData[field] as string, storageAdapter, @@ -329,7 +329,7 @@ export const createUploadsExtension = ( return } - for await (const field of fieldsToDelete) { + for (const field of fieldsToDelete) { const uploadLocation = data?.[field] if (uploadLocation) { try {