diff --git a/apps/web-app/src/features/exchanges/components/AddSourceDialog.tsx b/apps/web-app/src/features/exchanges/components/AddSourceDialog.tsx
index 4a5b0cd..bc44c1b 100644
--- a/apps/web-app/src/features/exchanges/components/AddSourceDialog.tsx
+++ b/apps/web-app/src/features/exchanges/components/AddSourceDialog.tsx
@@ -53,6 +53,8 @@ export function AddSourceDialog({
setCode('');
setAliases('');
} catch (_error) {
+ // TODO: Implement proper error handling/toast notification
+ // eslint-disable-next-line no-console
console.error('Error adding source:', _error);
} finally {
setLoading(false);
diff --git a/apps/web-app/src/main.tsx b/apps/web-app/src/main.tsx
index 26e5f1b..9e97c8d 100644
--- a/apps/web-app/src/main.tsx
+++ b/apps/web-app/src/main.tsx
@@ -3,7 +3,12 @@ import ReactDOM from 'react-dom/client';
import { App } from './app';
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(
diff --git a/libs/cache/src/connection-manager.ts b/libs/cache/src/connection-manager.ts
index d70203b..d0d361e 100644
--- a/libs/cache/src/connection-manager.ts
+++ b/libs/cache/src/connection-manager.ts
@@ -42,7 +42,11 @@ export class RedisConnectionManager {
RedisConnectionManager.sharedConnections.set(name, connection);
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 {
// Create unique connection per instance
const uniqueName = `${name}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
@@ -113,7 +117,7 @@ export class RedisConnectionManager {
try {
await connection.quit();
} catch (error) {
- this.logger.warn('Error closing Redis connection:', error);
+ this.logger.warn('Error closing Redis connection:', error as Error);
}
}
diff --git a/libs/cache/src/index.ts b/libs/cache/src/index.ts
index 88efd1e..d11247b 100644
--- a/libs/cache/src/index.ts
+++ b/libs/cache/src/index.ts
@@ -21,7 +21,11 @@ export function createCache(options: CacheOptions): CacheProvider {
const cacheKey = `${defaultOptions.keyPrefix}-${defaultOptions.ttl}`;
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);
diff --git a/libs/config/src/cli.ts b/libs/config/src/cli.ts
index 029f122..b0fe42b 100644
--- a/libs/config/src/cli.ts
+++ b/libs/config/src/cli.ts
@@ -1,4 +1,5 @@
#!/usr/bin/env bun
+/* eslint-disable no-console */
import { parseArgs } from 'util';
import { join } from 'path';
import { ConfigManager } from './config-manager';
diff --git a/libs/config/src/loaders/env.loader.ts b/libs/config/src/loaders/env.loader.ts
index 984ea7c..9a47343 100644
--- a/libs/config/src/loaders/env.loader.ts
+++ b/libs/config/src/loaders/env.loader.ts
@@ -84,7 +84,13 @@ export class EnvLoader implements ConfigLoader {
}
private setNestedValue(obj: Record, 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 {
const target = path.reduce((acc, key) => {
@@ -175,6 +181,7 @@ export class EnvLoader implements ConfigLoader {
} catch (error: any) {
// File not found is not an error (env files are optional)
if (error.code !== 'ENOENT') {
+ // eslint-disable-next-line no-console
console.warn(`Warning: Could not load env file ${filePath}:`, error.message);
}
}
diff --git a/libs/event-bus/src/types.ts b/libs/event-bus/src/types.ts
index c835a1d..d07d569 100644
--- a/libs/event-bus/src/types.ts
+++ b/libs/event-bus/src/types.ts
@@ -4,7 +4,7 @@ export interface EventBusMessage {
source: string;
timestamp: number;
data: T;
- metadata?: Record;
+ metadata?: Record;
}
export interface EventHandler {
diff --git a/libs/http/src/types.ts b/libs/http/src/types.ts
index 330e05d..30f2e09 100644
--- a/libs/http/src/types.ts
+++ b/libs/http/src/types.ts
@@ -30,7 +30,7 @@ export interface RequestConfig {
method?: HttpMethod;
url: string;
headers?: Record;
- data?: any; // Changed from 'body' to 'data' for consistency
+ data?: unknown; // Changed from 'body' to 'data' for consistency
timeout?: number;
proxy?: ProxyInfo | string; // Proxy can be a ProxyInfo object or a URL string
}
diff --git a/libs/logger/src/logger.ts b/libs/logger/src/logger.ts
index aabd973..e14c87f 100644
--- a/libs/logger/src/logger.ts
+++ b/libs/logger/src/logger.ts
@@ -31,6 +31,7 @@ export function setLoggerConfig(config: LoggerConfig): void {
globalConfig = { ...globalConfig, ...config };
// Clear cache to force recreation with new config
loggerCache.clear();
+ // eslint-disable-next-line no-console
console.log('Logger config updated:', globalConfig.logLevel);
}
/**
@@ -118,7 +119,11 @@ function getPinoLogger(serviceName: string, config: LoggerConfig = globalConfig)
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 {
if (typeof logger.flush === 'function') {
logger.flush(err => {
if (err) {
+ // eslint-disable-next-line no-console
console.error('Logger flush error:', err);
}
resolve();
@@ -315,8 +321,10 @@ export async function shutdownLoggers(): Promise {
try {
await Promise.allSettled(flushPromises);
+ // eslint-disable-next-line no-console
console.log('All loggers flushed successfully');
} catch (error) {
+ // eslint-disable-next-line no-console
console.error('Logger flush failed:', error);
} finally {
loggerCache.clear();
diff --git a/libs/mongodb-client/src/types.ts b/libs/mongodb-client/src/types.ts
index 4680f10..17dd445 100644
--- a/libs/mongodb-client/src/types.ts
+++ b/libs/mongodb-client/src/types.ts
@@ -76,7 +76,7 @@ export interface DocumentBase {
created_at: Date;
updated_at: Date;
source: string;
- metadata?: Record;
+ metadata?: Record;
}
/**
@@ -150,7 +150,7 @@ export interface SecFiling extends DocumentBase {
period_end_date: Date;
url: string;
content: string;
- extracted_data?: Record;
+ extracted_data?: Record;
financial_statements?: Array<{
statement_type: string;
data: Record;
diff --git a/libs/questdb-client/src/client.ts b/libs/questdb-client/src/client.ts
index aeac394..2049330 100644
--- a/libs/questdb-client/src/client.ts
+++ b/libs/questdb-client/src/client.ts
@@ -77,7 +77,7 @@ export class QuestDBClient {
return;
} catch (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) {
await this.pgPool.end();