Skip to content

armgit / ente

Public Imported from GitHub
0

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

Replace ignore() helper with ignoreRestSiblings lint option

Manav Rathic04fd77fd91e
diff --git a/web/packages/build-config/eslintrc-base.mjs b/web/packages/build-config/eslintrc-base.mjs
index edbbbbb575..11799ae96b 100644
--- a/web/packages/build-config/eslintrc-base.mjs
+++ b/web/packages/build-config/eslintrc-base.mjs
@@ -37,9 +37,11 @@ export default tseslint.config(
"error",
{ allowConstantLoopConditions: true },
],
- // Shared files are linted by workspaces with different configs, so
- // a local disable can be required in one run and invalid in another.
- // We also use `||` when a blank string should select the default.
+ "@typescript-eslint/no-unused-vars": [
+ "error",
+ { ignoreRestSiblings: true },
+ ],
+ // We use `||` where a blank string should select the default.
"@typescript-eslint/prefer-nullish-coalescing": "off",
},
},
diff --git a/web/packages/gallery/services/files-db.ts b/web/packages/gallery/services/files-db.ts
index 2039b62a15..b32a688cdd 100644
--- a/web/packages/gallery/services/files-db.ts
+++ b/web/packages/gallery/services/files-db.ts
@@ -4,7 +4,6 @@ import {
CollectionPrivateMagicMetadataData,
CollectionPublicMagicMetadataData,
CollectionShareeMagicMetadataData,
- ignore,
RemoteCollectionUser,
RemotePublicURL,
} from "ente-media/collection";
@@ -94,14 +93,6 @@ const LocalCollection = z
isDeleted,
...rest
} = c;
- ignore([
- encryptedKey,
- keyDecryptionNonce,
- encryptedName,
- nameDecryptionNonce,
- attributes,
- isDeleted,
- ]);
return rest;
});
@@ -154,7 +145,6 @@ const transformFile = (file: EnteFile & { isDeleted?: unknown }) => {
pubMagicMetadata,
...rest
} = file;
- ignore(isDeleted);
const metadata = transformDecryptedMetadataJSON(
file.id,
origMetadata,
diff --git a/web/packages/media/collection.ts b/web/packages/media/collection.ts
index d8276c7423..fd17728d2e 100644
--- a/web/packages/media/collection.ts
+++ b/web/packages/media/collection.ts
@@ -149,6 +149,7 @@ export const decryptRemoteCollection = async (
encryptedName,
nameDecryptionNonce,
sharees,
+ // The attributes field is mobile specific and unused by the web clients.
attributes,
isDeleted,
magicMetadata: encryptedMagicMetadata,
@@ -157,11 +158,6 @@ export const decryptRemoteCollection = async (
...rest
} = collection;
- ignore([encryptedKey, keyDecryptionNonce]);
- // The attributes field is mobile specific and unused by the web clients.
- ignore(attributes);
- ignore(isDeleted);
-
const name =
// The `||` is deliberate: remote sets name to blank to indicate
// absence. Only very old collections, created before names were
@@ -216,15 +212,10 @@ export const decryptRemoteCollection = async (
};
};
-export const ignore = (xs: unknown) => typeof xs;
-
const parseRemoteCollectionUser = ({
name,
...rest
-}: RemoteCollectionUser): CollectionUser => {
- ignore(name);
- return rest;
-};
+}: RemoteCollectionUser): CollectionUser => rest;
export const CollectionSubType = {
default: 0,
diff --git a/web/packages/media/file.ts b/web/packages/media/file.ts
index cac2db49e1..720256858a 100644
--- a/web/packages/media/file.ts
+++ b/web/packages/media/file.ts
@@ -2,7 +2,6 @@ import { decryptBox, decryptMetadataJSON } from "ente-base/crypto";
import log from "ente-base/log";
import { nullishToBlank, nullToUndefined } from "ente-utils/transform";
import { z } from "zod";
-import { ignore } from "./collection";
import {
fileFileName,
FileMetadata,
@@ -97,6 +96,8 @@ export const decryptRemoteFile = async (
id,
encryptedKey,
keyDecryptionNonce,
+ // isDeleted only matters in the diff response, and it has already been
+ // acted on before we get here.
isDeleted,
metadata: encryptedMetadata,
magicMetadata: encryptedMagicMetadata,
@@ -104,10 +105,6 @@ export const decryptRemoteFile = async (
...rest
} = remoteFile;
- // isDeleted only matters in the diff response, and it has already been
- // acted on before we get here.
- ignore(isDeleted);
-
const key = await decryptBox(
{ encryptedData: encryptedKey, nonce: keyDecryptionNonce },
collectionKey,