fixed more lint issues

This commit is contained in:
Boki 2025-06-20 08:42:58 -04:00
parent 48503ce8d1
commit cc014de397
11 changed files with 42 additions and 11 deletions

View file

@ -53,6 +53,8 @@ export function AddSourceDialog({
setCode(''); setCode('');
setAliases(''); setAliases('');
} catch (_error) { } catch (_error) {
// TODO: Implement proper error handling/toast notification
// eslint-disable-next-line no-console
console.error('Error adding source:', _error); console.error('Error adding source:', _error);
} finally { } finally {
setLoading(false); setLoading(false);

View file

@ -3,7 +3,12 @@ import ReactDOM from 'react-dom/client';
import { App } from './app'; import { App } from './app';
import './index.css'; import './index.css';
ReactDOM.createRoot(document.getElementById('root')!).render( const rootElement = document.getElementById('root');
if (!rootElement) {
throw new Error('Root element not found');
}
ReactDOM.createRoot(rootElement).render(
<React.StrictMode> <React.StrictMode>
<App /> <App />
</React.StrictMode> </React.StrictMode>

View file

@ -42,7 +42,11 @@ export class RedisConnectionManager {
RedisConnectionManager.sharedConnections.set(name, connection); RedisConnectionManager.sharedConnections.set(name, connection);
this.logger.info(`Created shared Redis connection: ${name}`); this.logger.info(`Created shared Redis connection: ${name}`);
} }
return RedisConnectionManager.sharedConnections.get(name)!; const connection = RedisConnectionManager.sharedConnections.get(name);
if (!connection) {
throw new Error(`Expected connection ${name} to exist in shared connections`);
}
return connection;
} else { } else {
// Create unique connection per instance // Create unique connection per instance
const uniqueName = `${name}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; const uniqueName = `${name}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
@ -113,7 +117,7 @@ export class RedisConnectionManager {
try { try {
await connection.quit(); await connection.quit();
} catch (error) { } catch (error) {
this.logger.warn('Error closing Redis connection:', error); this.logger.warn('Error closing Redis connection:', error as Error);
} }
} }

View file

@ -21,7 +21,11 @@ export function createCache(options: CacheOptions): CacheProvider {
const cacheKey = `${defaultOptions.keyPrefix}-${defaultOptions.ttl}`; const cacheKey = `${defaultOptions.keyPrefix}-${defaultOptions.ttl}`;
if (cacheInstances.has(cacheKey)) { if (cacheInstances.has(cacheKey)) {
return cacheInstances.get(cacheKey)!; const cachedInstance = cacheInstances.get(cacheKey);
if (!cachedInstance) {
throw new Error(`Expected cache instance ${cacheKey} to exist`);
}
return cachedInstance;
} }
const cache = new RedisCache(defaultOptions); const cache = new RedisCache(defaultOptions);

View file

@ -1,4 +1,5 @@
#!/usr/bin/env bun #!/usr/bin/env bun
/* eslint-disable no-console */
import { parseArgs } from 'util'; import { parseArgs } from 'util';
import { join } from 'path'; import { join } from 'path';
import { ConfigManager } from './config-manager'; import { ConfigManager } from './config-manager';

View file

@ -84,7 +84,13 @@ export class EnvLoader implements ConfigLoader {
} }
private setNestedValue(obj: Record<string, any>, path: string[], value: unknown): boolean { private setNestedValue(obj: Record<string, any>, path: string[], value: unknown): boolean {
const lastKey = path.pop()!; if (path.length === 0) {
return false; // Cannot set value on empty path
}
const lastKey = path.pop();
if (!lastKey) {
return false; // This should never happen due to length check above
}
try { try {
const target = path.reduce((acc, key) => { const target = path.reduce((acc, key) => {
@ -175,6 +181,7 @@ export class EnvLoader implements ConfigLoader {
} catch (error: any) { } catch (error: any) {
// File not found is not an error (env files are optional) // File not found is not an error (env files are optional)
if (error.code !== 'ENOENT') { if (error.code !== 'ENOENT') {
// eslint-disable-next-line no-console
console.warn(`Warning: Could not load env file ${filePath}:`, error.message); console.warn(`Warning: Could not load env file ${filePath}:`, error.message);
} }
} }

View file

@ -4,7 +4,7 @@ export interface EventBusMessage<T = any> {
source: string; source: string;
timestamp: number; timestamp: number;
data: T; data: T;
metadata?: Record<string, any>; metadata?: Record<string, unknown>;
} }
export interface EventHandler<T = any> { export interface EventHandler<T = any> {

View file

@ -30,7 +30,7 @@ export interface RequestConfig {
method?: HttpMethod; method?: HttpMethod;
url: string; url: string;
headers?: Record<string, string>; headers?: Record<string, string>;
data?: any; // Changed from 'body' to 'data' for consistency data?: unknown; // Changed from 'body' to 'data' for consistency
timeout?: number; timeout?: number;
proxy?: ProxyInfo | string; // Proxy can be a ProxyInfo object or a URL string proxy?: ProxyInfo | string; // Proxy can be a ProxyInfo object or a URL string
} }

View file

@ -31,6 +31,7 @@ export function setLoggerConfig(config: LoggerConfig): void {
globalConfig = { ...globalConfig, ...config }; globalConfig = { ...globalConfig, ...config };
// Clear cache to force recreation with new config // Clear cache to force recreation with new config
loggerCache.clear(); loggerCache.clear();
// eslint-disable-next-line no-console
console.log('Logger config updated:', globalConfig.logLevel); console.log('Logger config updated:', globalConfig.logLevel);
} }
/** /**
@ -118,7 +119,11 @@ function getPinoLogger(serviceName: string, config: LoggerConfig = globalConfig)
loggerCache.set(cacheKey, pino(loggerOptions)); loggerCache.set(cacheKey, pino(loggerOptions));
} }
return loggerCache.get(cacheKey)!; const logger = loggerCache.get(cacheKey);
if (!logger) {
throw new Error(`Expected logger ${cacheKey} to exist in cache`);
}
return logger;
} }
/** /**
@ -303,6 +308,7 @@ export async function shutdownLoggers(): Promise<void> {
if (typeof logger.flush === 'function') { if (typeof logger.flush === 'function') {
logger.flush(err => { logger.flush(err => {
if (err) { if (err) {
// eslint-disable-next-line no-console
console.error('Logger flush error:', err); console.error('Logger flush error:', err);
} }
resolve(); resolve();
@ -315,8 +321,10 @@ export async function shutdownLoggers(): Promise<void> {
try { try {
await Promise.allSettled(flushPromises); await Promise.allSettled(flushPromises);
// eslint-disable-next-line no-console
console.log('All loggers flushed successfully'); console.log('All loggers flushed successfully');
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console
console.error('Logger flush failed:', error); console.error('Logger flush failed:', error);
} finally { } finally {
loggerCache.clear(); loggerCache.clear();

View file

@ -76,7 +76,7 @@ export interface DocumentBase {
created_at: Date; created_at: Date;
updated_at: Date; updated_at: Date;
source: string; source: string;
metadata?: Record<string, any>; metadata?: Record<string, unknown>;
} }
/** /**
@ -150,7 +150,7 @@ export interface SecFiling extends DocumentBase {
period_end_date: Date; period_end_date: Date;
url: string; url: string;
content: string; content: string;
extracted_data?: Record<string, any>; extracted_data?: Record<string, unknown>;
financial_statements?: Array<{ financial_statements?: Array<{
statement_type: string; statement_type: string;
data: Record<string, number>; data: Record<string, number>;

View file

@ -77,7 +77,7 @@ export class QuestDBClient {
return; return;
} catch (error) { } catch (error) {
lastError = error as Error; lastError = error as Error;
this.logger.warn(`QuestDB connection attempt ${attempt} failed:`, error); this.logger.warn(`QuestDB connection attempt ${attempt} failed:`, error as Error);
if (this.pgPool) { if (this.pgPool) {
await this.pgPool.end(); await this.pgPool.end();