From 277935b8b1ecc40b7d6dc9e3c4c890b577b7e48e Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Mon, 5 May 2025 10:46:00 +0100 Subject: [PATCH] Chore: Fixed conflict between TS and eslint --- packages/app-desktop/commands/restoreNoteRevision.ts | 2 +- packages/app-mobile/commands/newNote.ts | 2 +- packages/lib/commands/showEditorPlugin.ts | 2 +- packages/lib/services/CommandService.ts | 6 ++---- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/app-desktop/commands/restoreNoteRevision.ts b/packages/app-desktop/commands/restoreNoteRevision.ts index db0fd50774..c80870643a 100644 --- a/packages/app-desktop/commands/restoreNoteRevision.ts +++ b/packages/app-desktop/commands/restoreNoteRevision.ts @@ -9,7 +9,7 @@ export const declaration: CommandDeclaration = { export const runtime = (): CommandRuntime => { return { - execute: async (_context: CommandContext, noteId: string, reverseRevIndex:number = 0) => { + execute: async (_context: CommandContext, noteId: string, reverseRevIndex = 0) => { try { const note = await RevisionService.instance().restoreNoteById(noteId, reverseRevIndex); await shim.showMessageBox(RevisionService.instance().restoreSuccessMessage(note), { type: MessageBoxType.Info }); diff --git a/packages/app-mobile/commands/newNote.ts b/packages/app-mobile/commands/newNote.ts index 238a22f028..a36b2f9f38 100644 --- a/packages/app-mobile/commands/newNote.ts +++ b/packages/app-mobile/commands/newNote.ts @@ -12,7 +12,7 @@ export const declaration: CommandDeclaration = { export const runtime = (): CommandRuntime => { return { - execute: async (_context: CommandContext, body:string = '', todo:boolean = false, options: GotoNoteOptions = null) => { + execute: async (_context: CommandContext, body = '', todo = false, options: GotoNoteOptions = null) => { const folderId = Setting.value('activeFolderId'); if (!folderId) { logger.warn('Not creating new note -- no active folder ID.'); diff --git a/packages/lib/commands/showEditorPlugin.ts b/packages/lib/commands/showEditorPlugin.ts index 2226ba5bfb..2d25655627 100644 --- a/packages/lib/commands/showEditorPlugin.ts +++ b/packages/lib/commands/showEditorPlugin.ts @@ -13,7 +13,7 @@ export const declaration: CommandDeclaration = { export const runtime = (): CommandRuntime => { return { - execute: async (context: CommandContext, editorViewId:string = '', show:boolean = true) => { + execute: async (context: CommandContext, editorViewId = '', show = true) => { logger.info('View:', editorViewId, 'Show:', show); const shownEditorViewIds = Setting.value('plugins.shownEditorViewIds'); diff --git a/packages/lib/services/CommandService.ts b/packages/lib/services/CommandService.ts index 0adcc95d92..7fa9b026b7 100644 --- a/packages/lib/services/CommandService.ts +++ b/packages/lib/services/CommandService.ts @@ -8,8 +8,6 @@ import type { WhenClauseContext } from './commands/stateToWhenClauseContext'; type LabelFunction = ()=> string; type EnabledCondition = string; -export type CommandArgument = string|number|object|boolean|null; - export interface CommandContext { // The state may also be of type "AppState" (used by the desktop app), which inherits from "State" (used by all apps) state: State; @@ -19,7 +17,7 @@ export interface CommandContext { export interface CommandRuntime { // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied - execute(context: CommandContext, ...args: CommandArgument[]): Promise; + execute(context: CommandContext, ...args: any[]): Promise; enabledCondition?: EnabledCondition; // Used for the (optional) toolbar button title // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied @@ -319,7 +317,7 @@ export default class CommandService extends BaseService { } // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied - public async execute(commandName: string, ...args: CommandArgument[]): Promise { + public async execute(commandName: string, ...args: any[]): Promise { const command = this.commandByName(commandName); // Some commands such as "showModalMessage" can be executed many // times per seconds, so we should only display this message in