fixed all lint errors

This commit is contained in:
Boki 2025-06-23 18:14:43 -04:00
parent 519d24722e
commit 26d9b9ab3f
23 changed files with 63 additions and 43 deletions

View file

@ -5,6 +5,7 @@
import {
BaseHandler,
Disabled,
Handler,
Operation,
ScheduledOperation,
@ -13,6 +14,7 @@ import {
} from '@stock-bot/handlers';
@Handler('example')
@Disabled()
export class ExampleHandler extends BaseHandler {
constructor(services: IServiceContainer) {
super(services);
@ -86,7 +88,7 @@ export class ExampleHandler extends BaseHandler {
* Complex operation that still uses action file
*/
@Operation('process-batch')
async processBatch(input: any, context: ExecutionContext): Promise<unknown> {
async processBatch(input: any, _context: ExecutionContext): Promise<unknown> {
// For complex operations, still use action files
const { processBatch } = await import('./actions/batch.action');
return processBatch(this, input);

View file

@ -1,7 +1,7 @@
/**
* Proxy Check Operations - Checking proxy functionality
*/
import { OperationContext } from '@stock-bot/di';
import type { OperationContext } from '@stock-bot/di';
import { getLogger } from '@stock-bot/logger';
import type { ProxyInfo } from '@stock-bot/proxy';
import { fetch } from '@stock-bot/utils';
@ -13,7 +13,7 @@ import { PROXY_CONFIG } from '../shared/config';
export async function checkProxy(proxy: ProxyInfo): Promise<ProxyInfo> {
const ctx = {
logger: getLogger('proxy-check'),
resolve: <T>(_name: string) => {
resolve: (_name: string) => {
throw new Error(`Service container not available for proxy operations`);
},
} as any;
@ -99,7 +99,7 @@ async function updateProxyInCache(
isWorking: boolean,
ctx: OperationContext
): Promise<void> {
const _cacheKey = `${PROXY_CONFIG.CACHE_KEY}:${proxy.protocol}://${proxy.host}:${proxy.port}`;
// const _cacheKey = `${PROXY_CONFIG.CACHE_KEY}:${proxy.protocol}://${proxy.host}:${proxy.port}`;
try {
// For now, skip cache operations without service container
@ -147,7 +147,7 @@ async function updateProxyInCache(
updated.successRate = updated.total > 0 ? (updated.working / updated.total) * 100 : 0;
// Save to cache: reset TTL for working proxies, keep existing TTL for failed ones
const _cacheOptions = isWorking ? { ttl: PROXY_CONFIG.CACHE_TTL } : undefined;
// const _cacheOptions = isWorking ? { ttl: PROXY_CONFIG.CACHE_TTL } : undefined;
// Skip cache operations without service container
// TODO: Pass service container to operations

View file

@ -45,11 +45,11 @@ export async function createSingleSession(
handler: BaseHandler,
input: any
): Promise<{ sessionId: string; status: string; sessionType: string }> {
const { sessionId, sessionType } = input || {};
const sessionManager = QMSessionManager.getInstance();
const { sessionId: _sessionId, sessionType } = input || {};
const _sessionManager = QMSessionManager.getInstance();
// Get proxy from proxy service
const proxyString = handler.proxy.getProxy();
const _proxyString = handler.proxy.getProxy();
// const session = {
// proxy: proxyString || 'http://proxy:8080',

View file

@ -44,7 +44,7 @@ const app = new ServiceApplication(
},
{
// Lifecycle hooks if needed
onStarted: (port) => {
onStarted: (_port) => {
const logger = getLogger('data-ingestion');
logger.info('Data ingestion service startup initiated with ServiceApplication framework');
},

View file

@ -48,7 +48,7 @@ const app = new ServiceApplication(
const enhancedContainer = setupServiceContainer(config, container);
return enhancedContainer;
},
onStarted: (port) => {
onStarted: (_port) => {
const logger = getLogger('data-pipeline');
logger.info('Data pipeline service startup initiated with ServiceApplication framework');
},

View file

@ -49,7 +49,7 @@ const app = new ServiceApplication(
},
{
// Custom lifecycle hooks
onStarted: (port) => {
onStarted: (_port) => {
const logger = getLogger('web-api');
logger.info('Web API service startup initiated with ServiceApplication framework');
},

View file

@ -11,7 +11,6 @@ import type {
DatabaseStats,
SystemHealth,
ServiceMetrics,
MetricSnapshot,
ServiceStatus,
ProxyStats,
SystemOverview
@ -196,7 +195,7 @@ export class MonitoringService {
/**
* Get stats for a specific queue
*/
private async getQueueStatsForQueue(queue: any, queueName: string) {
private async getQueueStatsForQueue(queue: any, _queueName: string) {
// Check if it has the getStats method
if (queue.getStats && typeof queue.getStats === 'function') {
const stats = await queue.getStats();
@ -240,7 +239,7 @@ export class MonitoringService {
try {
const result = await queue[methodName]();
return Array.isArray(result) ? result.length : (result || 0);
} catch (e) {
} catch (_e) {
// Continue to next method
}
}
@ -260,7 +259,7 @@ export class MonitoringService {
if (queue.getPausedCount && typeof queue.getPausedCount === 'function') {
return await queue.getPausedCount();
}
} catch (e) {
} catch (_e) {
// Ignore
}
return 0;
@ -269,7 +268,7 @@ export class MonitoringService {
/**
* Get worker info for a queue
*/
private getWorkerInfo(queue: any, queueManager: any, queueName: string) {
private getWorkerInfo(queue: any, queueManager: any, _queueName: string) {
try {
// Check queue itself for worker info
if (queue.workers && Array.isArray(queue.workers)) {
@ -296,7 +295,7 @@ export class MonitoringService {
concurrency: 1,
};
}
} catch (e) {
} catch (_e) {
// Ignore
}
@ -313,7 +312,7 @@ export class MonitoringService {
if (this.container.postgres) {
try {
const startTime = Date.now();
const result = await this.container.postgres.query('SELECT 1');
const _result = await this.container.postgres.query('SELECT 1');
const latency = Date.now() - startTime;
// Get pool stats
@ -540,7 +539,7 @@ export class MonitoringService {
const response = await fetch(`http://localhost:${service.port}${service.path}`, {
signal: AbortSignal.timeout(5000), // 5 second timeout
});
const latency = Date.now() - startTime;
const _latency = Date.now() - startTime;
if (response.ok) {
const data = await response.json();
@ -704,13 +703,13 @@ export class MonitoringService {
const lines = meminfo.split('\n');
let memAvailable = 0;
let memTotal = 0;
let _memTotal = 0;
for (const line of lines) {
if (line.startsWith('MemAvailable:')) {
memAvailable = parseInt(line.split(/\s+/)[1], 10) * 1024; // Convert from KB to bytes
} else if (line.startsWith('MemTotal:')) {
memTotal = parseInt(line.split(/\s+/)[1], 10) * 1024;
_memTotal = parseInt(line.split(/\s+/)[1], 10) * 1024;
}
}