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
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable max-depth, @typescript-eslint/no-unused-vars */
|
||||
/* @ts-ignore */
|
||||
import { createHash } from 'crypto'
|
||||
import * as libsignal from 'libsignal'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable max-depth */
|
||||
import NodeCache from '@cacheable/node-cache'
|
||||
import { Boom } from '@hapi/boom'
|
||||
import { LRUCache } from 'lru-cache'
|
||||
|
||||
@@ -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
|
||||
})
|
||||
|
||||
@@ -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...')
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable max-depth, @typescript-eslint/no-unused-vars */
|
||||
/**
|
||||
* Smart Cache System
|
||||
*
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable max-depth */
|
||||
/**
|
||||
* Circuit Breaker Pattern Implementation
|
||||
*
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable max-depth, @typescript-eslint/no-unused-vars */
|
||||
/**
|
||||
* Prometheus Metrics Exposition - Enterprise Grade
|
||||
*
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable prefer-const */
|
||||
/**
|
||||
* Smart Retry Logic
|
||||
*
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/**
|
||||
* Structured Logging System for InfiniteAPI
|
||||
*
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable max-depth */
|
||||
/**
|
||||
* Unified Session Telemetry Implementation
|
||||
*
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/**
|
||||
* Testes unitários para structured-logger.ts
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user