From 35932915968c9bdbe9b950eb2f2b74d772c67dd5 Mon Sep 17 00:00:00 2001 From: Bill Ballou Date: Sat, 31 Jan 2026 20:32:24 -0500 Subject: [PATCH] fix: address ObsidianReviewBot linting issues - Add type guard for recursive parameter in notifications.ts to ensure only boolean values are stringified (prevents [object Object] output) - Remove unused error variables from catch blocks across 5 files: - vault-tools.ts (5 instances) - frontmatter-utils.ts (3 instances) - search-utils.ts (2 instances) - waypoint-utils.ts (1 instance) --- src/tools/vault-tools.ts | 10 +++++----- src/ui/notifications.ts | 4 ++-- src/utils/frontmatter-utils.ts | 8 ++++---- src/utils/search-utils.ts | 4 ++-- src/utils/waypoint-utils.ts | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/tools/vault-tools.ts b/src/tools/vault-tools.ts index 98333d1..e429b4f 100644 --- a/src/tools/vault-tools.ts +++ b/src/tools/vault-tools.ts @@ -286,7 +286,7 @@ export class VaultTools { try { const content = await this.vault.read(item); fileMetadata.wordCount = ContentUtils.countWords(content); - } catch (error) { + } catch { // Skip word count if file can't be read (binary file, etc.) // wordCount field simply omitted for this file } @@ -356,7 +356,7 @@ export class VaultTools { frontmatterSummary: summary }; } - } catch (error) { + } catch { // If frontmatter extraction fails, just return base metadata } @@ -390,7 +390,7 @@ export class VaultTools { if (folderWithStat.stat && typeof folderWithStat.stat.mtime === 'number') { modified = folderWithStat.stat.mtime; } - } catch (error) { + } catch { // Silently fail - modified will remain 0 } @@ -442,7 +442,7 @@ export class VaultTools { try { const content = await this.vault.read(item); metadata.wordCount = ContentUtils.countWords(content); - } catch (error) { + } catch { // Skip word count if file can't be read (binary file, etc.) } } @@ -712,7 +712,7 @@ export class VaultTools { } } } - } catch (error) { + } catch { // Skip files that can't be read } } diff --git a/src/ui/notifications.ts b/src/ui/notifications.ts index e8e305f..ae67e0a 100644 --- a/src/ui/notifications.ts +++ b/src/ui/notifications.ts @@ -162,8 +162,8 @@ export class NotificationManager { if (args.folder && typeof args.folder === 'string') { keyParams.push(`folder: "${this.truncateString(args.folder, 30)}"`); } - if (args.recursive !== undefined) { - keyParams.push(`recursive: ${String(args.recursive)}`); + if (typeof args.recursive === 'boolean') { + keyParams.push(`recursive: ${args.recursive}`); } // If no key params, show first 50 chars of JSON diff --git a/src/utils/frontmatter-utils.ts b/src/utils/frontmatter-utils.ts index 1eb6dd1..403cf13 100644 --- a/src/utils/frontmatter-utils.ts +++ b/src/utils/frontmatter-utils.ts @@ -73,7 +73,7 @@ export class FrontmatterUtils { let parsedFrontmatter: Record | null = null; try { parsedFrontmatter = parseYaml(frontmatter) || {}; - } catch (error) { + } catch { // If parsing fails, return null for parsed frontmatter parsedFrontmatter = null; } @@ -326,7 +326,7 @@ export class FrontmatterUtils { compressed: true // Indicate data is compressed } }; - } catch (decompressError) { + } catch { // Decompression failed return { isExcalidraw: true, @@ -355,9 +355,9 @@ export class FrontmatterUtils { version: jsonData.version || 2 } }; - } catch (error) { + } catch { // If parsing fails, return with default values - const isExcalidraw = content.includes('excalidraw-plugin') || + const isExcalidraw = content.includes('excalidraw-plugin') || content.includes('"type":"excalidraw"'); diff --git a/src/utils/search-utils.ts b/src/utils/search-utils.ts index 14e6051..923e6e3 100644 --- a/src/utils/search-utils.ts +++ b/src/utils/search-utils.ts @@ -114,7 +114,7 @@ export class SearchUtils { filesWithMatches.add(file.path); matches.push(...filenameMatches); } - } catch (error) { + } catch { // Skip files that can't be read } } @@ -323,7 +323,7 @@ export class SearchUtils { waypointContent.push(line); } } - } catch (error) { + } catch { // Skip files that can't be searched } } diff --git a/src/utils/waypoint-utils.ts b/src/utils/waypoint-utils.ts index 1cf1b29..6a81504 100644 --- a/src/utils/waypoint-utils.ts +++ b/src/utils/waypoint-utils.ts @@ -100,7 +100,7 @@ export class WaypointUtils { try { const content = await vault.read(file); hasWaypoint = this.hasWaypointMarker(content); - } catch (error) { + } catch { // If we can't read the file, we can't check for waypoints }