From dd6eec6a0311b4c54128e538adbb3d41dd0100e9 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Fri, 30 Jun 2023 10:30:29 +0100 Subject: [PATCH] Tools: Apply rule @typescript-eslint/ban-types --- .eslintrc.js | 1 + packages/app-cli/app/base-command.ts | 3 +++ packages/app-cli/app/command-sync.ts | 1 + packages/app-cli/app/services/plugins/PluginRunner.ts | 2 ++ packages/app-cli/app/setupCommand.ts | 1 + packages/app-cli/app/utils/testUtils.ts | 1 + packages/app-desktop/InteropServiceHelper.ts | 1 + packages/app-desktop/bridge.ts | 2 ++ packages/app-desktop/gui/Button/Button.tsx | 1 + packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx | 3 +++ packages/app-desktop/gui/ConfigScreen/Sidebar.tsx | 1 + .../gui/ConfigScreen/controls/plugins/PluginsStates.tsx | 4 ++++ .../gui/ConfigScreen/controls/plugins/SearchPlugins.tsx | 1 + .../ConfigScreen/controls/plugins/useOnInstallHandler.ts | 1 + packages/app-desktop/gui/Dialog.tsx | 2 ++ .../app-desktop/gui/DialogButtonRow/useKeyboardHandler.ts | 2 ++ packages/app-desktop/gui/EditFolderDialog/Dialog.tsx | 1 + packages/app-desktop/gui/HelpButton.tsx | 1 + packages/app-desktop/gui/IconButton.tsx | 1 + packages/app-desktop/gui/ItemList.tsx | 3 +++ packages/app-desktop/gui/MainScreen/MainScreen.tsx | 3 +++ .../app-desktop/gui/MainScreen/commands/gotoAnything.ts | 1 + packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx | 1 + packages/app-desktop/gui/MenuBar.tsx | 2 ++ packages/app-desktop/gui/MultiNoteActions.tsx | 1 + packages/app-desktop/gui/NoteContentPropertiesDialog.tsx | 2 ++ .../gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx | 1 + .../gui/NoteEditor/NoteBody/CodeMirror/utils/useKeymap.ts | 4 ++-- .../NoteBody/CodeMirror/utils/useScrollHandler.ts | 1 + .../gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx | 2 ++ .../NoteEditor/NoteBody/TinyMCE/utils/openEditDialog.ts | 1 + .../NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.ts | 1 + .../gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.ts | 1 + packages/app-desktop/gui/NoteEditor/utils/contextMenu.ts | 3 +++ .../app-desktop/gui/NoteEditor/utils/contextMenuUtils.ts | 4 ++++ packages/app-desktop/gui/NoteEditor/utils/types.ts | 4 ++++ packages/app-desktop/gui/NoteEditor/utils/useFormNote.ts | 2 ++ .../app-desktop/gui/NoteEditor/utils/useMessageHandler.ts | 1 + .../app-desktop/gui/NoteEditor/utils/useSearchMarkers.ts | 1 + .../gui/NoteEditor/utils/useWindowCommandHandler.ts | 5 +++++ packages/app-desktop/gui/NoteList/types.ts | 1 + packages/app-desktop/gui/NotePropertiesDialog.tsx | 4 ++++ packages/app-desktop/gui/NoteRevisionViewer.tsx | 2 ++ packages/app-desktop/gui/NoteSearchBar.tsx | 4 ++++ packages/app-desktop/gui/NoteTextViewer.tsx | 2 ++ packages/app-desktop/gui/PdfViewer.tsx | 1 + packages/app-desktop/gui/PromptDialog.tsx | 1 + .../app-desktop/gui/ResizableLayout/ResizableLayout.tsx | 2 ++ .../app-desktop/gui/ResizableLayout/utils/iterateItems.ts | 1 + packages/app-desktop/gui/ResourceScreen.tsx | 1 + packages/app-desktop/gui/Root.tsx | 2 ++ packages/app-desktop/gui/SearchBar/SearchBar.tsx | 2 ++ packages/app-desktop/gui/ShareNoteDialog.tsx | 1 + packages/app-desktop/gui/Sidebar/Sidebar.tsx | 2 ++ packages/app-desktop/gui/StatusScreen/StatusScreen.tsx | 1 + packages/app-desktop/gui/SyncWizard/Dialog.tsx | 2 ++ packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx | 4 ++++ .../app-desktop/gui/lib/ToggleButton/ToggleButton.tsx | 1 + packages/app-desktop/gui/utils/NoteListUtils.ts | 1 + packages/app-desktop/plugins/GotoAnything.tsx | 2 ++ packages/app-desktop/services/commands/types.ts | 1 + packages/app-desktop/services/plugins/UserWebview.tsx | 3 +++ .../app-desktop/services/plugins/hooks/useHtmlLoader.ts | 1 + .../app-desktop/services/plugins/hooks/useScriptLoader.ts | 1 + .../services/plugins/hooks/useSubmitHandler.ts | 1 + .../services/plugins/hooks/useWebviewToPluginMessages.ts | 1 + packages/app-mobile/components/CameraView.tsx | 1 + .../components/NoteBodyViewer/NoteBodyViewer.tsx | 4 ++++ .../components/NoteBodyViewer/hooks/useOnMessage.ts | 1 + .../NoteBodyViewer/hooks/useOnResourceLongPress.ts | 1 + packages/app-mobile/components/NoteEditor/NoteEditor.tsx | 1 + .../components/ProfileSwitcher/ProfileEditor.tsx | 1 + .../components/ProfileSwitcher/ProfileSwitcher.tsx | 1 + .../app-mobile/components/biometrics/BiometricPopup.tsx | 1 + packages/app-mobile/components/screens/ConfigScreen.tsx | 1 + packages/app-mobile/components/side-menu-content.tsx | 2 ++ .../components/voiceTyping/VoiceTypingDialog.tsx | 1 + packages/app-mobile/root.tsx | 1 + packages/app-mobile/services/profiles/index.ts | 2 ++ packages/app-mobile/services/voiceTyping/vosk.android.ts | 3 +++ packages/app-mobile/setupQuickActions.ts | 1 + packages/app-mobile/utils/shareHandler.ts | 1 + packages/lib/BaseApplication.ts | 1 + packages/lib/BaseModel.ts | 2 ++ packages/lib/BaseSyncTarget.ts | 1 + packages/lib/ClipperServer.ts | 2 ++ packages/lib/Logger.ts | 7 ++++++- packages/lib/PoorManIntervals.ts | 3 +++ packages/lib/Synchronizer.ts | 2 ++ packages/lib/TaskQueue.ts | 2 ++ packages/lib/WelcomeUtils.ts | 1 + packages/lib/eventManager.ts | 7 +++++++ packages/lib/file-api.ts | 3 +++ packages/lib/htmlUtils.ts | 4 ++++ packages/lib/import-enex.ts | 3 +++ packages/lib/markdownUtils.ts | 1 + packages/lib/models/Setting.ts | 3 +++ packages/lib/ntp.ts | 1 + packages/lib/onedrive-api.ts | 1 + packages/lib/registry.ts | 1 + packages/lib/services/CommandService.ts | 5 +++++ packages/lib/services/DecryptionWorker.ts | 3 +++ packages/lib/services/ExternalEditWatcher.ts | 5 +++++ packages/lib/services/KeymapService.ts | 2 ++ packages/lib/services/NavService.ts | 4 ++++ packages/lib/services/ReportService.ts | 1 + packages/lib/services/ResourceEditWatcher/index.ts | 4 ++++ packages/lib/services/ResourceFetcher.ts | 3 +++ packages/lib/services/UndoRedoService.ts | 2 ++ packages/lib/services/commands/MenuUtils.ts | 3 +++ packages/lib/services/e2ee/EncryptionService.ts | 1 + packages/lib/services/interop/InteropService.ts | 2 ++ .../lib/services/interop/InteropService_Exporter_Md.ts | 1 + packages/lib/services/interop/types.ts | 1 + packages/lib/services/plugins/Plugin.ts | 6 ++++++ packages/lib/services/plugins/WebviewController.ts | 4 ++++ packages/lib/services/plugins/api/JoplinFilters.ts | 2 ++ packages/lib/services/plugins/api/JoplinViewsPanels.ts | 1 + packages/lib/services/plugins/api/JoplinWorkspace.ts | 4 ++++ packages/lib/services/plugins/utils/makeListener.ts | 1 + .../lib/services/plugins/utils/mapEventHandlersToIds.ts | 1 + packages/lib/services/rest/Api.ts | 4 ++++ packages/lib/services/searchengine/SearchEngine.ts | 1 + packages/lib/services/share/ShareService.test.ts | 1 + packages/lib/services/synchronizer/ItemUploader.test.ts | 1 + packages/lib/services/synchronizer/LockHandler.ts | 1 + .../services/synchronizer/Synchronizer.resources.test.ts | 1 + .../synchronizer/synchronizer_MigrationHandler.test.ts | 1 + packages/lib/shim.ts | 5 +++++ packages/lib/testing/test-utils-synchronizer.ts | 1 + packages/lib/testing/test-utils.ts | 4 ++++ packages/lib/theme.ts | 1 + packages/lib/time.ts | 1 + packages/plugin-repo-cli/commands/updateRelease.ts | 1 + packages/plugin-repo-cli/index.ts | 1 + packages/react-native-saf-x/src/index.ts | 8 ++++---- packages/renderer/HtmlToHtml.ts | 3 +++ packages/renderer/MdToHtml/rules/html_image.ts | 1 + packages/renderer/MdToHtml/rules/mermaid.ts | 3 ++- packages/renderer/htmlUtils.ts | 2 ++ packages/server/src/commands/DbCommand.ts | 1 + packages/server/src/commands/MigrateCommand.ts | 1 + packages/server/src/commands/StorageCommand.ts | 1 + packages/server/src/models/BaseModel.ts | 1 + packages/server/src/models/UserModel.ts | 2 ++ packages/server/src/routes/api/events.ts | 1 + packages/server/src/routes/index/stripe.ts | 2 ++ packages/server/src/utils/cache.ts | 2 +- packages/server/src/utils/koaIf.ts | 2 ++ packages/server/src/utils/requestUtils.ts | 1 + packages/server/src/utils/testing/testRouters.ts | 1 + packages/server/src/utils/testing/testUtils.ts | 5 +++++ packages/server/src/utils/time.ts | 1 + 153 files changed, 296 insertions(+), 9 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index dec4ec4e7d..070c14b7e3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -184,6 +184,7 @@ module.exports = { }, 'rules': { '@typescript-eslint/ban-ts-comment': ['error'], + '@typescript-eslint/ban-types': 'error', '@typescript-eslint/explicit-member-accessibility': ['error'], '@typescript-eslint/type-annotation-spacing': ['error', { 'before': false, 'after': true }], '@typescript-eslint/array-type': 'error', diff --git a/packages/app-cli/app/base-command.ts b/packages/app-cli/app/base-command.ts index ecae00668c..b8aa2c3864 100644 --- a/packages/app-cli/app/base-command.ts +++ b/packages/app-cli/app/base-command.ts @@ -54,6 +54,7 @@ export default class BaseCommand { return r[0]; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public setDispatcher(fn: Function) { this.dispatcher_ = fn; } @@ -63,6 +64,7 @@ export default class BaseCommand { return this.dispatcher_(action); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public setStdout(fn: Function) { this.stdout_ = fn; } @@ -71,6 +73,7 @@ export default class BaseCommand { if (this.stdout_) this.stdout_(text); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public setPrompt(fn: Function) { this.prompt_ = fn; } diff --git a/packages/app-cli/app/command-sync.ts b/packages/app-cli/app/command-sync.ts index 0c57c4bad0..0e13790469 100644 --- a/packages/app-cli/app/command-sync.ts +++ b/packages/app-cli/app/command-sync.ts @@ -18,6 +18,7 @@ import { pathExists, writeFile } from 'fs-extra'; class Command extends BaseCommand { private syncTargetId_: number = null; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private releaseLockFn_: Function = null; private oneDriveApiUtils_: any = null; diff --git a/packages/app-cli/app/services/plugins/PluginRunner.ts b/packages/app-cli/app/services/plugins/PluginRunner.ts index f016de0621..b149f960c5 100644 --- a/packages/app-cli/app/services/plugins/PluginRunner.ts +++ b/packages/app-cli/app/services/plugins/PluginRunner.ts @@ -65,6 +65,7 @@ export default class PluginRunner extends BasePluginRunner { } public async run(plugin: Plugin, sandbox: Global): Promise { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function, reject: Function) => { const onStarted = () => { plugin.off('started', onStarted); @@ -85,6 +86,7 @@ export default class PluginRunner extends BasePluginRunner { public async waitForSandboxCalls(): Promise { const startTime = Date.now(); + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function, reject: Function) => { const iid = setInterval(() => { if (!Object.keys(this.activeSandboxCalls_).length) { diff --git a/packages/app-cli/app/setupCommand.ts b/packages/app-cli/app/setupCommand.ts index ceda917af6..4c2de83ef1 100644 --- a/packages/app-cli/app/setupCommand.ts +++ b/packages/app-cli/app/setupCommand.ts @@ -1,5 +1,6 @@ import { _ } from '@joplin/lib/locale'; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default (cmd: any, stdout: Function, store: Function, gui: Function) => { cmd.setStdout((text: string) => { return stdout(text); diff --git a/packages/app-cli/app/utils/testUtils.ts b/packages/app-cli/app/utils/testUtils.ts index 19b84f31c1..c128e8b75c 100644 --- a/packages/app-cli/app/utils/testUtils.ts +++ b/packages/app-cli/app/utils/testUtils.ts @@ -3,6 +3,7 @@ import Folder from '@joplin/lib/models/Folder'; import BaseCommand from '../base-command'; import setupCommand from '../setupCommand'; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export const setupCommandForTesting = (CommandClass: any, stdout: Function = null): BaseCommand => { const command = new CommandClass(); setupCommand(command, stdout, null, null); diff --git a/packages/app-desktop/InteropServiceHelper.ts b/packages/app-desktop/InteropServiceHelper.ts index 0df0cc2bac..ce7361db29 100644 --- a/packages/app-desktop/InteropServiceHelper.ts +++ b/packages/app-desktop/InteropServiceHelper.ts @@ -151,6 +151,7 @@ export default class InteropServiceHelper { return `${filename}.${fileExtension}`; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public static async export(_dispatch: Function, module: Module, options: ExportNoteOptions = null) { if (!options) options = {}; diff --git a/packages/app-desktop/bridge.ts b/packages/app-desktop/bridge.ts index 01fdd26458..8f44ba1ca9 100644 --- a/packages/app-desktop/bridge.ts +++ b/packages/app-desktop/bridge.ts @@ -88,6 +88,7 @@ export class Bridge { // Perhaps the easiest would be to patch electron-context-menu to // support the renderer process again. Or possibly revert to an old // version of electron-context-menu. + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public setupContextMenu(_spellCheckerMenuItemsHandler: Function) { require('electron-context-menu')({ allWindows: [this.window()], @@ -255,6 +256,7 @@ export class Bridge { return nativeTheme.shouldUseDarkColors; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public addEventListener(name: string, fn: Function) { if (name === 'nativeThemeUpdated') { nativeTheme.on('updated', fn); diff --git a/packages/app-desktop/gui/Button/Button.tsx b/packages/app-desktop/gui/Button/Button.tsx index 53f843a158..4737d83775 100644 --- a/packages/app-desktop/gui/Button/Button.tsx +++ b/packages/app-desktop/gui/Button/Button.tsx @@ -20,6 +20,7 @@ interface Props { iconName?: string; level?: ButtonLevel; className?: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onClick?: Function; color?: string; iconAnimation?: string; diff --git a/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx b/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx index a838046c40..5c47cacab0 100644 --- a/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx +++ b/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx @@ -6,8 +6,11 @@ const styled = require('styled-components').default; interface Props { backButtonTitle?: string; hasChanges?: boolean; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onCancelClick: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onSaveClick?: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onApplyClick?: Function; } diff --git a/packages/app-desktop/gui/ConfigScreen/Sidebar.tsx b/packages/app-desktop/gui/ConfigScreen/Sidebar.tsx index b1cd98eeb8..26b24856d1 100644 --- a/packages/app-desktop/gui/ConfigScreen/Sidebar.tsx +++ b/packages/app-desktop/gui/ConfigScreen/Sidebar.tsx @@ -7,6 +7,7 @@ const styled = require('styled-components').default; interface Props { selection: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onSelectionChange: Function; sections: any[]; } diff --git a/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginsStates.tsx b/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginsStates.tsx index cb8087a1fe..d7de8911e4 100644 --- a/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginsStates.tsx +++ b/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginsStates.tsx @@ -45,9 +45,13 @@ const RepoApiErrorMessage = styled(StyledMessage)` interface Props { value: any; themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onChange: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied renderLabel: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied renderDescription: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied renderHeader: Function; } diff --git a/packages/app-desktop/gui/ConfigScreen/controls/plugins/SearchPlugins.tsx b/packages/app-desktop/gui/ConfigScreen/controls/plugins/SearchPlugins.tsx index 77c2a21f53..fe125dde5e 100644 --- a/packages/app-desktop/gui/ConfigScreen/controls/plugins/SearchPlugins.tsx +++ b/packages/app-desktop/gui/ConfigScreen/controls/plugins/SearchPlugins.tsx @@ -25,6 +25,7 @@ interface Props { onSearchQueryChange(event: OnChangeEvent): void; pluginSettings: PluginSettings; onPluginSettingsChange(event: any): void; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied renderDescription: Function; maxWidth: number; repoApi(): RepositoryApi; diff --git a/packages/app-desktop/gui/ConfigScreen/controls/plugins/useOnInstallHandler.ts b/packages/app-desktop/gui/ConfigScreen/controls/plugins/useOnInstallHandler.ts index 646d138406..2f693b4f73 100644 --- a/packages/app-desktop/gui/ConfigScreen/controls/plugins/useOnInstallHandler.ts +++ b/packages/app-desktop/gui/ConfigScreen/controls/plugins/useOnInstallHandler.ts @@ -13,6 +13,7 @@ export interface OnPluginSettingChangeEvent { type OnPluginSettingChangeHandler = (event: OnPluginSettingChangeEvent)=> void; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function(setInstallingPluginIds: Function, pluginSettings: PluginSettings, repoApi: Function, onPluginSettingsChange: OnPluginSettingChangeHandler, isUpdate: boolean) { return useCallback(async (event: ItemEvent) => { const pluginId = event.item.manifest.id; diff --git a/packages/app-desktop/gui/Dialog.tsx b/packages/app-desktop/gui/Dialog.tsx index 42dd3f23db..527c00d31d 100644 --- a/packages/app-desktop/gui/Dialog.tsx +++ b/packages/app-desktop/gui/Dialog.tsx @@ -26,8 +26,10 @@ const DialogRoot = styled.div` `; interface Props { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied renderContent: Function; className?: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onClose?: Function; } diff --git a/packages/app-desktop/gui/DialogButtonRow/useKeyboardHandler.ts b/packages/app-desktop/gui/DialogButtonRow/useKeyboardHandler.ts index 2dd4ee5982..0cb419221e 100644 --- a/packages/app-desktop/gui/DialogButtonRow/useKeyboardHandler.ts +++ b/packages/app-desktop/gui/DialogButtonRow/useKeyboardHandler.ts @@ -2,7 +2,9 @@ import { useEffect, useState, useRef, useCallback } from 'react'; import { isInsideContainer } from '@joplin/lib/dom'; interface Props { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onOkButtonClick: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onCancelButtonClick: Function; } diff --git a/packages/app-desktop/gui/EditFolderDialog/Dialog.tsx b/packages/app-desktop/gui/EditFolderDialog/Dialog.tsx index 3e5b8add10..5baf449e98 100644 --- a/packages/app-desktop/gui/EditFolderDialog/Dialog.tsx +++ b/packages/app-desktop/gui/EditFolderDialog/Dialog.tsx @@ -16,6 +16,7 @@ import FolderIconBox from '../FolderIconBox'; interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; folderId: string; parentId: string; diff --git a/packages/app-desktop/gui/HelpButton.tsx b/packages/app-desktop/gui/HelpButton.tsx index 7ac916db61..def9515012 100644 --- a/packages/app-desktop/gui/HelpButton.tsx +++ b/packages/app-desktop/gui/HelpButton.tsx @@ -5,6 +5,7 @@ import { AppState } from '../app.reducer'; interface Props { tip: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onClick: Function; themeId: number; style: any; diff --git a/packages/app-desktop/gui/IconButton.tsx b/packages/app-desktop/gui/IconButton.tsx index de86301d07..7e230fc147 100644 --- a/packages/app-desktop/gui/IconButton.tsx +++ b/packages/app-desktop/gui/IconButton.tsx @@ -5,6 +5,7 @@ interface Props { themeId: number; style: any; iconName: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onClick: Function; } diff --git a/packages/app-desktop/gui/ItemList.tsx b/packages/app-desktop/gui/ItemList.tsx index f5c95bbf39..9ffe360f1d 100644 --- a/packages/app-desktop/gui/ItemList.tsx +++ b/packages/app-desktop/gui/ItemList.tsx @@ -5,9 +5,12 @@ interface Props { itemHeight: number; items: any[]; disabled?: boolean; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onKeyDown?: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied itemRenderer: Function; className?: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onNoteDrop?: Function; } diff --git a/packages/app-desktop/gui/MainScreen/MainScreen.tsx b/packages/app-desktop/gui/MainScreen/MainScreen.tsx index f5bf87737c..4ed7444d74 100644 --- a/packages/app-desktop/gui/MainScreen/MainScreen.tsx +++ b/packages/app-desktop/gui/MainScreen/MainScreen.tsx @@ -57,6 +57,7 @@ interface Props { pluginHtmlContents: PluginHtmlContents; pluginsLoaded: boolean; hasNotesBeingSaved: boolean; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; mainLayout: LayoutItem; style: any; @@ -121,6 +122,7 @@ class MainScreenComponent extends React.Component { private isPrinting_: boolean; private styleKey_: string; private styles_: any; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private promptOnClose_: Function; public constructor(props: Props) { @@ -514,6 +516,7 @@ class MainScreenComponent extends React.Component { return this.styles_; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private renderNotificationMessage(message: string, callForAction: string, callForActionHandler: Function, callForAction2: string = null, callForActionHandler2: Function = null) { const theme = themeStyle(this.props.themeId); const urlStyle: any = { color: theme.colorWarnUrl, textDecoration: 'underline' }; diff --git a/packages/app-desktop/gui/MainScreen/commands/gotoAnything.ts b/packages/app-desktop/gui/MainScreen/commands/gotoAnything.ts index 8309219f28..f6b5812c98 100644 --- a/packages/app-desktop/gui/MainScreen/commands/gotoAnything.ts +++ b/packages/app-desktop/gui/MainScreen/commands/gotoAnything.ts @@ -29,6 +29,7 @@ export const runtime = (): CommandRuntime => { } else if (uiType === UiType.CommandPalette) { menuItemById('commandPalette').click(); } else if (uiType === UiType.ControlledApi) { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function, reject: Function) => { const menuItem = PluginManager.instance().menuItems().find((i: any) => i.id === 'controlledApi'); menuItem.userData = { diff --git a/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx b/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx index 60a5ea3631..d04d188b4c 100644 --- a/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx +++ b/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx @@ -14,6 +14,7 @@ import { PasswordInput } from '../PasswordInput/PasswordInput'; interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; } diff --git a/packages/app-desktop/gui/MenuBar.tsx b/packages/app-desktop/gui/MenuBar.tsx index 79589d4f4b..042f02bec5 100644 --- a/packages/app-desktop/gui/MenuBar.tsx +++ b/packages/app-desktop/gui/MenuBar.tsx @@ -54,6 +54,7 @@ function getPluginCommandNames(plugins: PluginStates): string[] { return output; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function createPluginMenuTree(label: string, menuItems: MenuItem[], onMenuItemClick: Function) { const output: any = { label: label, @@ -108,6 +109,7 @@ const useSwitchProfileMenuItems = (profileConfig: ProfileConfig, menuItemDic: an }; interface Props { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; menuItemProps: any; routeName: string; diff --git a/packages/app-desktop/gui/MultiNoteActions.tsx b/packages/app-desktop/gui/MultiNoteActions.tsx index a431f5f7ac..6290ed35eb 100644 --- a/packages/app-desktop/gui/MultiNoteActions.tsx +++ b/packages/app-desktop/gui/MultiNoteActions.tsx @@ -9,6 +9,7 @@ interface MultiNoteActionsProps { themeId: number; selectedNoteIds: string[]; notes: any[]; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; watchedNoteFiles: string[]; plugins: PluginStates; diff --git a/packages/app-desktop/gui/NoteContentPropertiesDialog.tsx b/packages/app-desktop/gui/NoteContentPropertiesDialog.tsx index 1ec58b918a..e942c5adcd 100644 --- a/packages/app-desktop/gui/NoteContentPropertiesDialog.tsx +++ b/packages/app-desktop/gui/NoteContentPropertiesDialog.tsx @@ -10,6 +10,7 @@ interface NoteContentPropertiesDialogProps { themeId: number; text: string; markupLanguage: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onClose: Function; } @@ -28,6 +29,7 @@ function markupToHtml() { return markupToHtml_; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function countElements(text: string, wordSetter: Function, characterSetter: Function, characterNoSpaceSetter: Function, lineSetter: Function) { Countable.count(text, (counter: any) => { wordSetter(counter.words); diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx index 5a4eefee2c..ec71561b8b 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.tsx @@ -62,6 +62,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) { const editorRef = useRef(null); const rootRef = useRef(null); const webviewRef = useRef(null); + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const props_onChangeRef = useRef(null); props_onChangeRef.current = props.onChange; diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useKeymap.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useKeymap.ts index d545b49387..ccdb4498ad 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useKeymap.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useKeymap.ts @@ -30,7 +30,7 @@ export default function useKeymap(CodeMirror: any) { } // Converts a command of the form editor.command to just command - function editorCommandToCodeMirror(command: String) { + function editorCommandToCodeMirror(command: string) { return command.slice(7); // 7 is the length of editor. } @@ -38,7 +38,7 @@ export default function useKeymap(CodeMirror: any) { // CodeMirror requires a - between keys while Electron want's a + // CodeMirror doesn't recognize Option (it uses Alt instead) // CodeMirror requires Shift to be first - function normalizeAccelerator(accelerator: String) { + function normalizeAccelerator(accelerator: string) { const command = accelerator.replace(/\+/g, '-').replace('Option', 'Alt'); // From here is taken out of codemirror/lib/codemirror.js const parts = command.split(/-(?!$)/); diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useScrollHandler.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useScrollHandler.ts index a30ac08081..93fe2c2d1c 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useScrollHandler.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useScrollHandler.ts @@ -1,6 +1,7 @@ import { useCallback, useRef } from 'react'; import shim from '@joplin/lib/shim'; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function useScrollHandler(editorRef: any, webviewRef: any, onScroll: Function) { const scrollTimeoutId_ = useRef(null); const scrollPercent_ = useRef(0); diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx index 2e86858939..0827ebf502 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx @@ -905,9 +905,11 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { // Need to save the onChange handler to a ref to make sure // we call the current one from setTimeout. // https://github.com/facebook/react/issues/14010#issuecomment-433788147 + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const props_onChangeRef = useRef(); props_onChangeRef.current = props.onChange; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const prop_htmlToMarkdownRef = useRef(); prop_htmlToMarkdownRef.current = props.htmlToMarkdown; diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/openEditDialog.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/openEditDialog.ts index b69b5ab0ee..c0a6d7f507 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/openEditDialog.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/openEditDialog.ts @@ -77,6 +77,7 @@ function editableInnerHtml(html: string): string { return editable[0].innerHTML; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function openEditDialog(editor: any, markupToHtml: any, dispatchDidUpdate: Function, editable: any) { const source = editable ? findBlockSource(editable) : newBlockSource(); diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.ts index b151c491fd..85559ebd43 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.ts @@ -41,6 +41,7 @@ interface ContextMenuActionOptions { const contextMenuActionOptions: ContextMenuActionOptions = { current: null }; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function(editor: any, plugins: PluginStates, dispatch: Function) { useEffect(() => { if (!editor) return () => {}; diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.ts index 72f344af90..3604acebf6 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.ts @@ -3,6 +3,7 @@ import shim from '@joplin/lib/shim'; interface HookDependencies { editor: any; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onScroll: Function; } diff --git a/packages/app-desktop/gui/NoteEditor/utils/contextMenu.ts b/packages/app-desktop/gui/NoteEditor/utils/contextMenu.ts index 6d946f151d..029f2b499a 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/contextMenu.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/contextMenu.ts @@ -30,6 +30,7 @@ async function saveFileData(data: any, filename: string) { await writeFile(newFilePath, data); } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export async function openItemById(itemId: string, dispatch: Function, hash = '') { const item = await BaseItem.loadItemById(itemId); @@ -68,6 +69,7 @@ export async function openItemById(itemId: string, dispatch: Function, hash = '' } } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export function menuItems(dispatch: Function): ContextMenuItems { return { open: { @@ -194,6 +196,7 @@ export function menuItems(dispatch: Function): ContextMenuItems { }; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default async function contextMenu(options: ContextMenuOptions, dispatch: Function) { const menu = new Menu(); diff --git a/packages/app-desktop/gui/NoteEditor/utils/contextMenuUtils.ts b/packages/app-desktop/gui/NoteEditor/utils/contextMenuUtils.ts index 967e320064..79169806bf 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/contextMenuUtils.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/contextMenuUtils.ts @@ -17,14 +17,18 @@ export interface ContextMenuOptions { linkToCopy: string; textToCopy: string; htmlToCopy: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied insertContent: Function; isReadOnly?: boolean; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied fireEditorEvent: Function; } export interface ContextMenuItem { label: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onAction: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied isActive: Function; } diff --git a/packages/app-desktop/gui/NoteEditor/utils/types.ts b/packages/app-desktop/gui/NoteEditor/utils/types.ts index ced6549c58..4daaae8c04 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/types.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/types.ts @@ -18,6 +18,7 @@ export interface NoteEditorProps { // style: any; noteId: string; themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; selectedNoteIds: string[]; selectedFolderId: string; @@ -59,9 +60,11 @@ export interface NoteBodyEditorProps { onMessage(event: any): void; onScroll(event: any): void; markupToHtml: (markupLanguage: MarkupLanguage, markup: string, options: MarkupToHtmlOptions)=> Promise; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied htmlToMarkdown: Function; allAssets: (markupLanguage: MarkupLanguage, options: AllAssetsOptions)=> Promise; disabled: boolean; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; noteToolbar: any; setLocalSearchResultCount(count: number): void; @@ -70,6 +73,7 @@ export interface NoteBodyEditorProps { keyboardMode: string; resourceInfos: ResourceInfos; locale: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onDrop: Function; noteToolbarButtonInfos: ToolbarButtonInfo[]; plugins: PluginStates; diff --git a/packages/app-desktop/gui/NoteEditor/utils/useFormNote.ts b/packages/app-desktop/gui/NoteEditor/utils/useFormNote.ts index 5299479460..e742e9be4d 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useFormNote.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useFormNote.ts @@ -28,6 +28,7 @@ interface HookDependencies { onAfterLoad(event: OnLoadEvent): void; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function installResourceChangeHandler(onResourceChangeHandler: Function) { ResourceFetcher.instance().on('downloadComplete', onResourceChangeHandler); ResourceFetcher.instance().on('downloadStarted', onResourceChangeHandler); @@ -35,6 +36,7 @@ function installResourceChangeHandler(onResourceChangeHandler: Function) { ResourceEditWatcher.instance().on('resourceChange', onResourceChangeHandler); } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function uninstallResourceChangeHandler(onResourceChangeHandler: Function) { ResourceFetcher.instance().off('downloadComplete', onResourceChangeHandler); ResourceFetcher.instance().off('downloadStarted', onResourceChangeHandler); diff --git a/packages/app-desktop/gui/NoteEditor/utils/useMessageHandler.ts b/packages/app-desktop/gui/NoteEditor/utils/useMessageHandler.ts index 8e2cea5e56..57c9a8c71d 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useMessageHandler.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useMessageHandler.ts @@ -7,6 +7,7 @@ import ResourceFetcher from '@joplin/lib/services/ResourceFetcher'; import { reg } from '@joplin/lib/registry'; const bridge = require('@electron/remote').require('./bridge').default; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function useMessageHandler(scrollWhenReady: any, setScrollWhenReady: Function, editorRef: any, setLocalSearchResultCount: Function, dispatch: Function, formNote: FormNote) { return useCallback(async (event: any) => { const msg = event.channel ? event.channel : ''; diff --git a/packages/app-desktop/gui/NoteEditor/utils/useSearchMarkers.ts b/packages/app-desktop/gui/NoteEditor/utils/useSearchMarkers.ts index 402c39b883..84f78e9fd0 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useSearchMarkers.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useSearchMarkers.ts @@ -24,6 +24,7 @@ function defaultSearchMarkers(): SearchMarkers { } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function useSearchMarkers(showLocalSearch: boolean, localSearchMarkerOptions: Function, searches: any[], selectedSearchId: string, highlightedWords: any[] = []) { return useMemo((): SearchMarkers => { if (showLocalSearch) return localSearchMarkerOptions(); diff --git a/packages/app-desktop/gui/NoteEditor/utils/useWindowCommandHandler.ts b/packages/app-desktop/gui/NoteEditor/utils/useWindowCommandHandler.ts index 9893032ad7..52f877d8b8 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useWindowCommandHandler.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useWindowCommandHandler.ts @@ -15,15 +15,20 @@ const commandsWithDependencies = [ interface HookDependencies { formNote: FormNote; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied setShowLocalSearch: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; noteSearchBarRef: any; editorRef: any; titleInputRef: any; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied saveNoteAndWait: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied setFormNote: Function; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function editorCommandRuntime(declaration: CommandDeclaration, editorRef: any, setFormNote: Function): CommandRuntime { const markdownEditorOnly = !Object.keys(joplinCommandToTinyMceCommands).includes(declaration.name); diff --git a/packages/app-desktop/gui/NoteList/types.ts b/packages/app-desktop/gui/NoteList/types.ts index df219c4d4f..f4544e8c80 100644 --- a/packages/app-desktop/gui/NoteList/types.ts +++ b/packages/app-desktop/gui/NoteList/types.ts @@ -5,6 +5,7 @@ export interface Props { themeId: any; selectedNoteIds: string[]; notes: NoteEntity[]; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; watchedNoteFiles: any[]; plugins: PluginStates; diff --git a/packages/app-desktop/gui/NotePropertiesDialog.tsx b/packages/app-desktop/gui/NotePropertiesDialog.tsx index 15005807b8..c22a57a338 100644 --- a/packages/app-desktop/gui/NotePropertiesDialog.tsx +++ b/packages/app-desktop/gui/NotePropertiesDialog.tsx @@ -13,7 +13,9 @@ const formatcoords = require('formatcoords'); interface Props { noteId: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onClose: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onRevisionLinkClick: Function; themeId: number; } @@ -210,6 +212,7 @@ class NotePropertiesDialog extends React.Component { public async saveProperty() { if (!this.state.editedKey) return; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function) => { const newFormNote = { ...this.state.formNote }; @@ -234,6 +237,7 @@ class NotePropertiesDialog extends React.Component { } public async cancelProperty() { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function) => { this.okButton.current.focus(); this.setState({ diff --git a/packages/app-desktop/gui/NoteRevisionViewer.tsx b/packages/app-desktop/gui/NoteRevisionViewer.tsx index c4c766db26..5800089999 100644 --- a/packages/app-desktop/gui/NoteRevisionViewer.tsx +++ b/packages/app-desktop/gui/NoteRevisionViewer.tsx @@ -22,6 +22,7 @@ import shared from '@joplin/lib/components/shared/note-screen-shared'; interface Props { themeId: number; noteId: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onBack: Function; customCss: string; } @@ -36,6 +37,7 @@ interface State { class NoteRevisionViewerComponent extends React.PureComponent { private viewerRef_: any; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private helpButton_onClick: Function; public constructor(props: Props) { diff --git a/packages/app-desktop/gui/NoteSearchBar.tsx b/packages/app-desktop/gui/NoteSearchBar.tsx index 395bb8f644..55c8ec1166 100644 --- a/packages/app-desktop/gui/NoteSearchBar.tsx +++ b/packages/app-desktop/gui/NoteSearchBar.tsx @@ -4,9 +4,13 @@ import { _ } from '@joplin/lib/locale'; interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onNext: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onPrevious: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onClose: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onChange: Function; query: string; searching: boolean; diff --git a/packages/app-desktop/gui/NoteTextViewer.tsx b/packages/app-desktop/gui/NoteTextViewer.tsx index 67a4c758ae..c2dbd36377 100644 --- a/packages/app-desktop/gui/NoteTextViewer.tsx +++ b/packages/app-desktop/gui/NoteTextViewer.tsx @@ -3,7 +3,9 @@ import * as React from 'react'; import { reg } from '@joplin/lib/registry'; interface Props { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onDomReady: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onIpcMessage: Function; viewerStyle: any; contentMaxWidth?: number; diff --git a/packages/app-desktop/gui/PdfViewer.tsx b/packages/app-desktop/gui/PdfViewer.tsx index 8bec4b2771..b8acd71b07 100644 --- a/packages/app-desktop/gui/PdfViewer.tsx +++ b/packages/app-desktop/gui/PdfViewer.tsx @@ -27,6 +27,7 @@ const IFrame = styled.iframe` interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; resource: any; pageNo: number; diff --git a/packages/app-desktop/gui/PromptDialog.tsx b/packages/app-desktop/gui/PromptDialog.tsx index aeb4e9d36b..f76a2a0066 100644 --- a/packages/app-desktop/gui/PromptDialog.tsx +++ b/packages/app-desktop/gui/PromptDialog.tsx @@ -12,6 +12,7 @@ interface Props { visible: boolean; style: any; buttons: any[]; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onClose: Function; inputType: string; description: string; diff --git a/packages/app-desktop/gui/ResizableLayout/ResizableLayout.tsx b/packages/app-desktop/gui/ResizableLayout/ResizableLayout.tsx index a514a8bc51..e01bebb977 100644 --- a/packages/app-desktop/gui/ResizableLayout/ResizableLayout.tsx +++ b/packages/app-desktop/gui/ResizableLayout/ResizableLayout.tsx @@ -20,6 +20,7 @@ interface Props { onResize(event: OnResizeEvent): void; width?: number; height?: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied renderItem: Function; onMoveButtonClick(event: MoveButtonClickEvent): void; moveMode: boolean; @@ -32,6 +33,7 @@ function itemVisible(item: LayoutItem, moveMode: boolean) { return item.visible !== false; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function renderContainer(item: LayoutItem, parent: LayoutItem | null, sizes: LayoutItemSizes, resizedItemMaxSize: Size | null, onResizeStart: Function, onResize: Function, onResizeStop: Function, children: any[], isLastChild: boolean, moveMode: boolean): any { const style: any = { display: itemVisible(item, moveMode) ? 'flex' : 'none', diff --git a/packages/app-desktop/gui/ResizableLayout/utils/iterateItems.ts b/packages/app-desktop/gui/ResizableLayout/utils/iterateItems.ts index a1cd65e440..5121f8a2d7 100644 --- a/packages/app-desktop/gui/ResizableLayout/utils/iterateItems.ts +++ b/packages/app-desktop/gui/ResizableLayout/utils/iterateItems.ts @@ -8,6 +8,7 @@ export default function iterateItems(layout: LayoutItem, callback: ItemItemCallb const result = callback(0, layout, null); if (result === false) return; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function recurseFind(item: LayoutItem, callback: Function): boolean { if (item.children) { for (let childIndex = 0; childIndex < item.children.length; childIndex++) { diff --git a/packages/app-desktop/gui/ResourceScreen.tsx b/packages/app-desktop/gui/ResourceScreen.tsx index 7557df2ce0..6bf7cb3e50 100644 --- a/packages/app-desktop/gui/ResourceScreen.tsx +++ b/packages/app-desktop/gui/ResourceScreen.tsx @@ -16,6 +16,7 @@ interface Style { interface Props { themeId: number; style: Style; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; } diff --git a/packages/app-desktop/gui/Root.tsx b/packages/app-desktop/gui/Root.tsx index f017a3c6d6..0e7797a299 100644 --- a/packages/app-desktop/gui/Root.tsx +++ b/packages/app-desktop/gui/Root.tsx @@ -34,6 +34,7 @@ const bridge = require('@electron/remote').require('./bridge').default; interface Props { themeId: number; appState: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; size: Size; zoomFactor: number; @@ -51,6 +52,7 @@ interface ModalDialogProps { interface RegisteredDialogProps { themeId: number; key: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; } diff --git a/packages/app-desktop/gui/SearchBar/SearchBar.tsx b/packages/app-desktop/gui/SearchBar/SearchBar.tsx index d4514c47d7..d759f139fd 100644 --- a/packages/app-desktop/gui/SearchBar/SearchBar.tsx +++ b/packages/app-desktop/gui/SearchBar/SearchBar.tsx @@ -21,6 +21,7 @@ export const Root = styled.div` interface Props { inputRef?: any; notesParentType: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch?: Function; selectedNoteId: string; isFocused?: boolean; @@ -32,6 +33,7 @@ function SearchBar(props: Props) { const searchId = useRef(uuid.create()); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function search(searchId: string, query: string, dispatch: Function) { dispatch({ type: 'SEARCH_UPDATE', diff --git a/packages/app-desktop/gui/ShareNoteDialog.tsx b/packages/app-desktop/gui/ShareNoteDialog.tsx index ba78948ae7..c7753fa15f 100644 --- a/packages/app-desktop/gui/ShareNoteDialog.tsx +++ b/packages/app-desktop/gui/ShareNoteDialog.tsx @@ -21,6 +21,7 @@ const { clipboard } = require('electron'); interface Props { themeId: number; noteIds: string[]; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onClose: Function; shares: StateShare[]; syncTargetId: number; diff --git a/packages/app-desktop/gui/Sidebar/Sidebar.tsx b/packages/app-desktop/gui/Sidebar/Sidebar.tsx index d0b19525be..bba188af36 100644 --- a/packages/app-desktop/gui/Sidebar/Sidebar.tsx +++ b/packages/app-desktop/gui/Sidebar/Sidebar.tsx @@ -51,6 +51,7 @@ const StyledSpanFix = styled.span` interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; folders: any[]; collapsedFolderIds: string[]; @@ -571,6 +572,7 @@ const SidebarComponent = (props: Props) => { ); }; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const renderHeader = (key: string, label: string, iconName: string, contextMenuHandler: Function = null, onPlusButtonClick: Function = null, extraProps: any = {}) => { const headerClick = extraProps.onClick || null; delete extraProps.onClick; diff --git a/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx b/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx index a314d51f0f..07f92aa090 100644 --- a/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx +++ b/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx @@ -15,6 +15,7 @@ import styled from 'styled-components'; interface Props { themeId: string; style: any; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; } diff --git a/packages/app-desktop/gui/SyncWizard/Dialog.tsx b/packages/app-desktop/gui/SyncWizard/Dialog.tsx index 222f4b36aa..e5a0d5b323 100644 --- a/packages/app-desktop/gui/SyncWizard/Dialog.tsx +++ b/packages/app-desktop/gui/SyncWizard/Dialog.tsx @@ -16,6 +16,7 @@ import StyledLink from '../style/StyledLink'; interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; } @@ -150,6 +151,7 @@ export default function(props: Props) { const [joplinCloudPassword, setJoplinCloudPassword] = useState(''); const [joplinCloudLoginInProgress, setJoplinCloudLoginInProgress] = useState(false); + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function closeDialog(dispatch: Function) { dispatch({ type: 'DIALOG_CLOSE', diff --git a/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx b/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx index f6b3289846..88a54852e1 100644 --- a/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx +++ b/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx @@ -36,9 +36,13 @@ interface Props { inputRef?: any; value: string; onChange(event: OnChangeEvent): void; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onFocus?: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onBlur?: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onKeyDown?: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onSearchButtonClick: Function; searchStarted: boolean; placeholder?: string; diff --git a/packages/app-desktop/gui/lib/ToggleButton/ToggleButton.tsx b/packages/app-desktop/gui/lib/ToggleButton/ToggleButton.tsx index 92214fcae8..80450f3300 100644 --- a/packages/app-desktop/gui/lib/ToggleButton/ToggleButton.tsx +++ b/packages/app-desktop/gui/lib/ToggleButton/ToggleButton.tsx @@ -5,6 +5,7 @@ const Color = require('color'); interface Props { value: boolean; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onToggle: Function; themeId: number; } diff --git a/packages/app-desktop/gui/utils/NoteListUtils.ts b/packages/app-desktop/gui/utils/NoteListUtils.ts index b268901443..84b8a896e7 100644 --- a/packages/app-desktop/gui/utils/NoteListUtils.ts +++ b/packages/app-desktop/gui/utils/NoteListUtils.ts @@ -18,6 +18,7 @@ const { clipboard } = require('electron'); interface ContextMenuProps { notes: any[]; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; watchedNoteFiles: string[]; plugins: PluginStates; diff --git a/packages/app-desktop/plugins/GotoAnything.tsx b/packages/app-desktop/plugins/GotoAnything.tsx index d031343825..cd0cdc4cd1 100644 --- a/packages/app-desktop/plugins/GotoAnything.tsx +++ b/packages/app-desktop/plugins/GotoAnything.tsx @@ -37,6 +37,7 @@ interface SearchResult { interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; folders: any[]; showCompletedTodos: boolean; @@ -61,6 +62,7 @@ interface CommandQuery { class GotoAnything { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public dispatch: Function; public static Dialog: any; public static manifest: any; diff --git a/packages/app-desktop/services/commands/types.ts b/packages/app-desktop/services/commands/types.ts index 78f2f31389..71e4911678 100644 --- a/packages/app-desktop/services/commands/types.ts +++ b/packages/app-desktop/services/commands/types.ts @@ -2,5 +2,6 @@ import { AppState } from '../../app.reducer'; export interface DesktopCommandContext { state: AppState; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; } diff --git a/packages/app-desktop/services/plugins/UserWebview.tsx b/packages/app-desktop/services/plugins/UserWebview.tsx index 373287c33e..5686c6aa36 100644 --- a/packages/app-desktop/services/plugins/UserWebview.tsx +++ b/packages/app-desktop/services/plugins/UserWebview.tsx @@ -23,8 +23,11 @@ export interface Props { fitToContent?: boolean; borderBottom?: boolean; theme?: any; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onSubmit?: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onDismiss?: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onReady?: Function; } diff --git a/packages/app-desktop/services/plugins/hooks/useHtmlLoader.ts b/packages/app-desktop/services/plugins/hooks/useHtmlLoader.ts index 46e6402a9e..7a6e609d8f 100644 --- a/packages/app-desktop/services/plugins/hooks/useHtmlLoader.ts +++ b/packages/app-desktop/services/plugins/hooks/useHtmlLoader.ts @@ -1,6 +1,7 @@ import { useEffect, useState, useMemo } from 'react'; const md5 = require('md5'); +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function(frameWindow: any, isReady: boolean, postMessage: Function, html: string) { const [loadedHtmlHash, setLoadedHtmlHash] = useState(''); diff --git a/packages/app-desktop/services/plugins/hooks/useScriptLoader.ts b/packages/app-desktop/services/plugins/hooks/useScriptLoader.ts index 434e845fbb..37874827b8 100644 --- a/packages/app-desktop/services/plugins/hooks/useScriptLoader.ts +++ b/packages/app-desktop/services/plugins/hooks/useScriptLoader.ts @@ -1,5 +1,6 @@ import { useEffect } from 'react'; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function(postMessage: Function, isReady: boolean, scripts: string[], cssFilePath: string) { useEffect(() => { if (!isReady) return; diff --git a/packages/app-desktop/services/plugins/hooks/useSubmitHandler.ts b/packages/app-desktop/services/plugins/hooks/useSubmitHandler.ts index cfad798176..87dd816a59 100644 --- a/packages/app-desktop/services/plugins/hooks/useSubmitHandler.ts +++ b/packages/app-desktop/services/plugins/hooks/useSubmitHandler.ts @@ -1,5 +1,6 @@ import { useEffect } from 'react'; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function(frameWindow: any, onSubmit: Function, onDismiss: Function, loadedHtmlHash: string) { useEffect(() => { if (!frameWindow) return () => {}; diff --git a/packages/app-desktop/services/plugins/hooks/useWebviewToPluginMessages.ts b/packages/app-desktop/services/plugins/hooks/useWebviewToPluginMessages.ts index 41c37fb995..6d24a0361f 100644 --- a/packages/app-desktop/services/plugins/hooks/useWebviewToPluginMessages.ts +++ b/packages/app-desktop/services/plugins/hooks/useWebviewToPluginMessages.ts @@ -1,6 +1,7 @@ import PostMessageService, { MessageResponse, ResponderComponentType } from '@joplin/lib/services/PostMessageService'; import { useEffect } from 'react'; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function(frameWindow: any, isReady: boolean, pluginId: string, viewId: string, postMessage: Function) { useEffect(() => { PostMessageService.instance().registerResponder(ResponderComponentType.UserWebview, viewId, (message: MessageResponse) => { diff --git a/packages/app-mobile/components/CameraView.tsx b/packages/app-mobile/components/CameraView.tsx index a69457ad65..2d31d3f2b8 100644 --- a/packages/app-mobile/components/CameraView.tsx +++ b/packages/app-mobile/components/CameraView.tsx @@ -86,6 +86,7 @@ class CameraView extends Component { } } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public renderButton(onPress: Function, iconNameOrIcon: any, style: any) { let icon = null; diff --git a/packages/app-mobile/components/NoteBodyViewer/NoteBodyViewer.tsx b/packages/app-mobile/components/NoteBodyViewer/NoteBodyViewer.tsx index 3816137505..7a1519cdf3 100644 --- a/packages/app-mobile/components/NoteBodyViewer/NoteBodyViewer.tsx +++ b/packages/app-mobile/components/NoteBodyViewer/NoteBodyViewer.tsx @@ -19,9 +19,13 @@ interface Props { noteResources: any; paddingBottom: number; noteHash: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onJoplinLinkClick: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onCheckboxChange?: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onMarkForDownload?: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onLoadEnd?: Function; } diff --git a/packages/app-mobile/components/NoteBodyViewer/hooks/useOnMessage.ts b/packages/app-mobile/components/NoteBodyViewer/hooks/useOnMessage.ts index ab2736d1d3..88df0732f6 100644 --- a/packages/app-mobile/components/NoteBodyViewer/hooks/useOnMessage.ts +++ b/packages/app-mobile/components/NoteBodyViewer/hooks/useOnMessage.ts @@ -1,6 +1,7 @@ import { useCallback } from 'react'; import shared from '@joplin/lib/components/shared/note-screen-shared'; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function useOnMessage(onCheckboxChange: Function, noteBody: string, onMarkForDownload: Function, onJoplinLinkClick: Function, onResourceLongPress: Function) { return useCallback((event: any) => { // 2021-05-19: Historically this was unescaped twice as it was diff --git a/packages/app-mobile/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts b/packages/app-mobile/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts index 2c5af459d7..18117a49f3 100644 --- a/packages/app-mobile/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts +++ b/packages/app-mobile/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts @@ -8,6 +8,7 @@ import Resource from '@joplin/lib/models/Resource'; import { copyToCache } from '../../../utils/ShareUtils'; const Share = require('react-native-share').default; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function useOnResourceLongPress(onJoplinLinkClick: Function, dialogBoxRef: any) { return useCallback(async (msg: string) => { try { diff --git a/packages/app-mobile/components/NoteEditor/NoteEditor.tsx b/packages/app-mobile/components/NoteEditor/NoteEditor.tsx index 209270f156..5cb7a045a7 100644 --- a/packages/app-mobile/components/NoteEditor/NoteEditor.tsx +++ b/packages/app-mobile/components/NoteEditor/NoteEditor.tsx @@ -314,6 +314,7 @@ function NoteEditor(props: Props, ref: any) { const msg = JSON.parse(data); + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const handlers: Record = { onLog: (event: any) => { // eslint-disable-next-line no-console diff --git a/packages/app-mobile/components/ProfileSwitcher/ProfileEditor.tsx b/packages/app-mobile/components/ProfileSwitcher/ProfileEditor.tsx index 6adc08b8ac..fee506b823 100644 --- a/packages/app-mobile/components/ProfileSwitcher/ProfileEditor.tsx +++ b/packages/app-mobile/components/ProfileSwitcher/ProfileEditor.tsx @@ -19,6 +19,7 @@ interface Navigation { interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; navigation: Navigation; } diff --git a/packages/app-mobile/components/ProfileSwitcher/ProfileSwitcher.tsx b/packages/app-mobile/components/ProfileSwitcher/ProfileSwitcher.tsx index b44f326176..e7b6f91188 100644 --- a/packages/app-mobile/components/ProfileSwitcher/ProfileSwitcher.tsx +++ b/packages/app-mobile/components/ProfileSwitcher/ProfileSwitcher.tsx @@ -14,6 +14,7 @@ const { themeStyle } = require('../global-style'); interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; } diff --git a/packages/app-mobile/components/biometrics/BiometricPopup.tsx b/packages/app-mobile/components/biometrics/BiometricPopup.tsx index 1d5b19ab94..3f4f267340 100644 --- a/packages/app-mobile/components/biometrics/BiometricPopup.tsx +++ b/packages/app-mobile/components/biometrics/BiometricPopup.tsx @@ -12,6 +12,7 @@ const logger = Logger.create('BiometricPopup'); interface Props { themeId: number; sensorInfo: SensorInfo; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; } diff --git a/packages/app-mobile/components/screens/ConfigScreen.tsx b/packages/app-mobile/components/screens/ConfigScreen.tsx index 0ba494e55f..7e99f24bcf 100644 --- a/packages/app-mobile/components/screens/ConfigScreen.tsx +++ b/packages/app-mobile/components/screens/ConfigScreen.tsx @@ -457,6 +457,7 @@ class ConfigScreenComponent extends BaseScreenComponent { ); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private renderToggle(key: string, label: string, value: any, updateSettingValue: Function, descriptionComp: any = null) { const theme = themeStyle(this.props.themeId); diff --git a/packages/app-mobile/components/side-menu-content.tsx b/packages/app-mobile/components/side-menu-content.tsx index 0a112fbcf6..586e1b416a 100644 --- a/packages/app-mobile/components/side-menu-content.tsx +++ b/packages/app-mobile/components/side-menu-content.tsx @@ -23,6 +23,7 @@ Icon.loadFont().catch((error: any) => { console.info(error); }); interface Props { syncStarted: boolean; themeId: number; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; collapsedFolderIds: string[]; syncReport: any; @@ -371,6 +372,7 @@ const SideMenuContentComponent = (props: Props) => { ); }; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const renderSidebarButton = (key: string, title: string, iconName: string, onPressHandler: Function = null, selected = false) => { let icon = ; diff --git a/packages/app-mobile/components/voiceTyping/VoiceTypingDialog.tsx b/packages/app-mobile/components/voiceTyping/VoiceTypingDialog.tsx index 5684ec59bc..e08506bcdb 100644 --- a/packages/app-mobile/components/voiceTyping/VoiceTypingDialog.tsx +++ b/packages/app-mobile/components/voiceTyping/VoiceTypingDialog.tsx @@ -82,6 +82,7 @@ export default (props: Props) => { }, [recorder, props.onDismiss]); const renderContent = () => { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const components: Record = { [RecorderState.Loading]: () => _('Loading...'), [RecorderState.Recording]: () => _('Please record your voice...'), diff --git a/packages/app-mobile/root.tsx b/packages/app-mobile/root.tsx index b0ed0b302a..bff7dba904 100644 --- a/packages/app-mobile/root.tsx +++ b/packages/app-mobile/root.tsx @@ -410,6 +410,7 @@ function decryptionWorker_resourceMetadataButNotBlobDecrypted() { ResourceFetcher.instance().scheduleAutoAddResources(); } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied async function initialize(dispatch: Function) { shimInit(); diff --git a/packages/app-mobile/services/profiles/index.ts b/packages/app-mobile/services/profiles/index.ts index c2a46f11c9..3d7cd059f4 100644 --- a/packages/app-mobile/services/profiles/index.ts +++ b/packages/app-mobile/services/profiles/index.ts @@ -6,7 +6,9 @@ import { Profile, ProfileConfig } from '@joplin/lib/services/profileConfig/types import { loadProfileConfig as libLoadProfileConfig, saveProfileConfig as libSaveProfileConfig } from '@joplin/lib/services/profileConfig/index'; import RNFetchBlob from 'rn-fetch-blob'; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied let dispatch_: Function = null; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export const setDispatch = (dispatch: Function) => { dispatch_ = dispatch; }; diff --git a/packages/app-mobile/services/voiceTyping/vosk.android.ts b/packages/app-mobile/services/voiceTyping/vosk.android.ts index a0b911c166..59e73a7f8f 100644 --- a/packages/app-mobile/services/voiceTyping/vosk.android.ts +++ b/packages/app-mobile/services/voiceTyping/vosk.android.ts @@ -147,7 +147,9 @@ export const startRecording = (vosk: Vosk, options: StartOptions): Recorder => { const result: string[] = []; const eventHandlers: any[] = []; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied let finalResultPromiseResolve: Function = null; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied let finalResultPromiseReject: Function = null; let finalResultTimeout = false; @@ -213,6 +215,7 @@ export const startRecording = (vosk: Vosk, options: StartOptions): Recorder => { completeRecording('', new Error('Could not process your message. Please try again.')); }, 5000); + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function, reject: Function) => { finalResultPromiseResolve = resolve; finalResultPromiseReject = reject; diff --git a/packages/app-mobile/setupQuickActions.ts b/packages/app-mobile/setupQuickActions.ts index 4edfbf8525..29c702ba99 100644 --- a/packages/app-mobile/setupQuickActions.ts +++ b/packages/app-mobile/setupQuickActions.ts @@ -11,6 +11,7 @@ type TData = { type: string; }; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default (dispatch: Function, folderId: string) => { const userInfo = { url: '' }; QuickActions.setShortcutItems([ diff --git a/packages/app-mobile/utils/shareHandler.ts b/packages/app-mobile/utils/shareHandler.ts index b4b654b25d..b66acecb82 100644 --- a/packages/app-mobile/utils/shareHandler.ts +++ b/packages/app-mobile/utils/shareHandler.ts @@ -7,6 +7,7 @@ const { ToastAndroid } = require('react-native'); const { PermissionsAndroid } = require('react-native'); const { Platform } = require('react-native'); +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default async (sharedData: SharedData, folderId: string, dispatch: Function) => { if (!!sharedData.resources && sharedData.resources.length > 0) { diff --git a/packages/lib/BaseApplication.ts b/packages/lib/BaseApplication.ts index 06bf20f9a7..a983b764b4 100644 --- a/packages/lib/BaseApplication.ts +++ b/packages/lib/BaseApplication.ts @@ -309,6 +309,7 @@ export default class BaseApplication { }; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { return this.eventEmitter_.on(eventName, callback); } diff --git a/packages/lib/BaseModel.ts b/packages/lib/BaseModel.ts index 110ae79474..92d29482ee 100644 --- a/packages/lib/BaseModel.ts +++ b/packages/lib/BaseModel.ts @@ -81,6 +81,7 @@ class BaseModel { public static TYPE_SMART_FILTER = ModelType.SmartFilter; public static TYPE_COMMAND = ModelType.Command; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public static dispatch: Function = function() {}; private static saveMutexes_: any = {}; @@ -430,6 +431,7 @@ class BaseModel { return mutex; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public static releaseSaveMutex(modelOrId: any, release: Function) { if (!release) return; if (!modelOrId) return release(); diff --git a/packages/lib/BaseSyncTarget.ts b/packages/lib/BaseSyncTarget.ts index 10c93a05b6..f114a18ceb 100644 --- a/packages/lib/BaseSyncTarget.ts +++ b/packages/lib/BaseSyncTarget.ts @@ -7,6 +7,7 @@ import ShareService from './services/share/ShareService'; export default class BaseSyncTarget { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public static dispatch: Function = () => {}; private synchronizer_: Synchronizer = null; diff --git a/packages/lib/ClipperServer.ts b/packages/lib/ClipperServer.ts index 714c00803d..e5998f0935 100644 --- a/packages/lib/ClipperServer.ts +++ b/packages/lib/ClipperServer.ts @@ -20,6 +20,7 @@ export default class ClipperServer { private server_: any = null; private port_: number = null; private api_: Api = null; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private dispatch_: Function; private static instance_: ClipperServer = null; @@ -52,6 +53,7 @@ export default class ClipperServer { return this.logger_; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public setDispatch(d: Function) { this.dispatch_ = d; } diff --git a/packages/lib/Logger.ts b/packages/lib/Logger.ts index 880d947dc1..66fdf66db6 100644 --- a/packages/lib/Logger.ts +++ b/packages/lib/Logger.ts @@ -40,9 +40,13 @@ interface Target extends TargetOptions { } export interface LoggerWrapper { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied debug: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied info: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied warn: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied error: Function; } @@ -248,8 +252,9 @@ class Logger { // because that would slow down the main process, especially // when many log operations are being done (eg. during sync in // dev mode). + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied let release: Function = null; - // eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied + /* eslint-disable-next-line promise/prefer-await-to-then, @typescript-eslint/ban-types -- Old code before rule was applied, Old code before rule was applied */ writeToFileMutex_.acquire().then((r: Function) => { release = r; return Logger.fsDriver().appendFile(target.path, `${line.join(': ')}\n`, 'utf8'); diff --git a/packages/lib/PoorManIntervals.ts b/packages/lib/PoorManIntervals.ts index 87b2cc2468..a2a1c89fb0 100644 --- a/packages/lib/PoorManIntervals.ts +++ b/packages/lib/PoorManIntervals.ts @@ -12,6 +12,7 @@ type IntervalId = number; interface Interval { id: IntervalId; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied callback: Function; interval: number; lastIntervalTime: number; @@ -29,6 +30,7 @@ export default class PoorManIntervals { private static intervalId_: IntervalId = 0; private static intervals_: Intervals = {}; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public static setInterval(callback: Function, interval: number): IntervalId { if (interval <= this.maxNativeTimerDuration_) return setInterval(callback, interval); @@ -46,6 +48,7 @@ export default class PoorManIntervals { return id; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public static setTimeout(callback: Function, interval: number): IntervalId { if (interval <= this.maxNativeTimerDuration_) return setTimeout(callback, interval); diff --git a/packages/lib/Synchronizer.ts b/packages/lib/Synchronizer.ts index ed8c619f3a..dacaafe742 100644 --- a/packages/lib/Synchronizer.ts +++ b/packages/lib/Synchronizer.ts @@ -72,9 +72,11 @@ export default class Synchronizer { // such as cancelling in the middle of a loop. public testingHooks_: string[] = []; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private onProgress_: Function; private progressReport_: any = {}; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public dispatch: Function; public constructor(db: JoplinDatabase, api: FileApi, appType: AppType) { diff --git a/packages/lib/TaskQueue.ts b/packages/lib/TaskQueue.ts index 7831b7a1c8..b251dfd6ba 100644 --- a/packages/lib/TaskQueue.ts +++ b/packages/lib/TaskQueue.ts @@ -4,6 +4,7 @@ import Logger from './Logger'; interface Task { id: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied callback: Function; } @@ -32,6 +33,7 @@ export default class TaskQueue { return Setting.value('sync.maxConcurrentConnections'); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public push(id: string, callback: Function) { if (this.stopping_) throw new Error('Cannot push task when queue is stopping'); diff --git a/packages/lib/WelcomeUtils.ts b/packages/lib/WelcomeUtils.ts index 5f2f4733fa..4fe2872f23 100644 --- a/packages/lib/WelcomeUtils.ts +++ b/packages/lib/WelcomeUtils.ts @@ -99,6 +99,7 @@ class WelcomeUtils { return output; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public static async install(locale: string, dispatch: Function) { if (!Setting.value('welcome.enabled')) { Setting.setValue('welcome.wasBuilt', true); diff --git a/packages/lib/eventManager.ts b/packages/lib/eventManager.ts index 116f4e4107..79450f6568 100644 --- a/packages/lib/eventManager.ts +++ b/packages/lib/eventManager.ts @@ -21,6 +21,7 @@ export class EventManager { this.appStateListeners_ = {}; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { return this.emitter_.on(eventName, callback); } @@ -29,18 +30,22 @@ export class EventManager { return this.emitter_.emit(eventName, object); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public removeListener(eventName: string, callback: Function) { return this.emitter_.removeListener(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public off(eventName: string, callback: Function) { return this.removeListener(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public filterOn(filterName: string, callback: Function) { return this.emitter_.on(`filter:${filterName}`, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public filterOff(filterName: string, callback: Function) { return this.removeListener(`filter:${filterName}`, callback); } @@ -67,6 +72,7 @@ export class EventManager { return output; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public appStateOn(propName: string, callback: Function) { if (!this.appStateListeners_[propName]) { this.appStateListeners_[propName] = []; @@ -76,6 +82,7 @@ export class EventManager { this.appStateListeners_[propName].push(callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public appStateOff(propName: string, callback: Function) { if (!this.appStateListeners_[propName]) { throw new Error('EventManager: Trying to unregister a state prop watch for a non-watched prop (1)'); diff --git a/packages/lib/file-api.ts b/packages/lib/file-api.ts index 0a4b31038b..cbd8f07e4d 100644 --- a/packages/lib/file-api.ts +++ b/packages/lib/file-api.ts @@ -60,6 +60,7 @@ function requestCanBeRepeated(error: any) { return true; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied async function tryAndRepeat(fn: Function, count: number) { let retryCount = 0; @@ -99,6 +100,7 @@ class FileApi { private remoteDateMutex_ = new Mutex(); private initialized_ = false; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public constructor(baseDir: string | Function, driver: any) { this.baseDir_ = baseDir; this.driver_ = driver; @@ -397,6 +399,7 @@ function basicDeltaContextFromOptions_(options: any) { // This is the basic delta algorithm, which can be used in case the cloud service does not have // a built-in delta API. OneDrive and Dropbox have one for example, but Nextcloud and obviously // the file system do not. +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied async function basicDelta(path: string, getDirStatFn: Function, options: any) { const outputLimit = 50; const itemIds = await options.allItemIdsHandler(); diff --git a/packages/lib/htmlUtils.ts b/packages/lib/htmlUtils.ts index c5bcf66a64..bd61f7fd26 100644 --- a/packages/lib/htmlUtils.ts +++ b/packages/lib/htmlUtils.ts @@ -85,6 +85,7 @@ class HtmlUtils { return html.replace(htmlReg, `:/${id}`); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public replaceImageUrls(html: string, callback: Function) { return this.processImageTags(html, (data: any) => { const newSrc = callback(data.src); @@ -95,6 +96,7 @@ class HtmlUtils { }); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public replaceEmbedUrls(html: string, callback: Function) { if (!html) return ''; // We are adding the link as since joplin disabled , tags due to security reasons. @@ -110,6 +112,7 @@ class HtmlUtils { return html; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public replaceMediaUrls(html: string, callback: Function) { html = this.replaceImageUrls(html, callback); html = this.replaceEmbedUrls(html, callback); @@ -121,6 +124,7 @@ class HtmlUtils { // file path is going to be used, it will need to be unescaped first. The // transformed SRC, must also be escaped before being sent back to this // function. + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public processImageTags(html: string, callback: Function) { if (!html) return ''; diff --git a/packages/lib/import-enex.ts b/packages/lib/import-enex.ts index 006620b794..1d9738bdb5 100644 --- a/packages/lib/import-enex.ts +++ b/packages/lib/import-enex.ts @@ -224,7 +224,9 @@ async function saveNoteTags(note: ExtractedNote) { interface ImportOptions { fuzzyMatching?: boolean; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onProgress?: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onError?: Function; outputFormat?: string; } @@ -326,6 +328,7 @@ export default async function importEnex(parentFolderId: string, filePath: strin if (!('onProgress' in importOptions)) importOptions.onProgress = function() {}; if (!('onError' in importOptions)) importOptions.onError = function() {}; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function handleSaxStreamEvent(fn: Function) { return function(...args: any[]) { // Pass the parser to the wrapped function for debugging purposes diff --git a/packages/lib/markdownUtils.ts b/packages/lib/markdownUtils.ts index 36ffceb555..1927dc9c12 100644 --- a/packages/lib/markdownUtils.ts +++ b/packages/lib/markdownUtils.ts @@ -16,6 +16,7 @@ export enum MarkdownTableJustify { export interface MarkdownTableHeader { name: string; label: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied filter?: Function; disableEscape?: boolean; justify?: MarkdownTableJustify; diff --git a/packages/lib/models/Setting.ts b/packages/lib/models/Setting.ts index c2481f0c48..07e530c12f 100644 --- a/packages/lib/models/Setting.ts +++ b/packages/lib/models/Setting.ts @@ -57,6 +57,7 @@ export interface SettingItem { isEnum?: boolean; section?: string; label?(): string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied description?: Function; options?(): any; optionsOrder?(): string[]; @@ -69,6 +70,7 @@ export interface SettingItem { maximum?: number; step?: number; onClick?(): void; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied unitLabel?: Function; needRestart?: boolean; autoSave?: boolean; @@ -207,6 +209,7 @@ const defaultMigrations: DefaultMigration[] = [ interface UserSettingMigration { oldName: string; newName: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied transformValue: Function; } diff --git a/packages/lib/ntp.ts b/packages/lib/ntp.ts index 972d32911b..6e8606de30 100644 --- a/packages/lib/ntp.ts +++ b/packages/lib/ntp.ts @@ -22,6 +22,7 @@ const parseNtpServer = (ntpServer: string): NtpServer => { }; export async function getNetworkTime(ntpServer: string): Promise { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function, reject: Function) => { const s = parseNtpServer(ntpServer); ntpClient().getNetworkTime(s.domain, s.port, (error: any, date: Date) => { diff --git a/packages/lib/onedrive-api.ts b/packages/lib/onedrive-api.ts index 5c75793327..554282f3c9 100644 --- a/packages/lib/onedrive-api.ts +++ b/packages/lib/onedrive-api.ts @@ -44,6 +44,7 @@ export default class OneDriveApi { } } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { this.listeners_[eventName].push(callback); } diff --git a/packages/lib/registry.ts b/packages/lib/registry.ts index 4490460ec9..7bf067707f 100644 --- a/packages/lib/registry.ts +++ b/packages/lib/registry.ts @@ -93,6 +93,7 @@ class Registry { if (delay === null) delay = 1000 * 10; if (syncOptions === null) syncOptions = {}; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied let promiseResolve: Function = null; const promise = new Promise((resolve) => { promiseResolve = resolve; diff --git a/packages/lib/services/CommandService.ts b/packages/lib/services/CommandService.ts index 89b1c1c578..979c515353 100644 --- a/packages/lib/services/CommandService.ts +++ b/packages/lib/services/CommandService.ts @@ -10,6 +10,7 @@ type EnabledCondition = string; 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; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; } @@ -102,8 +103,10 @@ export default class CommandService extends BaseService { private commands_: Commands = {}; private store_: any; private devMode_: boolean; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private stateToWhenClauseContext_: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public initialize(store: any, devMode: boolean, stateToWhenClauseContext: Function) { utils.store = store; this.store_ = store; @@ -111,10 +114,12 @@ export default class CommandService extends BaseService { this.stateToWhenClauseContext_ = stateToWhenClauseContext; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { eventManager.on(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public off(eventName: string, callback: Function) { eventManager.off(eventName, callback); } diff --git a/packages/lib/services/DecryptionWorker.ts b/packages/lib/services/DecryptionWorker.ts index 7be7303c06..3e30ff0455 100644 --- a/packages/lib/services/DecryptionWorker.ts +++ b/packages/lib/services/DecryptionWorker.ts @@ -23,6 +23,7 @@ export default class DecryptionWorker { private state_ = 'idle'; private logger_: Logger; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public dispatch: Function = () => {}; private scheduleId_: any = null; private eventEmitter_: any; @@ -45,10 +46,12 @@ export default class DecryptionWorker { return this.logger_; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { return this.eventEmitter_.on(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public off(eventName: string, callback: Function) { return this.eventEmitter_.removeListener(eventName, callback); } diff --git a/packages/lib/services/ExternalEditWatcher.ts b/packages/lib/services/ExternalEditWatcher.ts index d18b98e955..31a6b9f00e 100644 --- a/packages/lib/services/ExternalEditWatcher.ts +++ b/packages/lib/services/ExternalEditWatcher.ts @@ -12,7 +12,9 @@ const { ErrorNotFound } = require('./rest/utils/errors'); export default class ExternalEditWatcher { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private dispatch: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private bridge_: Function; private logger_: Logger = new Logger(); private watcher_: any = null; @@ -28,6 +30,7 @@ export default class ExternalEditWatcher { return this.instance_; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public initialize(bridge: Function, dispatch: Function) { this.bridge_ = bridge; this.dispatch = dispatch; @@ -59,10 +62,12 @@ export default class ExternalEditWatcher { return Setting.value('profileDir'); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { return this.eventEmitter_.on(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public off(eventName: string, callback: Function) { return this.eventEmitter_.removeListener(eventName, callback); } diff --git a/packages/lib/services/KeymapService.ts b/packages/lib/services/KeymapService.ts index d4d5540cea..a1f95ebda4 100644 --- a/packages/lib/services/KeymapService.ts +++ b/packages/lib/services/KeymapService.ts @@ -410,10 +410,12 @@ export default class KeymapService extends BaseService { return parts.join('+'); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { eventManager.on(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public off(eventName: string, callback: Function) { eventManager.off(eventName, callback); } diff --git a/packages/lib/services/NavService.ts b/packages/lib/services/NavService.ts index c399e5e55b..ea7783d515 100644 --- a/packages/lib/services/NavService.ts +++ b/packages/lib/services/NavService.ts @@ -1,6 +1,8 @@ export default class NavService { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public static dispatch: Function = () => {}; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private static handlers_: Function[] = []; public static async go(routeName: string) { @@ -15,6 +17,7 @@ export default class NavService { }); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public static addHandler(handler: Function) { for (let i = this.handlers_.length - 1; i >= 0; i--) { const h = this.handlers_[i]; @@ -24,6 +27,7 @@ export default class NavService { this.handlers_.push(handler); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public static removeHandler(hanlder: Function) { for (let i = this.handlers_.length - 1; i >= 0; i--) { const h = this.handlers_[i]; diff --git a/packages/lib/services/ReportService.ts b/packages/lib/services/ReportService.ts index d927a73d66..fe2d83ef98 100644 --- a/packages/lib/services/ReportService.ts +++ b/packages/lib/services/ReportService.ts @@ -143,6 +143,7 @@ export default class ReportService { } private addRetryAllHandler(section: ReportSection): ReportSection { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const retryHandlers: Function[] = []; for (let i = 0; i < section.body.length; i++) { diff --git a/packages/lib/services/ResourceEditWatcher/index.ts b/packages/lib/services/ResourceEditWatcher/index.ts index 9971605fb4..adf2759851 100644 --- a/packages/lib/services/ResourceEditWatcher/index.ts +++ b/packages/lib/services/ResourceEditWatcher/index.ts @@ -28,6 +28,7 @@ export default class ResourceEditWatcher { private static instance_: ResourceEditWatcher; private logger_: any; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private dispatch: Function; private watcher_: any; private chokidar_: any; @@ -44,6 +45,7 @@ export default class ResourceEditWatcher { this.eventEmitter_ = new EventEmitter(); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public initialize(logger: any, dispatch: Function, openItem: OpenItemFn) { this.logger_ = logger; this.dispatch = dispatch; @@ -69,10 +71,12 @@ export default class ResourceEditWatcher { return this.logger_; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { return this.eventEmitter_.on(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public off(eventName: string, callback: Function) { return this.eventEmitter_.removeListener(eventName, callback); } diff --git a/packages/lib/services/ResourceFetcher.ts b/packages/lib/services/ResourceFetcher.ts index 8976d525c8..f54295c9bb 100644 --- a/packages/lib/services/ResourceFetcher.ts +++ b/packages/lib/services/ResourceFetcher.ts @@ -11,6 +11,7 @@ export default class ResourceFetcher extends BaseService { public static instance_: ResourceFetcher; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public dispatch: Function = (_o: any) => {}; private logger_: Logger = new Logger(); private queue_: any[] = []; @@ -35,10 +36,12 @@ export default class ResourceFetcher extends BaseService { return ResourceFetcher.instance_; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { return this.eventEmitter_.on(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public off(eventName: string, callback: Function) { return this.eventEmitter_.removeListener(eventName, callback); } diff --git a/packages/lib/services/UndoRedoService.ts b/packages/lib/services/UndoRedoService.ts index 2ce21901ac..fb154c1619 100644 --- a/packages/lib/services/UndoRedoService.ts +++ b/packages/lib/services/UndoRedoService.ts @@ -39,10 +39,12 @@ export default class UndoRedoService { this.push = this.push.bind(this); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { return this.eventEmitter.on(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public off(eventName: string, callback: Function) { return this.eventEmitter.removeListener(eventName, callback); } diff --git a/packages/lib/services/commands/MenuUtils.ts b/packages/lib/services/commands/MenuUtils.ts index e8d0d4ed64..975723f920 100644 --- a/packages/lib/services/commands/MenuUtils.ts +++ b/packages/lib/services/commands/MenuUtils.ts @@ -9,6 +9,7 @@ const { createCachedSelector } = require('re-reselect'); export interface MenuItem { id?: string; label?: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied click?: Function; role?: any; type?: string; @@ -74,6 +75,7 @@ export default class MenuUtils { return KeymapService.instance(); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public commandToMenuItem(commandName: string, onClick: Function): MenuItem { const command = this.service.commandByName(commandName); @@ -99,6 +101,7 @@ export default class MenuUtils { }); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public commandsToMenuItems(commandNames: string[], onClick: Function, locale: string): MenuItems { const key = `${this.keymapService.lastSaveTime}_${commandNames.join('_')}_${locale}`; if (this.menuItemCache_[key]) return this.menuItemCache_[key]; diff --git a/packages/lib/services/e2ee/EncryptionService.ts b/packages/lib/services/e2ee/EncryptionService.ts index 985ab9380c..3e835a7539 100644 --- a/packages/lib/services/e2ee/EncryptionService.ts +++ b/packages/lib/services/e2ee/EncryptionService.ts @@ -43,6 +43,7 @@ export enum EncryptionMethod { export interface EncryptOptions { encryptionMethod?: EncryptionMethod; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onProgress?: Function; encryptionHandler?: EncryptionCustomHandler; masterKeyId?: string; diff --git a/packages/lib/services/interop/InteropService.ts b/packages/lib/services/interop/InteropService.ts index 70ba9db95a..de111ef9d9 100644 --- a/packages/lib/services/interop/InteropService.ts +++ b/packages/lib/services/interop/InteropService.ts @@ -31,10 +31,12 @@ export default class InteropService { this.eventEmitter_ = new EventEmitter(); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { return this.eventEmitter_.on(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public off(eventName: string, callback: Function) { return this.eventEmitter_.removeListener(eventName, callback); } diff --git a/packages/lib/services/interop/InteropService_Exporter_Md.ts b/packages/lib/services/interop/InteropService_Exporter_Md.ts index 2038867c58..f4595fecf7 100644 --- a/packages/lib/services/interop/InteropService_Exporter_Md.ts +++ b/packages/lib/services/interop/InteropService_Exporter_Md.ts @@ -66,6 +66,7 @@ export default class InteropService_Exporter_Md extends InteropService_Exporter_ return await this.replaceItemIdsByRelativePaths_(noteBody, linkedNoteIds, notePaths, createRelativePath); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private async replaceItemIdsByRelativePaths_(noteBody: string, linkedItemIds: string[], paths: any, fn_createRelativePath: Function) { let newBody = noteBody; diff --git a/packages/lib/services/interop/types.ts b/packages/lib/services/interop/types.ts index 8561d03410..c5925a83a8 100644 --- a/packages/lib/services/interop/types.ts +++ b/packages/lib/services/interop/types.ts @@ -60,6 +60,7 @@ export interface Module { importerClass?: string; outputFormat?: ImportModuleOutputFormat; isDefault?: boolean; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied fullLabel?: Function; // Used only if `isCustom` is true diff --git a/packages/lib/services/plugins/Plugin.ts b/packages/lib/services/plugins/Plugin.ts index 3ff2bc9628..95fe3995c7 100644 --- a/packages/lib/services/plugins/Plugin.ts +++ b/packages/lib/services/plugins/Plugin.ts @@ -28,14 +28,18 @@ export default class Plugin { private scriptText_: string; private viewControllers_: ViewControllers = {}; private contentScripts_: ContentScripts = {}; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private dispatch_: Function; private eventEmitter_: any; private devMode_ = false; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private messageListener_: Function = null; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private contentScriptMessageListeners_: Record = {}; private dataDir_: string; private dataDirCreated_ = false; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public constructor(baseDir: string, manifest: PluginManifest, scriptText: string, dispatch: Function, dataDir: string) { this.baseDir_ = shim.fsDriver().resolve(baseDir); this.manifest_ = manifest; @@ -84,10 +88,12 @@ export default class Plugin { return Object.keys(this.viewControllers_).length; } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public on(eventName: string, callback: Function) { return this.eventEmitter_.on(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public off(eventName: string, callback: Function) { return this.eventEmitter_.removeListener(eventName, callback); } diff --git a/packages/lib/services/plugins/WebviewController.ts b/packages/lib/services/plugins/WebviewController.ts index f57723536b..a9a948b865 100644 --- a/packages/lib/services/plugins/WebviewController.ts +++ b/packages/lib/services/plugins/WebviewController.ts @@ -14,7 +14,9 @@ export interface Options { } interface CloseResponse { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied resolve: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied reject: Function; } @@ -41,6 +43,7 @@ function findItemByKey(layout: any, key: string): any { export default class WebviewController extends ViewController { private baseDir_: string; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private messageListener_: Function = null; private closeResponse_: CloseResponse = null; @@ -165,6 +168,7 @@ export default class WebviewController extends ViewController { this.setStoreProp('opened', true); + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function, reject: Function) => { this.closeResponse_ = { resolve, reject }; }); diff --git a/packages/lib/services/plugins/api/JoplinFilters.ts b/packages/lib/services/plugins/api/JoplinFilters.ts index 139e61c67d..df47bb54c6 100644 --- a/packages/lib/services/plugins/api/JoplinFilters.ts +++ b/packages/lib/services/plugins/api/JoplinFilters.ts @@ -9,10 +9,12 @@ import eventManager from '../../../eventManager'; * so for now disable filters. */ export default class JoplinFilters { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public async on(name: string, callback: Function) { eventManager.filterOn(name, callback); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public async off(name: string, callback: Function) { eventManager.filterOff(name, callback); } diff --git a/packages/lib/services/plugins/api/JoplinViewsPanels.ts b/packages/lib/services/plugins/api/JoplinViewsPanels.ts index 8f4a9ff5b7..019413219f 100644 --- a/packages/lib/services/plugins/api/JoplinViewsPanels.ts +++ b/packages/lib/services/plugins/api/JoplinViewsPanels.ts @@ -76,6 +76,7 @@ export default class JoplinViewsPanels { * demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/post_messages) for more details. * */ + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public async onMessage(handle: ViewHandle, callback: Function): Promise { return this.controller(handle).onMessage(callback); } diff --git a/packages/lib/services/plugins/api/JoplinWorkspace.ts b/packages/lib/services/plugins/api/JoplinWorkspace.ts index 9eccdf16dd..11334e8db2 100644 --- a/packages/lib/services/plugins/api/JoplinWorkspace.ts +++ b/packages/lib/services/plugins/api/JoplinWorkspace.ts @@ -68,6 +68,7 @@ export default class JoplinWorkspace { /** * Called when a new note or notes are selected. */ + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public async onNoteSelectionChange(callback: Function): Promise { eventManager.appStateOn('selectedNoteIds', callback); @@ -84,6 +85,7 @@ export default class JoplinWorkspace { * Called when the content of a note changes. * @deprecated Use `onNoteChange()` instead, which is reliably triggered whenever the note content, or any note property changes. */ + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public async onNoteContentChange(callback: Function) { eventManager.on('noteContentChange', callback); } @@ -116,6 +118,7 @@ export default class JoplinWorkspace { /** * Called when an alarm associated with a to-do is triggered. */ + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public async onNoteAlarmTrigger(handler: Function): Promise { return makeListener(eventManager, 'noteAlarmTrigger', handler); } @@ -130,6 +133,7 @@ export default class JoplinWorkspace { /** * Called when the synchronisation process has finished. */ + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public async onSyncComplete(callback: Function): Promise { return makeListener(eventManager, 'syncComplete', callback); } diff --git a/packages/lib/services/plugins/utils/makeListener.ts b/packages/lib/services/plugins/utils/makeListener.ts index 104c644f47..b32017b822 100644 --- a/packages/lib/services/plugins/utils/makeListener.ts +++ b/packages/lib/services/plugins/utils/makeListener.ts @@ -1,6 +1,7 @@ import { EventManager } from '../../../eventManager'; import { Disposable } from '../api/types'; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function(eventManager: EventManager, eventName: string, callback: Function): Disposable { eventManager.on(eventName, callback); diff --git a/packages/lib/services/plugins/utils/mapEventHandlersToIds.ts b/packages/lib/services/plugins/utils/mapEventHandlersToIds.ts index 7e826f0d0a..165dba15c3 100644 --- a/packages/lib/services/plugins/utils/mapEventHandlersToIds.ts +++ b/packages/lib/services/plugins/utils/mapEventHandlersToIds.ts @@ -1,6 +1,7 @@ let eventHandlerIndex_ = 1; export interface EventHandlers { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied [key: string]: Function; } diff --git a/packages/lib/services/rest/Api.ts b/packages/lib/services/rest/Api.ts index d83dd93d1b..3de65a6477 100644 --- a/packages/lib/services/rest/Api.ts +++ b/packages/lib/services/rest/Api.ts @@ -73,6 +73,7 @@ interface AuthToken { } export interface RequestContext { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; authToken: AuthToken; token: string; @@ -86,13 +87,16 @@ interface ResourceNameToRoute { export default class Api { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private token_: string | Function; private authToken_: AuthToken = null; private knownNounces_: any = {}; private actionApi_: any; private resourceNameToRoute_: ResourceNameToRoute = {}; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private dispatch_: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public constructor(token: string | Function = null, dispatch: Function = null, actionApi: any = null) { this.token_ = token; this.actionApi_ = actionApi; diff --git a/packages/lib/services/searchengine/SearchEngine.ts b/packages/lib/services/searchengine/SearchEngine.ts index c588f299e8..fcaf941db6 100644 --- a/packages/lib/services/searchengine/SearchEngine.ts +++ b/packages/lib/services/searchengine/SearchEngine.ts @@ -44,6 +44,7 @@ export default class SearchEngine { public static SEARCH_TYPE_NONLATIN_SCRIPT = SearchType.Nonlatin; public static SEARCH_TYPE_FTS = SearchType.Fts; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public dispatch: Function = (_o: any) => {}; private logger_ = new Logger(); private db_: any = null; diff --git a/packages/lib/services/share/ShareService.test.ts b/packages/lib/services/share/ShareService.test.ts index ccfa55a1be..609430d260 100644 --- a/packages/lib/services/share/ShareService.test.ts +++ b/packages/lib/services/share/ShareService.test.ts @@ -79,6 +79,7 @@ describe('ShareService', () => { } }); + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function testShareFolderService(extraExecHandlers: Record = {}, options: TestShareFolderServiceOptions = {}) { return mockService({ exec: async (method: string, path: string, query: Record, body: any) => { diff --git a/packages/lib/services/synchronizer/ItemUploader.test.ts b/packages/lib/services/synchronizer/ItemUploader.test.ts index 0d2cd3fc37..d7b6b2cc2b 100644 --- a/packages/lib/services/synchronizer/ItemUploader.test.ts +++ b/packages/lib/services/synchronizer/ItemUploader.test.ts @@ -18,6 +18,7 @@ function newFakeApi(): FileApi { return { supportsMultiPut: true } as any; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function newFakeApiCall(callRecorder: ApiCall[], itemBodyCallback: Function = null): ApiCallFunction { const apiCall = async (callName: string, ...args: any[]): Promise => { callRecorder.push({ name: callName, args }); diff --git a/packages/lib/services/synchronizer/LockHandler.ts b/packages/lib/services/synchronizer/LockHandler.ts index 823ad6cd61..0f20048261 100644 --- a/packages/lib/services/synchronizer/LockHandler.ts +++ b/packages/lib/services/synchronizer/LockHandler.ts @@ -348,6 +348,7 @@ export default class LockHandler { return this.api_.remoteDate(); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public startAutoLockRefresh(lock: Lock, errorHandler: Function): string { const handle = this.autoLockRefreshHandle(lock); if (this.refreshTimers_[handle]) { diff --git a/packages/lib/services/synchronizer/Synchronizer.resources.test.ts b/packages/lib/services/synchronizer/Synchronizer.resources.test.ts index 2b75f1f4ca..4eff62bc63 100644 --- a/packages/lib/services/synchronizer/Synchronizer.resources.test.ts +++ b/packages/lib/services/synchronizer/Synchronizer.resources.test.ts @@ -76,6 +76,7 @@ describe('Synchronizer.resources', () => { const fetcher = new ResourceFetcher(() => { return { // Simulate a failed download + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied get: () => { return new Promise((_resolve: Function, reject: Function) => { reject(new Error('did not work')); }); }, }; }); diff --git a/packages/lib/services/synchronizer/synchronizer_MigrationHandler.test.ts b/packages/lib/services/synchronizer/synchronizer_MigrationHandler.test.ts index 9f777c9943..329fb861f3 100644 --- a/packages/lib/services/synchronizer/synchronizer_MigrationHandler.test.ts +++ b/packages/lib/services/synchronizer/synchronizer_MigrationHandler.test.ts @@ -33,6 +33,7 @@ function migrationHandler(clientId = 'abcd'): MigrationHandler { } interface MigrationTests { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied [key: string]: Function; } diff --git a/packages/lib/shim.ts b/packages/lib/shim.ts index 29520a3295..b97be62f2e 100644 --- a/packages/lib/shim.ts +++ b/packages/lib/shim.ts @@ -31,6 +31,7 @@ const shim = { }, msleep_: (ms: number) => { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function) => { shim.setTimeout(() => { resolve(null); @@ -156,6 +157,7 @@ const shim = { return previous; }, + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied fetchWithRetry: async function(fetchFn: Function, options: any = null) { if (!options) options = {}; if (!options.timeout) options.timeout = 1000 * 120; // ms @@ -218,6 +220,7 @@ const shim = { throw new Error('Not implemented'); }, + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied detectAndSetLocale: null as Function, attachFileToNote: async (_note: any, _filePath: string): Promise => { @@ -303,10 +306,12 @@ const shim = { // // Having the timers wrapped in that way would also make it easier to debug timing issue and // find out what timers have been fired or not. + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied setTimeout: (_fn: Function, _interval: number) => { throw new Error('Not implemented'); }, + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied setInterval: (_fn: Function, _interval: number) => { throw new Error('Not implemented'); }, diff --git a/packages/lib/testing/test-utils-synchronizer.ts b/packages/lib/testing/test-utils-synchronizer.ts index d4e422c25f..d150509a2b 100644 --- a/packages/lib/testing/test-utils-synchronizer.ts +++ b/packages/lib/testing/test-utils-synchronizer.ts @@ -37,6 +37,7 @@ export async function remoteResources() { return remoteItemsByTypes([BaseModel.TYPE_RESOURCE]); } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export async function localNotesFoldersSameAsRemote(locals: any[], expect: Function) { let error = null; try { diff --git a/packages/lib/testing/test-utils.ts b/packages/lib/testing/test-utils.ts index e982a3113d..2e1345311b 100644 --- a/packages/lib/testing/test-utils.ts +++ b/packages/lib/testing/test-utils.ts @@ -678,6 +678,7 @@ function objectsEqual(o1: any, o2: any) { return true; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied async function checkThrowAsync(asyncFn: Function) { let hasThrown = false; try { @@ -688,6 +689,7 @@ async function checkThrowAsync(asyncFn: Function) { return hasThrown; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied async function expectThrow(asyncFn: Function, errorCode: any = undefined) { let hasThrown = false; let thrownError = null; @@ -708,6 +710,7 @@ async function expectThrow(asyncFn: Function, errorCode: any = undefined) { } } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied async function expectNotThrow(asyncFn: Function) { let thrownError = null; try { @@ -724,6 +727,7 @@ async function expectNotThrow(asyncFn: Function) { } } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function checkThrow(fn: Function) { let hasThrown = false; try { diff --git a/packages/lib/theme.ts b/packages/lib/theme.ts index a61b831680..f3cc59ce46 100644 --- a/packages/lib/theme.ts +++ b/packages/lib/theme.ts @@ -387,6 +387,7 @@ const cachedStyles_: any = { // cacheKey must be a globally unique key, and must change whenever // the dependencies of the style change. If the style depends only // on the theme, a static string can be provided as a cache key. +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export function buildStyle(cacheKey: any, themeId: number, callback: Function) { cacheKey = Array.isArray(cacheKey) ? cacheKey.join('_') : cacheKey; diff --git a/packages/lib/time.ts b/packages/lib/time.ts index 0443d995bc..e59e41b2eb 100644 --- a/packages/lib/time.ts +++ b/packages/lib/time.ts @@ -133,6 +133,7 @@ class Time { } public msleep(ms: number) { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function) => { shim.setTimeout(() => { resolve(); diff --git a/packages/plugin-repo-cli/commands/updateRelease.ts b/packages/plugin-repo-cli/commands/updateRelease.ts index cb2275462d..6f7f1b31aa 100644 --- a/packages/plugin-repo-cli/commands/updateRelease.ts +++ b/packages/plugin-repo-cli/commands/updateRelease.ts @@ -86,6 +86,7 @@ async function deleteAsset(oauthToken: string, id: number) { } async function uploadAsset(oauthToken: string, uploadUrl: string, pluginInfo: PluginInfo) { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function, reject: Function) => { ghReleaseAssets({ url: uploadUrl, diff --git a/packages/plugin-repo-cli/index.ts b/packages/plugin-repo-cli/index.ts index ab09a6fd69..2cd7457a35 100644 --- a/packages/plugin-repo-cli/index.ts +++ b/packages/plugin-repo-cli/index.ts @@ -276,6 +276,7 @@ async function commandVersion() { async function main() { const scriptName = 'plugin-repo-cli'; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const commands: Record = { build: commandBuild, version: commandVersion, diff --git a/packages/react-native-saf-x/src/index.ts b/packages/react-native-saf-x/src/index.ts index 9c7edcb89a..860cad8be4 100644 --- a/packages/react-native-saf-x/src/index.ts +++ b/packages/react-native-saf-x/src/index.ts @@ -35,10 +35,10 @@ interface SafxInterface { multiple: boolean, ): Promise; createDocument( - data: String, - encoding?: String, + data: string, + encoding?: string, initialName?: string, - mimeType?: String, + mimeType?: string, ): Promise; hasPermission(uriString: string): Promise; exists(uriString: string): Promise; @@ -50,7 +50,7 @@ interface SafxInterface { mimeType?: string, append?: boolean, ): Promise; - createFile(uriString: string, mimeType?: String): Promise; + createFile(uriString: string, mimeType?: string): Promise; unlink(uriString: string): Promise; mkdir(uriString: string): Promise; rename(uriString: string, newName: string): Promise; diff --git a/packages/renderer/HtmlToHtml.ts b/packages/renderer/HtmlToHtml.ts index c8d3ddd1e5..717da48f06 100644 --- a/packages/renderer/HtmlToHtml.ts +++ b/packages/renderer/HtmlToHtml.ts @@ -15,8 +15,11 @@ const md5 = require('md5'); const inMemoryCache = new InMemoryCache(10); interface FsDriver { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied writeFile: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied exists: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied cacheCssToFile: Function; } diff --git a/packages/renderer/MdToHtml/rules/html_image.ts b/packages/renderer/MdToHtml/rules/html_image.ts index 2b2a7201db..74413e99f7 100644 --- a/packages/renderer/MdToHtml/rules/html_image.ts +++ b/packages/renderer/MdToHtml/rules/html_image.ts @@ -26,6 +26,7 @@ function plugin(markdownIt: any, ruleOptions: RuleOptions) { const imageRegex = //gi; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const handleImageTags = function(defaultRender: Function) { return function(tokens: any[], idx: number, options: any, env: any, self: any) { const token = tokens[idx]; diff --git a/packages/renderer/MdToHtml/rules/mermaid.ts b/packages/renderer/MdToHtml/rules/mermaid.ts index 40af1cff15..5b26699caf 100644 --- a/packages/renderer/MdToHtml/rules/mermaid.ts +++ b/packages/renderer/MdToHtml/rules/mermaid.ts @@ -29,13 +29,14 @@ export default { }, plugin: function(markdownIt: any, ruleOptions: RuleOptions) { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const defaultRender: Function = markdownIt.renderer.rules.fence || function(tokens: any[], idx: number, options: any, env: any, self: any) { return self.renderToken(tokens, idx, options, env, self); }; const exportButtonMarkup = isDesktop(ruleOptions.platformName) ? exportGraphButton(ruleOptions) : ''; - markdownIt.renderer.rules.fence = function(tokens: any[], idx: number, options: {}, env: any, self: any) { + markdownIt.renderer.rules.fence = function(tokens: any[], idx: number, options: any, env: any, self: any) { const token = tokens[idx]; if (token.info !== 'mermaid') return defaultRender(tokens, idx, options, env, self); const contentHtml = markdownIt.utils.escapeHtml(token.content); diff --git a/packages/renderer/htmlUtils.ts b/packages/renderer/htmlUtils.ts index 866b8676c0..b48f9bd4ac 100644 --- a/packages/renderer/htmlUtils.ts +++ b/packages/renderer/htmlUtils.ts @@ -52,6 +52,7 @@ class HtmlUtils { return output.join(' '); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public processImageTags(html: string, callback: Function) { if (!html) return ''; @@ -77,6 +78,7 @@ class HtmlUtils { }); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public processAnchorTags(html: string, callback: Function) { if (!html) return ''; diff --git a/packages/server/src/commands/DbCommand.ts b/packages/server/src/commands/DbCommand.ts index f03369f46c..3088041ec1 100644 --- a/packages/server/src/commands/DbCommand.ts +++ b/packages/server/src/commands/DbCommand.ts @@ -38,6 +38,7 @@ export default class DbCommand extends BaseCommand { public async run(argv: Argv): Promise { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const commands: Record = { create: async () => { await createDb(config().database); diff --git a/packages/server/src/commands/MigrateCommand.ts b/packages/server/src/commands/MigrateCommand.ts index bec64620f0..599db58777 100644 --- a/packages/server/src/commands/MigrateCommand.ts +++ b/packages/server/src/commands/MigrateCommand.ts @@ -52,6 +52,7 @@ export default class MigrateCommand extends BaseCommand { } public async run(argv: Argv, runContext: RunContext): Promise { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const commands: Record = { up: async () => { await migrateUp(runContext.db, argv.disableTransactions); diff --git a/packages/server/src/commands/StorageCommand.ts b/packages/server/src/commands/StorageCommand.ts index 02547e45db..0e4640bf8e 100644 --- a/packages/server/src/commands/StorageCommand.ts +++ b/packages/server/src/commands/StorageCommand.ts @@ -67,6 +67,7 @@ export default class StorageCommand extends BaseCommand { public async run(argv: Argv, runContext: RunContext): Promise { const batchSize = argv.batchSize || 1000; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const commands: Record = { [ArgvCommand.Import]: async () => { if (!argv.connection) throw new Error('--connection option is required'); diff --git a/packages/server/src/models/BaseModel.ts b/packages/server/src/models/BaseModel.ts index e031947cfc..f447a0ae10 100644 --- a/packages/server/src/models/BaseModel.ts +++ b/packages/server/src/models/BaseModel.ts @@ -205,6 +205,7 @@ export default abstract class BaseModel { // // The `name` argument is only for debugging, so that any stuck transaction // can be more easily identified. + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied protected async withTransaction(fn: Function, name: string): Promise { const debugSteps = false; const debugTimeout = true; diff --git a/packages/server/src/models/UserModel.ts b/packages/server/src/models/UserModel.ts index 3062587bc0..6d9ece1b03 100644 --- a/packages/server/src/models/UserModel.ts +++ b/packages/server/src/models/UserModel.ts @@ -295,6 +295,7 @@ export default class UserModel extends BaseModel { await this.save({ id: user.id, email_confirmed: 1 }); } + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public async processEmailConfirmation(userId: Uuid, token: string, beforeChangingEmailHandler: Function) { await this.models().token().checkToken(userId, token); const user = await this.models().user().load(userId); @@ -450,6 +451,7 @@ export default class UserModel extends BaseModel { public async handleFailedPaymentSubscriptions() { interface SubInfo { subs: Subscription[]; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied templateFn: Function; emailKeyPrefix: string; flagType: UserFlagType; diff --git a/packages/server/src/routes/api/events.ts b/packages/server/src/routes/api/events.ts index 31ba798f06..46ec546464 100644 --- a/packages/server/src/routes/api/events.ts +++ b/packages/server/src/routes/api/events.ts @@ -9,6 +9,7 @@ interface Event { name: string; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const supportedEvents: Record = { syncStart: async (_ctx: AppContext) => { // await ctx.joplin.models.share().updateSharedItems2(ctx.joplin.owner.id); diff --git a/packages/server/src/routes/index/stripe.ts b/packages/server/src/routes/index/stripe.ts index 7712523287..e899050089 100644 --- a/packages/server/src/routes/index/stripe.ts +++ b/packages/server/src/routes/index/stripe.ts @@ -44,7 +44,9 @@ interface CreateCheckoutSessionFields { type StripeRouteHandler = (stripe: Stripe, path: SubPath, ctx: AppContext)=> Promise; interface PostHandlers { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied createCheckoutSession: Function; + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied webhook: Function; } diff --git a/packages/server/src/utils/cache.ts b/packages/server/src/utils/cache.ts index f973f96055..471256129f 100644 --- a/packages/server/src/utils/cache.ts +++ b/packages/server/src/utils/cache.ts @@ -18,7 +18,7 @@ class Cache { }; } - public async setObject(key: string, object: Object): Promise { + public async setObject(key: string, object: any): Promise { if (!object) return; return this.setAny(key, object); } diff --git a/packages/server/src/utils/koaIf.ts b/packages/server/src/utils/koaIf.ts index 8d3075834b..b1a5ef653d 100644 --- a/packages/server/src/utils/koaIf.ts +++ b/packages/server/src/utils/koaIf.ts @@ -1,6 +1,8 @@ import { Context } from 'koa'; +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export default function koaIf(middleware: Function, condition: any = null) { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return async (ctx: Context, next: Function) => { if (typeof condition === 'function' && condition(ctx)) { await middleware(ctx, next); diff --git a/packages/server/src/utils/requestUtils.ts b/packages/server/src/utils/requestUtils.ts index fc73a0437d..6bc3d1efa7 100644 --- a/packages/server/src/utils/requestUtils.ts +++ b/packages/server/src/utils/requestUtils.ts @@ -42,6 +42,7 @@ export async function formParse(request: IncomingMessage): Promise { const form = formidable({ multiples: true }); form.parse(req, (error: any, fields: Fields, files: Files) => { diff --git a/packages/server/src/utils/testing/testRouters.ts b/packages/server/src/utils/testing/testRouters.ts index bdc54b088d..8cee2841d3 100644 --- a/packages/server/src/utils/testing/testRouters.ts +++ b/packages/server/src/utils/testing/testRouters.ts @@ -28,6 +28,7 @@ const execCommand = function(command: string, returnStdErr = false): Promise { setTimeout(() => { resolve(); diff --git a/packages/server/src/utils/testing/testUtils.ts b/packages/server/src/utils/testing/testUtils.ts index c45fcc38e0..4cfc1a436f 100644 --- a/packages/server/src/utils/testing/testUtils.ts +++ b/packages/server/src/utils/testing/testUtils.ts @@ -435,6 +435,7 @@ export function readCredentialFileSync(filename: string, defaultValue: string = return r.toString(); } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export async function checkThrowAsync(asyncFn: Function): Promise { try { await asyncFn(); @@ -444,6 +445,7 @@ export async function checkThrowAsync(asyncFn: Function): Promise { return null; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export async function expectThrow(asyncFn: Function, errorCode: any = undefined): Promise { let hasThrown = false; let thrownError = null; @@ -466,6 +468,7 @@ export async function expectThrow(asyncFn: Function, errorCode: any = undefined) return thrownError; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export async function expectHttpError(asyncFn: Function, expectedHttpCode: number, expectedErrorCode: string = null): Promise { let thrownError = null; @@ -486,6 +489,7 @@ export async function expectHttpError(asyncFn: Function, expectedHttpCode: numbe } } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export async function expectNoHttpError(asyncFn: Function): Promise { let thrownError = null; @@ -574,6 +578,7 @@ is_shared: 0 type_: 4`; } +// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied export async function expectNotThrow(asyncFn: Function) { let thrownError = null; try { diff --git a/packages/server/src/utils/time.ts b/packages/server/src/utils/time.ts index d8b0631afc..c5562695e7 100644 --- a/packages/server/src/utils/time.ts +++ b/packages/server/src/utils/time.ts @@ -22,6 +22,7 @@ export const Week = 7 * Day; export const Month = 30 * Day; export function msleep(ms: number) { + // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied return new Promise((resolve: Function) => { setTimeout(() => { resolve(null);