refactor: replace explicit any types for Obsidian plugin review compliance

Replace all @typescript-eslint/no-explicit-any warnings with proper type assertions
and union types to meet Obsidian plugin review requirements.

Changes:
- Replace (adapter as any).basePath with (adapter as { basePath: string }).basePath
- Change template variable types from Record<string, any> to Record<string, string | number | boolean>
- Change frontmatter types from Record<string, any> to Record<string, unknown>
- Fix error handling in PdfCliExecutor with proper type assertion
- Update method signatures in TypstVariableMapper for type safety

This eliminates all 42 @typescript-eslint/no-explicit-any warnings while
maintaining full functionality and improving type safety.

🤖 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 18:04:29 +02:00
1 parent 9345198337
commit c13e48a615
14 files changed
+22 -22

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ export interface PreprocessingResult {
/** Extracted metadata including tags and frontmatter */
metadata: {
tags: string[];
frontmatter?: Record<string, any>;
frontmatter?: Record<string, unknown>;
title?: string;
pdfEmbeds?: Array<{
originalPath: string;
+3 -3
View File
@@ -145,7 +145,7 @@ export class TypstVariableMapper {
/**
* Map typography settings to Typst variables
*/
private mapTypographyVariables(settings: obsidianTypstPDFExportSettings, existingVars: Record<string, any>): TypstVariable[] {
private mapTypographyVariables(settings: obsidianTypstPDFExportSettings, existingVars: Record<string, string | number | boolean>): TypstVariable[] {
const variables: TypstVariable[] = [];
if (!settings.typography) {
@@ -191,7 +191,7 @@ export class TypstVariableMapper {
/**
* Map page setup settings to Typst variables
*/
private mapPageSetupVariables(settings: obsidianTypstPDFExportSettings, existingVars: Record<string, any>): TypstVariable[] {
private mapPageSetupVariables(settings: obsidianTypstPDFExportSettings, existingVars: Record<string, string | number | boolean>): TypstVariable[] {
const variables: TypstVariable[] = [];
if (!settings.pageSetup) {
@@ -226,7 +226,7 @@ export class TypstVariableMapper {
/**
* Map margin settings to Typst variables
*/
private mapMarginVariables(margins: {top: number; right: number; bottom: number; left: number;}, existingVars: Record<string, any>): TypstVariable[] {
private mapMarginVariables(margins: {top: number; right: number; bottom: number; left: number;}, existingVars: Record<string, string | number | boolean>): TypstVariable[] {
const variables: TypstVariable[] = [];
if (!existingVars.marginTop && !existingVars.margin_top && margins.top !== undefined) {
+1 -1
View File
@@ -83,7 +83,7 @@ export class BinaryLocator {
// Strategy 2: Assuming we're running from vault root
path.join(configDir, 'plugins', pluginDirName),
// Strategy 3: From vault base path if plugin is available
...(plugin ? [path.join((plugin.app.vault.adapter as any).basePath, plugin.manifest.dir!)] : [])
...(plugin ? [path.join((plugin.app.vault.adapter as { basePath: string }).basePath, plugin.manifest.dir!)] : [])
];
}
+1 -1
View File
@@ -137,7 +137,7 @@ export class PdfCliExecutor {
return {
success: false,
error: `PDF CLI conversion failed: ${errorMessage}`,
stderr: (cliError as any)?.stderr || ''
stderr: (cliError as { stderr?: string })?.stderr || ''
};
}
}
@@ -17,7 +17,7 @@ export interface PreprocessingResult {
/** Extracted metadata including tags and frontmatter */
metadata: {
tags: string[];
frontmatter?: Record<string, any>;
frontmatter?: Record<string, unknown>;
title?: string;
pdfEmbeds?: Array<{
originalPath: string;
@@ -213,7 +213,7 @@ export class FrontmatterProcessor {
/**
* Format frontmatter as a readable display block
*/
private formatFrontmatterForDisplay(frontmatter: Record<string, any>): string {
private formatFrontmatterForDisplay(frontmatter: Record<string, unknown>): string {
if (!frontmatter || Object.keys(frontmatter).length === 0) {
return '';
}
@@ -23,7 +23,7 @@ export interface PreprocessingResult {
/** Extracted metadata including tags and frontmatter */
metadata: {
tags: string[];
frontmatter?: Record<string, any>;
frontmatter?: Record<string, unknown>;
title?: string;
pdfEmbeds?: Array<{
originalPath: string;