From d119cb064a876203a03ea83606b89450e7bc0bdd Mon Sep 17 00:00:00 2001 From: Renato Alcara Date: Sat, 25 Apr 2026 23:49:55 -0300 Subject: [PATCH] fix(lint): flatten max-depth in storeTcTokensFromHistorySync MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI lint failed with: process-message.ts:127:6 error Blocks are nested too deeply (5). Maximum allowed is 4 max-depth The previous shape nested `if (pnsToResolve.length) → try → if (mappings) → for → if (pn && lid)` = 5 levels. Flattened to 4 by: - Using `mappings ?? []` so the for-of can iterate without an outer guard - Inverting the inner predicate to `if (!pn || !lid) continue` No behavior change. CI should now pass. --- src/Utils/process-message.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Utils/process-message.ts b/src/Utils/process-message.ts index 7fe43e3c..df77a801 100644 --- a/src/Utils/process-message.ts +++ b/src/Utils/process-message.ts @@ -122,10 +122,10 @@ async function storeTcTokensFromHistorySync( if (pnsToResolve.length) { try { const mappings = await signalRepository.lidMapping.getLIDsForPNs(pnsToResolve) - if (mappings) { - for (const { pn, lid } of mappings) { - if (pn && lid) pnToLid.set(jidNormalizedUser(pn), lid) - } + // Flat loop (continue-on-skip) keeps max nesting depth at 4 for lint. + for (const { pn, lid } of mappings ?? []) { + if (!pn || !lid) continue + pnToLid.set(jidNormalizedUser(pn), lid) } } catch (err) { // Per-chat fallback below (storageJid := jid). Don't abort the chunk —