Skip to content

Commit

Permalink
Fix @typescript-eslint/await-thenable rule violations
Browse files Browse the repository at this point in the history
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
typescript-eslint/typescript-eslint#10008
  • Loading branch information
Philzen committed Jan 7, 2025
1 parent 0eff933 commit 52b8a6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/storage/src/createSavers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const createUploadSavers = <MNames extends ModelNames = ModelNames>(

savers[saverKey] = async (data, overrideSaveOptions) => {
const updatedFields = {} as Record<string, string>
for await (const field of currentModelUploadFields) {
for (const field of currentModelUploadFields) {
if (data[field]) {
const file = data[field]

Expand Down
6 changes: 3 additions & 3 deletions packages/storage/src/prismaExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const createUploadsExtension = <MNames extends ModelNames = ModelNames>(
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)
}

Expand Down Expand Up @@ -258,7 +258,7 @@ export const createUploadsExtension = <MNames extends ModelNames = ModelNames>(
return async () => {
const base64UploadFields: Record<keyof typeof needs, string> = {}

for await (const field of uploadFields) {
for (const field of uploadFields) {
base64UploadFields[field] = await fileToDataUri(
modelData[field] as string,
storageAdapter,
Expand Down Expand Up @@ -329,7 +329,7 @@ export const createUploadsExtension = <MNames extends ModelNames = ModelNames>(
return
}

for await (const field of fieldsToDelete) {
for (const field of fieldsToDelete) {
const uploadLocation = data?.[field]
if (uploadLocation) {
try {
Expand Down

0 comments on commit 52b8a6f

Please sign in to comment.