Skip to content

Commit

Permalink
fix: minor problems hinted by eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
yy4382 committed Sep 21, 2024
1 parent be63fed commit c719091
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/components/Photo/Card/PhotoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
</template>

<script setup lang="ts">
import { type Photo } from "~/types";
import type { Photo } from "~/types";
const props = defineProps<{
photo: Photo;
disabled?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions app/components/Upload/UploadPreviewBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ const upload = async (finishedEachCb?: FinishEachCb) => {
processedFile.value!,
key.value,
);
finishedEachCb && finishedEachCb(key.value, file.value.name, true);
if (finishedEachCb) finishedEachCb(key.value, file.value.name, true);
return { key: key.value, name: file.value.name, success: true };
} catch (e) {
console.error(e);
finishedEachCb && finishedEachCb(key.value, file.value.name, false);
if (finishedEachCb) finishedEachCb(key.value, file.value.name, false);
return { key: key.value, name: file.value.name, success: false };
}
};
Expand Down
8 changes: 4 additions & 4 deletions app/components/Upload/UploadWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

<script setup lang="ts">
import type { UploadedFileLinkObj } from "~/types";
import { type UploadPreviewBar } from "#components";
const { t } = useI18n();
const settings = useSettingsStore();
Expand All @@ -48,7 +47,7 @@ const uploadedLinks = defineModel("uploadedLinks", {
const uploading = ref(false);
const fileList = ref<File[]>([]);
const previewBars = ref<InstanceType<typeof UploadPreviewBar>[] | null>(null);
const previewBars = useTemplateRef("previewBars");
const uploadProgress = ref(0);
const uploadProgressMax = ref(0);
Expand All @@ -67,7 +66,7 @@ const upload = async () => {
const uploadPromises =
previewBars.value?.map((previewBar) => {
return previewBar.upload(() => {
return previewBar?.upload(() => {
uploadProgress.value++;
});
}) ?? [];
Expand All @@ -82,6 +81,7 @@ const upload = async () => {
// delete successful uploaded files
uploadedStates.forEach((state) => {
if (!state) return;
if (state.success) {
const index = fileList.value.findIndex(
(file) => file.name === state.name,
Expand All @@ -101,7 +101,7 @@ const upload = async () => {
if (failedUploads.length > 0) {
toast.add({
title: t("upload.message.uploadFailed.title"),
description: failedUploads.map((state) => state.key).join(", "),
description: failedUploads.map((state) => state?.key).join(", "),
actions: [
{
label: t("upload.message.uploadFailed.actions.goToSettings"),
Expand Down
1 change: 0 additions & 1 deletion app/types/AppSettings.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { z } from "zod";
type Prettify<T> = {
[K in keyof T]: T[K];
// eslint-disable-next-line @typescript-eslint/ban-types
} & {};

export const convertTypes = ["none", "jpg", "webp"] as const;
Expand Down
2 changes: 1 addition & 1 deletion app/utils/ImageS3Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
GetObjectCommand,
HeadObjectCommand,
} from "@aws-sdk/client-s3";
import { type S3Settings, type Photo } from "~/types";
import type { S3Settings, Photo } from "~/types";
import mime from "mime";

class ImageS3Client {
Expand Down
3 changes: 3 additions & 0 deletions app/utils/testOps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const checkGrantedToUpload = async (
debug("Granted to upload!");
return true;
} catch (e) {
console.error(e);
return false;
}
};
Expand All @@ -23,6 +24,7 @@ const checkGrantedToList = async (s3Settings: S3Settings) => {
debug("Granted to list!");
return true;
} catch (e) {
console.error(e);
return false;
}
};
Expand All @@ -34,6 +36,7 @@ const checkGrantedToDelete = async (s3Settings: S3Settings, key: string) => {
debug("Granted to delete!");
return true;
} catch (e) {
console.error(e);
return false;
}
};
Expand Down
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export default withNuxt({
camelcase: ["warn", { ignoreDestructuring: true }],
"no-console": ["warn", { allow: ["warn", "error"] }],
"vue/html-self-closing": ["off"], // Avoid conflicts with Prettier
"@typescript-eslint/ban-types": ["off"],
},
});

0 comments on commit c719091

Please sign in to comment.