From 531d65bf59342222c00fef42da12227324d43f6d Mon Sep 17 00:00:00 2001 From: Mara Date: Tue, 11 Jun 2024 13:58:54 +0200 Subject: [PATCH] lint(whitespace): whitespace lint(whitespace): formatting issue --- src/main.ts | 52 +++++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/src/main.ts b/src/main.ts index ab57204..071a5a0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -35,11 +35,9 @@ export default class NoteInFolder extends Plugin { ); for (const command of pluginCommands) { //remove commands if the folder is not in the settings - if ( - !this.settings.folder.some( + if (!this.settings.folder.some( (folder) => folder.commandName === command.replace("create-note-in-folder:", "") - ) - ) + )) this.app.commands.removeCommand(command); } } @@ -85,41 +83,41 @@ export default class NoteInFolder extends Plugin { } } if (quickSwitcher) this.quickSwitcherCommand(); //reload the quickswitcher command - this.registerEvent( - this.app.workspace.on("file-menu", (menu, file) => { + this.registerEvent( + this.app.workspace.on("file-menu", (menu, file) => { const folder = (file instanceof TFolder) ? file : file.parent; if (!(newFolder?.fileMenu && newFolder?.path.contains("{{current}}") || (folder && newFolder?.path === folder.path))) { return; } let commandName = newFolder.commandName ?? `${i18next.t("create")} ${newFolder.path}`; - const { folderPath, defaultName } = generateFileNameWithCurrent( - newFolder, - file, - this - ); - const path = normalizePath(`${folderPath}/${defaultName}`); - const fileAlreadyExists = this.app.vault.getAbstractFileByPath( - newFolder.path.replace("{{current}}", path) - ); - if (fileAlreadyExists && !newFolder.template.increment) - commandName = `Open note : ${newFolder.commandName ?? newFolder.path}`; + const { folderPath, defaultName } = generateFileNameWithCurrent( + newFolder, + file, + this + ); + const path = normalizePath(`${folderPath}/${defaultName}`); + const fileAlreadyExists = this.app.vault.getAbstractFileByPath( + newFolder.path.replace("{{current}}", path) + ); + if (fileAlreadyExists && !newFolder.template.increment) + commandName = `Open note : ${newFolder.commandName ?? newFolder.path}`; //prevent duplicate command if (menu.items.some((item) => { //@ts-ignore return item.titleEl?.getText() === commandName; })) return; menu.addSections(["create-note-in-folder"]) - menu.addItem((item) => { - item - .setTitle(commandName) - .setIcon("file-plus") + menu.addItem((item) => { + item + .setTitle(commandName) + .setIcon("file-plus") .setSection("create-note-in-folder") - .onClick(() => { - createFolderInCurrent(newFolder, file, this); - }); - }); - }) - ); + .onClick(() => { + createFolderInCurrent(newFolder, file, this); + }); + }); + }) + ); } /**