From 6a42f41f39343d8dd6b174304e7d61fd86686651 Mon Sep 17 00:00:00 2001 From: Christian Bager Bach Houmann Date: Mon, 27 Mar 2023 17:32:44 +0200 Subject: [PATCH] fix: lint errors --- src/MacrosManager.ts | 4 ++-- src/choiceExecutor.ts | 6 +++--- src/engine/CaptureChoiceEngine.ts | 2 +- src/engine/MacroChoiceEngine.ts | 14 +++++++++----- src/engine/QuickAddEngine.ts | 4 ++-- src/engine/SingleInlineScriptEngine.ts | 3 +++ src/engine/SingleMacroEngine.ts | 3 +++ src/engine/StartupMacroEngine.ts | 3 ++- src/engine/TemplateChoiceEngine.ts | 2 +- src/engine/TemplateEngine.ts | 9 +++++---- src/formatters/completeFormatter.ts | 5 +++++ src/formatters/fileNameDisplayFormatter.ts | 1 + src/formatters/formatDisplayFormatter.ts | 1 + src/formatters/formatter.ts | 5 +++++ src/gui/ChoiceBuilder/choiceBuilder.ts | 4 +++- src/gui/ChoiceBuilder/macroChoiceBuilder.ts | 9 +++++---- src/gui/ChoiceBuilder/templateChoiceBuilder.ts | 8 +++++--- .../genericCheckboxPrompt.ts | 3 ++- src/gui/GenericInfoDialog/GenericInfoDialog.ts | 15 +++++++++------ src/gui/GenericInputPrompt/GenericInputPrompt.ts | 3 ++- src/gui/GenericSuggester/genericSuggester.ts | 4 ++-- .../GenericWideInputPrompt.ts | 3 ++- src/gui/GenericYesNoPrompt/GenericYesNoPrompt.ts | 3 ++- src/gui/InputSuggester/inputSuggester.ts | 4 ++-- src/gui/MacroGUIs/MacroBuilder.ts | 16 ++++++++++------ src/gui/MacroGUIs/UserScriptSettingsModal.ts | 9 ++++++--- src/gui/UpdateModal/UpdateModal.ts | 8 +++++--- src/gui/suggesters/LaTeXSuggester.ts | 3 +++ src/gui/suggesters/choiceSuggester.ts | 5 +++-- src/gui/suggesters/fileSuggester.ts | 2 ++ src/gui/suggesters/suggest.ts | 11 ++++++++--- src/gui/suggesters/tagSuggester.ts | 1 + src/main.ts | 14 ++++++++------ src/migrations/Migrations.ts | 4 ++-- ...rementFileNameSettingMoveToDefaultBehavior.ts | 9 +++++---- src/migrations/isCaptureChoice.ts | 4 ++-- src/migrations/isMultiChoice.ts | 2 +- src/migrations/isNestedChoiceCommand.ts | 2 +- src/migrations/isOldTemplateChoice.ts | 2 +- src/migrations/migrate.ts | 8 ++++---- .../migrateToMacroIDFromEmbeddedMacro.ts | 8 ++++---- ...ExclusionInsertAfterAndWriteToBottomOfFile.ts | 7 ++++--- .../setVersionAfterUpdateModalRelease.ts | 3 ++- src/migrations/useQuickAddTemplateFolder.ts | 8 +++++++- src/quickAddApi.ts | 2 +- src/types/choices/ITemplateChoice.ts | 2 +- src/types/choices/TemplateChoice.ts | 2 +- .../SelectLinkOnActiveLineCommand.ts | 2 +- 48 files changed, 160 insertions(+), 92 deletions(-) diff --git a/src/MacrosManager.ts b/src/MacrosManager.ts index 7bbd249..b8d07b7 100644 --- a/src/MacrosManager.ts +++ b/src/MacrosManager.ts @@ -1,6 +1,6 @@ import type { IMacro } from "./types/macros/IMacro"; +import type { App } from "obsidian"; import { - App, ButtonComponent, Modal, Setting, @@ -223,7 +223,7 @@ export class MacrosManager extends Modal { this.macroContainer.scrollHeight ); } catch (error) { - log.logError(error); + log.logError(error as string); } }); } diff --git a/src/choiceExecutor.ts b/src/choiceExecutor.ts index 03a480a..f4f1b73 100644 --- a/src/choiceExecutor.ts +++ b/src/choiceExecutor.ts @@ -37,7 +37,7 @@ export class ChoiceExecutor implements IChoiceExecutor { } case ChoiceType.Multi: { const multiChoice: IMultiChoice = choice as IMultiChoice; - await this.onChooseMultiType(multiChoice); + this.onChooseMultiType(multiChoice); break; } default: @@ -66,7 +66,7 @@ export class ChoiceExecutor implements IChoiceExecutor { } private async onChooseMacroType(macroChoice: IMacroChoice) { - const macroEngine = await new MacroChoiceEngine( + const macroEngine = new MacroChoiceEngine( this.app, this.plugin, macroChoice, @@ -81,7 +81,7 @@ export class ChoiceExecutor implements IChoiceExecutor { }); } - private async onChooseMultiType(multiChoice: IMultiChoice) { + private onChooseMultiType(multiChoice: IMultiChoice) { ChoiceSuggester.Open(this.plugin, multiChoice.choices, this); } } diff --git a/src/engine/CaptureChoiceEngine.ts b/src/engine/CaptureChoiceEngine.ts index 65ef762..83a3762 100644 --- a/src/engine/CaptureChoiceEngine.ts +++ b/src/engine/CaptureChoiceEngine.ts @@ -115,7 +115,7 @@ export class CaptureChoiceEngine extends QuickAddChoiceEngine { filePath: string, content: string ): Promise<{ file: TFile; content: string }> { - const file: TFile = await this.getFileByPath(filePath); + const file: TFile = this.getFileByPath(filePath); if (!file) throw new Error("File not found"); // First format pass... diff --git a/src/engine/MacroChoiceEngine.ts b/src/engine/MacroChoiceEngine.ts index 35f589b..e1d83b3 100644 --- a/src/engine/MacroChoiceEngine.ts +++ b/src/engine/MacroChoiceEngine.ts @@ -82,7 +82,7 @@ export class MacroChoiceEngine extends QuickAddChoiceEngine { protected async executeCommands(commands: ICommand[]) { for (const command of commands) { if (command?.type === CommandType.Obsidian) - await this.executeObsidianCommand(command as IObsidianCommand); + this.executeObsidianCommand(command as IObsidianCommand); if (command?.type === CommandType.UserScript) await this.executeUserScript(command as IUserScript); if (command?.type === CommandType.Choice) @@ -125,7 +125,7 @@ export class MacroChoiceEngine extends QuickAddChoiceEngine { await this.userScriptDelegator(userScript); } catch (error) { log.logError( - `failed to run user script ${command.name}. Error:\n\n${error.message}` + `failed to run user script ${command.name}. Error:\n\n${(error as {message: string}).message}` ); } @@ -168,14 +168,17 @@ export class MacroChoiceEngine extends QuickAddChoiceEngine { case "function": if (this.userScriptCommand) { await this.runScriptWithSettings( + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument userScript, this.userScriptCommand ); } else { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument await this.onExportIsFunction(userScript); } break; case "object": + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument await this.onExportIsObject(userScript); break; case "bigint": @@ -231,12 +234,13 @@ export class MacroChoiceEngine extends QuickAddChoiceEngine { await this.userScriptDelegator(obj[selected]); } catch (e) { - log.logMessage(e); + log.logMessage(e as string); } } protected executeObsidianCommand(command: IObsidianCommand) { // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unsafe-call this.app.commands.executeCommandById(command.commandId); } @@ -274,10 +278,10 @@ export class MacroChoiceEngine extends QuickAddChoiceEngine { await PasteCommand.run(this.app); break; case EditorCommandType.SelectActiveLine: - await SelectActiveLineCommand.run(this.app); + SelectActiveLineCommand.run(this.app); break; case EditorCommandType.SelectLinkOnActiveLine: - await SelectLinkOnActiveLineCommand.run(this.app); + SelectLinkOnActiveLineCommand.run(this.app); break; } } diff --git a/src/engine/QuickAddEngine.ts b/src/engine/QuickAddEngine.ts index 5c27040..fb960e6 100644 --- a/src/engine/QuickAddEngine.ts +++ b/src/engine/QuickAddEngine.ts @@ -36,8 +36,8 @@ export abstract class QuickAddEngine { return await this.app.vault.adapter.exists(filePath); } - protected async getFileByPath(filePath: string): Promise { - const file = await this.app.vault.getAbstractFileByPath(filePath); + protected getFileByPath(filePath: string): TFile { + const file = this.app.vault.getAbstractFileByPath(filePath); if (!file) { log.logError(`${filePath} not found`); diff --git a/src/engine/SingleInlineScriptEngine.ts b/src/engine/SingleInlineScriptEngine.ts index f734dfd..64ec294 100644 --- a/src/engine/SingleInlineScriptEngine.ts +++ b/src/engine/SingleInlineScriptEngine.ts @@ -16,11 +16,14 @@ export class SingleInlineScriptEngine extends MacroChoiceEngine { // eslint-disable-next-line @typescript-eslint/no-explicit-any public async runAndGetOutput(code: string): Promise { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access const AsyncFunction = Object.getPrototypeOf( async function () {} ).constructor; + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call const userCode = new AsyncFunction(code); + // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call return await userCode.bind(this.params, this).call(); } } diff --git a/src/engine/SingleMacroEngine.ts b/src/engine/SingleMacroEngine.ts index 31cfd4c..0d7aaf2 100644 --- a/src/engine/SingleMacroEngine.ts +++ b/src/engine/SingleMacroEngine.ts @@ -38,9 +38,12 @@ export class SingleMacroEngine extends MacroChoiceEngine { // eslint-disable-next-line @typescript-eslint/no-explicit-any protected override async onExportIsObject(obj: any): Promise { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument if (!this.memberAccess) return await super.onExportIsObject(obj); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment let newObj = obj; this.memberAccess.forEach((key) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access newObj = newObj[key]; }); diff --git a/src/engine/StartupMacroEngine.ts b/src/engine/StartupMacroEngine.ts index d998933..3b53cc9 100644 --- a/src/engine/StartupMacroEngine.ts +++ b/src/engine/StartupMacroEngine.ts @@ -15,10 +15,11 @@ export class StartupMacroEngine extends MacroChoiceEngine { super(app, plugin, null, macros, choiceExecutor, null); } + // eslint-disable-next-line @typescript-eslint/require-await async run(): Promise { this.macros.forEach((macro) => { if (macro.runOnStartup) { - this.executeCommands(macro.commands); + void this.executeCommands(macro.commands); } }); } diff --git a/src/engine/TemplateChoiceEngine.ts b/src/engine/TemplateChoiceEngine.ts index 973b522..82edd25 100644 --- a/src/engine/TemplateChoiceEngine.ts +++ b/src/engine/TemplateChoiceEngine.ts @@ -156,7 +156,7 @@ export class TemplateChoiceEngine extends TemplateEngine { }); } } catch (error) { - log.logError(error); + log.logError(error as string); } } diff --git a/src/engine/TemplateEngine.ts b/src/engine/TemplateEngine.ts index 27c834a..44ade91 100644 --- a/src/engine/TemplateEngine.ts +++ b/src/engine/TemplateEngine.ts @@ -1,6 +1,7 @@ import { QuickAddEngine } from "./QuickAddEngine"; import { CompleteFormatter } from "../formatters/completeFormatter"; -import { App, TFile } from "obsidian"; +import type { App } from "obsidian"; +import { TFile } from "obsidian"; import type QuickAdd from "../main"; import { getTemplater, @@ -109,7 +110,7 @@ export abstract class TemplateEngine extends QuickAddEngine { return createdFile; } catch (e) { log.logError( - `Could not create file with template: \n\n${e.message}` + `Could not create file with template: \n\n${(e as {message: string}).message}` ); return null; } @@ -132,7 +133,7 @@ export abstract class TemplateEngine extends QuickAddEngine { return file; } catch (e) { - log.logError(e); + log.logError(e as string); return null; } } @@ -160,7 +161,7 @@ export abstract class TemplateEngine extends QuickAddEngine { return file; } catch (e) { - log.logError(e); + log.logError(e as string); return null; } } diff --git a/src/formatters/completeFormatter.ts b/src/formatters/completeFormatter.ts index 22ac540..ad9b1e7 100644 --- a/src/formatters/completeFormatter.ts +++ b/src/formatters/completeFormatter.ts @@ -1,3 +1,6 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ import { Formatter } from "./formatter"; import type { App } from "obsidian"; import { getNaturalLanguageDates } from "../utilityObsidian"; @@ -113,6 +116,7 @@ export class CompleteFormatter extends Formatter { for (const file of this.app.vault.getMarkdownFiles()) { const cache = this.app.metadataCache.getFileCache(file); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const value = cache?.frontmatter?.[variableName]; if (!value || typeof value == "object") continue; @@ -167,6 +171,7 @@ export class CompleteFormatter extends Formatter { ).run(); } + // eslint-disable-next-line @typescript-eslint/require-await protected async getSelectedText(): Promise { const activeView = this.app.workspace.getActiveViewOfType(MarkdownView); if (!activeView) return ""; diff --git a/src/formatters/fileNameDisplayFormatter.ts b/src/formatters/fileNameDisplayFormatter.ts index ab505b6..4046b54 100644 --- a/src/formatters/fileNameDisplayFormatter.ts +++ b/src/formatters/fileNameDisplayFormatter.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/require-await */ import { Formatter } from "./formatter"; import type { App } from "obsidian"; import { getNaturalLanguageDates } from "../utilityObsidian"; diff --git a/src/formatters/formatDisplayFormatter.ts b/src/formatters/formatDisplayFormatter.ts index e037205..72e44cb 100644 --- a/src/formatters/formatDisplayFormatter.ts +++ b/src/formatters/formatDisplayFormatter.ts @@ -69,6 +69,7 @@ export class FormatDisplayFormatter extends Formatter { } } + // eslint-disable-next-line @typescript-eslint/require-await protected async getSelectedText(): Promise { return "_selected_"; } diff --git a/src/formatters/formatter.ts b/src/formatters/formatter.ts index cc1d0c9..d1b9c7c 100644 --- a/src/formatters/formatter.ts +++ b/src/formatters/formatter.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { DATE_REGEX, DATE_REGEX_FORMATTED, @@ -84,6 +86,7 @@ export abstract class Formatter { return output; } + // eslint-disable-next-line @typescript-eslint/require-await protected async replaceLinkToCurrentFileInString( input: string ): Promise { @@ -213,6 +216,7 @@ export abstract class Formatter { suggestedValues: string[] ): Promise | string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any protected abstract suggestForField(variableName: string): any; protected async replaceDateVariableInString(input: string) { @@ -232,6 +236,7 @@ export abstract class Formatter { await this.promptForVariable(variableName) ); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const nld = this.getNaturalLanguageDates(); if ( !nld || diff --git a/src/gui/ChoiceBuilder/choiceBuilder.ts b/src/gui/ChoiceBuilder/choiceBuilder.ts index 135e93a..d1088d2 100644 --- a/src/gui/ChoiceBuilder/choiceBuilder.ts +++ b/src/gui/ChoiceBuilder/choiceBuilder.ts @@ -1,4 +1,5 @@ -import { App, Modal, Setting } from "obsidian"; +import type { App, Setting } from "obsidian"; +import { Modal } from "obsidian"; import type IChoice from "../../types/choices/IChoice"; import type { SvelteComponent } from "svelte"; import GenericInputPrompt from "../GenericInputPrompt/GenericInputPrompt"; @@ -63,6 +64,7 @@ export abstract class ChoiceBuilder extends Modal { }); headerEl.setText(choice.name); + // eslint-disable-next-line @typescript-eslint/no-misused-promises headerEl.addEventListener("click", async (ev) => { try { const newName: string = await GenericInputPrompt.Prompt( diff --git a/src/gui/ChoiceBuilder/macroChoiceBuilder.ts b/src/gui/ChoiceBuilder/macroChoiceBuilder.ts index a974217..13c4cef 100644 --- a/src/gui/ChoiceBuilder/macroChoiceBuilder.ts +++ b/src/gui/ChoiceBuilder/macroChoiceBuilder.ts @@ -1,12 +1,13 @@ import { ChoiceBuilder } from "./choiceBuilder"; import type IMacroChoice from "../../types/choices/IMacroChoice"; -import { App, ButtonComponent } from "obsidian"; +import type { App } from "obsidian"; +import { ButtonComponent } from "obsidian"; import { DropdownComponent } from "obsidian"; import type { IMacro } from "../../types/macros/IMacro"; import { MacroBuilder } from "../MacroGUIs/MacroBuilder"; import QuickAdd from "src/main"; import { settingsStore } from "src/settingsStore"; -import IChoice from "src/types/choices/IChoice"; +import type IChoice from "src/types/choices/IChoice"; import { log } from "src/logger/logManager"; export class MacroChoiceBuilder extends ChoiceBuilder { @@ -71,13 +72,13 @@ export class MacroChoiceBuilder extends ChoiceBuilder { .setIcon("plus") .setCta() .setTooltip("Create Macro") - .onClick(async () => { + .onClick(() => { try { const macro = settingsStore.createMacro(this.choice.name); this.choice.macroId = macro.id; this.reload(); } catch (error) { - log.logError(error); + log.logError(error as string); } }); } diff --git a/src/gui/ChoiceBuilder/templateChoiceBuilder.ts b/src/gui/ChoiceBuilder/templateChoiceBuilder.ts index f5a7be7..3e91339 100644 --- a/src/gui/ChoiceBuilder/templateChoiceBuilder.ts +++ b/src/gui/ChoiceBuilder/templateChoiceBuilder.ts @@ -1,6 +1,6 @@ import { ChoiceBuilder } from "./choiceBuilder"; +import type { App } from "obsidian"; import { - App, ButtonComponent, Setting, TextComponent, @@ -17,10 +17,10 @@ import type { FileViewMode } from "../../types/fileViewMode"; import { GenericTextSuggester } from "../suggesters/genericTextSuggester"; import { FormatSyntaxSuggester } from "../suggesters/formatSyntaxSuggester"; import { ExclusiveSuggester } from "../suggesters/exclusiveSuggester"; +import type { fileExistsChoices } from "src/constants"; import { fileExistsAppendToBottom, fileExistsAppendToTop, - fileExistsChoices, fileExistsDoNothing, fileExistsIncrement, fileExistsOverwriteFile, @@ -86,7 +86,7 @@ export class TemplateChoiceBuilder extends ChoiceBuilder { const formatDisplay: HTMLSpanElement = this.contentEl.createEl("span"); const displayFormatter: FileNameDisplayFormatter = new FileNameDisplayFormatter(this.app); - (async () => + void (async () => (formatDisplay.textContent = await displayFormatter.format( this.choice.fileNameFormat.format )))(); @@ -208,6 +208,7 @@ export class TemplateChoiceBuilder extends ChoiceBuilder { deleteFolder: (folder: string) => { this.choice.folder.folders = this.choice.folder.folders.filter((f) => f !== folder); + // eslint-disable-next-line @typescript-eslint/no-unsafe-call folderListEl.updateFolders(this.choice.folder.folders); suggester.updateCurrentItems(this.choice.folder.folders); }, @@ -240,6 +241,7 @@ export class TemplateChoiceBuilder extends ChoiceBuilder { } this.choice.folder.folders.push(input); + // eslint-disable-next-line @typescript-eslint/no-unsafe-call folderListEl.updateFolders(this.choice.folder.folders); folderInput.inputEl.value = ""; diff --git a/src/gui/GenericCheckboxPrompt/genericCheckboxPrompt.ts b/src/gui/GenericCheckboxPrompt/genericCheckboxPrompt.ts index acaa5ca..373d248 100644 --- a/src/gui/GenericCheckboxPrompt/genericCheckboxPrompt.ts +++ b/src/gui/GenericCheckboxPrompt/genericCheckboxPrompt.ts @@ -1,4 +1,5 @@ -import { App, ButtonComponent, Modal, ToggleComponent } from "obsidian"; +import type { App } from "obsidian"; +import { ButtonComponent, Modal, ToggleComponent } from "obsidian"; export default class GenericCheckboxPrompt extends Modal { private resolvePromise: (value: string[]) => void; diff --git a/src/gui/GenericInfoDialog/GenericInfoDialog.ts b/src/gui/GenericInfoDialog/GenericInfoDialog.ts index 68f3c22..8a063da 100644 --- a/src/gui/GenericInfoDialog/GenericInfoDialog.ts +++ b/src/gui/GenericInfoDialog/GenericInfoDialog.ts @@ -1,4 +1,5 @@ -import { App, ButtonComponent, Modal } from "obsidian"; +import type { App } from "obsidian"; +import { ButtonComponent, Modal } from "obsidian"; export default class GenericInfoDialog extends Modal { private resolvePromise: () => void; @@ -35,7 +36,9 @@ export default class GenericInfoDialog extends Modal { if (String.isString(this.text)) this.contentEl.createEl("p", { text: this.text }); else if (Array.isArray(this.text)) - this.text.forEach((line) => this.contentEl.createEl("p", { text: line })); + this.text.forEach((line) => + this.contentEl.createEl("p", { text: line }) + ); const buttonsDiv = this.contentEl.createDiv(); @@ -43,10 +46,10 @@ export default class GenericInfoDialog extends Modal { .setButtonText("OK") .onClick(() => this.close()); - Object.assign(buttonsDiv.style, ({ - "display": "flex", - "justifyContent": "flex-end" - } as Partial)); + Object.assign(buttonsDiv.style, { + display: "flex", + justifyContent: "flex-end", + } as Partial); noButton.buttonEl.focus(); } diff --git a/src/gui/GenericInputPrompt/GenericInputPrompt.ts b/src/gui/GenericInputPrompt/GenericInputPrompt.ts index b0c77f4..c4cc422 100644 --- a/src/gui/GenericInputPrompt/GenericInputPrompt.ts +++ b/src/gui/GenericInputPrompt/GenericInputPrompt.ts @@ -1,4 +1,5 @@ -import { App, ButtonComponent, Modal, TextComponent } from "obsidian"; +import type { App} from "obsidian"; +import { ButtonComponent, Modal, TextComponent } from "obsidian"; import { SilentFileSuggester } from "../suggesters/fileSuggester"; import { SilentTagSuggester } from "../suggesters/tagSuggester"; diff --git a/src/gui/GenericSuggester/genericSuggester.ts b/src/gui/GenericSuggester/genericSuggester.ts index efd7eda..bb99d49 100644 --- a/src/gui/GenericSuggester/genericSuggester.ts +++ b/src/gui/GenericSuggester/genericSuggester.ts @@ -1,5 +1,5 @@ -import { App, FuzzySuggestModal } from "obsidian"; -import type { FuzzyMatch } from "obsidian"; +import { FuzzySuggestModal } from "obsidian"; +import type { FuzzyMatch , App} from "obsidian"; export default class GenericSuggester extends FuzzySuggestModal { private resolvePromise: (value: string) => void; diff --git a/src/gui/GenericWideInputPrompt/GenericWideInputPrompt.ts b/src/gui/GenericWideInputPrompt/GenericWideInputPrompt.ts index 1e3dc41..9e2b105 100644 --- a/src/gui/GenericWideInputPrompt/GenericWideInputPrompt.ts +++ b/src/gui/GenericWideInputPrompt/GenericWideInputPrompt.ts @@ -1,4 +1,5 @@ -import { App, ButtonComponent, Modal, TextAreaComponent } from "obsidian"; +import type { App} from "obsidian"; +import { ButtonComponent, Modal, TextAreaComponent } from "obsidian"; import { SilentFileSuggester } from "../suggesters/fileSuggester"; import { SilentTagSuggester } from "../suggesters/tagSuggester"; diff --git a/src/gui/GenericYesNoPrompt/GenericYesNoPrompt.ts b/src/gui/GenericYesNoPrompt/GenericYesNoPrompt.ts index 9b6aed4..5b6770b 100644 --- a/src/gui/GenericYesNoPrompt/GenericYesNoPrompt.ts +++ b/src/gui/GenericYesNoPrompt/GenericYesNoPrompt.ts @@ -1,4 +1,5 @@ -import { App, ButtonComponent, Modal } from "obsidian"; +import type { App} from "obsidian"; +import { ButtonComponent, Modal } from "obsidian"; export default class GenericYesNoPrompt extends Modal { private resolvePromise: (input: boolean) => void; diff --git a/src/gui/InputSuggester/inputSuggester.ts b/src/gui/InputSuggester/inputSuggester.ts index a93bb80..43a9dfb 100644 --- a/src/gui/InputSuggester/inputSuggester.ts +++ b/src/gui/InputSuggester/inputSuggester.ts @@ -1,5 +1,5 @@ -import { App, FuzzySuggestModal } from "obsidian"; -import type { FuzzyMatch } from "obsidian"; +import { FuzzySuggestModal } from "obsidian"; +import type { FuzzyMatch , App} from "obsidian"; type Options = { limit: FuzzySuggestModal["limit"]; diff --git a/src/gui/MacroGUIs/MacroBuilder.ts b/src/gui/MacroGUIs/MacroBuilder.ts index da4ec59..3c3a7aa 100644 --- a/src/gui/MacroGUIs/MacroBuilder.ts +++ b/src/gui/MacroGUIs/MacroBuilder.ts @@ -1,12 +1,13 @@ import type { IMacro } from "../../types/macros/IMacro"; -import { +import type { App, - ButtonComponent, DropdownComponent, - Modal, - Setting, TextComponent, - TFile, + TFile} from "obsidian"; +import { + ButtonComponent, + Modal, + Setting } from "obsidian"; import type { IObsidianCommand } from "../../types/macros/IObsidianCommand"; import { UserScript } from "../../types/macros/UserScript"; @@ -90,6 +91,7 @@ export class MacroBuilder extends Modal { headerEl.setText(header); headerEl.addClass("clickable"); + // eslint-disable-next-line @typescript-eslint/no-misused-promises headerEl.addEventListener("click", async () => { const newMacroName: string = await GenericInputPrompt.Prompt( this.app, @@ -312,7 +314,7 @@ export class MacroBuilder extends Modal { // @ts-ignore Object.keys(this.app.commands.commands).forEach((key) => { // @ts-ignore - const command = this.app.commands.commands[key]; + const command: {name: string, id: string} = this.app.commands.commands[key]; this.commands.push(new ObsidianCommand(command.name, command.id)); }); @@ -355,6 +357,7 @@ export class MacroBuilder extends Modal { (c) => c.id !== commandId ); //@ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unsafe-call this.commandListEl.updateCommandList(this.macro.commands); }, saveCommands: (commands: ICommand[]) => { @@ -408,6 +411,7 @@ export class MacroBuilder extends Modal { private addCommandToMacro(command: ICommand) { this.macro.commands.push(command); //@ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unsafe-call this.commandListEl.updateCommandList(this.macro.commands); } } diff --git a/src/gui/MacroGUIs/UserScriptSettingsModal.ts b/src/gui/MacroGUIs/UserScriptSettingsModal.ts index c97000f..11000eb 100644 --- a/src/gui/MacroGUIs/UserScriptSettingsModal.ts +++ b/src/gui/MacroGUIs/UserScriptSettingsModal.ts @@ -1,4 +1,7 @@ -import { App, Modal, Setting, TextAreaComponent } from "obsidian"; +/* eslint-disable @typescript-eslint/restrict-plus-operands */ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +import type { App} from "obsidian"; +import { Modal, Setting, TextAreaComponent } from "obsidian"; import type { IUserScript } from "../../types/macros/IUserScript"; import QuickAdd from "../../main"; import { FormatDisplayFormatter } from "../../formatters/formatDisplayFormatter"; @@ -140,7 +143,7 @@ export class UserScriptSettingsModal extends Modal { private addDropdown(name: string, options: string[], value: string) { new Setting(this.contentEl).setName(name).addDropdown((dropdown) => { - options.forEach((item) => dropdown.addOption(item, item)); + options.forEach((item) => void dropdown.addOption(item, item)); dropdown.setValue(value); dropdown.onChange((value) => (this.command.settings[name] = value)); }); @@ -169,7 +172,7 @@ export class UserScriptSettingsModal extends Modal { input.inputEl.style.height = "100px"; input.inputEl.style.marginBottom = "1em"; - (async () => + void (async () => (formatDisplay.innerText = await displayFormatter.format(value)))(); } } diff --git a/src/gui/UpdateModal/UpdateModal.ts b/src/gui/UpdateModal/UpdateModal.ts index 704d9f3..b0a4228 100644 --- a/src/gui/UpdateModal/UpdateModal.ts +++ b/src/gui/UpdateModal/UpdateModal.ts @@ -1,4 +1,5 @@ -import { Component, MarkdownRenderer, Modal } from "obsidian"; +import type { Component} from "obsidian"; +import { MarkdownRenderer, Modal } from "obsidian"; import { log } from "src/logger/logManager"; type Release = { @@ -27,6 +28,7 @@ async function getReleaseNotesAfter( const response = await fetch( `https://api.github.com/repos/${repoOwner}/${repoName}/releases` ); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const releases: Release[] | { message: string } = await response.json(); if ((!response.ok && "message" in releases) || !Array.isArray(releases)) { @@ -93,7 +95,7 @@ export class UpdateModal extends Modal { this.display(); }) .catch((err) => { - log.logError(`Failed to fetch release notes: ${err}`); + log.logError(`Failed to fetch release notes: ${err as string}`); }); } @@ -130,7 +132,7 @@ export class UpdateModal extends Modal { releaseNotes )}`; - MarkdownRenderer.renderMarkdown( + void MarkdownRenderer.renderMarkdown( markdownStr, contentDiv, app.vault.getRoot().path, diff --git a/src/gui/suggesters/LaTeXSuggester.ts b/src/gui/suggesters/LaTeXSuggester.ts index a3ac135..3a4b86d 100644 --- a/src/gui/suggesters/LaTeXSuggester.ts +++ b/src/gui/suggesters/LaTeXSuggester.ts @@ -18,6 +18,7 @@ export class LaTeXSuggester extends TextInputSuggest { this.elementsRendered = this.symbols.reduce((elements, symbol) => { try { //@ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call elements[symbol.toString()] = renderMath(symbol, true); // Ignoring symbols that we can't use @@ -45,6 +46,7 @@ export class LaTeXSuggester extends TextInputSuggest { this.lastInput = match[1]; suggestions = this.symbols.filter((val) => //@ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call val.toLowerCase().contains(this.lastInput) ); } @@ -61,6 +63,7 @@ export class LaTeXSuggester extends TextInputSuggest { if (item) { el.setText(item); //@ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument el.append(this.elementsRendered[item]); } } diff --git a/src/gui/suggesters/choiceSuggester.ts b/src/gui/suggesters/choiceSuggester.ts index 01e121d..d29f3b2 100644 --- a/src/gui/suggesters/choiceSuggester.ts +++ b/src/gui/suggesters/choiceSuggester.ts @@ -1,4 +1,5 @@ -import { FuzzyMatch, FuzzySuggestModal, MarkdownRenderer } from "obsidian"; +import type { FuzzyMatch} from "obsidian"; +import { FuzzySuggestModal, MarkdownRenderer } from "obsidian"; import type IChoice from "../../types/choices/IChoice"; import { ChoiceExecutor } from "../../choiceExecutor"; import { ChoiceType } from "../../types/choices/choiceType"; @@ -32,7 +33,7 @@ export default class ChoiceSuggester extends FuzzySuggestModal { renderSuggestion(item: FuzzyMatch, el: HTMLElement): void { el.empty(); - MarkdownRenderer.renderMarkdown(item.item.name, el, '', this.plugin); + void MarkdownRenderer.renderMarkdown(item.item.name, el, '', this.plugin); el.classList.add("quickadd-choice-suggestion"); } diff --git a/src/gui/suggesters/fileSuggester.ts b/src/gui/suggesters/fileSuggester.ts index f9b82c8..40599e8 100644 --- a/src/gui/suggesters/fileSuggester.ts +++ b/src/gui/suggesters/fileSuggester.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/restrict-template-expressions */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ import { TextInputSuggest } from "./suggest"; import type { App, TFile } from "obsidian"; import { FILE_LINK_REGEX } from "../../constants"; diff --git a/src/gui/suggesters/suggest.ts b/src/gui/suggesters/suggest.ts index 23a7e4b..bbc18eb 100644 --- a/src/gui/suggesters/suggest.ts +++ b/src/gui/suggesters/suggest.ts @@ -1,7 +1,10 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ // Credits go to Liam's Periodic Notes Plugin: https://github.com/liamcain/obsidian-periodic-notes -import { App, Scope } from "obsidian"; -import type { ISuggestOwner } from "obsidian"; +import { Scope } from "obsidian"; +import type { ISuggestOwner , App} from "obsidian"; import { createPopper } from "@popperjs/core"; import type { Instance as PopperInstance } from "@popperjs/core"; @@ -27,11 +30,13 @@ class Suggest { containerEl.on( "click", ".suggestion-item", + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument this.onSuggestionClick.bind(this) ); containerEl.on( "mousemove", ".suggestion-item", + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument this.onSuggestionMouseover.bind(this) ); @@ -182,7 +187,7 @@ export abstract class TextInputSuggest implements ISuggestOwner { return; } state.styles.popper.width = targetWidth; - instance.update(); + void instance.update(); }, phase: "beforeWrite", requires: ["computeStyles"], diff --git a/src/gui/suggesters/tagSuggester.ts b/src/gui/suggesters/tagSuggester.ts index 45632b6..316df53 100644 --- a/src/gui/suggesters/tagSuggester.ts +++ b/src/gui/suggesters/tagSuggester.ts @@ -14,6 +14,7 @@ export class SilentTagSuggester extends TextInputSuggest { super(app, inputEl); // @ts-expect-error + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call this.tags = Object.keys(app.metadataCache.getTags()); } diff --git a/src/main.ts b/src/main.ts index 01139b3..ee013f9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,5 @@ -import { Plugin, TFile } from "obsidian"; +import type { TFile } from "obsidian"; +import { Plugin } from "obsidian"; import { DEFAULT_SETTINGS, QuickAddSettingsTab } from "./quickAddSettingsTab"; import type { QuickAddSettings } from "./quickAddSettingsTab"; import { log } from "./logger/logManager"; @@ -34,7 +35,7 @@ export default class QuickAdd extends Plugin { settingsStore.setState(this.settings); this.unsubscribeSettingsStore = settingsStore.subscribe((settings) => { this.settings = settings; - this.saveSettings(); + void this.saveSettings(); }); this.addCommand({ @@ -55,7 +56,7 @@ export default class QuickAdd extends Plugin { const id: string = this.manifest.id, plugins = this.app.plugins; - plugins.disablePlugin(id).then(() => plugins.enablePlugin(id)); + void plugins.disablePlugin(id).then(() => plugins.enablePlugin(id)); }, }); @@ -69,11 +70,11 @@ export default class QuickAdd extends Plugin { console.log(`Test QuickAdd (dev)`); - const fn = async () => { + const fn = () => { new UpdateModal("0.12.0").open(); }; - fn(); + void fn(); }, }); @@ -101,6 +102,7 @@ export default class QuickAdd extends Plugin { } async loadSettings() { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment this.settings = Object.assign( {}, DEFAULT_SETTINGS, @@ -197,7 +199,7 @@ export default class QuickAdd extends Plugin { if (currentVersion === knownVersion) return; this.settings.version = currentVersion; - this.saveSettings(); + void this.saveSettings(); if (this.settings.announceUpdates === false) return; diff --git a/src/migrations/Migrations.ts b/src/migrations/Migrations.ts index 55e3b6b..4422d95 100644 --- a/src/migrations/Migrations.ts +++ b/src/migrations/Migrations.ts @@ -1,5 +1,5 @@ -import QuickAdd from "src/main"; -import { QuickAddSettings } from "src/quickAddSettingsTab"; +import type QuickAdd from "src/main"; +import type { QuickAddSettings } from "src/quickAddSettingsTab"; export type Migration = { description: string; diff --git a/src/migrations/incrementFileNameSettingMoveToDefaultBehavior.ts b/src/migrations/incrementFileNameSettingMoveToDefaultBehavior.ts index 7875959..3be7e1c 100644 --- a/src/migrations/incrementFileNameSettingMoveToDefaultBehavior.ts +++ b/src/migrations/incrementFileNameSettingMoveToDefaultBehavior.ts @@ -1,10 +1,10 @@ -import QuickAdd from "src/main"; -import IChoice from "src/types/choices/IChoice"; -import { IMacro } from "src/types/macros/IMacro"; +import type QuickAdd from "src/main"; +import type IChoice from "src/types/choices/IChoice"; +import type { IMacro } from "src/types/macros/IMacro"; import { isMultiChoice } from "./isMultiChoice"; import { isNestedChoiceCommand } from "./isNestedChoiceCommand"; import { isOldTemplateChoice } from "./isOldTemplateChoice"; -import { Migration } from "./Migrations"; +import type { Migration } from "./Migrations"; function recursiveRemoveIncrementFileName(choices: IChoice[]): IChoice[] { for (const choice of choices) { @@ -46,6 +46,7 @@ function removeIncrementFileName(macros: IMacro[]): IMacro[] { const incrementFileNameSettingMoveToDefaultBehavior: Migration = { description: "'Increment file name' setting moved to 'Set default behavior if file already exists' setting", + // eslint-disable-next-line @typescript-eslint/require-await migrate: async (plugin: QuickAdd): Promise => { const choicesCopy = structuredClone(plugin.settings.choices); const choices = recursiveRemoveIncrementFileName(choicesCopy); diff --git a/src/migrations/isCaptureChoice.ts b/src/migrations/isCaptureChoice.ts index 7ce59b2..dd30dc8 100644 --- a/src/migrations/isCaptureChoice.ts +++ b/src/migrations/isCaptureChoice.ts @@ -1,6 +1,6 @@ -import { CaptureChoice } from "src/types/choices/CaptureChoice"; +import type { CaptureChoice } from "src/types/choices/CaptureChoice"; import { ChoiceType } from "src/types/choices/choiceType"; -import IChoice from "src/types/choices/IChoice"; +import type IChoice from "src/types/choices/IChoice"; export function isCaptureChoice(choice: IChoice): choice is CaptureChoice { return choice.type === ChoiceType.Capture; diff --git a/src/migrations/isMultiChoice.ts b/src/migrations/isMultiChoice.ts index 13793e1..e48610b 100644 --- a/src/migrations/isMultiChoice.ts +++ b/src/migrations/isMultiChoice.ts @@ -1,5 +1,5 @@ import { ChoiceType } from "src/types/choices/choiceType"; -import { MultiChoice } from "src/types/choices/MultiChoice"; +import type { MultiChoice } from "src/types/choices/MultiChoice"; export function isMultiChoice(choice: unknown): choice is MultiChoice { if ( diff --git a/src/migrations/isNestedChoiceCommand.ts b/src/migrations/isNestedChoiceCommand.ts index ed41bac..e306b4b 100644 --- a/src/migrations/isNestedChoiceCommand.ts +++ b/src/migrations/isNestedChoiceCommand.ts @@ -1,4 +1,4 @@ -import { NestedChoiceCommand } from "src/types/macros/QuickCommands/NestedChoiceCommand"; +import type { NestedChoiceCommand } from "src/types/macros/QuickCommands/NestedChoiceCommand"; export function isNestedChoiceCommand( command: unknown diff --git a/src/migrations/isOldTemplateChoice.ts b/src/migrations/isOldTemplateChoice.ts index 88e29c7..d1c3701 100644 --- a/src/migrations/isOldTemplateChoice.ts +++ b/src/migrations/isOldTemplateChoice.ts @@ -1,4 +1,4 @@ -import { TemplateChoice } from "src/types/choices/TemplateChoice"; +import type { TemplateChoice } from "src/types/choices/TemplateChoice"; export type OldTemplateChoice = TemplateChoice & { incrementFileName?: boolean; diff --git a/src/migrations/migrate.ts b/src/migrations/migrate.ts index d78d0ca..d624b34 100644 --- a/src/migrations/migrate.ts +++ b/src/migrations/migrate.ts @@ -1,6 +1,6 @@ import { log } from "src/logger/logManager"; -import QuickAdd from "src/main"; -import { Migrations } from "./Migrations"; +import type QuickAdd from "src/main"; +import type { Migrations } from "./Migrations"; import migrateToMacroIDFromEmbeddedMacro from "./migrateToMacroIDFromEmbeddedMacro"; import useQuickAddTemplateFolder from "./useQuickAddTemplateFolder"; import incrementFileNameSettingMoveToDefaultBehavior from "./incrementFileNameSettingMoveToDefaultBehavior"; @@ -42,14 +42,14 @@ async function migrate(plugin: QuickAdd): Promise { log.logMessage(`Migration ${migration} successful.`); } catch (error) { log.logError( - `Migration '${migration}' was unsuccessful. Please create an issue with the following error message: \n\n${error}\n\nQuickAdd will now revert to backup.` + `Migration '${migration}' was unsuccessful. Please create an issue with the following error message: \n\n${error as string}\n\nQuickAdd will now revert to backup.` ); plugin.settings = backup; } } - plugin.saveSettings(); + void plugin.saveSettings(); } export default migrate; diff --git a/src/migrations/migrateToMacroIDFromEmbeddedMacro.ts b/src/migrations/migrateToMacroIDFromEmbeddedMacro.ts index 17e32c7..1e3eab3 100644 --- a/src/migrations/migrateToMacroIDFromEmbeddedMacro.ts +++ b/src/migrations/migrateToMacroIDFromEmbeddedMacro.ts @@ -1,8 +1,8 @@ -import QuickAdd from "src/main"; +import type QuickAdd from "src/main"; import { ChoiceType } from "src/types/choices/choiceType"; -import IChoice from "src/types/choices/IChoice"; -import IMacroChoice from "src/types/choices/IMacroChoice"; -import IMultiChoice from "src/types/choices/IMultiChoice"; +import type IChoice from "src/types/choices/IChoice"; +import type IMacroChoice from "src/types/choices/IMacroChoice"; +import type IMultiChoice from "src/types/choices/IMultiChoice"; export default { description: "Migrate to macro ID from embedded macro in macro choices.", diff --git a/src/migrations/mutualExclusionInsertAfterAndWriteToBottomOfFile.ts b/src/migrations/mutualExclusionInsertAfterAndWriteToBottomOfFile.ts index 18cc05c..d4fd7d6 100644 --- a/src/migrations/mutualExclusionInsertAfterAndWriteToBottomOfFile.ts +++ b/src/migrations/mutualExclusionInsertAfterAndWriteToBottomOfFile.ts @@ -1,9 +1,9 @@ -import IChoice from "src/types/choices/IChoice"; -import { IMacro } from "src/types/macros/IMacro"; +import type IChoice from "src/types/choices/IChoice"; +import type { IMacro } from "src/types/macros/IMacro"; import { isCaptureChoice } from "./isCaptureChoice"; import { isMultiChoice } from "./isMultiChoice"; import { isNestedChoiceCommand } from "./isNestedChoiceCommand"; -import { Migration } from "./Migrations"; +import type { Migration } from "./Migrations"; function recursiveMigrateSettingInChoices(choices: IChoice[]): IChoice[] { for (const choice of choices) { @@ -46,6 +46,7 @@ function migrateSettingsInMacros(macros: IMacro[]): IMacro[] { const mutualExclusionInsertAfterAndWriteToBottomOfFile: Migration = { description: "Mutual exclusion of insertAfter and writeToBottomOfFile settings. If insertAfter is enabled, writeToBottomOfFile is disabled. To support changes in settings UI.", + // eslint-disable-next-line @typescript-eslint/require-await migrate: async (plugin) => { const choicesCopy = structuredClone(plugin.settings.choices); const choices = recursiveMigrateSettingInChoices(choicesCopy); diff --git a/src/migrations/setVersionAfterUpdateModalRelease.ts b/src/migrations/setVersionAfterUpdateModalRelease.ts index f291527..b9ef4c4 100644 --- a/src/migrations/setVersionAfterUpdateModalRelease.ts +++ b/src/migrations/setVersionAfterUpdateModalRelease.ts @@ -1,9 +1,10 @@ import { settingsStore } from "src/settingsStore"; -import { Migration } from "./Migrations"; +import type { Migration } from "./Migrations"; const setVersionAfterUpdateModalRelease: Migration = { description: "Set version to 0.14.0, which is the release version prior to the update modal release.", + // eslint-disable-next-line @typescript-eslint/require-await migrate: async (_) => { settingsStore.setState({ version: "0.14.0" }); }, diff --git a/src/migrations/useQuickAddTemplateFolder.ts b/src/migrations/useQuickAddTemplateFolder.ts index 1a5b1c6..669cdb3 100644 --- a/src/migrations/useQuickAddTemplateFolder.ts +++ b/src/migrations/useQuickAddTemplateFolder.ts @@ -1,9 +1,10 @@ import { log } from "src/logger/logManager"; -import QuickAdd from "src/main"; +import type QuickAdd from "src/main"; export default { description: "Use QuickAdd template folder instead of Obsidian templates plugin folder / Templater templates folder.", + // eslint-disable-next-line @typescript-eslint/require-await migrate: async (plugin: QuickAdd): Promise => { try { const templaterPlugin = app.plugins.plugins["templater"]; @@ -17,11 +18,15 @@ export default { } if (obsidianTemplatesPlugin) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const obsidianTemplatesSettings = //@ts-ignore obsidianTemplatesPlugin.instance.options; + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access if (obsidianTemplatesSettings["folder"]) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment plugin.settings.templateFolderPath = + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access obsidianTemplatesSettings["folder"]; log.logMessage( @@ -34,6 +39,7 @@ export default { const templaterSettings = templaterPlugin.settings; //@ts-ignore if (templaterSettings["template_folder"]) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment plugin.settings.templateFolderPath = //@ts-ignore templaterSettings["template_folder"]; diff --git a/src/quickAddApi.ts b/src/quickAddApi.ts index 7d442b1..e8097e2 100644 --- a/src/quickAddApi.ts +++ b/src/quickAddApi.ts @@ -74,7 +74,7 @@ export class QuickAddApi { }, format: async ( input: string, - variables?: { [key: string]: any } + variables?: { [key: string]: unknown } ) => { if (variables) { Object.keys(variables).forEach((key) => { diff --git a/src/types/choices/ITemplateChoice.ts b/src/types/choices/ITemplateChoice.ts index fbe4d44..a84706c 100644 --- a/src/types/choices/ITemplateChoice.ts +++ b/src/types/choices/ITemplateChoice.ts @@ -1,7 +1,7 @@ import type IChoice from "./IChoice"; import type { NewTabDirection } from "../newTabDirection"; import type { FileViewMode } from "../fileViewMode"; -import { fileExistsChoices } from "src/constants"; +import type { fileExistsChoices } from "src/constants"; export default interface ITemplateChoice extends IChoice { templatePath: string; diff --git a/src/types/choices/TemplateChoice.ts b/src/types/choices/TemplateChoice.ts index 9035150..e77d02c 100644 --- a/src/types/choices/TemplateChoice.ts +++ b/src/types/choices/TemplateChoice.ts @@ -3,7 +3,7 @@ import type ITemplateChoice from "./ITemplateChoice"; import { Choice } from "./Choice"; import { NewTabDirection } from "../newTabDirection"; import type { FileViewMode } from "../fileViewMode"; -import { fileExistsChoices } from "src/constants"; +import type { fileExistsChoices } from "src/constants"; export class TemplateChoice extends Choice implements ITemplateChoice { appendLink: boolean; diff --git a/src/types/macros/EditorCommands/SelectLinkOnActiveLineCommand.ts b/src/types/macros/EditorCommands/SelectLinkOnActiveLineCommand.ts index 012c7c9..1754dfe 100644 --- a/src/types/macros/EditorCommands/SelectLinkOnActiveLineCommand.ts +++ b/src/types/macros/EditorCommands/SelectLinkOnActiveLineCommand.ts @@ -9,7 +9,7 @@ export class SelectLinkOnActiveLineCommand extends EditorCommand { super(EditorCommandType.SelectLinkOnActiveLine); } - static async run(app: App) { + static run(app: App) { const activeView = EditorCommand.getActiveMarkdownView(app); const { line: lineNumber } = activeView.editor.getCursor();