Skip to content

armgit / ente

Public Imported from GitHub
0

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

More lints

Manav Rathie64d66a32016
diff --git a/web/apps/photos/eslint.config.mjs b/web/apps/photos/eslint.config.mjs
index acc4236012..b8709f6cd3 100644
--- a/web/apps/photos/eslint.config.mjs
+++ b/web/apps/photos/eslint.config.mjs
@@ -19,18 +19,8 @@ export default [
"@typescript-eslint/no-unsafe-call": "off",
/** TODO: Disabled as we migrate, try to prune these again */
"@typescript-eslint/no-floating-promises": "off",
- "@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
- "@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/prefer-promise-reject-errors": "off",
- "@typescript-eslint/no-useless-constructor": "off",
- "@typescript-eslint/require-await": "off",
- "@typescript-eslint/no-misused-promises": "off",
- "@typescript-eslint/restrict-template-expressions": "off",
- "@typescript-eslint/no-inferrable-types": "off",
- "@typescript-eslint/no-base-to-string": "off",
- "@typescript-eslint/restrict-plus-operands": "off",
- "@typescript-eslint/no-unused-expressions": "off",
"react-hooks/exhaustive-deps": "off",
"react-refresh/only-export-components": "off",
},
diff --git a/web/apps/photos/src/components/Collections/AllAlbums.tsx b/web/apps/photos/src/components/Collections/AllAlbums.tsx
index ca2a032a35..11aa4d46e7 100644
--- a/web/apps/photos/src/components/Collections/AllAlbums.tsx
+++ b/web/apps/photos/src/components/Collections/AllAlbums.tsx
@@ -211,7 +211,7 @@ const AllAlbumsContent: React.FC<AllAlbumsContentProps> = ({
if (!collectionSummaries) {
return;
}
- const main = async () => {
+ const main = () => {
if (refreshInProgress.current) {
shouldRefresh.current = true;
return;
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx
index 0bd3871d59..9986932cb9 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx
@@ -1673,7 +1673,7 @@ const ManageLinkPassword: React.FC<ManagePublicLinkSettingProps> = ({
const { show: showSetPassword, props: setPasswordVisibilityProps } =
useModalVisibility();
- const handlePasswordChangeSetting = async () => {
+ const handlePasswordChangeSetting = () => {
if (publicURL.passwordEnabled) {
showMiniDialog({
title: t("disable_password"),
diff --git a/web/apps/photos/src/components/FileList.tsx b/web/apps/photos/src/components/FileList.tsx
index 4a1c497f59..e946d9dab7 100644
--- a/web/apps/photos/src/components/FileList.tsx
+++ b/web/apps/photos/src/components/FileList.tsx
@@ -1,3 +1,5 @@
+// TODO: Audit this file
+/* eslint-disable @typescript-eslint/restrict-plus-operands */
import AlbumOutlinedIcon from "@mui/icons-material/AlbumOutlined";
import FavoriteRoundedIcon from "@mui/icons-material/FavoriteRounded";
import PlayCircleOutlineOutlinedIcon from "@mui/icons-material/PlayCircleOutlineOutlined";
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index fe9ec555f7..3343f26b01 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -567,6 +567,7 @@ export const Upload: React.FC<UploadProps> = ({
}
}
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
let showNextModal = () => {};
if (importSuggestion.hasNestedFolders) {
showNextModal = () => setOpenCollectionMappingChoice(true);
@@ -586,7 +587,7 @@ export const Upload: React.FC<UploadProps> = ({
})();
}, [webFiles, desktopFiles, desktopFilePaths, desktopZipItems]);
- const preCollectionCreationAction = async () => {
+ const preCollectionCreationAction = () => {
onCloseCollectionSelector?.();
props.setShouldDisableDropzone(uploadManager.isUploadInProgress());
setUploadPhase("preparing");
@@ -597,7 +598,7 @@ export const Upload: React.FC<UploadProps> = ({
collection: Collection,
uploaderName?: string,
) => {
- await preCollectionCreationAction();
+ preCollectionCreationAction();
const uploadItemsWithCollection = uploadItemsAndPaths.current.map(
([uploadItem, path], index) => ({
uploadItem,
@@ -618,7 +619,7 @@ export const Upload: React.FC<UploadProps> = ({
mapping: CollectionMapping,
collectionName?: string,
) => {
- await preCollectionCreationAction();
+ preCollectionCreationAction();
let uploadItemsWithCollection: UploadItemWithCollection[] = [];
let collectionNameToUploadItems = new Map<
string,
@@ -821,7 +822,7 @@ export const Upload: React.FC<UploadProps> = ({
}
};
- const handlePublicUpload = async (uploaderName: string) => {
+ const handlePublicUpload = (uploaderName: string) => {
savePublicCollectionUploaderName(
publicCollectionGalleryContext.credentials.accessToken,
uploaderName,
@@ -1210,20 +1211,22 @@ const UploadOptions: React.FC<UploadOptionsProps> = ({
onSelect("folders");
break;
case "zips":
- !showTakeoutOptions
- ? setShowTakeoutOptions(true)
- : onSelect("zips");
+ if (!showTakeoutOptions) {
+ setShowTakeoutOptions(true);
+ } else {
+ onSelect("zips");
+ }
break;
}
};
- return !showTakeoutOptions ? (
+ return showTakeoutOptions ? (
+ <TakeoutOptions onSelect={handleSelect} onClose={handleTakeoutClose} />
+ ) : (
<DefaultOptions
{...{ intent, pendingUploadType, onClose }}
onSelect={handleSelect}
/>
- ) : (
- <TakeoutOptions onSelect={handleSelect} onClose={handleTakeoutClose} />
);
};
diff --git a/web/apps/photos/src/components/WatchFolder.tsx b/web/apps/photos/src/components/WatchFolder.tsx
index c88e332776..d403997626 100644
--- a/web/apps/photos/src/components/WatchFolder.tsx
+++ b/web/apps/photos/src/components/WatchFolder.tsx
@@ -152,7 +152,7 @@ export const WatchFolder: React.FC<ModalVisibilityProps> = ({
interface WatchList {
watches: FolderWatch[] | undefined;
- removeWatch: (watch: FolderWatch) => void;
+ removeWatch: (watch: FolderWatch) => Promise<void>;
}
const WatchList: React.FC<WatchList> = ({ watches, removeWatch }) =>
@@ -201,13 +201,13 @@ const Check: React.FC = () => (
interface WatchEntryProps {
watch: FolderWatch;
- removeWatch: (watch: FolderWatch) => void;
+ removeWatch: (watch: FolderWatch) => Promise<void>;
}
const WatchEntry: React.FC<WatchEntryProps> = ({ watch, removeWatch }) => {
const { showMiniDialog } = useBaseContext();
- const confirmStopWatching = () => {
+ const confirmStopWatching = () =>
showMiniDialog({
title: t("stop_watching_folder_title"),
message: t("stop_watching_folder_message"),
@@ -217,7 +217,6 @@ const WatchEntry: React.FC<WatchEntryProps> = ({ watch, removeWatch }) => {
action: () => removeWatch(watch),
},
});
- };
return (
<SpacedRow sx={{ overflow: "hidden", flexShrink: 0 }}>
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index f29869493a..21173e9908 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -1337,7 +1337,7 @@ export async function handleSubscriptionCompletionRedirectIfNeeded(
);
}
} else if (status == "fail") {
- log.error(`Subscription purchase failed: ${reason}`);
+ log.error(`Subscription purchase failed`, reason);
switch (reason) {
case "canceled":
showMiniDialog({
diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsx
index 92a49006ab..705ea034c9 100644
--- a/web/apps/photos/src/pages/shared-albums.tsx
+++ b/web/apps/photos/src/pages/shared-albums.tsx
@@ -1,3 +1,5 @@
+// TODO: Audit this file
+/* eslint-disable @typescript-eslint/no-unused-expressions */
import AddPhotoAlternateOutlinedIcon from "@mui/icons-material/AddPhotoAlternateOutlined";
import CloseIcon from "@mui/icons-material/Close";
import DownloadIcon from "@mui/icons-material/Download";
diff --git a/web/apps/photos/src/services/upload-manager.ts b/web/apps/photos/src/services/upload-manager.ts
index 9c351f8df7..e5d61f6170 100644
--- a/web/apps/photos/src/services/upload-manager.ts
+++ b/web/apps/photos/src/services/upload-manager.ts
@@ -101,8 +101,8 @@ class UIService {
// UPLOAD LEVEL STATES
private uploadPhase: UploadPhase = "preparing";
private filenames = new Map<number, string>();
- private hasLivePhoto: boolean = false;
- private uploadProgressView: boolean = false;
+ private hasLivePhoto = false;
+ private uploadProgressView = false;
// STAGE LEVEL STATES
private perFileProgress: number;
@@ -269,7 +269,7 @@ class UploadManager {
private uiService = new UIService();
- public async init(
+ public init(
progressUpdater: ProgressUpdater,
onUploadFile: (file: EnteFile) => void,
publicAlbumsCredentials: PublicAlbumsCredentials | undefined,
@@ -571,7 +571,7 @@ class UploadManager {
}
if (isDesktop && watcher.isUploadRunning()) {
- await watcher.onFileUpload(uploadableItem, uploadResult);
+ watcher.onFileUpload(uploadableItem, uploadResult);
}
return type == "addedSymlink" ? "uploaded" : type;
diff --git a/web/apps/photos/src/services/watch.ts b/web/apps/photos/src/services/watch.ts
index e9e6270281..38fcf838d1 100644
--- a/web/apps/photos/src/services/watch.ts
+++ b/web/apps/photos/src/services/watch.ts
@@ -74,6 +74,8 @@ class FolderWatcher {
private debouncedRunNextEvent: () => void;
constructor() {
+ // TODO:
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
this.debouncedRunNextEvent = debounce(() => this.runNextEvent(), 1000);
}
@@ -319,10 +321,7 @@ class FolderWatcher {
* Callback invoked by the uploader whenever a item we requested to
* {@link upload} gets uploaded.
*/
- async onFileUpload(
- item: UploadItemWithCollection,
- uploadResult: UploadResult,
- ) {
+ onFileUpload(item: UploadItemWithCollection, uploadResult: UploadResult) {
// Re the usage of ensureString: For desktop watch, the only possibility
// for a UploadItem is for it to be a string (the absolute path to a
// file on disk).
diff --git a/web/apps/photos/tests/upload.test.ts b/web/apps/photos/tests/upload.test.ts
index 4605d65245..ec4812998c 100644
--- a/web/apps/photos/tests/upload.test.ts
+++ b/web/apps/photos/tests/upload.test.ts
@@ -1,3 +1,6 @@
+/* eslint-disable @typescript-eslint/no-base-to-string */
+// TODO: Audit this file
+/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/dot-notation */
import {
parseDateFromDigitGroups,
@@ -163,13 +166,13 @@ export async function testUpload() {
await exifDataParsingCheck(expectedState);
await fileDimensionExtractionCheck(expectedState);
await googleMetadataReadingCheck(expectedState);
- await totalFileCountCheck(expectedState);
+ totalFileCountCheck(expectedState);
} catch (e) {
console.log(e);
}
}
-async function totalFileCountCheck(expectedState) {
+function totalFileCountCheck(expectedState) {
const userDetails = userDetailsSnapshot();
if (expectedState.total_file_count === userDetails.fileCount) {
console.log("file count check passed βœ…");
diff --git a/web/packages/new/albums/components/UploaderNameInput.tsx b/web/packages/new/albums/components/UploaderNameInput.tsx
index 7aa31b7b0f..8d951bd0c3 100644
--- a/web/packages/new/albums/components/UploaderNameInput.tsx
+++ b/web/packages/new/albums/components/UploaderNameInput.tsx
@@ -29,7 +29,7 @@ type UploaderNameInput = ModalVisibilityProps & {
/**
* Callback invoked when the user presses submit after entering a name.
*/
- onSubmit: (name: string) => Promise<void>;
+ onSubmit: (name: string) => void | Promise<void>;
};
/**