fix(lint): flatten max-depth in storeTcTokensFromHistorySync

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.
This commit is contained in:
Renato Alcara
2026-04-25 23:49:55 -03:00
parent b5910c591a
commit d119cb064a
+4 -4
View File
@@ -122,10 +122,10 @@ async function storeTcTokensFromHistorySync(
if (pnsToResolve.length) { if (pnsToResolve.length) {
try { try {
const mappings = await signalRepository.lidMapping.getLIDsForPNs(pnsToResolve) const mappings = await signalRepository.lidMapping.getLIDsForPNs(pnsToResolve)
if (mappings) { // Flat loop (continue-on-skip) keeps max nesting depth at 4 for lint.
for (const { pn, lid } of mappings) { for (const { pn, lid } of mappings ?? []) {
if (pn && lid) pnToLid.set(jidNormalizedUser(pn), lid) if (!pn || !lid) continue
} pnToLid.set(jidNormalizedUser(pn), lid)
} }
} catch (err) { } catch (err) {
// Per-chat fallback below (storageJid := jid). Don't abort the chunk — // Per-chat fallback below (storageJid := jid). Don't abort the chunk —