more lint fixes

This commit is contained in:
Boki 2025-06-20 09:10:57 -04:00
parent 3e545cdaa9
commit 67c073e4f2
7 changed files with 29 additions and 15 deletions

View file

@ -98,11 +98,11 @@ export class ConfigManager<T = Record<string, unknown>> {
getValue<R = unknown>(path: string): R { getValue<R = unknown>(path: string): R {
const config = this.get(); const config = this.get();
const keys = path.split('.'); const keys = path.split('.');
let value: any = config; let value: unknown = config;
for (const key of keys) { for (const key of keys) {
if (value && typeof value === 'object' && key in value) { if (value && typeof value === 'object' && key in value) {
value = value[key]; value = (value as Record<string, unknown>)[key];
} else { } else {
throw new ConfigError(`Configuration key not found: ${path}`); throw new ConfigError(`Configuration key not found: ${path}`);
} }

View file

@ -110,7 +110,7 @@ export function getProviderConfig(provider: string) {
if (!providers || !(provider in providers)) { if (!providers || !(provider in providers)) {
throw new Error(`Provider configuration not found: ${provider}`); throw new Error(`Provider configuration not found: ${provider}`);
} }
return (providers as any)[provider]; return (providers as Record<string, unknown>)[provider];
} }
// Export environment helpers // Export environment helpers

View file

@ -43,7 +43,7 @@ export class FileLoader implements ConfigLoader {
try { try {
const content = await readFile(filepath, 'utf-8'); const content = await readFile(filepath, 'utf-8');
return JSON.parse(content); return JSON.parse(content);
} catch (error: any) { } catch (error: unknown) {
// File not found is not an error (configs are optional) // File not found is not an error (configs are optional)
if (error.code === 'ENOENT') { if (error.code === 'ENOENT') {
return null; return null;

View file

@ -49,7 +49,7 @@ export class PostgreSQLClient {
let lastError: Error | null = null; let lastError: Error | null = null;
for (let attempt = 1; attempt <= this.options.retryAttempts!; attempt++) { for (let attempt = 1; attempt <= (this.options.retryAttempts ?? 3); attempt++) {
try { try {
this.logger.info( this.logger.info(
`Connecting to PostgreSQL (attempt ${attempt}/${this.options.retryAttempts})...` `Connecting to PostgreSQL (attempt ${attempt}/${this.options.retryAttempts})...`
@ -81,8 +81,8 @@ export class PostgreSQLClient {
this.pool = null; this.pool = null;
} }
if (attempt < this.options.retryAttempts!) { if (attempt < (this.options.retryAttempts ?? 3)) {
await this.delay(this.options.retryDelay! * attempt); await this.delay((this.options.retryDelay ?? 1000) * attempt);
} }
} }
} }

View file

@ -68,7 +68,10 @@ export class PostgreSQLHealthMonitor {
if (!this.lastHealthCheck) { if (!this.lastHealthCheck) {
await this.performHealthCheck(); await this.performHealthCheck();
} }
return this.lastHealthCheck!; if (!this.lastHealthCheck) {
throw new Error('Health check failed to produce results');
}
return this.lastHealthCheck;
} }
/** /**

View file

@ -52,7 +52,7 @@ export class QuestDBClient {
let lastError: Error | null = null; let lastError: Error | null = null;
for (let attempt = 1; attempt <= this.options.retryAttempts!; attempt++) { for (let attempt = 1; attempt <= (this.options.retryAttempts ?? 3); attempt++) {
try { try {
this.logger.info( this.logger.info(
`Connecting to QuestDB (attempt ${attempt}/${this.options.retryAttempts})...` `Connecting to QuestDB (attempt ${attempt}/${this.options.retryAttempts})...`
@ -84,8 +84,8 @@ export class QuestDBClient {
this.pgPool = null; this.pgPool = null;
} }
if (attempt < this.options.retryAttempts!) { if (attempt < (this.options.retryAttempts ?? 3)) {
await this.delay(this.options.retryDelay! * attempt); await this.delay((this.options.retryDelay ?? 1000) * attempt);
} }
} }
} }

View file

@ -35,7 +35,9 @@ export class QueueManager {
if (config.rateLimitRules && config.rateLimitRules.length > 0) { if (config.rateLimitRules && config.rateLimitRules.length > 0) {
this.rateLimiter = new QueueRateLimiter(this.redisConnection); this.rateLimiter = new QueueRateLimiter(this.redisConnection);
config.rateLimitRules.forEach(rule => { config.rateLimitRules.forEach(rule => {
this.rateLimiter!.addRule(rule); if (this.rateLimiter) {
this.rateLimiter.addRule(rule);
}
}); });
} }
@ -113,7 +115,10 @@ export class QueueManager {
getQueue(queueName: string, options: QueueOptions = {}): Queue { getQueue(queueName: string, options: QueueOptions = {}): Queue {
// Return existing queue if it exists // Return existing queue if it exists
if (this.queues.has(queueName)) { if (this.queues.has(queueName)) {
return this.queues.get(queueName)!; const existingQueue = this.queues.get(queueName);
if (existingQueue) {
return existingQueue;
}
} }
// Create new queue with merged options // Create new queue with merged options
@ -147,7 +152,9 @@ export class QueueManager {
mergedOptions.rateLimitRules.forEach(rule => { mergedOptions.rateLimitRules.forEach(rule => {
// Ensure queue name is set for queue-specific rules // Ensure queue name is set for queue-specific rules
const ruleWithQueue = { ...rule, queueName }; const ruleWithQueue = { ...rule, queueName };
this.rateLimiter!.addRule(ruleWithQueue); if (this.rateLimiter) {
this.rateLimiter.addRule(ruleWithQueue);
}
}); });
} }
@ -188,7 +195,11 @@ export class QueueManager {
this.caches.set(queueName, cacheProvider); this.caches.set(queueName, cacheProvider);
logger.trace('Cache created for queue', { queueName }); logger.trace('Cache created for queue', { queueName });
} }
return this.caches.get(queueName)!; const cache = this.caches.get(queueName);
if (!cache) {
throw new Error(`Expected cache for queue ${queueName} to exist`);
}
return cache;
} }
/** /**