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)
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -73,7 +73,7 @@ export class FrontmatterUtils {
|
||||
let parsedFrontmatter: Record<string, YAMLValue> | 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"');
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user