Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Lint

Manav Rathib974be5c61ca
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
index 85d317575b..f445cca217 100644
--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx
@@ -9,7 +9,10 @@ import {
GalleryItemsSummary,
} from "@/new/photos/components/gallery/ListHeader";
import { SpaceBetweenFlex } from "@/new/photos/components/mui";
-import { ALL_SECTION, HIDDEN_ITEMS_SECTION } from "@/new/photos/services/collection";
+import {
+ ALL_SECTION,
+ HIDDEN_ITEMS_SECTION,
+} from "@/new/photos/services/collection";
import type {
CollectionSummary,
CollectionSummaryType,
diff --git a/web/apps/photos/src/components/PhotoFrame.tsx b/web/apps/photos/src/components/PhotoFrame.tsx
index fc5723d1e5..a74cde8d02 100644
--- a/web/apps/photos/src/components/PhotoFrame.tsx
+++ b/web/apps/photos/src/components/PhotoFrame.tsx
@@ -3,6 +3,7 @@ import type { LivePhotoSourceURL, SourceURLs } from "@/media/file";
import { EnteFile } from "@/media/file";
import { FileType } from "@/media/file-type";
import type { GalleryBarMode } from "@/new/photos/components/gallery/BarImpl";
+import { TRASH_SECTION } from "@/new/photos/services/collection";
import DownloadManager from "@/new/photos/services/download";
import { PHOTOS_PAGES } from "@ente/shared/constants/pages";
import { CustomError } from "@ente/shared/error";
@@ -19,7 +20,6 @@ import {
SelectedState,
SetFilesDownloadProgressAttributesCreator,
} from "types/gallery";
-import { TRASH_SECTION } from "utils/collection";
import {
handleSelectCreator,
updateFileMsrcProps,
diff --git a/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx b/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
index 4ac19e899b..0f66a27ed6 100644
--- a/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
+++ b/web/apps/photos/src/components/pages/gallery/PreviewCard.tsx
@@ -9,6 +9,7 @@ import {
LoadingThumbnail,
StaticThumbnail,
} from "@/new/photos/components/PlaceholderThumbnails";
+import { TRASH_SECTION } from "@/new/photos/services/collection";
import DownloadManager from "@/new/photos/services/download";
import { Overlay } from "@ente/shared/components/Container";
import { CustomError } from "@ente/shared/error";
@@ -21,7 +22,6 @@ import i18n from "i18next";
import { DeduplicateContext } from "pages/deduplicate";
import { GalleryContext } from "pages/gallery";
import React, { useContext, useEffect, useRef, useState } from "react";
-import { TRASH_SECTION } from "utils/collection";
import { shouldShowAvatar } from "utils/file";
import Avatar from "./Avatar";
diff --git a/web/apps/photos/src/pages/deduplicate.tsx b/web/apps/photos/src/pages/deduplicate.tsx
index feab67f22a..f1ef74a7c3 100644
--- a/web/apps/photos/src/pages/deduplicate.tsx
+++ b/web/apps/photos/src/pages/deduplicate.tsx
@@ -1,5 +1,6 @@
import { stashRedirect } from "@/accounts/services/redirect";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
+import { ALL_SECTION } from "@/new/photos/services/collection";
import { getLocalFiles } from "@/new/photos/services/files";
import { AppContext } from "@/new/photos/types/context";
import { VerticallyCentered } from "@ente/shared/components/Container";
@@ -27,7 +28,6 @@ import {
DefaultDeduplicateContext,
} from "types/deduplicate";
import { SelectedState } from "types/gallery";
-import { ALL_SECTION } from "utils/collection";
import { constructFileToCollectionMap, getSelectedFiles } from "utils/file";
export const DeduplicateContext = createContext<DeduplicateContextType>(
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index ab6b22a6ee..34f3015527 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -11,6 +11,7 @@ import {
GalleryItemsSummary,
} from "@/new/photos/components/gallery/ListHeader";
import { SpaceBetweenFlex } from "@/new/photos/components/mui";
+import { ALL_SECTION } from "@/new/photos/services/collection";
import downloadManager from "@/new/photos/services/download";
import { sortFiles } from "@/new/photos/services/files";
import { AppContext } from "@/new/photos/types/context";
@@ -71,11 +72,7 @@ import {
SetFilesDownloadProgressAttributes,
SetFilesDownloadProgressAttributesCreator,
} from "types/gallery";
-import {
- ALL_SECTION,
- downloadCollectionFiles,
- isHiddenCollection,
-} from "utils/collection";
+import { downloadCollectionFiles, isHiddenCollection } from "utils/collection";
import { downloadSelectedFiles, getSelectedFiles } from "utils/file";
import { formatNumber } from "utils/number/format";
import { PublicCollectionGalleryContext } from "utils/publicCollectionGallery";
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.ts
index bcc4ae9baa..09bb680532 100644
--- a/web/packages/new/photos/components/gallery/reducer.ts
+++ b/web/packages/new/photos/components/gallery/reducer.ts
@@ -140,11 +140,11 @@ export const setDerivativeState = (
hiddenCollections,
);
hiddenCollectionSummaries.set(HIDDEN_ITEMS_SECTION, hiddenItemsSummaries);
- // TODO: Move to reducer
const mergedCollectionSummaries = mergeMaps(
collectionSummaries,
sectionSummaries,
);
+ // TODO: Move to reducer
// setCollectionSummaries(mergeMaps(collectionSummaries, sectionSummaries));
// TODO: Move to reducer
// setHiddenCollectionSummaries(hiddenCollectionSummaries);
@@ -248,7 +248,10 @@ export function getCollectionSummaries(
collectionSummaries.set(collection.id, {
id: collection.id,
name: CollectionSummaryItemName,
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
latestFile: collectionLatestFiles.get(collection.id),
coverFile: collectionCoverFiles.get(collection.id),
fileCount: collectionFilesCount.get(collection.id) ?? 0,
@@ -308,11 +311,17 @@ export const getCollectionCoverFiles = (
if (collection.pubMagicMetadata?.data?.asc) {
coverFiles.set(
collection.id,
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
collectionFiles[collectionFiles.length - 1],
);
} else {
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
coverFiles.set(collection.id, collectionFiles[0]);
}
});
@@ -332,9 +341,15 @@ export function getDummyUncategorizedCollectionSummary(): CollectionSummary {
id: DUMMY_UNCATEGORIZED_COLLECTION,
name: t("section_uncategorized"),
type: "uncategorized",
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
latestFile: null,
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
coverFile: null,
fileCount: 0,
updationTime: 0,
@@ -360,10 +375,16 @@ export function getHiddenItemsSummary(
name: t("hidden_items"),
type: "hiddenItems",
coverFile: hiddenItems?.[0],
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
latestFile: hiddenItems?.[0],
fileCount: hiddenItems?.length,
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
updationTime: hiddenItems?.[0]?.updationTime,
};
}
@@ -397,12 +418,21 @@ export function getArchivedSectionSummary(
id: ARCHIVE_SECTION,
name: t("section_archive"),
type: "archive",
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
coverFile: null,
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
latestFile: archivedFiles?.[0],
fileCount: archivedFiles?.length ?? 0,
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
updationTime: archivedFiles?.[0]?.updationTime,
};
}
@@ -420,10 +450,16 @@ function getAllSectionSummary(
name: t("section_all"),
type: "all",
coverFile: allSectionFiles?.[0],
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
latestFile: allSectionFiles?.[0],
fileCount: allSectionFiles?.length || 0,
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
updationTime: allSectionFiles?.[0]?.updationTime,
};
}
@@ -462,12 +498,21 @@ export function getTrashedCollectionSummary(
id: TRASH_SECTION,
name: t("section_trash"),
type: "trash",
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
coverFile: null,
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
latestFile: trashedFiles?.[0],
fileCount: trashedFiles?.length,
- // @ts-expect-error TODO Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
updationTime: trashedFiles?.[0]?.updationTime,
};
}
diff --git a/web/packages/new/photos/services/file.ts b/web/packages/new/photos/services/file.ts
index b508a157d0..bfb4368b8b 100644
--- a/web/packages/new/photos/services/file.ts
+++ b/web/packages/new/photos/services/file.ts
@@ -6,7 +6,10 @@ export const groupFilesBasedOnCollectionID = (files: EnteFile[]) => {
for (const file of files) {
const id = file.collectionID;
if (!result.has(id)) result.set(id, []);
- // @ts-expect-error TODO: Review types
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
result.get(id).push(file);
}
return result;
diff --git a/web/packages/new/photos/services/magic-metadata.ts b/web/packages/new/photos/services/magic-metadata.ts
index 3d47b96468..e0cacaa455 100644
--- a/web/packages/new/photos/services/magic-metadata.ts
+++ b/web/packages/new/photos/services/magic-metadata.ts
@@ -60,7 +60,10 @@ export async function updateMagicMetadata<T>(
originalMagicMetadata.data = await cryptoWorker.decryptMetadataJSON({
encryptedDataB64: originalMagicMetadata.data,
decryptionHeaderB64: originalMagicMetadata.header,
- // @ts-expect-error TODO: Need to use zod here.
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
keyB64: decryptionKey,
});
}
@@ -77,7 +80,10 @@ export async function updateMagicMetadata<T>(
const magicMetadata = {
...originalMagicMetadata,
data: nonEmptyMagicMetadataProps,
- // @ts-expect-error TODO review this file
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
count: Object.keys(nonEmptyMagicMetadataProps).length,
};
@@ -87,9 +93,15 @@ export async function updateMagicMetadata<T>(
export const getNewMagicMetadata = <T>(): MagicMetadataCore<T> => {
return {
version: 1,
- // @ts-expect-error TODO review this file
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
data: null,
- // @ts-expect-error TODO review this file
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
header: null,
count: 0,
};
@@ -97,7 +109,10 @@ export const getNewMagicMetadata = <T>(): MagicMetadataCore<T> => {
export const getNonEmptyMagicMetadataProps = <T>(magicMetadataProps: T): T => {
return Object.fromEntries(
- // @ts-expect-error TODO review this file
+ // See: [Note: strict mode migration]
+ //
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
Object.entries(magicMetadataProps).filter(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
([_, v]) => v !== null && v !== undefined,