lint fixes
This commit is contained in:
parent
1f190b1068
commit
c1d04723e1
17 changed files with 34 additions and 27 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun --watch src/index.ts",
|
"dev": "bun --watch src/index.ts",
|
||||||
"build": "bun build src/index.ts --outdir dist --target node",
|
"build": "bun build src/index.ts --outdir dist --target node --external chromium-bidi --external electron --external playwright --external playwright-core",
|
||||||
"start": "bun dist/index.js",
|
"start": "bun dist/index.js",
|
||||||
"test": "bun test",
|
"test": "bun test",
|
||||||
"clean": "rm -rf dist"
|
"clean": "rm -rf dist"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import { initializeServiceConfig } from '@stock-bot/config';
|
||||||
import { getLogger, setLoggerConfig, shutdownLoggers } from '@stock-bot/logger';
|
import { getLogger, setLoggerConfig, shutdownLoggers } from '@stock-bot/logger';
|
||||||
import { connectMongoDB } from '@stock-bot/mongodb-client';
|
import { connectMongoDB } from '@stock-bot/mongodb-client';
|
||||||
import { connectPostgreSQL } from '@stock-bot/postgres-client';
|
import { connectPostgreSQL } from '@stock-bot/postgres-client';
|
||||||
import { QueueManager, handlerRegistry, type QueueManagerConfig } from '@stock-bot/queue';
|
import { QueueManager, type QueueManagerConfig } from '@stock-bot/queue';
|
||||||
import { Shutdown } from '@stock-bot/shutdown';
|
import { Shutdown } from '@stock-bot/shutdown';
|
||||||
// Local imports
|
// Local imports
|
||||||
import { exchangeRoutes, healthRoutes, queueRoutes } from './routes';
|
import { exchangeRoutes, healthRoutes, queueRoutes } from './routes';
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ export async function fetchSession(): Promise<Record<string, string> | undefined
|
||||||
resolve(event.headers);
|
resolve(event.headers);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
resolve(undefined);
|
resolve(undefined);
|
||||||
console.log('📊 Raw Summary Response:', (e as Error).message);
|
logger.debug('Raw Summary Response error', { error: (e as Error).message });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun --watch src/index.ts",
|
"dev": "bun --watch src/index.ts",
|
||||||
"build": "bun build src/index.ts --outdir dist --target node",
|
"build": "bun build src/index.ts --outdir dist --target node --external chromium-bidi --external electron --external playwright --external playwright-core",
|
||||||
"start": "bun dist/index.js",
|
"start": "bun dist/index.js",
|
||||||
"test": "bun test",
|
"test": "bun test",
|
||||||
"clean": "rm -rf dist"
|
"clean": "rm -rf dist"
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun --watch src/index.ts",
|
"dev": "bun --watch src/index.ts",
|
||||||
"build": "bun build src/index.ts --outdir dist --target node",
|
"build": "bun build src/index.ts --outdir dist --target node --external chromium-bidi --external electron --external playwright --external playwright-core",
|
||||||
"start": "bun dist/index.js",
|
"start": "bun dist/index.js",
|
||||||
"test": "bun test",
|
"test": "bun test",
|
||||||
"clean": "rm -rf dist"
|
"clean": "rm -rf dist"
|
||||||
|
|
|
||||||
|
|
@ -635,7 +635,7 @@ export function PortfolioTable() {
|
||||||
<DataTable
|
<DataTable
|
||||||
data={data}
|
data={data}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
onRowClick={row => console.log('Clicked:', row.symbol)}
|
onRowClick={_row => {/* Handle row click */}}
|
||||||
className="border border-border rounded-lg"
|
className="border border-border rounded-lg"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ export function AddProviderMappingDialog({
|
||||||
try {
|
try {
|
||||||
const providersData = await fetchProviders();
|
const providersData = await fetchProviders();
|
||||||
setProviders(providersData);
|
setProviders(providersData);
|
||||||
} catch (error) {
|
} catch {
|
||||||
// Error loading providers - could add toast notification here
|
// Error loading providers - could add toast notification here
|
||||||
} finally {
|
} finally {
|
||||||
setProvidersLoading(false);
|
setProvidersLoading(false);
|
||||||
|
|
@ -62,7 +62,7 @@ export function AddProviderMappingDialog({
|
||||||
try {
|
try {
|
||||||
const exchangesData = await fetchUnmappedProviderExchanges(provider);
|
const exchangesData = await fetchUnmappedProviderExchanges(provider);
|
||||||
setUnmappedExchanges(exchangesData);
|
setUnmappedExchanges(exchangesData);
|
||||||
} catch (error) {
|
} catch {
|
||||||
// Error loading unmapped exchanges - could add toast notification here
|
// Error loading unmapped exchanges - could add toast notification here
|
||||||
} finally {
|
} finally {
|
||||||
setExchangesLoading(false);
|
setExchangesLoading(false);
|
||||||
|
|
@ -102,7 +102,7 @@ export function AddProviderMappingDialog({
|
||||||
};
|
};
|
||||||
|
|
||||||
await onCreateMapping(request);
|
await onCreateMapping(request);
|
||||||
} catch (error) {
|
} catch {
|
||||||
// Error creating provider mapping - could add toast notification here
|
// Error creating provider mapping - could add toast notification here
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* without requiring an actual QuestDB instance.
|
* without requiring an actual QuestDB instance.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { afterEach, beforeEach, describe, expect, it, mock, spyOn } from 'bun:test';
|
import { afterEach, beforeEach, describe, expect, it, mock } from 'bun:test';
|
||||||
import {
|
import {
|
||||||
createQuestDBClient,
|
createQuestDBClient,
|
||||||
QuestDBClient,
|
QuestDBClient,
|
||||||
|
|
@ -33,7 +33,7 @@ describe('QuestDB Client Integration', () => {
|
||||||
if (client && client.connected) {
|
if (client && client.connected) {
|
||||||
try {
|
try {
|
||||||
await client.disconnect();
|
await client.disconnect();
|
||||||
} catch (error) {
|
} catch {
|
||||||
// Ignore cleanup errors in tests
|
// Ignore cleanup errors in tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* Provides utilities and mocks for testing database operations.
|
* Provides utilities and mocks for testing database operations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { beforeAll, beforeEach, mock, spyOn } from 'bun:test';
|
import { beforeAll, beforeEach, mock } from 'bun:test';
|
||||||
import { newDb } from 'pg-mem';
|
import { newDb } from 'pg-mem';
|
||||||
|
|
||||||
// Mock PostgreSQL database for unit tests
|
// Mock PostgreSQL database for unit tests
|
||||||
|
|
@ -124,7 +124,7 @@ beforeEach(() => {
|
||||||
pgMem.public.none('DROP TABLE IF EXISTS indicators CASCADE');
|
pgMem.public.none('DROP TABLE IF EXISTS indicators CASCADE');
|
||||||
pgMem.public.none('DROP TABLE IF EXISTS performance CASCADE');
|
pgMem.public.none('DROP TABLE IF EXISTS performance CASCADE');
|
||||||
pgMem.public.none('DROP TABLE IF EXISTS risk_metrics CASCADE');
|
pgMem.public.none('DROP TABLE IF EXISTS risk_metrics CASCADE');
|
||||||
} catch (error) {
|
} catch {
|
||||||
// Tables might not exist, ignore errors
|
// Tables might not exist, ignore errors
|
||||||
}
|
}
|
||||||
} // Reset fetch mock
|
} // Reset fetch mock
|
||||||
|
|
@ -248,7 +248,7 @@ export const questdbTestHelpers = {
|
||||||
*/
|
*/
|
||||||
validateQuestDBQuery: (query: string): boolean => {
|
validateQuestDBQuery: (query: string): boolean => {
|
||||||
// Basic validation for QuestDB-specific syntax
|
// Basic validation for QuestDB-specific syntax
|
||||||
const questdbKeywords = ['SAMPLE BY', 'LATEST BY', 'ASOF JOIN', 'SPLICE JOIN', 'LT JOIN'];
|
const _questdbKeywords = ['SAMPLE BY', 'LATEST BY', 'ASOF JOIN', 'SPLICE JOIN', 'LT JOIN'];
|
||||||
|
|
||||||
// Check for valid SQL structure
|
// Check for valid SQL structure
|
||||||
const hasSelect = /SELECT\s+/i.test(query);
|
const hasSelect = /SELECT\s+/i.test(query);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ describe('Batch Processor', () => {
|
||||||
'generic': async (payload) => {
|
'generic': async (payload) => {
|
||||||
return { processed: true, data: payload };
|
return { processed: true, data: payload };
|
||||||
},
|
},
|
||||||
'process-batch-items': async (batchData) => {
|
'process-batch-items': async (_batchData) => {
|
||||||
// This is called by the batch processor internally
|
// This is called by the batch processor internally
|
||||||
return { batchProcessed: true };
|
return { batchProcessed: true };
|
||||||
},
|
},
|
||||||
|
|
@ -87,7 +87,7 @@ describe('Batch Processor', () => {
|
||||||
await queue.getBullQueue().clean(0, 1000, 'active');
|
await queue.getBullQueue().clean(0, 1000, 'active');
|
||||||
await queue.getBullQueue().clean(0, 1000, 'waiting');
|
await queue.getBullQueue().clean(0, 1000, 'waiting');
|
||||||
await queue.getBullQueue().clean(0, 1000, 'delayed');
|
await queue.getBullQueue().clean(0, 1000, 'delayed');
|
||||||
} catch (error) {
|
} catch {
|
||||||
// Ignore cleanup errors
|
// Ignore cleanup errors
|
||||||
}
|
}
|
||||||
await queue.close();
|
await queue.close();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
|
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
|
||||||
import { Queue, Worker, Job } from 'bullmq';
|
import { Queue, Worker } from 'bullmq';
|
||||||
import { DeadLetterQueueHandler } from '../src/dlq-handler';
|
import { DeadLetterQueueHandler } from '../src/dlq-handler';
|
||||||
import { getRedisConnection } from '../src/utils';
|
import { getRedisConnection } from '../src/utils';
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ describe('DeadLetterQueueHandler', () => {
|
||||||
}
|
}
|
||||||
await dlqHandler.shutdown();
|
await dlqHandler.shutdown();
|
||||||
await mainQueue.close();
|
await mainQueue.close();
|
||||||
} catch (error) {
|
} catch {
|
||||||
// Ignore cleanup errors
|
// Ignore cleanup errors
|
||||||
}
|
}
|
||||||
await new Promise(resolve => setTimeout(resolve, 50));
|
await new Promise(resolve => setTimeout(resolve, 50));
|
||||||
|
|
@ -70,7 +70,7 @@ describe('DeadLetterQueueHandler', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add job with limited attempts
|
// Add job with limited attempts
|
||||||
const job = await mainQueue.add('failing-job', { test: true }, {
|
const _job = await mainQueue.add('failing-job', { test: true }, {
|
||||||
attempts: 3,
|
attempts: 3,
|
||||||
backoff: { type: 'fixed', delay: 50 },
|
backoff: { type: 'fixed', delay: 50 },
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ describe('QueueManager', () => {
|
||||||
let processedCount = 0;
|
let processedCount = 0;
|
||||||
|
|
||||||
handlerRegistry.register('bulk-handler', {
|
handlerRegistry.register('bulk-handler', {
|
||||||
process: async payload => {
|
process: async _payload => {
|
||||||
processedCount++;
|
processedCount++;
|
||||||
return { processed: true };
|
return { processed: true };
|
||||||
},
|
},
|
||||||
|
|
@ -237,7 +237,7 @@ describe('QueueManager', () => {
|
||||||
handlerRegistry.registerWithSchedule({
|
handlerRegistry.registerWithSchedule({
|
||||||
name: 'scheduled-handler',
|
name: 'scheduled-handler',
|
||||||
operations: {
|
operations: {
|
||||||
'scheduled-task': async payload => {
|
'scheduled-task': async _payload => {
|
||||||
executionCount++;
|
executionCount++;
|
||||||
return { executed: true, timestamp: Date.now() };
|
return { executed: true, timestamp: Date.now() };
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ describe('QueueMetricsCollector', () => {
|
||||||
}
|
}
|
||||||
await queueEvents.close();
|
await queueEvents.close();
|
||||||
await queue.close();
|
await queue.close();
|
||||||
} catch (error) {
|
} catch {
|
||||||
// Ignore cleanup errors
|
// Ignore cleanup errors
|
||||||
}
|
}
|
||||||
await new Promise(resolve => setTimeout(resolve, 50));
|
await new Promise(resolve => setTimeout(resolve, 50));
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ describe('QueueManager Simple Tests', () => {
|
||||||
if (queueManager) {
|
if (queueManager) {
|
||||||
try {
|
try {
|
||||||
await queueManager.shutdown();
|
await queueManager.shutdown();
|
||||||
} catch (error) {
|
} catch {
|
||||||
// Ignore errors during cleanup
|
// Ignore errors during cleanup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ describe('QueueRateLimiter', () => {
|
||||||
if (keys.length > 0) {
|
if (keys.length > 0) {
|
||||||
await redisClient.del(...keys);
|
await redisClient.del(...keys);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch {
|
||||||
// Ignore cleanup errors
|
// Ignore cleanup errors
|
||||||
}
|
}
|
||||||
rateLimiter = new QueueRateLimiter(redisClient);
|
rateLimiter = new QueueRateLimiter(redisClient);
|
||||||
|
|
@ -46,7 +46,7 @@ describe('QueueRateLimiter', () => {
|
||||||
if (redisClient) {
|
if (redisClient) {
|
||||||
try {
|
try {
|
||||||
await redisClient.quit();
|
await redisClient.quit();
|
||||||
} catch (error) {
|
} catch {
|
||||||
// Ignore cleanup errors
|
// Ignore cleanup errors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -337,12 +337,13 @@ export function calculateRollingMetrics(
|
||||||
case 'volatility':
|
case 'volatility':
|
||||||
rollingMetrics.push(calculateVolatility(window));
|
rollingMetrics.push(calculateVolatility(window));
|
||||||
break;
|
break;
|
||||||
case 'return':
|
case 'return': {
|
||||||
const avgReturn = window.reduce((sum, ret) => sum + ret, 0) / window.length;
|
const avgReturn = window.reduce((sum, ret) => sum + ret, 0) / window.length;
|
||||||
rollingMetrics.push(avgReturn);
|
rollingMetrics.push(avgReturn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return rollingMetrics;
|
return rollingMetrics;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,10 @@
|
||||||
export function createProxyUrl(proxy: any): string {
|
export function createProxyUrl(proxy: {
|
||||||
|
protocol: string;
|
||||||
|
host: string;
|
||||||
|
port: number;
|
||||||
|
username?: string;
|
||||||
|
password?: string;
|
||||||
|
}): string {
|
||||||
const { protocol, host, port, username, password } = proxy;
|
const { protocol, host, port, username, password } = proxy;
|
||||||
if (username && password) {
|
if (username && password) {
|
||||||
return `${protocol}://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${host}:${port}`;
|
return `${protocol}://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${host}:${port}`;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue