Skip to content

armgit / ente

Public Imported from GitHub
0

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

Same issue in more places

Manav Rathi75385a6e02e4
diff --git a/web/apps/photos/eslint.config.mjs b/web/apps/photos/eslint.config.mjs
index 8e5b0ec27c..acc4236012 100644
--- a/web/apps/photos/eslint.config.mjs
+++ b/web/apps/photos/eslint.config.mjs
@@ -10,7 +10,6 @@ export default [
* turned on to function correctly"
*/
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
- "@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/no-unnecessary-condition": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-explicit-any": "off",
diff --git a/web/packages/accounts/components/utils/second-factor-choice.ts b/web/packages/accounts/components/utils/second-factor-choice.ts
index 788ea4876a..e263bb6af3 100644
--- a/web/packages/accounts/components/utils/second-factor-choice.ts
+++ b/web/packages/accounts/components/utils/second-factor-choice.ts
@@ -51,10 +51,8 @@ export const useSecondFactorChoiceIfNeeded = () => {
// ID will be in a V2 attribute during a transient migration period.
//
// Note the use of || instead of ?? since _twoFactorSessionIDV1 will
- // be an empty string, not undefined, if it is unset. This is
- // intentional, so disable the eslint rule too.
+ // be an empty string, not undefined, if it is unset.
const _twoFactorSessionID =
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
_twoFactorSessionIDV1 || _twoFactorSessionIDV2;
let passkeySessionID: string | undefined;
diff --git a/web/packages/accounts/pages/two-factor/recover.tsx b/web/packages/accounts/pages/two-factor/recover.tsx
index a7dbd2c6d5..f0aba30440 100644
--- a/web/packages/accounts/pages/two-factor/recover.tsx
+++ b/web/packages/accounts/pages/two-factor/recover.tsx
@@ -48,14 +48,7 @@ const Page: React.FC<RecoverPageProps> = ({ twoFactorType }) => {
useEffect(() => {
const user = getData("user");
- // TODO: Can't disable @typescript-eslint/prefer-nullish-coalescing here
- // because this file is imported from multiple configurations, some of
- // which have it on, some of which have it off.
- //
- // Converting || to ?? here is a behaviour change that will need audit
- // first. So for now, writing it the weird way around.
- let sid = user.passkeySessionID;
- if (!sid) sid = user.twoFactorSessionID;
+ const sid = user.passkeySessionID || user.twoFactorSessionID;
if (!user?.email || !sid) {
void router.push("/");
} else if (
diff --git a/web/packages/build-config/eslintrc-base.mjs b/web/packages/build-config/eslintrc-base.mjs
index 27bcbf3434..b93dd77123 100644
--- a/web/packages/build-config/eslintrc-base.mjs
+++ b/web/packages/build-config/eslintrc-base.mjs
@@ -56,6 +56,25 @@ export default tseslint.config(
"error",
{ allowConstantLoopConditions: true },
],
+ // This one is a good suggestion in general, but it not always the
+ // one we want because there are cases where we'd intentionally want
+ // to map falsey values like empty strings to the default (e.g.
+ // remote might be returning a blank string to indicate a missing
+ // value), for which `||` is the appropriate operator, and doing it
+ // without using `||` is unnecessarily convoluted.
+ //
+ // So the next best thing would be for us to disable this piecemeal,
+ // and I tried that for a while. But that runs into a different
+ // problem: currently some of our code gets linted under different
+ // rules depending on the (pseudo-)package that is importing it.
+ // This rules being on by default but off in some cases means that
+ // for the same line of code, it is an error for some but not all
+ // invocations of eslint. And so eslint then starts complaining
+ // about us trying to squelch a non error.
+ //
+ // Given that (a) it is not always the right choice, and (b) it is
+ // not not usable for our current state, disabling it globally.
+ "@typescript-eslint/prefer-nullish-coalescing": "off",
},
},
);
diff --git a/web/packages/gallery/services/upload.ts b/web/packages/gallery/services/upload.ts
index 19d87e276e..76de7f96b5 100644
--- a/web/packages/gallery/services/upload.ts
+++ b/web/packages/gallery/services/upload.ts
@@ -141,7 +141,6 @@ export const updateShouldDisableCFUploadProxy = async (
savedPreference?: boolean,
) => {
_state.shouldDisableCFUploadProxy =
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
savedPreference || (await computeShouldDisableCFUploadProxy());
};
diff --git a/web/packages/new/photos/services/collections.ts b/web/packages/new/photos/services/collections.ts
index 0a42a5f307..8e1833f28e 100644
--- a/web/packages/new/photos/services/collections.ts
+++ b/web/packages/new/photos/services/collections.ts
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
// TODO: Audit this file
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
-/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
diff --git a/web/packages/new/photos/services/settings.ts b/web/packages/new/photos/services/settings.ts
index 87e04f362b..17f4ef00d4 100644
--- a/web/packages/new/photos/services/settings.ts
+++ b/web/packages/new/photos/services/settings.ts
@@ -2,12 +2,6 @@
* @file Storage (in-memory, local, remote) and update of various settings.
*/
-// We want to map falsey values like empty strings to the default, for which
-// `||` is the appropriate operator, so turn off the eslint suggestion to use
-// `??` instead for this file.
-//
-/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
-
import { isDevBuild } from "ente-base/env";
import { localUser } from "ente-base/local-user";
import log from "ente-base/log";
diff --git a/web/packages/shared/eslint.config.mjs b/web/packages/shared/eslint.config.mjs
index 385d1b56a8..c792ea72b9 100644
--- a/web/packages/shared/eslint.config.mjs
+++ b/web/packages/shared/eslint.config.mjs
@@ -10,7 +10,6 @@ export default [
* turned on to function correctly"
*/
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
- "@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/no-unnecessary-condition": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-explicit-any": "off",