From eaa09306173cd2cd4c7121d46b7fa29112a84f73 Mon Sep 17 00:00:00 2001 From: Stan Wohlwend Date: Sun, 14 Jul 2024 10:41:20 -0700 Subject: [PATCH] Disallow unused expressions --- eslint-configs/defaults.js | 1 + packages/stack-shared/src/utils/promises.tsx | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/eslint-configs/defaults.js b/eslint-configs/defaults.js index f8691e9e1..bfc79eae0 100644 --- a/eslint-configs/defaults.js +++ b/eslint-configs/defaults.js @@ -8,6 +8,7 @@ module.exports = { tsconfigRootDir: process.cwd(), }, rules: { + "no-unused-expressions": ["error", { enforceForJSX: true }], "no-trailing-spaces": "warn", "key-spacing": "error", "indent": ["error", 2, { diff --git a/packages/stack-shared/src/utils/promises.tsx b/packages/stack-shared/src/utils/promises.tsx index 23f46d426..c7ec0792a 100644 --- a/packages/stack-shared/src/utils/promises.tsx +++ b/packages/stack-shared/src/utils/promises.tsx @@ -236,7 +236,11 @@ export function rateLimited( ); for (const nextFunc of nextFuncs) { - value.status === "ok" ? nextFunc[0](value.data) : nextFunc[1](value.error); + if (value.status === "ok") { + nextFunc[0](value.data); + } else { + nextFunc[1](value.error); + } } };