From 26247c768128a924a41742dcc43d2aefcb1b4454 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 13 Feb 2026 23:13:20 +0000 Subject: [PATCH] Fix lint errors: remove unused imports, fix floating promises, clean up eslint directives - Remove unused eslint-disable directives from multiple files - Fix floating promise in baileys-event-stream.ts by adding void operator - Remove unused import recordMessageRetry from messages-send.ts - Prefix unused variable beforeTime with underscore in test file - Remove incorrect eslint-disable comments that were causing prettier errors Progress: Reduced from 68 to 35 errors. Remaining errors are primarily max-depth issues. https://claude.ai/code/session_015R3U3kiprQiNTTNNt31Sg6 --- src/Signal/libsignal.ts | 1 - src/Socket/chats.ts | 1 - src/Socket/messages-send.ts | 6 ++---- src/Socket/socket.ts | 2 -- src/Utils/baileys-event-stream.ts | 4 ++-- src/Utils/cache-utils.ts | 1 - src/Utils/chat-utils.ts | 7 +++---- src/Utils/circuit-breaker.ts | 1 - src/Utils/decode-wa-message.ts | 1 - src/Utils/prometheus-metrics.ts | 1 - src/Utils/retry-utils.ts | 1 - src/Utils/sticker-pack.ts | 1 - src/Utils/structured-logger.ts | 1 - src/Utils/trace-context.ts | 3 +-- src/Utils/unified-session.ts | 1 - src/__tests__/Signal/session-activity-tracker.test.ts | 2 +- src/__tests__/Utils/structured-logger.test.ts | 1 - 17 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/Signal/libsignal.ts b/src/Signal/libsignal.ts index 9bf2d2b2..c9c5bfc0 100644 --- a/src/Signal/libsignal.ts +++ b/src/Signal/libsignal.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-depth, @typescript-eslint/no-unused-vars */ /* @ts-ignore */ import { createHash } from 'crypto' import * as libsignal from 'libsignal' diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index 08926c1c..95f85d18 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-depth */ import NodeCache from '@cacheable/node-cache' import { Boom } from '@hapi/boom' import { LRUCache } from 'lru-cache' diff --git a/src/Socket/messages-send.ts b/src/Socket/messages-send.ts index 3b06d2d6..4b8ad109 100644 --- a/src/Socket/messages-send.ts +++ b/src/Socket/messages-send.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-depth, @typescript-eslint/no-unused-vars, @typescript-eslint/no-floating-promises */ import NodeCache from '@cacheable/node-cache' import { Boom } from '@hapi/boom' import { proto } from '../../WAProto/index.js' @@ -43,7 +42,7 @@ import { import { logMessageSent } from '../Utils/baileys-logger' import { getUrlInfo } from '../Utils/link-preview' import { makeKeyedMutex } from '../Utils/make-mutex' -import { metrics, recordMessageFailure, recordMessageRetry, recordMessageSent } from '../Utils/prometheus-metrics' +import { metrics, recordMessageFailure, recordMessageSent } from '../Utils/prometheus-metrics' import { getMessageReportingToken, shouldIncludeReportingToken } from '../Utils/reporting-utils' import { areJidsSameUser, @@ -722,7 +721,7 @@ export const makeMessagesSocket = (config: SocketConfig) => { * Returns the attributes for the interactive binary node based on message type * For native_flow: returns { v: '4', name: '' } or special attributes for payment flows */ - const getButtonArgs = (message: proto.IMessage): BinaryNodeAttributes => { + const _getButtonArgs = (message: proto.IMessage): BinaryNodeAttributes => { const buttonType = getButtonType(message) // For native_flow messages, check for special button types that need specific attributes @@ -940,7 +939,6 @@ export const makeMessagesSocket = (config: SocketConfig) => { const bytes = encodeNewsletterMessage(patched as proto.IMessage) binaryNodeContent.push({ tag: 'plaintext', - // eslint-disable-next-line @typescript-eslint/no-floating-promises attrs: {}, content: bytes }) diff --git a/src/Socket/socket.ts b/src/Socket/socket.ts index d9366618..eb287fe4 100644 --- a/src/Socket/socket.ts +++ b/src/Socket/socket.ts @@ -310,7 +310,6 @@ export const makeSocket = (config: SocketConfig) => { } } } - // eslint-disable-next-line @typescript-eslint/no-floating-promises /** send a query, and wait for its response. auto-generates message ID if not provided */ const queryInternal = async (node: BinaryNode, timeoutMs?: number) => { @@ -601,7 +600,6 @@ export const makeSocket = (config: SocketConfig) => { const keyEnc = noise.processHandshake(handshake, creds.noiseKey) let node: proto.IClientPayload - // eslint-disable-next-line @typescript-eslint/no-floating-promises if (!creds.me) { node = generateRegistrationNode(creds, config) logger.info({ node }, 'not logged in, attempting registration...') diff --git a/src/Utils/baileys-event-stream.ts b/src/Utils/baileys-event-stream.ts index e43e8285..f477d88f 100644 --- a/src/Utils/baileys-event-stream.ts +++ b/src/Utils/baileys-event-stream.ts @@ -310,7 +310,7 @@ export class BaileysEventStream extends EventEmitter { // Process if not paused if (!this.paused && !this.isProcessing) { - this.processNext() + void this.processNext() } return true @@ -598,7 +598,7 @@ export class BaileysEventStream extends EventEmitter { resume(): void { this.paused = false this.emit('resume') - this.processNext() + void this.processNext() } /** diff --git a/src/Utils/cache-utils.ts b/src/Utils/cache-utils.ts index 792fc90f..c18152ed 100644 --- a/src/Utils/cache-utils.ts +++ b/src/Utils/cache-utils.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-depth, @typescript-eslint/no-unused-vars */ /** * Smart Cache System * diff --git a/src/Utils/chat-utils.ts b/src/Utils/chat-utils.ts index 5ec13446..5072dfe7 100644 --- a/src/Utils/chat-utils.ts +++ b/src/Utils/chat-utils.ts @@ -216,7 +216,7 @@ export const decodeSyncdMutations = async ( // if it's a syncdmutation, get the operation property // otherwise, if it's only a record -- it'll be a SET mutation const operation = 'operation' in msgMutation ? msgMutation.operation : proto.SyncdMutation.SyncdOperation.SET - // eslint-disable-next-line eqeqeq + if (operation == null) { throw new Boom('Missing operation in mutation', { statusCode: 500 }) } @@ -343,7 +343,7 @@ export const decodeSyncdPatch = async ( } const msgVersion = msg.version?.version - // eslint-disable-next-line eqeqeq + if (msgVersion == null) { throw new Boom('Missing version in patch message', { statusCode: 500 }) } @@ -446,7 +446,7 @@ export const decodeSyncdSnapshot = async ( const newState = newLTHashState() const snapshotVersion = snapshot.version?.version - // eslint-disable-next-line eqeqeq + if (snapshotVersion == null) { throw new Boom('Missing version in snapshot', { statusCode: 500 }) } @@ -540,7 +540,6 @@ export const decodePatches = async ( const ver = version?.version if (ver == null) { - // eslint-disable-next-line eqeqeq throw new Boom('Missing version in patch', { statusCode: 500 }) } diff --git a/src/Utils/circuit-breaker.ts b/src/Utils/circuit-breaker.ts index 9707dd6d..5edd7dc3 100644 --- a/src/Utils/circuit-breaker.ts +++ b/src/Utils/circuit-breaker.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-depth */ /** * Circuit Breaker Pattern Implementation * diff --git a/src/Utils/decode-wa-message.ts b/src/Utils/decode-wa-message.ts index 3b21e9fa..7611a32e 100644 --- a/src/Utils/decode-wa-message.ts +++ b/src/Utils/decode-wa-message.ts @@ -1,4 +1,3 @@ -/* eslint-disable space-before-function-paren */ import { Boom } from '@hapi/boom' import { proto } from '../../WAProto/index.js' import type { WAMessage, WAMessageKey } from '../Types' diff --git a/src/Utils/prometheus-metrics.ts b/src/Utils/prometheus-metrics.ts index e9be92db..baaec86d 100644 --- a/src/Utils/prometheus-metrics.ts +++ b/src/Utils/prometheus-metrics.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-depth, @typescript-eslint/no-unused-vars */ /** * Prometheus Metrics Exposition - Enterprise Grade * diff --git a/src/Utils/retry-utils.ts b/src/Utils/retry-utils.ts index ed07ef4e..a45d5a1c 100644 --- a/src/Utils/retry-utils.ts +++ b/src/Utils/retry-utils.ts @@ -1,4 +1,3 @@ -/* eslint-disable prefer-const */ /** * Smart Retry Logic * diff --git a/src/Utils/sticker-pack.ts b/src/Utils/sticker-pack.ts index 232b3b13..5ba002d9 100644 --- a/src/Utils/sticker-pack.ts +++ b/src/Utils/sticker-pack.ts @@ -1,4 +1,3 @@ -/* eslint-disable prefer-const, space-before-function-paren */ import { Boom } from '@hapi/boom' import { createHash } from 'crypto' import { zipSync } from 'fflate' diff --git a/src/Utils/structured-logger.ts b/src/Utils/structured-logger.ts index be9e59d3..80497b7b 100644 --- a/src/Utils/structured-logger.ts +++ b/src/Utils/structured-logger.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ /** * Structured Logging System for InfiniteAPI * diff --git a/src/Utils/trace-context.ts b/src/Utils/trace-context.ts index b5073e3c..9ebd436e 100644 --- a/src/Utils/trace-context.ts +++ b/src/Utils/trace-context.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-floating-promises, space-before-function-paren */ /** * Request Tracing Context * @@ -320,7 +319,7 @@ export function setSpanError(span: Span, error: Error): void { span.attributes.error = true span.attributes.errorMessage = error.message span.attributes.errorName = error.name - // eslint-disable-next-line @typescript-eslint/no-floating-promises + if (error.stack) { span.attributes.errorStack = error.stack } diff --git a/src/Utils/unified-session.ts b/src/Utils/unified-session.ts index 273ef737..0ac9e469 100644 --- a/src/Utils/unified-session.ts +++ b/src/Utils/unified-session.ts @@ -1,4 +1,3 @@ -/* eslint-disable max-depth */ /** * Unified Session Telemetry Implementation * diff --git a/src/__tests__/Signal/session-activity-tracker.test.ts b/src/__tests__/Signal/session-activity-tracker.test.ts index c15f312d..f1aec43d 100644 --- a/src/__tests__/Signal/session-activity-tracker.test.ts +++ b/src/__tests__/Signal/session-activity-tracker.test.ts @@ -29,7 +29,7 @@ describe('SessionActivityTracker', () => { const tracker = makeSessionActivityTracker(mockKeys, logger, config) const jid = '5511999999999@s.whatsapp.net' - const beforeTime = Date.now() + const _beforeTime = Date.now() tracker.recordActivity(jid) diff --git a/src/__tests__/Utils/structured-logger.test.ts b/src/__tests__/Utils/structured-logger.test.ts index 8188013b..48cd4d66 100644 --- a/src/__tests__/Utils/structured-logger.test.ts +++ b/src/__tests__/Utils/structured-logger.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ /** * Testes unitários para structured-logger.ts */