From caed98d0b63317f610e7a37dd9b13306f46bea7b Mon Sep 17 00:00:00 2001 From: Florian Egger Date: Wed, 6 May 2026 21:13:59 +0200 Subject: [PATCH] ``` Update ESLint rules to disable console logging in utils and error-handler Remove unused function and type in vault-indexer ``` ``` Remove unused safeWriteFile function in utils Remove unused isVaultLike type in vault-indexer ``` --- .eslintrc.js | 14 ++++++++++++++ src/error-handler.ts | 3 --- src/utils.ts | 11 ----------- src/vault-indexer.ts | 11 ----------- 4 files changed, 14 insertions(+), 25 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 14cdcd4..a78dfa3 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,6 +18,20 @@ module.exports = { 'no-console': 'warn', 'no-empty': ['error', { allowEmptyCatch: true }], }, + overrides: [ + { + files: ['src/utils.ts', 'src/error-handler.ts'], + rules: { + 'no-console': 'off', + }, + }, + { + files: ['jest.config.js', '.eslintrc.js'], + parserOptions: { + project: null, + }, + }, + ], env: { node: true, es2020: true, diff --git a/src/error-handler.ts b/src/error-handler.ts index 11faa40..c675fa9 100644 --- a/src/error-handler.ts +++ b/src/error-handler.ts @@ -20,15 +20,12 @@ export class ErrorHandler { if (error instanceof Error) { const ctx = context ? ` [${context}]` : ''; // Use console.error instead of ErrorHandler.error for fatal errors - // eslint-disable-next-line no-console console.error(`Ollama Plugin Error${ctx}: ${error.message}`); if (error.stack) { - // eslint-disable-next-line no-console console.error(error.stack); } } else { const ctx = context ? ` [${context}]` : ''; - // eslint-disable-next-line no-console console.error(`Ollama Plugin Error${ctx}:`, error); } } diff --git a/src/utils.ts b/src/utils.ts index 891673e..bc72c0d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -30,28 +30,24 @@ export class Logger { static debug(message: string, category: string = 'general'): void { if (LogLevel.DEBUG >= Logger.minLevel) { - // eslint-disable-next-line no-console console.debug(`[${category}] DEBUG: ${message}`); } } static info(message: string, category: string = 'general'): void { if (LogLevel.INFO >= Logger.minLevel) { - // eslint-disable-next-line no-console console.info(`[${category}] INFO: ${message}`); } } static warn(message: string, category: string = 'general'): void { if (LogLevel.WARN >= Logger.minLevel) { - // eslint-disable-next-line no-console console.warn(`[${category}] WARN: ${message}`); } } static error(message: string, category: string = 'general'): void { if (LogLevel.ERROR >= Logger.minLevel) { - // eslint-disable-next-line no-console console.error(`[${category}] ERROR: ${message}`); } } @@ -191,13 +187,6 @@ export function sanitizeFilePath(path: string): string { return path; } -export function safeWriteFile(filePath: string, content: string): Promise { - const sanitizedPath = sanitizeFilePath(filePath); - // eslint-disable-next-line no-console - console.log(`Writing to ${sanitizedPath}:`, content); - return Promise.resolve(); -} - // ==================== HTTP Helpers ==================== export function isValidHttpUrl(url: string): boolean { diff --git a/src/vault-indexer.ts b/src/vault-indexer.ts index be5f0e6..a6ea391 100644 --- a/src/vault-indexer.ts +++ b/src/vault-indexer.ts @@ -30,17 +30,6 @@ interface ScoreResult { matchedFields: string[]; } -function isVaultLike(value: unknown): value is VaultLike { - return ( - typeof value === 'object' && - value !== null && - 'getMarkdownFiles' in value && - typeof value.getMarkdownFiles === 'function' && - 'read' in value && - typeof value.read === 'function' - ); -} - class VaultIndexer { private summaries: Map = new Map(); private vault: VaultLike | null = null;