Fix: all remaining lint errors

Fix: all remaining lint errors
This commit is contained in:
Renato Alcara
2026-02-13 20:39:55 -03:00
committed by GitHub
19 changed files with 45 additions and 32 deletions
+4 -1
View File
@@ -1,4 +1,3 @@
/* eslint-disable max-depth, @typescript-eslint/no-unused-vars */
/* @ts-ignore */ /* @ts-ignore */
import { createHash } from 'crypto' import { createHash } from 'crypto'
import * as libsignal from 'libsignal' import * as libsignal from 'libsignal'
@@ -155,11 +154,13 @@ function extractIdentityFromPkmsg(ciphertext: Uint8Array, logger?: ILogger): Uin
// Field 5 is identityKey // Field 5 is identityKey
if (fieldNumber === 5) { if (fieldNumber === 5) {
// Validate key length // Validate key length
// eslint-disable-next-line max-depth
if (length !== IDENTITY_KEY_LENGTH) { if (length !== IDENTITY_KEY_LENGTH) {
logger?.debug({ length, expected: IDENTITY_KEY_LENGTH }, 'Invalid identity key length') logger?.debug({ length, expected: IDENTITY_KEY_LENGTH }, 'Invalid identity key length')
return undefined return undefined
} }
// eslint-disable-next-line max-depth
if (offset + length > ciphertext.length) { if (offset + length > ciphertext.length) {
logger?.debug('Identity key extends beyond ciphertext bounds') logger?.debug('Identity key extends beyond ciphertext bounds')
return undefined return undefined
@@ -168,6 +169,7 @@ function extractIdentityFromPkmsg(ciphertext: Uint8Array, logger?: ILogger): Uin
const identityKey = ciphertext.slice(offset, offset + length) const identityKey = ciphertext.slice(offset, offset + length)
// Validate key type byte (must be 0x05 for Curve25519) // Validate key type byte (must be 0x05 for Curve25519)
// eslint-disable-next-line max-depth
if (identityKey[0] !== CURVE25519_KEY_TYPE) { if (identityKey[0] !== CURVE25519_KEY_TYPE) {
logger?.debug({ type: identityKey[0], expected: CURVE25519_KEY_TYPE }, 'Invalid identity key type') logger?.debug({ type: identityKey[0], expected: CURVE25519_KEY_TYPE }, 'Invalid identity key type')
return undefined return undefined
@@ -350,6 +352,7 @@ export function makeLibSignalRepository(
// Reset prekey circuit breaker since we identified the cause // Reset prekey circuit breaker since we identified the cause
// Reset regardless of state (could be open, half-open, or closed with accumulated failures) // Reset regardless of state (could be open, half-open, or closed with accumulated failures)
// eslint-disable-next-line max-depth
if (preKeyCircuitBreaker) { if (preKeyCircuitBreaker) {
preKeyCircuitBreaker.reset() preKeyCircuitBreaker.reset()
logger.debug({ jid }, 'Reset prekey circuit breaker after identity key change detection') logger.debug({ jid }, 'Reset prekey circuit breaker after identity key change detection')
-1
View File
@@ -1,4 +1,3 @@
/* eslint-disable max-depth */
import NodeCache from '@cacheable/node-cache' import NodeCache from '@cacheable/node-cache'
import { Boom } from '@hapi/boom' import { Boom } from '@hapi/boom'
import { LRUCache } from 'lru-cache' import { LRUCache } from 'lru-cache'
+4 -4
View File
@@ -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 NodeCache from '@cacheable/node-cache'
import { Boom } from '@hapi/boom' import { Boom } from '@hapi/boom'
import { proto } from '../../WAProto/index.js' import { proto } from '../../WAProto/index.js'
@@ -43,7 +42,7 @@ import {
import { logMessageSent } from '../Utils/baileys-logger' import { logMessageSent } from '../Utils/baileys-logger'
import { getUrlInfo } from '../Utils/link-preview' import { getUrlInfo } from '../Utils/link-preview'
import { makeKeyedMutex } from '../Utils/make-mutex' 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 { getMessageReportingToken, shouldIncludeReportingToken } from '../Utils/reporting-utils'
import { import {
areJidsSameUser, areJidsSameUser,
@@ -722,7 +721,8 @@ export const makeMessagesSocket = (config: SocketConfig) => {
* Returns the attributes for the interactive binary node based on message type * 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 * For native_flow: returns { v: '4', name: '' } or special attributes for payment flows
*/ */
const getButtonArgs = (message: proto.IMessage): BinaryNodeAttributes => { // eslint-disable-next-line @typescript-eslint/no-unused-vars
const _getButtonArgs = (message: proto.IMessage): BinaryNodeAttributes => {
const buttonType = getButtonType(message) const buttonType = getButtonType(message)
// For native_flow messages, check for special button types that need specific attributes // For native_flow messages, check for special button types that need specific attributes
@@ -880,6 +880,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
delete message.viewOnceMessage delete message.viewOnceMessage
message.listMessage = listMessage message.listMessage = listMessage
// Keep messageContextInfo if it was nested // Keep messageContextInfo if it was nested
// eslint-disable-next-line max-depth
if (!message.messageContextInfo && innerMsg?.messageContextInfo) { if (!message.messageContextInfo && innerMsg?.messageContextInfo) {
message.messageContextInfo = innerMsg.messageContextInfo message.messageContextInfo = innerMsg.messageContextInfo
} }
@@ -940,7 +941,6 @@ export const makeMessagesSocket = (config: SocketConfig) => {
const bytes = encodeNewsletterMessage(patched as proto.IMessage) const bytes = encodeNewsletterMessage(patched as proto.IMessage)
binaryNodeContent.push({ binaryNodeContent.push({
tag: 'plaintext', tag: 'plaintext',
// eslint-disable-next-line @typescript-eslint/no-floating-promises
attrs: {}, attrs: {},
content: bytes content: bytes
}) })
-2
View File
@@ -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 */ /** send a query, and wait for its response. auto-generates message ID if not provided */
const queryInternal = async (node: BinaryNode, timeoutMs?: number) => { const queryInternal = async (node: BinaryNode, timeoutMs?: number) => {
@@ -601,7 +600,6 @@ export const makeSocket = (config: SocketConfig) => {
const keyEnc = noise.processHandshake(handshake, creds.noiseKey) const keyEnc = noise.processHandshake(handshake, creds.noiseKey)
let node: proto.IClientPayload let node: proto.IClientPayload
// eslint-disable-next-line @typescript-eslint/no-floating-promises
if (!creds.me) { if (!creds.me) {
node = generateRegistrationNode(creds, config) node = generateRegistrationNode(creds, config)
logger.info({ node }, 'not logged in, attempting registration...') logger.info({ node }, 'not logged in, attempting registration...')
+2 -2
View File
@@ -310,7 +310,7 @@ export class BaileysEventStream extends EventEmitter {
// Process if not paused // Process if not paused
if (!this.paused && !this.isProcessing) { if (!this.paused && !this.isProcessing) {
this.processNext() void this.processNext()
} }
return true return true
@@ -598,7 +598,7 @@ export class BaileysEventStream extends EventEmitter {
resume(): void { resume(): void {
this.paused = false this.paused = false
this.emit('resume') this.emit('resume')
this.processNext() void this.processNext()
} }
/** /**
+3 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable max-depth, @typescript-eslint/no-unused-vars */
/** /**
* Smart Cache System * Smart Cache System
* *
@@ -469,7 +468,9 @@ export function cached<V>(options: CacheOptions<V> & { keyGenerator?: (...args:
/** /**
* Wrapper for function with cache * Wrapper for function with cache
*/ */
export function withCache<T extends (...args: unknown[]) => unknown>(
// eslint-disable-next-line prettier/prettier
export function withCache<T extends(...args: unknown[]) => unknown>(
fn: T, fn: T,
options: CacheOptions<ReturnType<T>> & { keyGenerator?: (...args: Parameters<T>) => string } = {} options: CacheOptions<ReturnType<T>> & { keyGenerator?: (...args: Parameters<T>) => string } = {}
): T { ): T {
+3 -4
View File
@@ -216,7 +216,7 @@ export const decodeSyncdMutations = async (
// if it's a syncdmutation, get the operation property // if it's a syncdmutation, get the operation property
// otherwise, if it's only a record -- it'll be a SET mutation // otherwise, if it's only a record -- it'll be a SET mutation
const operation = 'operation' in msgMutation ? msgMutation.operation : proto.SyncdMutation.SyncdOperation.SET const operation = 'operation' in msgMutation ? msgMutation.operation : proto.SyncdMutation.SyncdOperation.SET
// eslint-disable-next-line eqeqeq
if (operation == null) { if (operation == null) {
throw new Boom('Missing operation in mutation', { statusCode: 500 }) throw new Boom('Missing operation in mutation', { statusCode: 500 })
} }
@@ -343,7 +343,7 @@ export const decodeSyncdPatch = async (
} }
const msgVersion = msg.version?.version const msgVersion = msg.version?.version
// eslint-disable-next-line eqeqeq
if (msgVersion == null) { if (msgVersion == null) {
throw new Boom('Missing version in patch message', { statusCode: 500 }) throw new Boom('Missing version in patch message', { statusCode: 500 })
} }
@@ -446,7 +446,7 @@ export const decodeSyncdSnapshot = async (
const newState = newLTHashState() const newState = newLTHashState()
const snapshotVersion = snapshot.version?.version const snapshotVersion = snapshot.version?.version
// eslint-disable-next-line eqeqeq
if (snapshotVersion == null) { if (snapshotVersion == null) {
throw new Boom('Missing version in snapshot', { statusCode: 500 }) throw new Boom('Missing version in snapshot', { statusCode: 500 })
} }
@@ -540,7 +540,6 @@ export const decodePatches = async (
const ver = version?.version const ver = version?.version
if (ver == null) { if (ver == null) {
// eslint-disable-next-line eqeqeq
throw new Boom('Missing version in patch', { statusCode: 500 }) throw new Boom('Missing version in patch', { statusCode: 500 })
} }
+1 -1
View File
@@ -1,4 +1,3 @@
/* eslint-disable max-depth */
/** /**
* Circuit Breaker Pattern Implementation * Circuit Breaker Pattern Implementation
* *
@@ -625,6 +624,7 @@ export function circuitBreaker(options: Omit<CircuitBreakerOptions, 'name'> & {
* ) * )
* ``` * ```
*/ */
// eslint-disable-next-line space-before-function-paren
export function withCircuitBreaker<T extends (...args: unknown[]) => unknown>( export function withCircuitBreaker<T extends (...args: unknown[]) => unknown>(
fn: T, fn: T,
options: CircuitBreakerOptions options: CircuitBreakerOptions
+4 -1
View File
@@ -1,4 +1,3 @@
/* eslint-disable space-before-function-paren */
import { Boom } from '@hapi/boom' import { Boom } from '@hapi/boom'
import { proto } from '../../WAProto/index.js' import { proto } from '../../WAProto/index.js'
import type { WAMessage, WAMessageKey } from '../Types' import type { WAMessage, WAMessageKey } from '../Types'
@@ -412,6 +411,7 @@ export const decryptMessageNode = (
if (isCorrupted) { if (isCorrupted) {
// Corrupted session errors are expected and auto-recovered // Corrupted session errors are expected and auto-recovered
// Only log as ERROR if retries exhausted, otherwise WARN on first attempt // Only log as ERROR if retries exhausted, otherwise WARN on first attempt
// eslint-disable-next-line max-depth
if (isRetryExhausted) { if (isRetryExhausted) {
logger.error( logger.error(
errorContext, errorContext,
@@ -423,7 +423,9 @@ export const decryptMessageNode = (
} }
// Automatic cleanup of corrupted session (if enabled) // Automatic cleanup of corrupted session (if enabled)
// eslint-disable-next-line max-depth
if (autoCleanCorrupted) { if (autoCleanCorrupted) {
// eslint-disable-next-line max-depth
try { try {
const deletedCount = await cleanupCorruptedSession(decryptionJid, repository, logger) const deletedCount = await cleanupCorruptedSession(decryptionJid, repository, logger)
@@ -443,6 +445,7 @@ export const decryptMessageNode = (
} }
} else if (isSessionRecord) { } else if (isSessionRecord) {
// Session record errors are transient - retry should handle them // Session record errors are transient - retry should handle them
// eslint-disable-next-line max-depth
if (isRetryExhausted) { if (isRetryExhausted) {
logger.error(errorContext, `Failed to decrypt: No session record found after ${err.attempts} attempts`) logger.error(errorContext, `Failed to decrypt: No session record found after ${err.attempts} attempts`)
} else { } else {
+10
View File
@@ -357,12 +357,14 @@ const processMessage = async (
// This is how WhatsApp Web learns mappings for chats with non-contacts // This is how WhatsApp Web learns mappings for chats with non-contacts
if (data.lidPnMappings?.length) { if (data.lidPnMappings?.length) {
logger?.debug({ count: data.lidPnMappings.length }, 'processing LID-PN mappings from history sync') logger?.debug({ count: data.lidPnMappings.length }, 'processing LID-PN mappings from history sync')
// eslint-disable-next-line max-depth
try { try {
const result = await signalRepository.lidMapping.storeLIDPNMappings(data.lidPnMappings) const result = await signalRepository.lidMapping.storeLIDPNMappings(data.lidPnMappings)
logger?.debug( logger?.debug(
{ stored: result.stored, skipped: result.skipped, errors: result.errors }, { stored: result.stored, skipped: result.skipped, errors: result.errors },
'stored LID-PN mappings from history sync' 'stored LID-PN mappings from history sync'
) )
// eslint-disable-next-line max-depth
if (result.stored > 0) { if (result.stored > 0) {
logger?.info({ stored: result.stored }, 'fallback LID mappings are now available from history sync') logger?.info({ stored: result.stored }, 'fallback LID mappings are now available from history sync')
} }
@@ -371,6 +373,7 @@ const processMessage = async (
} }
// Emit all mappings at once for better performance // Emit all mappings at once for better performance
// eslint-disable-next-line max-depth
if (data.lidPnMappings.length > 0) { if (data.lidPnMappings.length > 0) {
ev.emit('lid-mapping.update', data.lidPnMappings) ev.emit('lid-mapping.update', data.lidPnMappings)
} }
@@ -462,6 +465,7 @@ const processMessage = async (
const { placeholderMessageResendResponse: retryResponse } = result const { placeholderMessageResendResponse: retryResponse } = result
//eslint-disable-next-line max-depth //eslint-disable-next-line max-depth
if (retryResponse) { if (retryResponse) {
// eslint-disable-next-line max-depth
if (!retryResponse.webMessageInfoBytes) { if (!retryResponse.webMessageInfoBytes) {
continue continue
} }
@@ -470,8 +474,10 @@ const processMessage = async (
// Merge cached metadata with decoded message // Merge cached metadata with decoded message
// This ensures we don't lose critical information like pushName and LID mappings // This ensures we don't lose critical information like pushName and LID mappings
// eslint-disable-next-line max-depth
if (cachedData && typeof cachedData === 'object') { if (cachedData && typeof cachedData === 'object') {
// Preserve pushName if not present in PDO response // Preserve pushName if not present in PDO response
// eslint-disable-next-line max-depth
if (cachedData.pushName && !webMessageInfo.pushName) { if (cachedData.pushName && !webMessageInfo.pushName) {
webMessageInfo.pushName = cachedData.pushName webMessageInfo.pushName = cachedData.pushName
logger?.debug({ msgId: webMessageInfo.key?.id }, 'CTWA: Restored pushName from cached metadata') logger?.debug({ msgId: webMessageInfo.key?.id }, 'CTWA: Restored pushName from cached metadata')
@@ -479,8 +485,10 @@ const processMessage = async (
// Preserve participantAlt (LID) if not present in PDO response // Preserve participantAlt (LID) if not present in PDO response
// This is critical for maintaining LID/PN mapping in groups // This is critical for maintaining LID/PN mapping in groups
// eslint-disable-next-line max-depth
if (cachedData.participantAlt && webMessageInfo.key) { if (cachedData.participantAlt && webMessageInfo.key) {
const msgKey = webMessageInfo.key as WAMessageKey const msgKey = webMessageInfo.key as WAMessageKey
// eslint-disable-next-line max-depth
if (!msgKey.participantAlt) { if (!msgKey.participantAlt) {
msgKey.participantAlt = cachedData.participantAlt msgKey.participantAlt = cachedData.participantAlt
logger?.debug( logger?.debug(
@@ -491,6 +499,7 @@ const processMessage = async (
} }
// Preserve original participant if not in PDO response // Preserve original participant if not in PDO response
// eslint-disable-next-line max-depth
if (cachedData.participant && webMessageInfo.key && !webMessageInfo.key.participant) { if (cachedData.participant && webMessageInfo.key && !webMessageInfo.key.participant) {
webMessageInfo.key.participant = cachedData.participant webMessageInfo.key.participant = cachedData.participant
logger?.debug({ msgId: webMessageInfo.key?.id }, 'CTWA: Restored participant from cached metadata') logger?.debug({ msgId: webMessageInfo.key?.id }, 'CTWA: Restored participant from cached metadata')
@@ -498,6 +507,7 @@ const processMessage = async (
// Only use cached timestamp if PDO response doesn't have one // Only use cached timestamp if PDO response doesn't have one
// PDO response timestamp is more authoritative if present // PDO response timestamp is more authoritative if present
// eslint-disable-next-line max-depth
if (!webMessageInfo.messageTimestamp && cachedData.messageTimestamp) { if (!webMessageInfo.messageTimestamp && cachedData.messageTimestamp) {
webMessageInfo.messageTimestamp = cachedData.messageTimestamp webMessageInfo.messageTimestamp = cachedData.messageTimestamp
} }
+4 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable max-depth, @typescript-eslint/no-unused-vars */
/** /**
* Prometheus Metrics Exposition - Enterprise Grade * Prometheus Metrics Exposition - Enterprise Grade
* *
@@ -100,6 +99,7 @@ export function getConfiguredPrefix(): string {
/** /**
* Check if a metric with the given name already exists in the custom registry * Check if a metric with the given name already exists in the custom registry
*/ */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function metricExists(name: string): boolean { function metricExists(name: string): boolean {
const fullName = getFullMetricName(name) const fullName = getFullMetricName(name)
try { try {
@@ -113,6 +113,7 @@ function metricExists(name: string): boolean {
/** /**
* Get an existing metric from the custom registry * Get an existing metric from the custom registry
*/ */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function getExistingMetric<T>(name: string): T | undefined { function getExistingMetric<T>(name: string): T | undefined {
const fullName = getFullMetricName(name) const fullName = getFullMetricName(name)
try { try {
@@ -1926,7 +1927,8 @@ export function updateBufferStatistics(stats: {
* Record a cache cleanup operation * Record a cache cleanup operation
* Used by event-buffer.ts when LRU cleanup is performed * Used by event-buffer.ts when LRU cleanup is performed
*/ */
export function recordCacheCleanup(removedCount: number): void { // eslint-disable-next-line @typescript-eslint/no-unused-vars
export function recordCacheCleanup(_removedCount: number): void {
try { try {
metrics.bufferCacheCleanup?.inc({}) metrics.bufferCacheCleanup?.inc({})
} catch { } catch {
+1 -1
View File
@@ -1,4 +1,3 @@
/* eslint-disable prefer-const */
/** /**
* Smart Retry Logic * Smart Retry Logic
* *
@@ -452,6 +451,7 @@ export function withRetry(options: RetryOptions = {}) {
/** /**
* Wrapper for function with retry * Wrapper for function with retry
*/ */
// eslint-disable-next-line space-before-function-paren
export function retryable<T extends (...args: unknown[]) => unknown>( export function retryable<T extends (...args: unknown[]) => unknown>(
fn: T, fn: T,
options: RetryOptions = {} options: RetryOptions = {}
+4 -2
View File
@@ -1,11 +1,10 @@
/* eslint-disable prefer-const, space-before-function-paren */
import { Boom } from '@hapi/boom' import { Boom } from '@hapi/boom'
import { createHash } from 'crypto' import { createHash } from 'crypto'
import { zipSync } from 'fflate' import { zipSync } from 'fflate'
import { promises as fs } from 'fs' import { promises as fs } from 'fs'
import { proto } from '../../WAProto/index.js' import { proto } from '../../WAProto/index.js'
import type { MediaType } from '../Defaults/index.js' import type { MediaType } from '../Defaults/index.js'
import type { Sticker, StickerPack, WAMediaUpload, WAMediaUploadFunction } from '../Types/Message.js' import type { StickerPack, WAMediaUpload, WAMediaUploadFunction } from '../Types/Message.js'
import { generateMessageIDV2 } from './generics.js' import { generateMessageIDV2 } from './generics.js'
import type { ILogger } from './logger.js' import type { ILogger } from './logger.js'
import { encryptedStream, getImageProcessingLibrary } from './messages-media.js' import { encryptedStream, getImageProcessingLibrary } from './messages-media.js'
@@ -466,6 +465,7 @@ export const prepareStickerPackMessage = async (
const buffer = await mediaToBuffer(sticker.data, `sticker ${i + 1}`) const buffer = await mediaToBuffer(sticker.data, `sticker ${i + 1}`)
// Converte para WebP // Converte para WebP
// eslint-disable-next-line prefer-const
let { webpBuffer, isAnimated } = await convertToWebP(buffer, logger) let { webpBuffer, isAnimated } = await convertToWebP(buffer, logger)
// ENHANCEMENT: Auto-compression if exceeds 1MB (try quality 70, then 50) // ENHANCEMENT: Auto-compression if exceeds 1MB (try quality 70, then 50)
@@ -485,6 +485,7 @@ export const prepareStickerPackMessage = async (
try { try {
const compressed70 = await lib.sharp.default(buffer).webp({ quality: 70 }).toBuffer() const compressed70 = await lib.sharp.default(buffer).webp({ quality: 70 }).toBuffer()
// eslint-disable-next-line max-depth
if (compressed70.length <= MAX_STICKER_SIZE) { if (compressed70.length <= MAX_STICKER_SIZE) {
webpBuffer = compressed70 webpBuffer = compressed70
logger?.info( logger?.info(
@@ -499,6 +500,7 @@ export const prepareStickerPackMessage = async (
// Try quality 50 // Try quality 50
const compressed50 = await lib.sharp.default(buffer).webp({ quality: 50 }).toBuffer() const compressed50 = await lib.sharp.default(buffer).webp({ quality: 50 }).toBuffer()
// eslint-disable-next-line max-depth
if (compressed50.length <= MAX_STICKER_SIZE) { if (compressed50.length <= MAX_STICKER_SIZE) {
webpBuffer = compressed50 webpBuffer = compressed50
logger?.info( logger?.info(
+1 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/** /**
* Structured Logging System for InfiniteAPI * Structured Logging System for InfiniteAPI
* *
@@ -321,7 +320,7 @@ class AsyncLogQueue {
enqueue(task: () => void): void { enqueue(task: () => void): void {
if (this.destroyed) return if (this.destroyed) return
this.queue.push(task) this.queue.push(task)
this.processNext() void this.processNext()
} }
private async processNext(): Promise<void> { private async processNext(): Promise<void> {
+2 -2
View File
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-floating-promises, space-before-function-paren */
/** /**
* Request Tracing Context * Request Tracing Context
* *
@@ -320,7 +319,7 @@ export function setSpanError(span: Span, error: Error): void {
span.attributes.error = true span.attributes.error = true
span.attributes.errorMessage = error.message span.attributes.errorMessage = error.message
span.attributes.errorName = error.name span.attributes.errorName = error.name
// eslint-disable-next-line @typescript-eslint/no-floating-promises
if (error.stack) { if (error.stack) {
span.attributes.errorStack = error.stack span.attributes.errorStack = error.stack
} }
@@ -382,6 +381,7 @@ export function traced(name?: string) {
/** /**
* Wrapper for tracing a function * Wrapper for tracing a function
*/ */
// eslint-disable-next-line space-before-function-paren
export function traceFunction<T extends (...args: unknown[]) => unknown>(name: string, fn: T): T { export function traceFunction<T extends (...args: unknown[]) => unknown>(name: string, fn: T): T {
return function (this: unknown, ...args: Parameters<T>): ReturnType<T> { return function (this: unknown, ...args: Parameters<T>): ReturnType<T> {
const span = startSpan({ name }) const span = startSpan({ name })
-1
View File
@@ -1,4 +1,3 @@
/* eslint-disable max-depth */
/** /**
* Unified Session Telemetry Implementation * Unified Session Telemetry Implementation
* *
@@ -29,7 +29,6 @@ describe('SessionActivityTracker', () => {
const tracker = makeSessionActivityTracker(mockKeys, logger, config) const tracker = makeSessionActivityTracker(mockKeys, logger, config)
const jid = '5511999999999@s.whatsapp.net' const jid = '5511999999999@s.whatsapp.net'
const beforeTime = Date.now()
tracker.recordActivity(jid) tracker.recordActivity(jid)
+2 -1
View File
@@ -304,7 +304,8 @@ describe('SessionCleanup', () => {
}) })
it('should handle null sessionActivityTracker gracefully', async () => { it('should handle null sessionActivityTracker gracefully', async () => {
const now = Date.now() // eslint-disable-next-line @typescript-eslint/no-unused-vars
const _ = Date.now()
// @ts-ignore // @ts-ignore
mockKeys.get.mockResolvedValue({ mockKeys.get.mockResolvedValue({
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/** /**
* Testes unitários para structured-logger.ts * Testes unitários para structured-logger.ts
*/ */
@@ -9,7 +8,6 @@ import {
createTimer, createTimer,
getDefaultLogger, getDefaultLogger,
LOG_LEVEL_VALUES, LOG_LEVEL_VALUES,
type LogLevel,
setDefaultLogger, setDefaultLogger,
StructuredLogger StructuredLogger
} from '../../Utils/structured-logger.js' } from '../../Utils/structured-logger.js'