refactor: clean up ESLint warnings and code quality

- Remove unused imports and variables across multiple files
- Fix prefer-const warnings by changing let to const
- Remove unused catch block variables or convert to parameter-less catch blocks
- Update package-lock.json with TypeScript-ESLint v8 dependencies
- Reduce ESLint warnings from 42 to 22 (remaining are necessary 'any' types)
- All remaining warnings are for Obsidian API compatibility

Fixes improve code quality while maintaining functionality.
Remaining 'any' type warnings are appropriate for Obsidian plugin development.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jarvis committed 2025-09-10 17:47:17 +02:00
1 parent c40f5af1fb
commit 9345198337
15 files changed
+349 -41

No files matched your search

+1 -3
View File
@@ -26,15 +26,13 @@ export class BinaryLocator {
try {
// Get the plugin directory - need to handle Obsidian's environment
// In Obsidian, __dirname points to electron.asar, so we need to find the actual plugin path
let pluginDir: string;
// Try multiple strategies to find the plugin directory
const pluginDirName = plugin?.manifest?.dir || 'typst-pdf-export';
const configDir = plugin?.app.vault.configDir || '.obsidian';
const possiblePluginDirs = this.getPossiblePluginDirs(plugin, pluginDirName, configDir);
// Find the first directory that exists and has node_modules
pluginDir = possiblePluginDirs.find(dir => {
const pluginDir = possiblePluginDirs.find(dir => {
try {
const nodeModulesPath = path.join(dir, 'node_modules');
return require('fs').existsSync(nodeModulesPath);
+2 -2
View File
@@ -36,7 +36,7 @@ export class FileDiscovery {
filePath: expectedOutputPath,
found: true
};
} catch (error) {
} catch {
// File not found with expected name, try to find alternatives
return await this.findAlternativeFile(outputDir, expectedFileName, expectedOutputPath);
}
@@ -82,7 +82,7 @@ export class FileDiscovery {
filePath: actualOutputPath,
found: true
};
} catch (finalError) {
} catch {
return {
filePath: '',
found: false,
+2 -2
View File
@@ -29,7 +29,7 @@ export class PdfProcessor {
// Check PDF signature - all valid PDFs must start with %PDF
const signature = buffer.subarray(0, 4).toString();
return signature === '%PDF';
} catch (error) {
} catch {
return false;
}
}
@@ -83,7 +83,7 @@ export class PdfProcessor {
try {
await fs.access(filePath);
return { success: true };
} catch (error: unknown) {
} catch {
return {
success: false,
error: `PDF file not found: ${filePath}`