diff --git a/.eslintrc.js b/.eslintrc.js index 7bf277e19..60103e9da 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -112,6 +112,8 @@ module.exports = { }, ], + '@typescript-eslint/no-explicit-any': ['error'], + // ------------------------------- // Formatting // ------------------------------- diff --git a/packages/app-cli/app/LinkSelector.ts b/packages/app-cli/app/LinkSelector.ts index 65a217f19..4c9c0dbf6 100644 --- a/packages/app-cli/app/LinkSelector.ts +++ b/packages/app-cli/app/LinkSelector.ts @@ -41,6 +41,7 @@ class LinkSelector { const newLinkStore: LinkStoreEntry[] = []; const lines: string[] = renderedText.split('\n'); for (let i = 0; i < lines.length; i++) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const r = (lines[i] as any).matchAll(this.linkRegex_); const matches = [...r]; // eslint-disable-next-line github/array-foreach -- Old code before rule was applied @@ -63,12 +64,14 @@ class LinkSelector { this.linkStore_ = this.findLinks(this.renderedText_); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public updateNote(textWidget: any): void { this.noteId_ = textWidget.noteId; this.scrollTop_ = textWidget.scrollTop_; this.updateText(textWidget.renderedText_); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public scrollWidget(textWidget: any): void { if (this.currentLinkIndex_ === null) return; @@ -94,6 +97,7 @@ class LinkSelector { return; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public changeLink(textWidget: any, offset: number): void | null { if (textWidget.noteId !== this.noteId_) { this.updateNote(textWidget); @@ -124,6 +128,7 @@ class LinkSelector { return; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public openLink(textWidget: any): void { if (textWidget.noteId !== this.noteId_) return; if (textWidget.renderedText_ !== this.renderedText_) return; diff --git a/packages/app-cli/app/app.ts b/packages/app-cli/app/app.ts index a7ead6e4b..dcb506e91 100644 --- a/packages/app-cli/app/app.ts +++ b/packages/app-cli/app/app.ts @@ -22,10 +22,14 @@ const { splitCommandBatch } = require('@joplin/lib/string-utils'); class Application extends BaseApplication { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private commands_: Record = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private commandMetadata_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private activeCommand_: any = null; private allCommandsLoaded_ = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private gui_: any = null; private cache_ = new Cache(); @@ -37,6 +41,7 @@ class Application extends BaseApplication { return this.gui().stdoutMaxWidth(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async guessTypeAndLoadItem(pattern: string, options: any = null) { let type = BaseModel.TYPE_NOTE; if (pattern.indexOf('/') === 0) { @@ -46,6 +51,7 @@ class Application extends BaseApplication { return this.loadItem(type, pattern, options); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async loadItem(type: ModelType | 'folderOrNote', pattern: string, options: any = null) { const output = await this.loadItems(type, pattern, options); @@ -70,6 +76,7 @@ class Application extends BaseApplication { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async loadItems(type: ModelType | 'folderOrNote', pattern: string, options: any = null): Promise<(FolderEntity | NoteEntity)[]> { if (type === 'folderOrNote') { const folders: FolderEntity[] = await this.loadItems(BaseModel.TYPE_FOLDER, pattern, options); @@ -160,6 +167,7 @@ class Application extends BaseApplication { } if (uiType !== null) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const temp: Record = {}; for (const n in this.commands_) { if (!this.commands_.hasOwnProperty(n)) continue; @@ -219,6 +227,7 @@ class Application extends BaseApplication { CommandClass = require(`${__dirname}/command-${name}.js`); } catch (error) { if (error.message && error.message.indexOf('Cannot find module') >= 0) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const e: any = new Error(_('No such command: %s', name)); e.type = 'notFound'; throw e; @@ -238,6 +247,7 @@ class Application extends BaseApplication { isDummy: () => { return true; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied prompt: (initialText = '', promptString = '', options: any = null) => { return cliUtils.prompt(initialText, promptString, options); }, @@ -260,6 +270,7 @@ class Application extends BaseApplication { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async execCommand(argv: string[]): Promise { if (!argv.length) return this.execCommand(['help']); // reg.logger().debug('execCommand()', argv); @@ -390,6 +401,7 @@ class Application extends BaseApplication { argv = await super.start(argv, { keychainEnabled }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied cliUtils.setStdout((object: any) => { return this.stdout(object); }); @@ -439,6 +451,7 @@ class Application extends BaseApplication { // initialised. So we manually call dispatchUpdateAll() to force an update. Setting.dispatchUpdateAll(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await refreshFolders((action: any) => this.store().dispatch(action)); const tags = await Tag.allWithNotes(); diff --git a/packages/app-cli/app/base-command.ts b/packages/app-cli/app/base-command.ts index b8aa2c386..0058964f4 100644 --- a/packages/app-cli/app/base-command.ts +++ b/packages/app-cli/app/base-command.ts @@ -3,14 +3,18 @@ import { reg } from '@joplin/lib/registry.js'; export default class BaseCommand { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected stdout_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected prompt_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected dispatcher_: any; public usage(): string { throw new Error('Usage not defined'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public encryptionCheck(item: any) { if (item && item.encryption_applied) throw new Error(_('Cannot change encrypted item')); } @@ -19,6 +23,7 @@ export default class BaseCommand { throw new Error('Description not defined'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async action(_args: any) { throw new Error('Action not defined'); } @@ -31,6 +36,7 @@ export default class BaseCommand { return this.compatibleUis().indexOf(ui) >= 0; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public options(): any[] { return []; } @@ -59,6 +65,7 @@ export default class BaseCommand { this.dispatcher_ = fn; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public dispatch(action: any) { if (!this.dispatcher_) throw new Error('Dispatcher not defined'); return this.dispatcher_(action); @@ -78,6 +85,7 @@ export default class BaseCommand { this.prompt_ = fn; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async prompt(message: string, options: any = null) { if (!this.prompt_) throw new Error('Prompt is undefined'); return await this.prompt_(message, options); diff --git a/packages/app-cli/app/command-apidoc.ts b/packages/app-cli/app/command-apidoc.ts index 8f30e7aca..51423ac75 100644 --- a/packages/app-cli/app/command-apidoc.ts +++ b/packages/app-cli/app/command-apidoc.ts @@ -37,6 +37,7 @@ class Command extends BaseCommand { return markdownUtils.createMarkdownTable(headers, tableFields); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const models = [ { diff --git a/packages/app-cli/app/command-attach.ts b/packages/app-cli/app/command-attach.ts index dee07b1fb..38cae899e 100644 --- a/packages/app-cli/app/command-attach.ts +++ b/packages/app-cli/app/command-attach.ts @@ -13,6 +13,7 @@ class Command extends BaseCommand { return _('Attaches the given file to the note.'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const title = args['note']; diff --git a/packages/app-cli/app/command-cat.ts b/packages/app-cli/app/command-cat.ts index 1dfd409f5..31702f405 100644 --- a/packages/app-cli/app/command-cat.ts +++ b/packages/app-cli/app/command-cat.ts @@ -18,6 +18,7 @@ class Command extends BaseCommand { return [['-v, --verbose', _('Displays the complete information about note.')]]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const title = args['note']; diff --git a/packages/app-cli/app/command-config.ts b/packages/app-cli/app/command-config.ts index a698942fc..bc7828340 100644 --- a/packages/app-cli/app/command-config.ts +++ b/packages/app-cli/app/command-config.ts @@ -27,6 +27,7 @@ class Command extends BaseCommand { return new Promise((resolve, reject) => { // being defensive and not attempting to settle twice let isSettled = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const chunks: any = []; inputStream.on('readable', () => { @@ -67,6 +68,7 @@ class Command extends BaseCommand { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const verbose = args.options.verbose; const isExport = args.options.export; @@ -91,6 +93,7 @@ class Command extends BaseCommand { keys.sort(); if (isExport) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const resultObj = keys.reduce>((acc, key) => { const value = Setting.value(key); if (!verbose && !value) return acc; diff --git a/packages/app-cli/app/command-cp.ts b/packages/app-cli/app/command-cp.ts index 23df1bacf..ebc83608d 100644 --- a/packages/app-cli/app/command-cp.ts +++ b/packages/app-cli/app/command-cp.ts @@ -13,6 +13,7 @@ class Command extends BaseCommand { return _('Duplicates the notes matching to [notebook]. If no notebook is specified the note is duplicated in the current notebook.'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { let folder = null; if (args['notebook']) { diff --git a/packages/app-cli/app/command-done.ts b/packages/app-cli/app/command-done.ts index 241ee2e62..8c02a469b 100644 --- a/packages/app-cli/app/command-done.ts +++ b/packages/app-cli/app/command-done.ts @@ -15,6 +15,7 @@ class Command extends BaseCommand { return _('Marks a to-do as done.'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async handleAction(commandInstance: BaseCommand, args: any, isCompleted: boolean) { const note: NoteEntity = await app().loadItem(BaseModel.TYPE_NOTE, args.note); commandInstance.encryptionCheck(note); @@ -31,6 +32,7 @@ class Command extends BaseCommand { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { await Command.handleAction(this, args, true); } diff --git a/packages/app-cli/app/command-e2ee.ts b/packages/app-cli/app/command-e2ee.ts index f748ab2e3..bfbd15f95 100644 --- a/packages/app-cli/app/command-e2ee.ts +++ b/packages/app-cli/app/command-e2ee.ts @@ -30,9 +30,11 @@ class Command extends BaseCommand { ]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async action(args: any) { const options = args.options; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const askForMasterKey = async (error: any) => { const masterKeyId = error.masterKeyId; const password = await this.prompt(_('Enter master password:'), { type: 'string', secure: true }); diff --git a/packages/app-cli/app/command-edit.ts b/packages/app-cli/app/command-edit.ts index dc32c8a92..87e05a762 100644 --- a/packages/app-cli/app/command-edit.ts +++ b/packages/app-cli/app/command-edit.ts @@ -17,6 +17,7 @@ class Command extends BaseCommand { return _('Edit note.'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { let tempFilePath: string|null = null; diff --git a/packages/app-cli/app/command-export.ts b/packages/app-cli/app/command-export.ts index 74042b2d3..46620496a 100644 --- a/packages/app-cli/app/command-export.ts +++ b/packages/app-cli/app/command-export.ts @@ -24,6 +24,7 @@ class Command extends BaseCommand { return [['--format ', _('Destination format: %s', formats.join(', '))], ['--note ', _('Exports only the given note.')], ['--notebook ', _('Exports only the given notebook.')]]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const exportOptions: ExportOptions = {}; exportOptions.path = args.path; @@ -35,10 +36,12 @@ class Command extends BaseCommand { if (args.options.note) { const notes = await app().loadItems(BaseModel.TYPE_NOTE, args.options.note, { parent: app().currentFolder() }); if (!notes.length) throw new Error(_('Cannot find "%s".', args.options.note)); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied exportOptions.sourceNoteIds = notes.map((n: any) => n.id); } else if (args.options.notebook) { const folders = await app().loadItems(BaseModel.TYPE_FOLDER, args.options.notebook); if (!folders.length) throw new Error(_('Cannot find "%s".', args.options.notebook)); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied exportOptions.sourceFolderIds = folders.map((n: any) => n.id); } diff --git a/packages/app-cli/app/command-geoloc.ts b/packages/app-cli/app/command-geoloc.ts index e45341d9d..f6209b369 100644 --- a/packages/app-cli/app/command-geoloc.ts +++ b/packages/app-cli/app/command-geoloc.ts @@ -13,6 +13,7 @@ class Command extends BaseCommand { return _('Displays a geolocation URL for the note.'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const title = args['note']; diff --git a/packages/app-cli/app/command-help.ts b/packages/app-cli/app/command-help.ts index 2dd4e61fd..39d204afc 100644 --- a/packages/app-cli/app/command-help.ts +++ b/packages/app-cli/app/command-help.ts @@ -29,6 +29,7 @@ class Command extends BaseCommand { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const stdoutWidth = app().commandStdoutMaxWidth(); diff --git a/packages/app-cli/app/command-import.ts b/packages/app-cli/app/command-import.ts index 12108374b..eb9427db3 100644 --- a/packages/app-cli/app/command-import.ts +++ b/packages/app-cli/app/command-import.ts @@ -30,6 +30,7 @@ class Command extends BaseCommand { ]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const folder = await app().loadItem(BaseModel.TYPE_FOLDER, args.notebook); diff --git a/packages/app-cli/app/command-ls.ts b/packages/app-cli/app/command-ls.ts index 0bfe9454b..63b02884f 100644 --- a/packages/app-cli/app/command-ls.ts +++ b/packages/app-cli/app/command-ls.ts @@ -34,11 +34,13 @@ class Command extends BaseCommand { ]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const pattern = args['note-pattern']; let items = []; const options = args.options; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queryOptions: any = {}; if (options.limit) queryOptions.limit = options.limit; if (options.sort) { diff --git a/packages/app-cli/app/command-mkbook.ts b/packages/app-cli/app/command-mkbook.ts index 118c54124..1d96c36f9 100644 --- a/packages/app-cli/app/command-mkbook.ts +++ b/packages/app-cli/app/command-mkbook.ts @@ -43,6 +43,7 @@ class Command extends BaseCommand { } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async action(args: any) { const targetFolder = args.options.parent; diff --git a/packages/app-cli/app/command-mv.ts b/packages/app-cli/app/command-mv.ts index 857ce5f59..fc9ef2bf7 100644 --- a/packages/app-cli/app/command-mv.ts +++ b/packages/app-cli/app/command-mv.ts @@ -14,6 +14,7 @@ class Command extends BaseCommand { return _('Moves the given to [notebook]'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const pattern = args['item']; const destination = args['notebook']; diff --git a/packages/app-cli/app/command-ren.ts b/packages/app-cli/app/command-ren.ts index ced1665f0..223e3dd54 100644 --- a/packages/app-cli/app/command-ren.ts +++ b/packages/app-cli/app/command-ren.ts @@ -14,6 +14,7 @@ class Command extends BaseCommand { return _('Renames the given (note or notebook) to .'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const pattern = args['item']; const name = args['name']; diff --git a/packages/app-cli/app/command-restore.ts b/packages/app-cli/app/command-restore.ts index dfe7cdaef..9043e763d 100644 --- a/packages/app-cli/app/command-restore.ts +++ b/packages/app-cli/app/command-restore.ts @@ -12,6 +12,7 @@ class Command extends BaseCommand { return _('Restore the items matching from the trash.'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const pattern = args['pattern']; diff --git a/packages/app-cli/app/command-rmbook.ts b/packages/app-cli/app/command-rmbook.ts index 666a72bcd..b17ebfeb0 100644 --- a/packages/app-cli/app/command-rmbook.ts +++ b/packages/app-cli/app/command-rmbook.ts @@ -21,6 +21,7 @@ class Command extends BaseCommand { ]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const pattern = args['notebook']; const force = args.options && args.options.force === true; diff --git a/packages/app-cli/app/command-rmnote.ts b/packages/app-cli/app/command-rmnote.ts index 60839fe12..30dd44558 100644 --- a/packages/app-cli/app/command-rmnote.ts +++ b/packages/app-cli/app/command-rmnote.ts @@ -21,6 +21,7 @@ class Command extends BaseCommand { ]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const pattern = args['note-pattern']; const force = args.options && args.options.force === true; diff --git a/packages/app-cli/app/command-set.ts b/packages/app-cli/app/command-set.ts index 54b59ae77..e2743d969 100644 --- a/packages/app-cli/app/command-set.ts +++ b/packages/app-cli/app/command-set.ts @@ -22,6 +22,7 @@ class Command extends BaseCommand { return _('Sets the property of the given to the given [value]. Possible properties are:\n\n%s', s.join(', ')); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const title = args['note']; const propName = args['name']; @@ -36,6 +37,7 @@ class Command extends BaseCommand { const timestamp = Date.now(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newNote: any = { id: notes[i].id, type_: notes[i].type_, diff --git a/packages/app-cli/app/command-settingschema.ts b/packages/app-cli/app/command-settingschema.ts index 46d52bfa0..44e717b93 100644 --- a/packages/app-cli/app/command-settingschema.ts +++ b/packages/app-cli/app/command-settingschema.ts @@ -35,7 +35,9 @@ class Command extends BaseCommand { return false; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async action(args: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const schema: Record = { title: 'JSON schema for Joplin setting files', '$id': Setting.schemaUrl, @@ -52,6 +54,7 @@ class Command extends BaseCommand { const type = settingTypeToSchemaType(md.type); if (!type) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const props: Record = {}; props.type = type; props.default = md.value; @@ -61,6 +64,7 @@ class Command extends BaseCommand { if (md.description && md.description('desktop')) description.push(md.description('desktop')); if (description.length) props.description = description.join('. '); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (md.isEnum) props.enum = Object.keys(md.options()).map((v: any) => Setting.formatValue(key, v)); if ('minimum' in md) props.minimum = md.minimum; if ('maximum' in md) props.maximum = md.maximum; diff --git a/packages/app-cli/app/command-sync.ts b/packages/app-cli/app/command-sync.ts index 2a266531d..65136b284 100644 --- a/packages/app-cli/app/command-sync.ts +++ b/packages/app-cli/app/command-sync.ts @@ -25,6 +25,7 @@ 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; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private oneDriveApiUtils_: any = null; public usage() { @@ -59,6 +60,7 @@ class Command extends BaseCommand { // OneDrive this.oneDriveApiUtils_ = new OneDriveApiNodeUtils(syncTarget.api()); const auth = await this.oneDriveApiUtils_.oauthDance({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied log: (...s: any[]) => { return this.stdout(...s); }, @@ -133,6 +135,7 @@ class Command extends BaseCommand { return !!this.oneDriveApiUtils_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async action(args: any) { this.releaseLockFn_ = null; @@ -181,7 +184,9 @@ class Command extends BaseCommand { const sync = await syncTarget.synchronizer(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProgress: (report: any) => { const lines = Synchronizer.reportToLines(report); if (lines.length) cliUtils.redraw(lines.join(' ')); diff --git a/packages/app-cli/app/command-testing.ts b/packages/app-cli/app/command-testing.ts index fc4c0c729..3074f3029 100644 --- a/packages/app-cli/app/command-testing.ts +++ b/packages/app-cli/app/command-testing.ts @@ -6,11 +6,13 @@ import populateDatabase from '@joplin/lib/services/debug/populateDatabase'; import { readCredentialFile } from '@joplin/lib/utils/credentialFiles'; import JoplinServerApi from '@joplin/lib/JoplinServerApi'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function randomElement(array: any[]): any { if (!array.length) return null; return array[Math.floor(Math.random() * array.length)]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function itemCount(args: any) { const count = Number(args.arg0); if (!count || isNaN(count)) throw new Error('Note count must be specified'); @@ -30,6 +32,7 @@ class Command extends BaseCommand { return false; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public options(): any[] { return [ ['--folder-count ', 'Folders to create'], @@ -40,6 +43,7 @@ class Command extends BaseCommand { ]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async action(args: any) { const { command, options } = args; @@ -53,6 +57,7 @@ class Command extends BaseCommand { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const promises: any[] = []; if (command === 'createRandomNotes') { diff --git a/packages/app-cli/app/command-use.ts b/packages/app-cli/app/command-use.ts index 4dc272f8b..e5d6c8802 100644 --- a/packages/app-cli/app/command-use.ts +++ b/packages/app-cli/app/command-use.ts @@ -16,6 +16,7 @@ class Command extends BaseCommand { return ['cli']; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override async action(args: any) { const folder = await app().loadItem(BaseModel.TYPE_FOLDER, args['notebook']); if (!folder) throw new Error(_('Cannot find "%s".', args['notebook'])); diff --git a/packages/app-cli/app/gui/FolderListWidget.ts b/packages/app-cli/app/gui/FolderListWidget.ts index 93998a163..863e2d7bc 100644 --- a/packages/app-cli/app/gui/FolderListWidget.ts +++ b/packages/app-cli/app/gui/FolderListWidget.ts @@ -25,6 +25,7 @@ export default class FolderListWidget extends ListWidget { this.trimItemTitle = false; this.showIds = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.itemRenderer = (item: any) => { const output = []; if (item === '-') { @@ -42,6 +43,7 @@ export default class FolderListWidget extends ListWidget { if (this.folderHasChildren_(this.folders, item.id)) { for (let i = 0; i < this.folders.length; i++) { if (this.folders[i].parent_id === item.id) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied noteCount -= (this.folders[i] as any).note_count; } } @@ -165,6 +167,7 @@ export default class FolderListWidget extends ListWidget { this.logger().info('FFFFFFFFFFFFF', JSON.stringify(this.folders, null, 4)); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let newItems: any[] = []; const orderFolders = (parentId: string) => { this.logger().info('PARENT', parentId); diff --git a/packages/app-cli/app/gui/StatusBarWidget.ts b/packages/app-cli/app/gui/StatusBarWidget.ts index 771c90cd5..18f29fcd9 100644 --- a/packages/app-cli/app/gui/StatusBarWidget.ts +++ b/packages/app-cli/app/gui/StatusBarWidget.ts @@ -27,6 +27,7 @@ export default class StatusBarWidget extends BaseWidget { this.invalidate(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async prompt(initialText = '', promptString: any = null, options: any = null) { if (this.promptState_) throw new Error('Another prompt already active'); if (promptString === null) promptString = ':'; @@ -86,6 +87,7 @@ export default class StatusBarWidget extends BaseWidget { // const textStyle = this.promptActive ? (s) => s : chalk.bgBlueBright.white; // const textStyle = (s) => s; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const textStyle = this.promptActive ? (s: any) => s : chalk.gray; this.term.drawHLine(this.absoluteInnerX, this.absoluteInnerY, this.innerWidth, textStyle(' ')); @@ -106,6 +108,7 @@ export default class StatusBarWidget extends BaseWidget { const isSecurePrompt = !!this.promptState_.secure; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = { cancelable: true, history: this.history, @@ -118,6 +121,7 @@ export default class StatusBarWidget extends BaseWidget { if ('cursorPosition' in this.promptState_) options.cursorPosition = this.promptState_.cursorPosition; if (isSecurePrompt) options.echoChar = true; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.inputEventEmitter_ = this.term.inputField(options, (error: any, input: any) => { let resolveResult = null; const resolveFn = this.promptState_.resolve; diff --git a/packages/app-cli/app/services/plugins/PluginRunner.ts b/packages/app-cli/app/services/plugins/PluginRunner.ts index f5177e4b1..51c320d74 100644 --- a/packages/app-cli/app/services/plugins/PluginRunner.ts +++ b/packages/app-cli/app/services/plugins/PluginRunner.ts @@ -8,14 +8,17 @@ import uuid from '@joplin/lib/uuid'; const sandboxProxy = require('@joplin/lib/services/plugins/sandboxProxy'); function createConsoleWrapper(pluginId: string) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const wrapper: any = {}; for (const n in console) { // eslint-disable-next-line no-console if (!console.hasOwnProperty(n)) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied wrapper[n] = (...args: any[]) => { const newArgs = args.slice(); newArgs.splice(0, 0, `Plugin "${pluginId}":`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (console as any)[n](...newArgs); }; } @@ -33,6 +36,7 @@ function createConsoleWrapper(pluginId: string) { export default class PluginRunner extends BasePluginRunner { private eventHandlers_: EventHandlers = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private activeSandboxCalls_: any = {}; public constructor() { @@ -41,12 +45,14 @@ export default class PluginRunner extends BasePluginRunner { this.eventHandler = this.eventHandler.bind(this); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async eventHandler(eventHandlerId: string, args: any[]) { const cb = this.eventHandlers_[eventHandlerId]; return cb(...args); } private newSandboxProxy(pluginId: string, sandbox: Global) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const target = async (path: string, args: any[]) => { const callId = `${pluginId}::${path}::${uuid.createNano()}`; this.activeSandboxCalls_[callId] = true; diff --git a/packages/app-cli/app/setupCommand.ts b/packages/app-cli/app/setupCommand.ts index 4c2de83ef..8bd31d0a3 100644 --- a/packages/app-cli/app/setupCommand.ts +++ b/packages/app-cli/app/setupCommand.ts @@ -1,11 +1,12 @@ import { _ } from '@joplin/lib/locale'; -// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied export default (cmd: any, stdout: Function, store: Function, gui: Function) => { cmd.setStdout((text: string) => { return stdout(text); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied cmd.setDispatcher((action: any) => { if (store()) { return store().dispatch(action); @@ -14,6 +15,7 @@ export default (cmd: any, stdout: Function, store: Function, gui: Function) => { } }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied cmd.setPrompt(async (message: string, options: any) => { if (!options) options = {}; if (!options.type) options.type = 'boolean'; diff --git a/packages/app-cli/app/utils/testUtils.ts b/packages/app-cli/app/utils/testUtils.ts index fc524b808..db66566aa 100644 --- a/packages/app-cli/app/utils/testUtils.ts +++ b/packages/app-cli/app/utils/testUtils.ts @@ -3,7 +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 +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, 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-cli/tests/HtmlToMd.ts b/packages/app-cli/tests/HtmlToMd.ts index 483ae0c94..0cbb769e1 100644 --- a/packages/app-cli/tests/HtmlToMd.ts +++ b/packages/app-cli/tests/HtmlToMd.ts @@ -22,6 +22,7 @@ describe('HtmlToMd', () => { // if (htmlFilename.indexOf('image_preserve_size') !== 0) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const htmlToMdOptions: any = {}; if (htmlFilename === 'anchor_local.html') { diff --git a/packages/app-cli/tests/MdToHtml.ts b/packages/app-cli/tests/MdToHtml.ts index 4616b1172..30f72a139 100644 --- a/packages/app-cli/tests/MdToHtml.ts +++ b/packages/app-cli/tests/MdToHtml.ts @@ -4,6 +4,7 @@ import { setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/ import shim from '@joplin/lib/shim'; const { themeStyle } = require('@joplin/lib/theme'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function newTestMdToHtml(options: any = null) { options = { ResourceModel: { @@ -37,6 +38,7 @@ describe('MdToHtml', () => { // if (mdFilename !== 'sanitize_9.md') continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const mdToHtmlOptions: any = { bodyOnly: true, }; @@ -86,6 +88,7 @@ describe('MdToHtml', () => { })); it('should return enabled plugin assets', (async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const pluginOptions: any = {}; const pluginNames = MdToHtml.pluginNames(); diff --git a/packages/app-cli/tests/services/keychain/KeychainService.ts b/packages/app-cli/tests/services/keychain/KeychainService.ts index 3881931e0..40a95802f 100644 --- a/packages/app-cli/tests/services/keychain/KeychainService.ts +++ b/packages/app-cli/tests/services/keychain/KeychainService.ts @@ -5,6 +5,7 @@ import shim from '@joplin/lib/shim'; import Setting from '@joplin/lib/models/Setting'; import { db, setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function describeIfCompatible(name: string, fn: any, elseFn: any) { if (['win32', 'darwin'].includes(shim.platformName())) { return describe(name, fn); diff --git a/packages/app-cli/tests/services/plugins/PluginService.ts b/packages/app-cli/tests/services/plugins/PluginService.ts index 74e8bf048..814761263 100644 --- a/packages/app-cli/tests/services/plugins/PluginService.ts +++ b/packages/app-cli/tests/services/plugins/PluginService.ts @@ -82,6 +82,7 @@ describe('services_PluginService', () => { const allFolders = await Folder.all(); expect(allFolders.length).toBe(2); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(allFolders.map((f: any) => f.title).sort().join(', ')).toBe('multi - simple1, multi - simple2'); })); diff --git a/packages/app-cli/tests/services/plugins/api/JoplinWorkspace.ts b/packages/app-cli/tests/services/plugins/api/JoplinWorkspace.ts index bd0ef4e9a..7d6c70e89 100644 --- a/packages/app-cli/tests/services/plugins/api/JoplinWorkspace.ts +++ b/packages/app-cli/tests/services/plugins/api/JoplinWorkspace.ts @@ -17,6 +17,7 @@ describe('JoplinWorkspace', () => { }); test('should listen to noteChange events', async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const appState: Record = { selectedNoteIds: [], }; @@ -49,6 +50,7 @@ describe('JoplinWorkspace', () => { const folder = (await Folder.all())[0]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const result: any = JSON.parse(folder.title); expect(result.id).toBe(note.id); diff --git a/packages/app-cli/tests/services/plugins/sandboxProxy.ts b/packages/app-cli/tests/services/plugins/sandboxProxy.ts index b822b65ae..ae7dd7456 100644 --- a/packages/app-cli/tests/services/plugins/sandboxProxy.ts +++ b/packages/app-cli/tests/services/plugins/sandboxProxy.ts @@ -11,11 +11,13 @@ describe('services_plugins_sandboxProxy', () => { it('should create a new sandbox proxy', (async () => { interface Result { path: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied args: any[]; } const results: Result[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const target: any = (path: string, args: any[]) => { results.push({ path, args }); }; @@ -34,11 +36,13 @@ describe('services_plugins_sandboxProxy', () => { it('should allow importing a namespace', (async () => { interface Result { path: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied args: any[]; } const results: Result[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const target: any = (path: string, args: any[]) => { results.push({ path, args }); }; diff --git a/packages/app-cli/tests/testUtils.ts b/packages/app-cli/tests/testUtils.ts index 95807849f..e6030ff19 100644 --- a/packages/app-cli/tests/testUtils.ts +++ b/packages/app-cli/tests/testUtils.ts @@ -2,6 +2,7 @@ import PluginService from '@joplin/lib/services/plugins/PluginService'; import PluginRunner from '../app/services/plugins/PluginRunner'; export interface PluginServiceOptions { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied getState?(): Record; } diff --git a/packages/app-desktop/ElectronAppWrapper.ts b/packages/app-desktop/ElectronAppWrapper.ts index 3b3c8e7ff..83eeb8796 100644 --- a/packages/app-desktop/ElectronAppWrapper.ts +++ b/packages/app-desktop/ElectronAppWrapper.ts @@ -20,24 +20,28 @@ interface RendererProcessQuitReply { } interface PluginWindows { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied [key: string]: any; } export default class ElectronAppWrapper { private logger_: Logger = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private electronApp_: any; private env_: string; private isDebugMode_: boolean; private profilePath_: string; private win_: BrowserWindow = null; private willQuitApp_ = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private tray_: any = null; private buildDir_: string = null; private rendererProcessQuitReply_: RendererProcessQuitReply = null; private pluginWindows_: PluginWindows = {}; private initialCallbackUrl_: string = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(electronApp: any, env: string, profilePath: string|null, isDebugMode: boolean, initialCallbackUrl: string) { this.electronApp_ = electronApp; this.env_ = env; @@ -115,6 +119,7 @@ export default class ElectronAppWrapper { const windowStateKeeper = require('electron-window-state'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const stateOptions: any = { defaultWidth: Math.round(0.8 * screen.getPrimaryDisplay().workArea.width), defaultHeight: Math.round(0.8 * screen.getPrimaryDisplay().workArea.height), @@ -126,6 +131,7 @@ export default class ElectronAppWrapper { // Load the previous state with fallback to defaults const windowState = windowStateKeeper(stateOptions); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const windowOptions: any = { x: windowState.x, y: windowState.y, @@ -192,6 +198,7 @@ export default class ElectronAppWrapper { }); this.win_.webContents.on('did-fail-load', async event => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if ((event as any).isMainFrame) { await this.handleAppFailure('Renderer process failed to load', false); } @@ -228,6 +235,7 @@ export default class ElectronAppWrapper { } }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.win_.on('close', (event: any) => { // If it's on macOS, the app is completely closed only if the user chooses to close the app (willQuitApp_ will be true) // otherwise the window is simply hidden, and will be re-open once the app is "activated" (which happens when the @@ -276,6 +284,7 @@ export default class ElectronAppWrapper { } }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ipcMain.on('asynchronous-message', (_event: any, message: string, args: any) => { if (message === 'appCloseReply') { // We got the response from the renderer process: @@ -287,6 +296,7 @@ export default class ElectronAppWrapper { // This handler receives IPC messages from a plugin or from the main window, // and forwards it to the main window or the plugin window. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ipcMain.on('pluginMessage', (_event: any, message: PluginMessage) => { try { if (message.target === 'mainWindow') { @@ -325,6 +335,7 @@ export default class ElectronAppWrapper { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public registerPluginWindow(pluginId: string, window: any) { this.pluginWindows_[pluginId] = window; } @@ -387,6 +398,7 @@ export default class ElectronAppWrapper { } // Note: this must be called only after the "ready" event of the app has been dispatched + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public createTray(contextMenu: any) { try { this.tray_ = new Tray(`${this.buildDir()}/icons/${this.trayIconFilename_()}`); @@ -423,6 +435,7 @@ export default class ElectronAppWrapper { } // Someone tried to open a second instance - focus our window instead + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.electronApp_.on('second-instance', (_e: any, argv: string[]) => { const win = this.window(); if (!win) return; @@ -463,6 +476,7 @@ export default class ElectronAppWrapper { this.win_.show(); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.electronApp_.on('open-url', (event: any, url: string) => { event.preventDefault(); void this.openCallbackUrl(url); diff --git a/packages/app-desktop/InteropServiceHelper.ts b/packages/app-desktop/InteropServiceHelper.ts index ff0c5a2f7..0f8bace86 100644 --- a/packages/app-desktop/InteropServiceHelper.ts +++ b/packages/app-desktop/InteropServiceHelper.ts @@ -68,6 +68,7 @@ export default class InteropServiceHelper { win = bridge().newBrowserWindow(windowOptions); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return new Promise((resolve, reject) => { win.webContents.on('did-finish-load', () => { @@ -85,6 +86,7 @@ export default class InteropServiceHelper { // pdfs. // https://github.com/laurent22/joplin/issues/6254. await win.webContents.executeJavaScript('document.querySelectorAll(\'details\').forEach(el=>el.setAttribute(\'open\',\'\'))'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const data = await win.webContents.printToPDF(options as any); resolve(data); } catch (error) { @@ -126,6 +128,7 @@ export default class InteropServiceHelper { resolve(null); }, 1000); } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied win.webContents.print(options as any, (success: boolean, reason: string) => { cleanup(); if (!success && reason !== 'cancelled') reject(new Error(`Could not print: ${reason}`)); diff --git a/packages/app-desktop/app.reducer.ts b/packages/app-desktop/app.reducer.ts index e498984d9..ed1added6 100644 --- a/packages/app-desktop/app.reducer.ts +++ b/packages/app-desktop/app.reducer.ts @@ -11,6 +11,7 @@ const logger = Logger.create('app.reducer'); export interface AppStateRoute { type: string; routeName: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied props: any; } @@ -21,29 +22,36 @@ export enum AppStateDialogName { export interface AppStateDialog { name: AppStateDialogName; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied props: Record; } export interface AppState extends State { route: AppStateRoute; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied navHistory: any[]; noteVisiblePanes: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied windowContentSize: any; watchedNoteFiles: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied lastEditorScrollPercents: any; devToolsVisible: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied visibleDialogs: any; // empty object if no dialog is visible. Otherwise contains the list of visible dialogs. focusedField: string; layoutMoveMode: boolean; startupPluginsLoaded: boolean; // Extra reducer keys go here + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied watchedResources: any; mainLayout: LayoutItem; dialogs: AppStateDialog[]; isResettingLayout: boolean; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function createAppDefaultState(windowContentSize: any, resourceEditWatcherDefaultState: any): AppState { return { ...defaultState, @@ -69,6 +77,7 @@ export function createAppDefaultState(windowContentSize: any, resourceEditWatche }; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function(state: AppState, action: any) { let newState = state; @@ -129,6 +138,7 @@ export default function(state: AppState, action: any) { case 'NOTE_VISIBLE_PANES_TOGGLE': { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const getNextLayout = (currentLayout: any) => { currentLayout = panes.length === 2 ? 'both' : currentLayout[0]; @@ -183,6 +193,7 @@ export default function(state: AppState, action: any) { logger.warn('MAIN_LAYOUT_SET_ITEM_PROP: Found an empty item in layout: ', JSON.stringify(state.mainLayout)); } else { if (item.key === action.itemKey) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (item as any)[action.propName] = action.propValue; return false; } diff --git a/packages/app-desktop/app.ts b/packages/app-desktop/app.ts index a53354054..42a21363f 100644 --- a/packages/app-desktop/app.ts +++ b/packages/app-desktop/app.ts @@ -84,6 +84,7 @@ const appDefaultState = createAppDefaultState( class Application extends BaseApplication { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private checkAllPluginStartedIID_: any = null; private initPluginServiceDone_ = false; private ocrService_: OcrService; @@ -98,6 +99,7 @@ class Application extends BaseApplication { return true; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public reducer(state: AppState = appDefaultState, action: any) { let newState = appReducer(state, action); newState = resourceEditWatcherReducer(newState, action); @@ -113,6 +115,7 @@ class Application extends BaseApplication { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected async generalMiddleware(store: any, next: any, action: any) { if (action.type === 'SETTING_UPDATE_ONE' && action.key === 'locale' || action.type === 'SETTING_UPDATE_ALL') { setLocale(Setting.value('locale')); @@ -233,13 +236,16 @@ class Application extends BaseApplication { // The context menu must be setup in renderer process because that's where // the spell checker service lives. electronContextMenu({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied shouldShowMenu: (_event: any, params: any) => { // params.inputFieldType === 'none' when right-clicking the text editor. This is a bit of a hack to detect it because in this // case we don't want to use the built-in context menu but a custom one. return params.isEditable && params.inputFieldType !== 'none'; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menu: (actions: any, props: any) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const spellCheckerMenuItems = SpellCheckerService.instance().contextMenuItems(props.misspelledWord, props.dictionarySuggestions).map((item: any) => new MenuItem(item)); const output = [ @@ -350,6 +356,7 @@ class Application extends BaseApplication { private setupOcrService() { if (Setting.value('ocr.enabled')) { if (!this.ocrService_) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const Tesseract = (window as any).Tesseract; const driver = new OcrDriverTesseract( @@ -375,6 +382,7 @@ class Application extends BaseApplication { eventManager.on(EventName.ResourceChange, handleResourceChange); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async start(argv: string[], startOptions: StartOptions = null): Promise { // If running inside a package, the command line, instead of being "node.exe " is "joplin.exe " so // insert an extra argument so that they can be processed in a consistent way everywhere. @@ -456,6 +464,7 @@ class Application extends BaseApplication { // manually call dispatchUpdateAll() to force an update. Setting.dispatchUpdateAll(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await refreshFolders((action: any) => this.dispatch(action)); const tags = await Tag.allWithNotes(); @@ -584,12 +593,14 @@ class Application extends BaseApplication { ResourceEditWatcher.instance().initialize( reg.logger(), + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (action: any) => { this.store().dispatch(action); }, (path: string) => bridge().openItem(path), ); // Forwards the local event to the global event manager, so that it can // be picked up by the plugin manager. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ResourceEditWatcher.instance().on('resourceChange', (event: any) => { eventManager.emit(EventName.ResourceChange, event); }); @@ -598,6 +609,7 @@ class Application extends BaseApplication { // Make it available to the console window - useful to call revisionService.collectRevisions() if (Setting.value('env') === 'dev') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (window as any).joplin = { revisionService: RevisionService.instance(), migrationService: MigrationService.instance(), diff --git a/packages/app-desktop/bridge.ts b/packages/app-desktop/bridge.ts index 6e76c8953..a379de97c 100644 --- a/packages/app-desktop/bridge.ts +++ b/packages/app-desktop/bridge.ts @@ -21,6 +21,7 @@ interface OpenDialogOptions { properties?: string[]; defaultPath?: string; createDirectory?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied filters?: any[]; } @@ -126,6 +127,7 @@ export class Bridge { this.onAllowedExtensionsChangeListener_ = listener; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async captureException(error: any) { Sentry.captureException(error); // We wait to give the "beforeSend" event handler time to process the crash dump and write @@ -191,6 +193,7 @@ export class Bridge { electronApp: this.electronApp(), + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied shouldShowMenu: (_event: any, params: any) => { return params.isEditable; }, @@ -219,6 +222,7 @@ export class Bridge { return require('electron').shell.showItemInFolder(toSystemSlashes(fullPath)); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public newBrowserWindow(options: any) { return new BrowserWindow(options); } @@ -248,6 +252,7 @@ export class Bridge { return this.window().webContents.closeDevTools(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async showSaveDialog(options: any) { if (!options) options = {}; if (!('defaultPath' in options) && this.lastSelectedPaths_.file) options.defaultPath = this.lastSelectedPaths_.file; @@ -262,16 +267,20 @@ export class Bridge { if (!options) options = {}; let fileType = 'file'; if (options.properties && options.properties.includes('openDirectory')) fileType = 'directory'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!('defaultPath' in options) && (this.lastSelectedPaths_ as any)[fileType]) options.defaultPath = (this.lastSelectedPaths_ as any)[fileType]; if (!('createDirectory' in options)) options.createDirectory = true; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const { filePaths } = await dialog.showOpenDialog(this.window(), options as any); if (filePaths && filePaths.length) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (this.lastSelectedPaths_ as any)[fileType] = dirname(filePaths[0]); } return filePaths; } // Don't use this directly - call one of the showXxxxxxxMessageBox() instead + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private showMessageBox_(window: any, options: MessageDialogOptions): number { if (!window) window = this.window(); return dialog.showMessageBoxSync(window, { message: '', ...options }); @@ -313,6 +322,7 @@ export class Bridge { return result; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public showInfoMessageBox(message: string, options: any = {}) { const result = this.showMessageBox_(this.window(), { type: 'info', message: message, diff --git a/packages/app-desktop/checkForUpdates.ts b/packages/app-desktop/checkForUpdates.ts index e5ee175de..08a68b8b7 100644 --- a/packages/app-desktop/checkForUpdates.ts +++ b/packages/app-desktop/checkForUpdates.ts @@ -64,6 +64,7 @@ async function addSkippedVersion(s: string) { await KvStore.instance().setValue('updateCheck::skippedVersions', JSON.stringify(versions)); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default async function checkForUpdates(inBackground: boolean, parentWindow: any, options: CheckForUpdateOptions) { if (isCheckingForUpdate_) { logger.info('Skipping check because it is already running'); diff --git a/packages/app-desktop/commands/exportFolders.ts b/packages/app-desktop/commands/exportFolders.ts index 25739e088..213e8c01c 100644 --- a/packages/app-desktop/commands/exportFolders.ts +++ b/packages/app-desktop/commands/exportFolders.ts @@ -11,6 +11,7 @@ export const runtime = (): CommandRuntime => { return { // "targetPath" should be a file for JEX export (because the format can // contain multiple folders) or a directory otherwise. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execute: async (_context: any, folderIds: string[], format: ExportModuleOutputFormat, targetPath: string) => { const exportOptions: ExportOptions = { sourceFolderIds: folderIds, diff --git a/packages/app-desktop/commands/exportNotes.ts b/packages/app-desktop/commands/exportNotes.ts index d9798d51d..a7a65b0c7 100644 --- a/packages/app-desktop/commands/exportNotes.ts +++ b/packages/app-desktop/commands/exportNotes.ts @@ -8,6 +8,7 @@ export const declaration: CommandDeclaration = { export const runtime = (): CommandRuntime => { return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execute: async (_context: any, noteIds: string[], format: ExportModuleOutputFormat, targetDirectoryPath: string) => { const exportOptions: ExportOptions = { path: targetDirectoryPath, diff --git a/packages/app-desktop/commands/focusElement.ts b/packages/app-desktop/commands/focusElement.ts index d6f5add90..304780f27 100644 --- a/packages/app-desktop/commands/focusElement.ts +++ b/packages/app-desktop/commands/focusElement.ts @@ -6,6 +6,7 @@ export const declaration: CommandDeclaration = { export const runtime = (): CommandRuntime => { return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execute: async (_context: any, target: string) => { if (target === 'noteBody') return CommandService.instance().execute('focusElementNoteBody'); if (target === 'noteList') return CommandService.instance().execute('focusElementNoteList'); diff --git a/packages/app-desktop/commands/toggleExternalEditing.ts b/packages/app-desktop/commands/toggleExternalEditing.ts index 234c9503b..0e108ef03 100644 --- a/packages/app-desktop/commands/toggleExternalEditing.ts +++ b/packages/app-desktop/commands/toggleExternalEditing.ts @@ -23,6 +23,7 @@ export const runtime = (): CommandRuntime => { } }, enabledCondition: 'oneNoteSelected && !noteIsReadOnly && (!modalDialogVisible || gotoAnythingVisible)', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied mapStateToTitle: (state: any) => { const noteId = stateUtils.selectedNoteId(state); return state.watchedNoteFiles.includes(noteId) ? _('Stop') : ''; diff --git a/packages/app-desktop/gui/Button/Button.tsx b/packages/app-desktop/gui/Button/Button.tsx index 765fa0755..7e827cf84 100644 --- a/packages/app-desktop/gui/Button/Button.tsx +++ b/packages/app-desktop/gui/Button/Button.tsx @@ -2,6 +2,9 @@ import * as React from 'react'; const styled = require('styled-components').default; const { space } = require('styled-system'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; +type StyleProps = any; + export enum ButtonLevel { Primary = 'primary', Secondary = 'secondary', @@ -26,6 +29,7 @@ interface Props { iconAnimation?: string; tooltip?: string; disabled?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; style?: any; size?: ButtonSize; isSquare?: boolean; @@ -71,131 +75,131 @@ const StyledButtonBase = styled.button` `; const StyledIcon = styled(styled.span(space))` - font-size: ${(props: any) => props.theme.toolbarIconSize}px; - ${(props: any) => props.animation ? `animation: ${props.animation}` : ''}; + font-size: ${(props: StyleProps) => props.theme.toolbarIconSize}px; + ${(props: StyleProps) => props.animation ? `animation: ${props.animation}` : ''}; `; const StyledButtonPrimary = styled(StyledButtonBase)` border: none; - background-color: ${(props: any) => props.theme.backgroundColor5}; + background-color: ${(props: StyleProps) => props.theme.backgroundColor5}; - ${(props: any) => props.disabled} { + ${(props: StyleProps) => props.disabled} { &:hover { - background-color: ${(props: any) => props.theme.backgroundColorHover5}; + background-color: ${(props: StyleProps) => props.theme.backgroundColorHover5}; } &:active { - background-color: ${(props: any) => props.theme.backgroundColorActive5}; + background-color: ${(props: StyleProps) => props.theme.backgroundColorActive5}; } } ${StyledIcon} { - color: ${(props: any) => props.theme.color5}; + color: ${(props: StyleProps) => props.theme.color5}; } ${StyledTitle} { - color: ${(props: any) => props.theme.color5}; + color: ${(props: StyleProps) => props.theme.color5}; } `; const StyledButtonSecondary = styled(StyledButtonBase)` - border: 1px solid ${(props: any) => props.theme.borderColor4}; - background-color: ${(props: any) => props.theme.backgroundColor4}; + border: 1px solid ${(props: StyleProps) => props.theme.borderColor4}; + background-color: ${(props: StyleProps) => props.theme.backgroundColor4}; - ${(props: any) => props.disabled} { + ${(props: StyleProps) => props.disabled} { &:hover { - background-color: ${(props: any) => props.theme.backgroundColorHover4}; + background-color: ${(props: StyleProps) => props.theme.backgroundColorHover4}; } &:active { - background-color: ${(props: any) => props.theme.backgroundColorActive4}; + background-color: ${(props: StyleProps) => props.theme.backgroundColorActive4}; } } ${StyledIcon} { - color: ${(props: any) => props.theme.color4}; + color: ${(props: StyleProps) => props.theme.color4}; } ${StyledTitle} { - color: ${(props: any) => props.theme.color4}; + color: ${(props: StyleProps) => props.theme.color4}; } `; const StyledButtonTertiary = styled(StyledButtonBase)` - border: 1px solid ${(props: any) => props.theme.color3}; - background-color: ${(props: any) => props.theme.backgroundColor3}; + border: 1px solid ${(props: StyleProps) => props.theme.color3}; + background-color: ${(props: StyleProps) => props.theme.backgroundColor3}; &:hover { - background-color: ${(props: any) => props.theme.backgroundColorHoverDim3}; + background-color: ${(props: StyleProps) => props.theme.backgroundColorHoverDim3}; } &:active { - background-color: ${(props: any) => props.theme.backgroundColorActive3}; + background-color: ${(props: StyleProps) => props.theme.backgroundColorActive3}; } ${StyledIcon} { - color: ${(props: any) => props.theme.color}; + color: ${(props: StyleProps) => props.theme.color}; } ${StyledTitle} { - color: ${(props: any) => props.theme.color}; + color: ${(props: StyleProps) => props.theme.color}; opacity: 0.9; } `; const StyledButtonRecommended = styled(StyledButtonBase)` - border: 1px solid ${(props: any) => props.theme.borderColor4}; - background-color: ${(props: any) => props.theme.warningBackgroundColor}; + border: 1px solid ${(props: StyleProps) => props.theme.borderColor4}; + background-color: ${(props: StyleProps) => props.theme.warningBackgroundColor}; ${StyledIcon} { - color: ${(props: any) => props.theme.color}; + color: ${(props: StyleProps) => props.theme.color}; } ${StyledTitle} { - color: ${(props: any) => props.theme.color}; + color: ${(props: StyleProps) => props.theme.color}; opacity: 0.9; } `; const StyledButtonSidebarSecondary = styled(StyledButtonBase)` background: none; - border-color: ${(props: any) => props.theme.color2}; - color: ${(props: any) => props.theme.color2}; + border-color: ${(props: StyleProps) => props.theme.color2}; + color: ${(props: StyleProps) => props.theme.color2}; &:hover { - color: ${(props: any) => props.theme.colorHover2}; - border-color: ${(props: any) => props.theme.colorHover2}; + color: ${(props: StyleProps) => props.theme.colorHover2}; + border-color: ${(props: StyleProps) => props.theme.colorHover2}; background: none; ${StyledTitle} { - color: ${(props: any) => props.theme.colorHover2}; + color: ${(props: StyleProps) => props.theme.colorHover2}; } ${StyledIcon} { - color: ${(props: any) => props.theme.colorHover2}; + color: ${(props: StyleProps) => props.theme.colorHover2}; } } &:active { - color: ${(props: any) => props.theme.colorActive2}; - border-color: ${(props: any) => props.theme.colorActive2}; + color: ${(props: StyleProps) => props.theme.colorActive2}; + border-color: ${(props: StyleProps) => props.theme.colorActive2}; background: none; ${StyledTitle} { - color: ${(props: any) => props.theme.colorActive2}; + color: ${(props: StyleProps) => props.theme.colorActive2}; } ${StyledIcon} { - color: ${(props: any) => props.theme.colorActive2}; + color: ${(props: StyleProps) => props.theme.colorActive2}; } } ${StyledTitle} { - color: ${(props: any) => props.theme.color2}; + color: ${(props: StyleProps) => props.theme.color2}; } ${StyledIcon} { - color: ${(props: any) => props.theme.color2}; + color: ${(props: StyleProps) => props.theme.color2}; } `; @@ -207,6 +211,7 @@ function buttonClass(level: ButtonLevel) { return StyledButtonSecondary; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; const Button = React.forwardRef((props: Props, ref: any) => { const iconOnly = props.iconName && !props.title; diff --git a/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx b/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx index 5c47cacab..cbee77fe9 100644 --- a/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx +++ b/packages/app-desktop/gui/ConfigScreen/ButtonBar.tsx @@ -3,6 +3,9 @@ import Button, { ButtonLevel } from '../Button/Button'; import { _ } from '@joplin/lib/locale'; const styled = require('styled-components').default; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; +type StyleProps = any; + interface Props { backButtonTitle?: string; hasChanges?: boolean; @@ -18,11 +21,11 @@ export const StyledRoot = styled.div` display: flex; align-items: center; padding: 10px; - background-color: ${(props: any) => props.theme.backgroundColor3}; - padding-left: ${(props: any) => props.theme.configScreenPadding}px; + background-color: ${(props: StyleProps) => props.theme.backgroundColor3}; + padding-left: ${(props: StyleProps) => props.theme.configScreenPadding}px; border-top-width: 1px; border-top-style: solid; - border-top-color: ${(props: any) => props.theme.dividerColor}; + border-top-color: ${(props: StyleProps) => props.theme.dividerColor}; `; export default function ButtonBar(props: Props) { diff --git a/packages/app-desktop/gui/ConfigScreen/ConfigScreen.tsx b/packages/app-desktop/gui/ConfigScreen/ConfigScreen.tsx index f237332e0..3bb23933d 100644 --- a/packages/app-desktop/gui/ConfigScreen/ConfigScreen.tsx +++ b/packages/app-desktop/gui/ConfigScreen/ConfigScreen.tsx @@ -21,14 +21,18 @@ import shouldShowMissingPasswordWarning from '@joplin/lib/components/shared/conf import MacOSMissingPasswordHelpLink from './controls/MissingPasswordHelpLink'; const { KeymapConfigScreen } = require('../KeymapConfig/KeymapConfigScreen'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const settingKeyToControl: any = { 'plugins.states': control_PluginsStates, }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied class ConfigScreenComponent extends React.Component { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private rowStyle_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(props: any) { super(props); @@ -138,10 +142,12 @@ class ConfigScreenComponent extends React.Component { this.setState({ selectedSectionName: section.name, screenName: screenName }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private sidebar_selectionChange(event: any) { void this.switchSection(event.section.name); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public renderSectionDescription(section: any) { const description = Setting.sectionDescription(section.name); if (!description) return null; @@ -154,6 +160,7 @@ class ConfigScreenComponent extends React.Component { ); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public sectionToComponent(key: string, section: any, settings: any, selected: boolean) { const theme = themeStyle(this.props.themeId); @@ -172,10 +179,12 @@ class ConfigScreenComponent extends React.Component { const settingComps = createSettingComponents(false); const advancedSettingComps = createSettingComponents(true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const sectionWidths: Record = { plugins: '100%', }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const sectionStyle: any = { marginTop: 20, marginBottom: 20, @@ -281,6 +290,7 @@ class ConfigScreenComponent extends React.Component { ); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private renderHeader(themeId: number, label: string, style: any = null) { const theme = themeStyle(themeId); @@ -302,9 +312,11 @@ class ConfigScreenComponent extends React.Component { return description ?
{description}
: null; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public settingToComponent(key: string, value: any) { const theme = themeStyle(this.props.themeId); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = null; const rowStyle = { @@ -339,6 +351,7 @@ class ConfigScreenComponent extends React.Component { paddingTop: 4, paddingBottom: 4 }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const updateSettingValue = (key: string, value: any) => { const md = Setting.settingMetadata(key); if (md.needRestart) { @@ -363,6 +376,7 @@ class ConfigScreenComponent extends React.Component { metadata={md} value={value} themeId={this.props.themeId} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onChange={(event: any) => { updateSettingValue(key, event.value); }} @@ -404,6 +418,7 @@ class ConfigScreenComponent extends React.Component { { onArgsChange(event); }} @@ -547,6 +566,7 @@ class ConfigScreenComponent extends React.Component { { onPathChange(event); }} @@ -567,6 +587,7 @@ class ConfigScreenComponent extends React.Component { ); } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onTextChange = (event: any) => { updateSettingValue(key, event.target.value); }; @@ -580,6 +601,7 @@ class ConfigScreenComponent extends React.Component { type={inputType} style={inputStyle} value={this.state.settings[key]} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onChange={(event: any) => { onTextChange(event); }} @@ -592,6 +614,7 @@ class ConfigScreenComponent extends React.Component { ); } } else if (md.type === Setting.TYPE_INT) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onNumChange = (event: any) => { updateSettingValue(key, event.target.value); }; @@ -599,6 +622,7 @@ class ConfigScreenComponent extends React.Component { const label = [md.label()]; if (md.unitLabel) label.push(`(${md.unitLabel()})`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const inputStyle: any = { ...textInputBaseStyle }; return ( @@ -610,6 +634,7 @@ class ConfigScreenComponent extends React.Component { type="number" style={inputStyle} value={this.state.settings[key]} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onChange={(event: any) => { onNumChange(event); }} @@ -717,6 +742,7 @@ class ConfigScreenComponent extends React.Component { const sections = shared.settingsSections({ device: AppType.Desktop, settings }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const needRestartComp: any = this.state.needRestart ? (
{this.restartMessage()} @@ -751,6 +777,7 @@ class ConfigScreenComponent extends React.Component { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const mapStateToProps = (state: any) => { return { themeId: state.settings.theme, diff --git a/packages/app-desktop/gui/ConfigScreen/Sidebar.tsx b/packages/app-desktop/gui/ConfigScreen/Sidebar.tsx index 8445792c4..3bebf6d6d 100644 --- a/packages/app-desktop/gui/ConfigScreen/Sidebar.tsx +++ b/packages/app-desktop/gui/ConfigScreen/Sidebar.tsx @@ -4,16 +4,20 @@ import Setting from '@joplin/lib/models/Setting'; import { _ } from '@joplin/lib/locale'; const styled = require('styled-components').default; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; +type StyleProps = any; + interface Props { selection: string; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onSelectionChange: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; sections: any[]; } export const StyledRoot = styled.div` display: flex; - background-color: ${(props: any) => props.theme.backgroundColor2}; + background-color: ${(props: StyleProps) => props.theme.backgroundColor2}; flex-direction: column; overflow-x: hidden; overflow-y: auto; @@ -23,16 +27,16 @@ export const StyledListItem = styled.a` box-sizing: border-box; display: flex; flex-direction: row; - padding: ${(props: any) => props.theme.mainPadding}px; - background: ${(props: any) => props.selected ? props.theme.selectedColor2 : 'none'}; + padding: ${(props: StyleProps) => props.theme.mainPadding}px; + background: ${(props: StyleProps) => props.selected ? props.theme.selectedColor2 : 'none'}; transition: 0.1s; text-decoration: none; cursor: default; - opacity: ${(props: any) => props.selected ? 1 : 0.8}; - padding-left: ${(props: any) => props.isSubSection ? '35' : props.theme.mainPadding}px; + opacity: ${(props: StyleProps) => props.selected ? 1 : 0.8}; + padding-left: ${(props: StyleProps) => props.isSubSection ? '35' : props.theme.mainPadding}px; &:hover { - background-color: ${(props: any) => props.theme.backgroundColorHover2}; + background-color: ${(props: StyleProps) => props.theme.backgroundColorHover2}; } `; @@ -40,21 +44,21 @@ export const StyledDivider = styled.div` box-sizing: border-box; display: flex; flex-direction: row; - color: ${(props: any) => props.theme.color2}; - padding: ${(props: any) => props.theme.mainPadding}px; - padding-top: ${(props: any) => props.theme.mainPadding * .8}px; - padding-bottom: ${(props: any) => props.theme.mainPadding * .8}px; - border-top: 1px solid ${(props: any) => props.theme.dividerColor}; - border-bottom: 1px solid ${(props: any) => props.theme.dividerColor}; - background-color: ${(props: any) => props.theme.selectedColor2}; - font-size: ${(props: any) => Math.round(props.theme.fontSize)}px; + color: ${(props: StyleProps) => props.theme.color2}; + padding: ${(props: StyleProps) => props.theme.mainPadding}px; + padding-top: ${(props: StyleProps) => props.theme.mainPadding * .8}px; + padding-bottom: ${(props: StyleProps) => props.theme.mainPadding * .8}px; + border-top: 1px solid ${(props: StyleProps) => props.theme.dividerColor}; + border-bottom: 1px solid ${(props: StyleProps) => props.theme.dividerColor}; + background-color: ${(props: StyleProps) => props.theme.selectedColor2}; + font-size: ${(props: StyleProps) => Math.round(props.theme.fontSize)}px; opacity: 0.5; `; export const StyledListItemLabel = styled.span` - font-size: ${(props: any) => Math.round(props.theme.fontSize * 1.2)}px; + font-size: ${(props: StyleProps) => Math.round(props.theme.fontSize * 1.2)}px; font-weight: 500; - color: ${(props: any) => props.theme.color2}; + color: ${(props: StyleProps) => props.theme.color2}; white-space: nowrap; display: flex; flex: 1; @@ -63,14 +67,16 @@ export const StyledListItemLabel = styled.span` `; export const StyledListItemIcon = styled.i` - font-size: ${(props: any) => Math.round(props.theme.fontSize * 1.4)}px; - color: ${(props: any) => props.theme.color2}; - margin-right: ${(props: any) => props.theme.mainPadding / 1.5}px; + font-size: ${(props: StyleProps) => Math.round(props.theme.fontSize * 1.4)}px; + color: ${(props: StyleProps) => props.theme.color2}; + margin-right: ${(props: StyleProps) => props.theme.mainPadding / 1.5}px; `; export default function Sidebar(props: Props) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; const buttons: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; function renderButton(section: any) { const selected = props.selection === section.name; return ( diff --git a/packages/app-desktop/gui/ConfigScreen/controls/MissingPasswordHelpLink.tsx b/packages/app-desktop/gui/ConfigScreen/controls/MissingPasswordHelpLink.tsx index 41a77c4b6..0cad75749 100644 --- a/packages/app-desktop/gui/ConfigScreen/controls/MissingPasswordHelpLink.tsx +++ b/packages/app-desktop/gui/ConfigScreen/controls/MissingPasswordHelpLink.tsx @@ -5,6 +5,7 @@ import bridge from '../../../services/bridge'; import StyledLink from '../../style/StyledLink'; interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied theme: any; text: string; } diff --git a/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginBox.tsx b/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginBox.tsx index 021808319..7fe971e03 100644 --- a/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginBox.tsx +++ b/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginBox.tsx @@ -98,6 +98,7 @@ const BoxedLabel = styled.div` margin-top: auto; `; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const StyledNameAndVersion = styled.div<{ mb: any }>` font-family: ${props => props.theme.fontFamily}; color: ${props => props.theme.color}; diff --git a/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginsStates.tsx b/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginsStates.tsx index 46face17f..425818807 100644 --- a/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginsStates.tsx +++ b/packages/app-desktop/gui/ConfigScreen/controls/plugins/PluginsStates.tsx @@ -28,6 +28,7 @@ const Root = styled.div` flex-direction: column; `; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const UserPluginsRoot = styled.div` ${space} display: flex; @@ -38,12 +39,14 @@ const ToolsButton = styled(Button)` margin-right: 6px; `; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const RepoApiErrorMessage = styled(StyledMessage)` max-width: ${props => props.maxWidth}px; margin-bottom: 10px; `; interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; themeId: number; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied @@ -233,6 +236,7 @@ export default function(props: Props) { setSearchQuery(event.value); }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onSearchPluginSettingsChange = useCallback((event: any) => { props.onChange({ value: pluginService.serializePluginSettings(event.value) }); // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied diff --git a/packages/app-desktop/gui/ConfigScreen/controls/plugins/SearchPlugins.tsx b/packages/app-desktop/gui/ConfigScreen/controls/plugins/SearchPlugins.tsx index 922b4145d..ee7d0e356 100644 --- a/packages/app-desktop/gui/ConfigScreen/controls/plugins/SearchPlugins.tsx +++ b/packages/app-desktop/gui/ConfigScreen/controls/plugins/SearchPlugins.tsx @@ -24,6 +24,7 @@ interface Props { searchQuery: string; onSearchQueryChange(event: OnChangeEvent): void; pluginSettings: PluginSettings; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onPluginSettingsChange(event: any): void; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied renderDescription: Function; diff --git a/packages/app-desktop/gui/DialogButtonRow.tsx b/packages/app-desktop/gui/DialogButtonRow.tsx index 3ece005e5..edbcbf3bc 100644 --- a/packages/app-desktop/gui/DialogButtonRow.tsx +++ b/packages/app-desktop/gui/DialogButtonRow.tsx @@ -23,6 +23,7 @@ interface Props { cancelButtonDisabled?: boolean; okButtonShow?: boolean; okButtonLabel?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied okButtonRef?: any; okButtonDisabled?: boolean; customButtons?: ButtonSpec[]; diff --git a/packages/app-desktop/gui/DialogButtonRow/useKeyboardHandler.ts b/packages/app-desktop/gui/DialogButtonRow/useKeyboardHandler.ts index 0cb419221..1a61fad7a 100644 --- a/packages/app-desktop/gui/DialogButtonRow/useKeyboardHandler.ts +++ b/packages/app-desktop/gui/DialogButtonRow/useKeyboardHandler.ts @@ -29,6 +29,7 @@ export default (props: Props) => { return ln && globalKeydownHandlersRef.current[ln - 1] === elementId; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const isInSubModal = (targetElement: any) => { // If we are inside a sub-modal within the dialog, we shouldn't handle // global key events. It can be for example the emoji picker. In general @@ -39,6 +40,7 @@ export default (props: Props) => { return false; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onKeyDown = useCallback((event: any) => { // Early exit if it's neither ENTER nor ESCAPE, because isInSubModal // function can be costly. diff --git a/packages/app-desktop/gui/DialogTitle.tsx b/packages/app-desktop/gui/DialogTitle.tsx index 756bffbba..75092d155 100644 --- a/packages/app-desktop/gui/DialogTitle.tsx +++ b/packages/app-desktop/gui/DialogTitle.tsx @@ -1,5 +1,6 @@ import styled from 'styled-components'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const Root = styled.div` display: flex; justify-content: ${props => props.justifyContent ? props.justifyContent : 'center'}; diff --git a/packages/app-desktop/gui/DropboxLoginScreen.tsx b/packages/app-desktop/gui/DropboxLoginScreen.tsx index 334095d49..33a3077a0 100644 --- a/packages/app-desktop/gui/DropboxLoginScreen.tsx +++ b/packages/app-desktop/gui/DropboxLoginScreen.tsx @@ -11,8 +11,10 @@ interface Props { themeId: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied class DropboxLoginScreenComponent extends React.Component { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private shared_: any; public constructor(props: Props) { @@ -61,6 +63,7 @@ class DropboxLoginScreenComponent extends React.Component { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const mapStateToProps = (state: any) => { return { themeId: state.settings.theme, diff --git a/packages/app-desktop/gui/Dropdown/Dropdown.tsx b/packages/app-desktop/gui/Dropdown/Dropdown.tsx index 645b259dc..32ceb9f75 100644 --- a/packages/app-desktop/gui/Dropdown/Dropdown.tsx +++ b/packages/app-desktop/gui/Dropdown/Dropdown.tsx @@ -31,6 +31,7 @@ export const Dropdown = (props: Props) => { return optionComps; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onChange = useCallback((event: any) => { props.onChange({ value: event.target.value }); }, [props.onChange]); diff --git a/packages/app-desktop/gui/EditFolderDialog/Dialog.tsx b/packages/app-desktop/gui/EditFolderDialog/Dialog.tsx index 689166876..c83a013e7 100644 --- a/packages/app-desktop/gui/EditFolderDialog/Dialog.tsx +++ b/packages/app-desktop/gui/EditFolderDialog/Dialog.tsx @@ -86,6 +86,7 @@ export default function(props: Props) { // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied }, [onClose, folderTitle, folderIcon, props.folderId, props.parentId]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onFolderTitleChange = useCallback((event: any) => { setFolderTitle(event.target.value); }, []); diff --git a/packages/app-desktop/gui/EditFolderDialog/IconSelector.tsx b/packages/app-desktop/gui/EditFolderDialog/IconSelector.tsx index 756df1677..d7f6bc5dd 100644 --- a/packages/app-desktop/gui/EditFolderDialog/IconSelector.tsx +++ b/packages/app-desktop/gui/EditFolderDialog/IconSelector.tsx @@ -58,6 +58,7 @@ export const IconSelector = (props: Props) => { useEffect(() => { if (!emojiButtonClassReady) return () => {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const p: EmojiButton = new (window as any).EmojiButton({ zIndex: 10000, }); diff --git a/packages/app-desktop/gui/EncryptionConfigScreen/EncryptionConfigScreen.tsx b/packages/app-desktop/gui/EncryptionConfigScreen/EncryptionConfigScreen.tsx index fa61a513e..2275f88f1 100644 --- a/packages/app-desktop/gui/EncryptionConfigScreen/EncryptionConfigScreen.tsx +++ b/packages/app-desktop/gui/EncryptionConfigScreen/EncryptionConfigScreen.tsx @@ -20,6 +20,7 @@ import ToggleAdvancedSettingsButton from '../ConfigScreen/controls/ToggleAdvance import MacOSMissingPasswordHelpLink from '../ConfigScreen/controls/MissingPasswordHelpLink'; interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied themeId: any; masterKeys: MasterKeyEntity[]; passwords: Record; @@ -34,6 +35,7 @@ interface Props { const EncryptionConfigScreen = (props: Props) => { const { inputPasswords, onInputPasswordChange } = useInputPasswords(props.passwords); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const theme: any = useMemo(() => { return themeStyle(props.themeId); }, [props.themeId]); @@ -157,6 +159,7 @@ const EncryptionConfigScreen = (props: Props) => { } const headerComp = isEnabledMasterKeys ?

{_('Encryption keys')}

: toggleShowDisabledMasterKeys() } style={{ ...theme.urlStyle, display: 'inline-block', marginBottom: 10 }} href="#">{showTable ? _('Hide disabled keys') : _('Show disabled keys')}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const infoComp: any = null; // isEnabledMasterKeys ?

{'Note: Only one key is going to be used for encryption (the one marked as "active"). Any of the keys might be used for decryption, depending on how the notes or notebooks were originally encrypted.'}

: null; const tableComp = !showTable ? null : ( diff --git a/packages/app-desktop/gui/ErrorBoundary.tsx b/packages/app-desktop/gui/ErrorBoundary.tsx index a28e7212c..b7df358e1 100644 --- a/packages/app-desktop/gui/ErrorBoundary.tsx +++ b/packages/app-desktop/gui/ErrorBoundary.tsx @@ -26,6 +26,7 @@ interface State { interface Props { message?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied children: any; } @@ -33,6 +34,7 @@ export default class ErrorBoundary extends React.Component { public state: State = { error: null, errorInfo: null, pluginInfos: [], plugins: {} }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public componentDidCatch(error: any, errorInfo: ErrorInfo) { if (typeof error === 'string') error = { message: error }; diff --git a/packages/app-desktop/gui/ExtensionBadge.tsx b/packages/app-desktop/gui/ExtensionBadge.tsx index 2b7c38e58..cf4a65d5c 100644 --- a/packages/app-desktop/gui/ExtensionBadge.tsx +++ b/packages/app-desktop/gui/ExtensionBadge.tsx @@ -8,13 +8,16 @@ interface Props { themeId: number; type: string; url: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style?: any; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const themeSelector = (_state: any, props: any) => themeStyle(props.themeId); const styleSelector = createSelector( themeSelector, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (theme: any) => { const output = { root: { diff --git a/packages/app-desktop/gui/HelpButton.tsx b/packages/app-desktop/gui/HelpButton.tsx index def951501..7dbb13df4 100644 --- a/packages/app-desktop/gui/HelpButton.tsx +++ b/packages/app-desktop/gui/HelpButton.tsx @@ -8,6 +8,7 @@ interface Props { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onClick: Function; themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; } @@ -26,6 +27,7 @@ class HelpButtonComponent extends React.Component { const theme = themeStyle(this.props.themeId); const style = { ...this.props.style, color: theme.color, textDecoration: 'none' }; const helpIconStyle = { flex: 0, width: 16, height: 16, marginLeft: 10 }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const extraProps: any = {}; if (this.props.tip) extraProps['data-tip'] = this.props.tip; return ( diff --git a/packages/app-desktop/gui/IconButton.tsx b/packages/app-desktop/gui/IconButton.tsx index 7e230fc14..1eec31020 100644 --- a/packages/app-desktop/gui/IconButton.tsx +++ b/packages/app-desktop/gui/IconButton.tsx @@ -3,6 +3,7 @@ import { themeStyle } from '@joplin/lib/theme'; interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; iconName: string; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied diff --git a/packages/app-desktop/gui/ImportScreen.tsx b/packages/app-desktop/gui/ImportScreen.tsx index 97b2ade15..39c9a23b7 100644 --- a/packages/app-desktop/gui/ImportScreen.tsx +++ b/packages/app-desktop/gui/ImportScreen.tsx @@ -83,6 +83,7 @@ class ImportScreenComponent extends React.Component { let lastProgress = ''; const options = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProgress: (progressState: any) => { const line = []; line.push(_('Found: %d.', progressState.loaded)); @@ -94,6 +95,7 @@ class ImportScreenComponent extends React.Component { lastProgress = line.join(' '); this.addMessage('progress', lastProgress); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onError: (error: any) => { // Don't display the error directly because most of the time it doesn't matter // (eg. for weird broken HTML, but the note is still imported) diff --git a/packages/app-desktop/gui/ItemList.tsx b/packages/app-desktop/gui/ItemList.tsx index 9ffe360f1..0b558ae63 100644 --- a/packages/app-desktop/gui/ItemList.tsx +++ b/packages/app-desktop/gui/ItemList.tsx @@ -1,8 +1,10 @@ import * as React from 'react'; interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; itemHeight: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied items: any[]; disabled?: boolean; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied @@ -22,6 +24,7 @@ interface State { class ItemList extends React.Component { private scrollTop_: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private listRef: any; public constructor(props: Props) { @@ -72,15 +75,18 @@ class ItemList extends React.Component { this.updateStateItemIndexes(newProps); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public onScroll(event: any) { this.scrollTop_ = event.target.scrollTop; this.updateStateItemIndexes(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public onKeyDown(event: any) { if (this.props.onKeyDown) this.props.onKeyDown(event); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public onDrop(event: any) { if (this.props.onNoteDrop) this.props.onNoteDrop(event); } diff --git a/packages/app-desktop/gui/KeymapConfig/styles/index.ts b/packages/app-desktop/gui/KeymapConfig/styles/index.ts index 4dba1c963..1470e7e26 100644 --- a/packages/app-desktop/gui/KeymapConfig/styles/index.ts +++ b/packages/app-desktop/gui/KeymapConfig/styles/index.ts @@ -1,6 +1,7 @@ const { buildStyle } = require('@joplin/lib/theme'); export default function styles(themeId: number) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return buildStyle('KeymapConfigScreen', themeId, (theme: any) => { return { container: { diff --git a/packages/app-desktop/gui/MainScreen/MainScreen.tsx b/packages/app-desktop/gui/MainScreen/MainScreen.tsx index 961d360fd..89a5acefb 100644 --- a/packages/app-desktop/gui/MainScreen/MainScreen.tsx +++ b/packages/app-desktop/gui/MainScreen/MainScreen.tsx @@ -65,8 +65,10 @@ interface Props { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; mainLayout: LayoutItem; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; layoutMoveMode: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied editorNoteStatuses: any; customCss: string; shouldUpgradeSyncTarget: boolean; @@ -78,6 +80,7 @@ interface Props { showShouldReencryptMessage: boolean; themeId: number; settingEditorCodeView: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginsLegacy: any; startupPluginsLoaded: boolean; shareInvitations: ShareInvitation[]; @@ -102,10 +105,14 @@ interface ShareFolderDialogOptions { } interface State { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied promptOptions: any; modalLayer: LayerModalState; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied notePropertiesDialogOptions: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied noteContentPropertiesDialogOptions: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied shareNoteDialogOptions: any; shareFolderDialogOptions: ShareFolderDialogOptions; } @@ -132,9 +139,11 @@ const defaultLayout: LayoutItem = { class MainScreenComponent extends React.Component { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private waitForNotesSavedIID_: any; private isPrinting_: boolean; private styleKey_: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private styles_: any; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private promptOnClose_: Function; @@ -176,6 +185,7 @@ class MainScreenComponent extends React.Component { window.addEventListener('resize', this.window_resize); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ipcRenderer.on('asynchronous-message', (_event: any, message: string, args: any) => { if (message === 'openCallbackUrl') { this.openCallbackUrl(args.url); @@ -330,6 +340,7 @@ class MainScreenComponent extends React.Component { } public updateRootLayoutSize() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.updateMainLayout(produce(this.props.mainLayout, (draft: any) => { const s = this.rootLayoutSize(); draft.width = s.width; @@ -400,6 +411,7 @@ class MainScreenComponent extends React.Component { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public layoutModeListenerKeyDown(event: any) { if (event.key !== 'Escape') return; if (!this.props.layoutMoveMode) return; @@ -425,6 +437,7 @@ class MainScreenComponent extends React.Component { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async printTo_(target: string, options: any) { // Concurrent print calls are disallowed to avoid incorrect settings being restored upon completion if (this.isPrinting_) { @@ -533,6 +546,7 @@ class MainScreenComponent extends React.Component { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private renderNotificationMessage(message: string, callForAction: string = null, callForActionHandler: Function = null, callForAction2: string = null, callForActionHandler2: Function = null) { const theme = themeStyle(this.props.themeId); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const urlStyle: any = { color: theme.colorWarnUrl, textDecoration: 'underline' }; if (!callForAction) return {message}; @@ -557,6 +571,7 @@ class MainScreenComponent extends React.Component { ); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public renderNotification(theme: any, styles: any) { if (!this.messageBoxVisible()) return null; @@ -705,6 +720,7 @@ class MainScreenComponent extends React.Component { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private resizableLayout_resize(event: any) { this.updateMainLayout(event.layout); } @@ -714,6 +730,7 @@ class MainScreenComponent extends React.Component { this.updateMainLayout(newLayout); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private resizableLayout_renderItem(key: string, event: any) { // Key should never be undefined but somehow it can happen, also not // clear how. For now in this case render nothing so that the app @@ -728,6 +745,7 @@ class MainScreenComponent extends React.Component { // const viewsToRemove:string[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const components: any = { sideBar: () => { return ; @@ -854,6 +872,7 @@ class MainScreenComponent extends React.Component { const styles = this.styles(this.props.themeId, style.width, style.height, this.messageBoxVisible()); if (!this.promptOnClose_) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.promptOnClose_ = (answer: any, buttonType: any) => { return this.state.promptOptions.onClose(answer, buttonType); }; @@ -898,6 +917,7 @@ class MainScreenComponent extends React.Component { lastDeletion={this.props.lastDeletion} lastDeletionNotificationTime={this.props.lastDeletionNotificationTime} themeId={this.props.themeId} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied dispatch={this.props.dispatch as any} /> {messageComp} diff --git a/packages/app-desktop/gui/MainScreen/commands/addProfile.ts b/packages/app-desktop/gui/MainScreen/commands/addProfile.ts index 32ec1ea31..64a0d32f3 100644 --- a/packages/app-desktop/gui/MainScreen/commands/addProfile.ts +++ b/packages/app-desktop/gui/MainScreen/commands/addProfile.ts @@ -9,6 +9,7 @@ export const declaration: CommandDeclaration = { label: () => _('Create new profile...'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext) => { diff --git a/packages/app-desktop/gui/MainScreen/commands/editAlarm.ts b/packages/app-desktop/gui/MainScreen/commands/editAlarm.ts index a48998f50..47f740664 100644 --- a/packages/app-desktop/gui/MainScreen/commands/editAlarm.ts +++ b/packages/app-desktop/gui/MainScreen/commands/editAlarm.ts @@ -12,6 +12,7 @@ export const declaration: CommandDeclaration = { iconName: 'icon-alarm', }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext, noteId: string = null) => { @@ -29,6 +30,7 @@ export const runtime = (comp: any): CommandRuntime => { inputType: 'datetime', buttons: ['ok', 'cancel', 'clear'], value: note.todo_due ? new Date(note.todo_due) : defaultDate, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onClose: async (answer: any, buttonType: string) => { let newNote: NoteEntity = null; @@ -57,6 +59,7 @@ export const runtime = (comp: any): CommandRuntime => { enabledCondition: 'oneNoteSelected && noteIsTodo && !noteTodoCompleted', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied mapStateToTitle: (state: any) => { const note = stateUtils.selectedNote(state); return note && note.todo_due ? time.formatMsToLocal(note.todo_due) : null; diff --git a/packages/app-desktop/gui/MainScreen/commands/exportPdf.ts b/packages/app-desktop/gui/MainScreen/commands/exportPdf.ts index db6800cca..d7bfe1bd7 100644 --- a/packages/app-desktop/gui/MainScreen/commands/exportPdf.ts +++ b/packages/app-desktop/gui/MainScreen/commands/exportPdf.ts @@ -10,6 +10,7 @@ export const declaration: CommandDeclaration = { label: () => `PDF - ${_('PDF File')}`, }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext, noteIds: string[] = null) => { diff --git a/packages/app-desktop/gui/MainScreen/commands/gotoAnything.ts b/packages/app-desktop/gui/MainScreen/commands/gotoAnything.ts index 410684457..0b8c96871 100644 --- a/packages/app-desktop/gui/MainScreen/commands/gotoAnything.ts +++ b/packages/app-desktop/gui/MainScreen/commands/gotoAnything.ts @@ -14,6 +14,7 @@ export const declaration: CommandDeclaration = { }; function menuItemById(id: string) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return PluginManager.instance().menuItems().find((i: any) => i.id === id); } @@ -31,6 +32,7 @@ export const runtime = (): CommandRuntime => { } 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) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const menuItem = PluginManager.instance().menuItems().find((i: any) => i.id === 'controlledApi'); menuItem.userData = { callback: { resolve, reject }, diff --git a/packages/app-desktop/gui/MainScreen/commands/hideModalMessage.ts b/packages/app-desktop/gui/MainScreen/commands/hideModalMessage.ts index f4ddd94b3..1efcc7442 100644 --- a/packages/app-desktop/gui/MainScreen/commands/hideModalMessage.ts +++ b/packages/app-desktop/gui/MainScreen/commands/hideModalMessage.ts @@ -4,6 +4,7 @@ export const declaration: CommandDeclaration = { name: 'hideModalMessage', }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async () => { diff --git a/packages/app-desktop/gui/MainScreen/commands/moveToFolder.ts b/packages/app-desktop/gui/MainScreen/commands/moveToFolder.ts index a2b384fde..9ad8e8787 100644 --- a/packages/app-desktop/gui/MainScreen/commands/moveToFolder.ts +++ b/packages/app-desktop/gui/MainScreen/commands/moveToFolder.ts @@ -8,15 +8,19 @@ export const declaration: CommandDeclaration = { label: () => _('Move to notebook'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext, noteIds: string[] = null) => { noteIds = noteIds || context.state.selectedNoteIds; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const folders: any[] = await Folder.sortFolderTree(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const startFolders: any[] = []; const maxDepth = 15; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const addOptions = (folders: any[], depth: number) => { for (let i = 0; i < folders.length; i++) { const folder = folders[i]; @@ -33,6 +37,7 @@ export const runtime = (comp: any): CommandRuntime => { inputType: 'dropdown', value: '', autocomplete: startFolders, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onClose: async (answer: any) => { if (answer) { for (let i = 0; i < noteIds.length; i++) { diff --git a/packages/app-desktop/gui/MainScreen/commands/print.ts b/packages/app-desktop/gui/MainScreen/commands/print.ts index 3ad4b5678..3940c1cb6 100644 --- a/packages/app-desktop/gui/MainScreen/commands/print.ts +++ b/packages/app-desktop/gui/MainScreen/commands/print.ts @@ -8,6 +8,7 @@ export const declaration: CommandDeclaration = { iconName: 'fa-file', }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext, noteIds: string[] = null) => { diff --git a/packages/app-desktop/gui/MainScreen/commands/renameFolder.ts b/packages/app-desktop/gui/MainScreen/commands/renameFolder.ts index 41ba655cf..c172c5cf6 100644 --- a/packages/app-desktop/gui/MainScreen/commands/renameFolder.ts +++ b/packages/app-desktop/gui/MainScreen/commands/renameFolder.ts @@ -8,6 +8,7 @@ export const declaration: CommandDeclaration = { label: () => _('Rename'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext, folderId: string = null) => { diff --git a/packages/app-desktop/gui/MainScreen/commands/renameTag.ts b/packages/app-desktop/gui/MainScreen/commands/renameTag.ts index 6f3e57af9..f1f45c07b 100644 --- a/packages/app-desktop/gui/MainScreen/commands/renameTag.ts +++ b/packages/app-desktop/gui/MainScreen/commands/renameTag.ts @@ -8,6 +8,7 @@ export const declaration: CommandDeclaration = { label: () => _('Rename'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext, tagId: string = null) => { diff --git a/packages/app-desktop/gui/MainScreen/commands/setTags.ts b/packages/app-desktop/gui/MainScreen/commands/setTags.ts index f87856900..31d539396 100644 --- a/packages/app-desktop/gui/MainScreen/commands/setTags.ts +++ b/packages/app-desktop/gui/MainScreen/commands/setTags.ts @@ -8,6 +8,7 @@ export const declaration: CommandDeclaration = { iconName: 'icon-tags', }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext, noteIds: string[] = null) => { @@ -15,18 +16,22 @@ export const runtime = (comp: any): CommandRuntime => { const tags = await Tag.commonTagsByNoteIds(noteIds); const startTags = tags + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .map((a: any) => { return { value: a.id, label: a.title }; }) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .sort((a: any, b: any) => { // sensitivity accent will treat accented characters as different // but treats caps as equal return a.label.localeCompare(b.label, undefined, { sensitivity: 'accent' }); }); const allTags = await Tag.allWithNotes(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const tagSuggestions = allTags.map((a: any) => { return { value: a.id, label: a.title }; }) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .sort((a: any, b: any) => { // sensitivity accent will treat accented characters as different // but treats caps as equal @@ -39,6 +44,7 @@ export const runtime = (comp: any): CommandRuntime => { inputType: 'tags', value: startTags, autocomplete: tagSuggestions, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onClose: async (answer: any[]) => { if (answer !== null) { const endTagTitles = answer.map(a => { @@ -47,6 +53,7 @@ export const runtime = (comp: any): CommandRuntime => { if (noteIds.length === 1) { await Tag.setNoteTagsByTitles(noteIds[0], endTagTitles); } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const startTagTitles = startTags.map((a: any) => { return a.label.trim(); }); const addTags = endTagTitles.filter((value: string) => !startTagTitles.includes(value)); const delTags = startTagTitles.filter((value: string) => !endTagTitles.includes(value)); @@ -54,6 +61,7 @@ export const runtime = (comp: any): CommandRuntime => { // apply the tag additions and deletions to each selected note for (let i = 0; i < noteIds.length; i++) { const tags = await Tag.tagsByNoteId(noteIds[i]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let tagTitles = tags.map((a: any) => { return a.title; }); tagTitles = tagTitles.concat(addTags); tagTitles = tagTitles.filter((value: string) => !delTags.includes(value)); diff --git a/packages/app-desktop/gui/MainScreen/commands/showModalMessage.tsx b/packages/app-desktop/gui/MainScreen/commands/showModalMessage.tsx index 7b53ebf2c..f5414cf3b 100644 --- a/packages/app-desktop/gui/MainScreen/commands/showModalMessage.tsx +++ b/packages/app-desktop/gui/MainScreen/commands/showModalMessage.tsx @@ -5,6 +5,7 @@ export const declaration: CommandDeclaration = { name: 'showModalMessage', }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (_context: CommandContext, message: string) => { diff --git a/packages/app-desktop/gui/MainScreen/commands/showNoteContentProperties.ts b/packages/app-desktop/gui/MainScreen/commands/showNoteContentProperties.ts index 61b0a0cd8..c636f3115 100644 --- a/packages/app-desktop/gui/MainScreen/commands/showNoteContentProperties.ts +++ b/packages/app-desktop/gui/MainScreen/commands/showNoteContentProperties.ts @@ -8,6 +8,7 @@ export const declaration: CommandDeclaration = { label: () => _('Statistics...'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext, noteId: string = null) => { diff --git a/packages/app-desktop/gui/MainScreen/commands/showNoteProperties.ts b/packages/app-desktop/gui/MainScreen/commands/showNoteProperties.ts index e54d7bc42..90c8233c5 100644 --- a/packages/app-desktop/gui/MainScreen/commands/showNoteProperties.ts +++ b/packages/app-desktop/gui/MainScreen/commands/showNoteProperties.ts @@ -8,6 +8,7 @@ export const declaration: CommandDeclaration = { iconName: 'icon-info', }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext, noteId: string = null) => { diff --git a/packages/app-desktop/gui/MainScreen/commands/showPrompt.ts b/packages/app-desktop/gui/MainScreen/commands/showPrompt.ts index a9acaca5e..8c0dd55d8 100644 --- a/packages/app-desktop/gui/MainScreen/commands/showPrompt.ts +++ b/packages/app-desktop/gui/MainScreen/commands/showPrompt.ts @@ -14,11 +14,14 @@ enum PromptInputType { interface PromptConfig { label: string; inputType?: PromptInputType; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value?: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied autocomplete?: any[]; buttons?: string[]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (_context: CommandContext, config: PromptConfig) => { @@ -26,6 +29,7 @@ export const runtime = (comp: any): CommandRuntime => { comp.setState({ promptOptions: { ...config, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onClose: async (answer: any, buttonType: string) => { comp.setState({ promptOptions: null }); resolve({ diff --git a/packages/app-desktop/gui/MainScreen/commands/showShareFolderDialog.ts b/packages/app-desktop/gui/MainScreen/commands/showShareFolderDialog.ts index fde0c5870..516dc6aa1 100644 --- a/packages/app-desktop/gui/MainScreen/commands/showShareFolderDialog.ts +++ b/packages/app-desktop/gui/MainScreen/commands/showShareFolderDialog.ts @@ -6,6 +6,7 @@ export const declaration: CommandDeclaration = { label: () => _('Share notebook...'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext, folderId: string = null) => { diff --git a/packages/app-desktop/gui/MainScreen/commands/showShareNoteDialog.ts b/packages/app-desktop/gui/MainScreen/commands/showShareNoteDialog.ts index 03d237c07..71d8b2b26 100644 --- a/packages/app-desktop/gui/MainScreen/commands/showShareNoteDialog.ts +++ b/packages/app-desktop/gui/MainScreen/commands/showShareNoteDialog.ts @@ -6,6 +6,7 @@ export const declaration: CommandDeclaration = { label: () => _('Publish note...'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async (context: CommandContext, noteIds: string[] = null) => { diff --git a/packages/app-desktop/gui/MainScreen/commands/showSpellCheckerMenu.ts b/packages/app-desktop/gui/MainScreen/commands/showSpellCheckerMenu.ts index 8d9dcd452..73476bf68 100644 --- a/packages/app-desktop/gui/MainScreen/commands/showSpellCheckerMenu.ts +++ b/packages/app-desktop/gui/MainScreen/commands/showSpellCheckerMenu.ts @@ -19,6 +19,7 @@ export const runtime = (): CommandRuntime => { useSpellChecker = useSpellChecker === null ? context.state.settings['spellChecker.enabled'] : useSpellChecker; const menuItems = SpellCheckerService.instance().spellCheckerConfigMenuItems(selectedLanguages, useSpellChecker); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const menu = Menu.buildFromTemplate(menuItems as any); menu.popup({ window: bridge().window() }); }, diff --git a/packages/app-desktop/gui/MainScreen/commands/toggleNotesSortOrderField.ts b/packages/app-desktop/gui/MainScreen/commands/toggleNotesSortOrderField.ts index 0c0b4c8b2..b68d3d1cd 100644 --- a/packages/app-desktop/gui/MainScreen/commands/toggleNotesSortOrderField.ts +++ b/packages/app-desktop/gui/MainScreen/commands/toggleNotesSortOrderField.ts @@ -10,6 +10,7 @@ export const declaration: CommandDeclaration = { export const runtime = (): CommandRuntime => { return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execute: async (_context: CommandContext, field?: string | any[], reverse?: boolean) => { // field: Sort order's field. undefined means switching a field. // reverse: whether the sort order is reversed or not. undefined means toggling. diff --git a/packages/app-desktop/gui/MainScreen/commands/toggleVisiblePanes.ts b/packages/app-desktop/gui/MainScreen/commands/toggleVisiblePanes.ts index b81e2f119..3af6b0051 100644 --- a/packages/app-desktop/gui/MainScreen/commands/toggleVisiblePanes.ts +++ b/packages/app-desktop/gui/MainScreen/commands/toggleVisiblePanes.ts @@ -7,6 +7,7 @@ export const declaration: CommandDeclaration = { iconName: 'icon-layout ', }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async () => { diff --git a/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx b/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx index d04d188b4..e3fc31bcc 100644 --- a/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx +++ b/packages/app-desktop/gui/MasterPasswordDialog/Dialog.tsx @@ -94,14 +94,17 @@ export default function(props: Props) { return !hasMasterPasswordEncryptedData; }, [hasMasterPasswordEncryptedData, mode]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onCurrentPasswordChange = useCallback((event: any) => { setCurrentPassword(event.target.value); }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onPasswordChange1 = useCallback((event: any) => { setPassword1(event.target.value); }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onPasswordChange2 = useCallback((event: any) => { setPassword2(event.target.value); }, []); diff --git a/packages/app-desktop/gui/MenuBar.tsx b/packages/app-desktop/gui/MenuBar.tsx index fc155c979..abf793c19 100644 --- a/packages/app-desktop/gui/MenuBar.tsx +++ b/packages/app-desktop/gui/MenuBar.tsx @@ -60,6 +60,7 @@ function getPluginCommandNames(plugins: PluginStates): string[] { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function createPluginMenuTree(label: string, menuItems: MenuItem[], onMenuItemClick: Function) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { label: label, submenu: [], @@ -76,13 +77,16 @@ function createPluginMenuTree(label: string, menuItems: MenuItem[], onMenuItemCl return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const useSwitchProfileMenuItems = (profileConfig: ProfileConfig, menuItemDic: any) => { return useMemo(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const switchProfileMenuItems: any[] = []; for (let i = 0; i < profileConfig.profiles.length; i++) { const profile = profileConfig.profiles[i]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let menuItem: any = {}; const profileNum = i + 1; @@ -113,9 +117,11 @@ const useSwitchProfileMenuItems = (profileConfig: ProfileConfig, menuItemDic: an }; const useNoteListMenuItems = (noteListRendererIds: string[]) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const [menuItems, setMenuItems] = useState([]); useAsyncEffect(async (event) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any[] = []; for (const id of noteListRendererIds) { const renderer = getListRendererById(id); @@ -141,6 +147,7 @@ const useNoteListMenuItems = (noteListRendererIds: string[]) => { interface Props { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menuItemProps: any; routeName: string; selectedFolderId: string; @@ -152,7 +159,9 @@ interface Props { showNoteCounts: boolean; uncompletedTodosOnTop: boolean; showCompletedTodos: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginMenuItems: any[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginMenus: any[]; ['spellChecker.enabled']: boolean; ['spellChecker.languages']: string[]; @@ -181,8 +190,10 @@ function menuItemSetEnabled(id: string, enabled: boolean) { menuItem.enabled = enabled; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function useMenuStates(menu: any, props: Props) { useEffect(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let timeoutId: any = null; function scheduleUpdate() { @@ -212,10 +223,12 @@ function useMenuStates(menu: any, props: Props) { const sortOptions = Setting.enumOptions(`${type}.sortOrder.field`); for (const field in sortOptions) { if (!sortOptions.hasOwnProperty(field)) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menuItemSetChecked(`sort:${type}:${field}`, (props as any)[`${type}.sortOrder.field`] === field); } const id = type === 'notes' ? 'toggleNotesSortOrderReverse' : `sort:${type}:reverse`; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menuItemSetChecked(id, (props as any)[`${type}.sortOrder.reverse`]); } @@ -289,12 +302,14 @@ function useMenu(props: Props) { void CommandService.instance().execute('showModalMessage', modalMessage); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const errors: any[] = []; const importOptions = { path, format: module.format, outputFormat: module.outputFormat, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProgress: (status: any) => { const statusStrings: string[] = Object.keys(status).map((key: string) => { return `${key}: ${status[key]}`; @@ -302,6 +317,7 @@ function useMenu(props: Props) { void CommandService.instance().execute('showModalMessage', `${modalMessage}\n\n${statusStrings.join('\n')}`); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onError: (error: any) => { errors.push(error); console.warn(error); @@ -349,6 +365,7 @@ function useMenu(props: Props) { const onImportModuleClickRef = useRef(null); onImportModuleClickRef.current = onImportModuleClick; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const pluginCommandNames = useMemo(() => props.pluginMenuItems.map((view: any) => view.commandName), [props.pluginMenuItems]); const menuItemDic = useMemo(() => { @@ -360,11 +377,13 @@ function useMenu(props: Props) { // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied }, [commandNames, pluginCommandNames, props.locale]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const switchProfileMenuItems: any[] = useSwitchProfileMenuItems(props.profileConfig, menuItemDic); const noteListMenuItems = useNoteListMenuItems(props.noteListRendererIds); useEffect(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let timeoutId: any = null; function updateMenu() { @@ -442,6 +461,7 @@ function useMenu(props: Props) { label: module.fullLabel(), click: async () => { await InteropServiceHelper.export( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (action: any) => props.dispatch(action), module, { @@ -507,9 +527,11 @@ function useMenu(props: Props) { submenu: switchProfileMenuItems, }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let toolsItems: any[] = []; // we need this workaround, because on macOS the menu is different + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const toolsItemsWindowsLinux: any[] = [ { label: _('Options'), @@ -686,6 +708,7 @@ function useMenu(props: Props) { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const rootMenus: any = { edit: { id: 'edit', @@ -922,6 +945,7 @@ function useMenu(props: Props) { // It seems the "visible" property of separators is ignored by Electron, making // it display separators that we want hidden. So this function iterates through // them and remove them completely. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const cleanUpSeparators = (items: any[]) => { const output = []; for (const item of items) { @@ -991,6 +1015,7 @@ function useMenu(props: Props) { menuItemDic.textCut, menuItemDic.textPaste, menuItemDic.textSelectAll, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ] as any, }, ])); @@ -1054,6 +1079,7 @@ function useMenu(props: Props) { return menu; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function MenuBar(props: Props): any { const menu = useMenu(props); if (menu) Menu.setApplicationMenu(menu); diff --git a/packages/app-desktop/gui/MultiNoteActions.tsx b/packages/app-desktop/gui/MultiNoteActions.tsx index 99fcc5709..fbe60a9b6 100644 --- a/packages/app-desktop/gui/MultiNoteActions.tsx +++ b/packages/app-desktop/gui/MultiNoteActions.tsx @@ -9,6 +9,7 @@ const bridge = require('@electron/remote').require('./bridge').default; interface MultiNoteActionsProps { themeId: number; selectedNoteIds: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied notes: any[]; dispatch: Dispatch; watchedNoteFiles: string[]; @@ -18,6 +19,7 @@ interface MultiNoteActionsProps { } function styles_(props: MultiNoteActionsProps) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return buildStyle('MultiNoteActions', props.themeId, (theme: any) => { return { root: { @@ -41,6 +43,7 @@ function styles_(props: MultiNoteActionsProps) { export default function MultiNoteActions(props: MultiNoteActionsProps) { const styles = styles_(props); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const multiNotesButton_click = (item: any) => { if (item.submenu) { item.submenu.popup({ window: bridge().window() }); diff --git a/packages/app-desktop/gui/Navigator.tsx b/packages/app-desktop/gui/Navigator.tsx index eb8fe90cf..fcf6cc3ea 100644 --- a/packages/app-desktop/gui/Navigator.tsx +++ b/packages/app-desktop/gui/Navigator.tsx @@ -5,6 +5,7 @@ import { AppState } from '../app.reducer'; const bridge = require('@electron/remote').require('./bridge').default; interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied route: any; } diff --git a/packages/app-desktop/gui/NoteContentPropertiesDialog.tsx b/packages/app-desktop/gui/NoteContentPropertiesDialog.tsx index e942c5adc..624ceb85c 100644 --- a/packages/app-desktop/gui/NoteContentPropertiesDialog.tsx +++ b/packages/app-desktop/gui/NoteContentPropertiesDialog.tsx @@ -22,6 +22,7 @@ interface KeyToLabelMap { [key: string]: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let markupToHtml_: any = null; function markupToHtml() { if (markupToHtml_) return markupToHtml_; @@ -31,6 +32,7 @@ function 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) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied Countable.count(text, (counter: any) => { wordSetter(counter.words); characterSetter(counter.all); @@ -49,6 +51,7 @@ function formatReadTime(readTimeMinutes: number) { export default function NoteContentPropertiesDialog(props: NoteContentPropertiesDialogProps) { const theme = themeStyle(props.themeId); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const tableBodyComps: any[] = []; // For the source Markdown const [lines, setLines] = useState(0); diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/index.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/index.ts index 8ac43a4fb..fe56d434a 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/index.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/index.ts @@ -1,5 +1,6 @@ import { useEffect, useRef } from 'react'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function cursorPositionToTextOffset(cursorPos: any, body: string) { if (!body) return 0; @@ -20,6 +21,7 @@ export function cursorPositionToTextOffset(cursorPos: any, body: string) { return pos; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function usePrevious(value: any): any { const ref = useRef(); useEffect(() => { diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/types.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/types.ts index 084483a1e..417eaf5b2 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/types.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/types.ts @@ -1,5 +1,6 @@ export interface RenderedBody { html: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginAssets: any[]; } diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useContextMenu.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useContextMenu.ts index 580df524d..ed6976260 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useContextMenu.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useContextMenu.ts @@ -124,6 +124,7 @@ const useContextMenu = (props: ContextMenuProps) => { // So in this situation, we use must manually align the internal codemirror selection // to the contextmenu selection if (editorRef.current && !editorRef.current.cm6 && spellCheckerMenuItems.length > 0) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (editorRef.current as any).alignSelection(params); } @@ -144,7 +145,7 @@ const useContextMenu = (props: ContextMenuProps) => { })); } - // eslint-disable-next-line github/array-foreach -- Old code before rule was applied + // eslint-disable-next-line github/array-foreach, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied menuUtils.pluginContextMenuItems(props.plugins, MenuItemLocation.EditorContextMenu).forEach((item: any) => { menu.append(new MenuItem(item)); }); diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useEditorSearchExtension.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useEditorSearchExtension.ts index dd8690be2..5bb66a2af 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useEditorSearchExtension.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useEditorSearchExtension.ts @@ -28,6 +28,7 @@ export default function useEditorSearchExtension(CodeMirror: CodeMirror5Emulatio setMarkers([]); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function clearOverlay(cm: any) { if (overlay) cm.removeOverlay(overlay); if (scrollbarMarks) { @@ -50,6 +51,7 @@ export default function useEditorSearchExtension(CodeMirror: CodeMirror5Emulatio // Modified from codemirror/addons/search/search.js function searchOverlay(query: RegExp) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return { token: function(stream: any) { query.lastIndex = stream.pos; const match = query.exec(stream.string); @@ -68,9 +70,11 @@ export default function useEditorSearchExtension(CodeMirror: CodeMirror5Emulatio // Highlights the currently active found work // It's possible to get tricky with this functions and just use findNext/findPrev // but this is fast enough and works more naturally with the current search logic + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function highlightSearch(cm: any, searchTerm: RegExp, index: number, scrollTo: boolean, withSelection: boolean) { const cursor = cm.getSearchCursor(searchTerm); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let match: any = null; for (let j = 0; j < index + 1; j++) { if (!cursor.findNext()) { @@ -99,6 +103,7 @@ export default function useEditorSearchExtension(CodeMirror: CodeMirror5Emulatio return keyword.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function getSearchTerm(keyword: any) { const value = escapeRegExp(keyword.value); return new RegExp(value, 'gi'); @@ -111,6 +116,7 @@ export default function useEditorSearchExtension(CodeMirror: CodeMirror5Emulatio }; }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied CodeMirror?.defineExtension('setMarkers', function(keywords: any, options: any) { if (!options) { options = { selectedIndex: 0, searchTimestamp: 0 }; @@ -121,6 +127,7 @@ export default function useEditorSearchExtension(CodeMirror: CodeMirror5Emulatio // HIGHLIGHT KEYWORDS // When doing a global search it's possible to have multiple keywords // This means we need to highlight each one + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const marks: any = []; for (let i = 0; i < keywords.length; i++) { const keyword = keywords[i]; diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useEditorSearchHandler.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useEditorSearchHandler.ts index d88aa0c49..b39c61303 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useEditorSearchHandler.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useEditorSearchHandler.ts @@ -5,8 +5,11 @@ const debounce = require('debounce'); interface Props { setLocalSearchResultCount(count: number): void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied searchMarkers: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied webviewRef: RefObject; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied editorRef: RefObject; noteContent: string; 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 d1b5d8ad5..d927941be 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useScrollHandler.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useScrollHandler.ts @@ -1,8 +1,9 @@ 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 +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied export default function useScrollHandler(editorRef: any, webviewRef: any, onScroll: Function) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const scrollTimeoutId_ = useRef(null); const scrollPercent_ = useRef(0); const ignoreNextEditorScrollTime_ = useRef(Date.now()); @@ -11,6 +12,7 @@ export default function useScrollHandler(editorRef: any, webviewRef: any, onScro const scrollTopIsUncertain_ = useRef(true); const lastResizeHeight_ = useRef(NaN); const lastLinesHeight_ = useRef(NaN); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const restoreEditorPercentScrollTimeoutId_ = useRef(null); // Ignores one next scroll event for a short time. @@ -35,6 +37,7 @@ export default function useScrollHandler(editorRef: any, webviewRef: any, onScro return false; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const scheduleOnScroll = useCallback((event: any) => { if (scrollTimeoutId_.current) { shim.clearTimeout(scrollTimeoutId_.current); @@ -141,6 +144,7 @@ export default function useScrollHandler(editorRef: any, webviewRef: any, onScro // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const editor_resize = useCallback((cm: any) => { if (isCodeMirrorReady(cm)) { // This handler is called when resized and refreshed. @@ -163,6 +167,7 @@ export default function useScrollHandler(editorRef: any, webviewRef: any, onScro // When heights of lines are updated in CodeMirror, 'update' events are raised. // If such an update event is raised, scroll position should be restored. // See https://github.com/laurent22/joplin/issues/5981 + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const editor_update = useCallback((cm: any, edited: boolean) => { if (isCodeMirrorReady(cm)) { if (edited) return; @@ -198,6 +203,7 @@ export default function useScrollHandler(editorRef: any, webviewRef: any, onScro }; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const translateLE_ = (codeMirror: any, percent: number, l2e: boolean) => { // If the input is out of (0,1) or not number, it is not translated. if (!(0 < percent && percent < 1)) return percent; @@ -226,14 +232,17 @@ const translateLE_ = (codeMirror: any, percent: number, l2e: boolean) => { // percent. They are used for synchronous scrolling between Editor and Viewer. // To see the detail of synchronous scrolling, refer the following design document. // https://github.com/laurent22/joplin/pull/5826#issuecomment-986032165 +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const translateScrollPercentL2E = (cm: any, lPercent: number) => { return translateLE_(cm, lPercent, true); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const translateScrollPercentE2L = (cm: any, ePercent: number) => { return translateLE_(cm, ePercent, false); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function isCodeMirrorReady(cm: any) { const info = cm?.getScrollInfo(); return info && info.height - info.clientHeight > 0; diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useWebviewIpcMessage.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useWebviewIpcMessage.ts index 736e66551..698af9ff7 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useWebviewIpcMessage.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useWebviewIpcMessage.ts @@ -3,6 +3,7 @@ import shared from '@joplin/lib/components/shared/note-screen-shared'; import { useCallback, RefObject } from 'react'; interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onMessage(event: any): void; getLineScrollPercent(): number; setEditorPercentScroll(fraction: number): void; @@ -13,6 +14,7 @@ interface Props { const useWebviewIpcMessage = (props: Props) => { const editorRef = props.editorRef; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return useCallback((event: any) => { const msg = event.channel ? event.channel : ''; const args = event.args; diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/CodeMirror.tsx b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/CodeMirror.tsx index 79e1e6f94..e73e52233 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/CodeMirror.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/CodeMirror.tsx @@ -163,6 +163,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: ForwardedRef { return selectedText(); @@ -170,6 +171,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: ForwardedRef { return selectedText(); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied replaceSelection: (value: any) => { return editorRef.current.replaceSelection(value); }, @@ -209,6 +211,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: ForwardedRef editorRef.current.insertAtCursor(value), attachFile: async () => { const cursor = editorRef.current.getCursor(); @@ -257,6 +260,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: ForwardedRef { const resourceMds = await getResourcesFromPasteEvent(event); if (!resourceMds.length) return; @@ -324,8 +328,10 @@ function CodeMirror(props: NoteBodyEditorProps, ref: ForwardedRef { return new Promise((resolve) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let element: any = document.createElement('script'); if (script.src.indexOf('.css') >= 0) { element = document.createElement('link'); @@ -649,6 +655,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: ForwardedRef { if (!webviewReady) return; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = { pluginAssets: renderedBody.pluginAssets, downloadResources: Setting.value('sync.resourceDownloadMode'), diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/Editor.tsx b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/Editor.tsx index 1fde3e254..ede245c59 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/Editor.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/Editor.tsx @@ -73,6 +73,7 @@ const topLanguages = [ for (let i = 0; i < topLanguages.length; i++) { const mode = topLanguages[i]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (CodeMirror.modeInfo.find((m: any) => m.mode === mode)) { require(`codemirror/mode/${mode}/${mode}`); } else { @@ -82,22 +83,31 @@ for (let i = 0; i < topLanguages.length; i++) { export interface EditorProps { value: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied searchMarkers: any; mode: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied codeMirrorTheme: any; readOnly: boolean; autoMatchBraces: boolean | object; keyMap: string; plugins: PluginStates; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onChange: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onScroll: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onEditorPaste: any; isSafeMode: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onResize: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onUpdate: any; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function Editor(props: EditorProps, ref: any) { const [editor, setEditor] = useState(null); const editorParent = useRef(null); @@ -111,6 +121,7 @@ function Editor(props: EditorProps, ref: any) { useLineSorting(CodeMirror); useEditorSearch(CodeMirror); useJoplinMode(CodeMirror); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const pluginOptions: any = useExternalPlugins(CodeMirror, props.plugins); useKeymap(CodeMirror); useJoplinCommands(CodeMirror); @@ -119,6 +130,7 @@ function Editor(props: EditorProps, ref: any) { return editor; }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const editor_change = useCallback((cm: any, change: any) => { if (props.onChange && change.origin !== 'setValue') { props.onChange(cm.getValue()); @@ -126,21 +138,22 @@ function Editor(props: EditorProps, ref: any) { } }, [props.onChange]); - // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars + // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any -- Old code before rule was applied const editor_scroll = useCallback((_cm: any) => { props.onScroll(); }, [props.onScroll]); - // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars + // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any -- Old code before rule was applied const editor_paste = useCallback((_cm: any, _event: any) => { props.onEditorPaste(); }, [props.onEditorPaste]); - // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars + // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any -- Old code before rule was applied const editor_drop = useCallback((cm: any, _event: any) => { focus('v5/Editor::editor_drop', cm); }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const editor_drag = useCallback((cm: any, event: any) => { // This is the type for all drag and drops that are external to codemirror // setting the cursor allows us to drop them in the right place @@ -152,10 +165,12 @@ function Editor(props: EditorProps, ref: any) { event.dataTransfer.dropEffect = 'copy'; }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const editor_resize = useCallback((cm: any) => { props.onResize(cm); }, [props.onResize]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const editor_update = useCallback((cm: any) => { const edited = Date.now() - lastEditTime.current <= 100; props.onUpdate(cm, edited); @@ -166,11 +181,13 @@ function Editor(props: EditorProps, ref: any) { const userOptions = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const safeOptions: Record = { value: props.value, readOnly: props.readOnly, }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const unsafeOptions: Record = { screenReaderLabel: props.value, theme: props.codeMirrorTheme, @@ -187,6 +204,7 @@ function Editor(props: EditorProps, ref: any) { keyMap: props.keyMap ? props.keyMap : 'default', }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let cmOptions: Record = { ...safeOptions }; if (!props.isSafeMode) { diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useCursorUtils.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useCursorUtils.ts index d8019d737..e85af490b 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useCursorUtils.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useCursorUtils.ts @@ -27,6 +27,7 @@ export function modifyListLines(lines: string[], num: number, listSymbol: string return lines; } // Helper functions that use the cursor +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useCursorUtils(CodeMirror: any) { CodeMirror.defineExtension('insertAtCursor', function(text: string) { @@ -120,6 +121,7 @@ export default function useCursorUtils(CodeMirror: any) { }); // params are the oncontextmenu params + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied CodeMirror.defineExtension('alignSelection', function(params: any) { // The below is a HACK that uses the selectionText from electron and the coordinates of // the click to determine what the codemirror selection should be @@ -174,6 +176,7 @@ export default function useCursorUtils(CodeMirror: any) { return beforeCursor.top < afterCursor.top && !!currentLine[ch - 1].match(/\s/); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied CodeMirror.commands.goLineRightSmart = function(cm: any) { // Only apply the manual cursor adjustments for contenteditable mode if (cm.options.inputStyle !== 'contenteditable') { @@ -202,6 +205,7 @@ export default function useCursorUtils(CodeMirror: any) { } }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied CodeMirror.commands.goLineUpSmart = function(cm: any) { if (cm.options.inputStyle !== 'contenteditable') { cm.execCommand('goLineUp'); @@ -217,6 +221,7 @@ export default function useCursorUtils(CodeMirror: any) { } }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied CodeMirror.commands.goLineDownSmart = function(cm: any) { if (cm.options.inputStyle !== 'contenteditable') { cm.execCommand('goLineDown'); diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useExternalPlugins.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useExternalPlugins.ts index 9e4622c18..4ea72ec80 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useExternalPlugins.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useExternalPlugins.ts @@ -7,6 +7,7 @@ import uuid from '@joplin/lib/uuid'; import { reg } from '@joplin/lib/registry'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useExternalPlugins(CodeMirror: any, plugins: PluginStates) { const [options, setOptions] = useState({}); useEffect(() => { diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useJoplinCommands.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useJoplinCommands.ts index 564895bba..88093d264 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useJoplinCommands.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useJoplinCommands.ts @@ -1,4 +1,5 @@ // Helper commands added to the the CodeMirror instance +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useJoplinCommands(CodeMirror: any) { CodeMirror.defineExtension('commandExists', (name: string) => { diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useJoplinMode.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useJoplinMode.ts index fc2a4fcaf..5e3baff31 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useJoplinMode.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useJoplinMode.ts @@ -4,18 +4,22 @@ import MarkdownUtils from '@joplin/lib/markdownUtils'; import Setting from '@joplin/lib/models/Setting'; interface JoplinModeState { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied outer: any; openCharacter: string; inTable: boolean; inCodeBlock: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied inner: any; } // Joplin markdown is a the same as markdown mode, but it has configured defaults // and support for katex math blocks +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useJoplinMode(CodeMirror: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied CodeMirror.defineMode('joplin-markdown', (config: any) => { const markdownConfig = { name: 'markdown', @@ -37,6 +41,7 @@ export default function useJoplinMode(CodeMirror: any) { // Find token will search for a valid katex start or end token // If found then it will return the index, otherwise -1 + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function findToken(stream: any, token: RegExp) { const match = token.exec(stream.string.slice(stream.pos)); @@ -64,6 +69,7 @@ export default function useJoplinMode(CodeMirror: any) { }; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied token: function(stream: any, state: JoplinModeState) { let currentMode = markdownMode; let currentState = state.outer; @@ -170,6 +176,7 @@ export default function useJoplinMode(CodeMirror: any) { return token; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied indent: function(state: JoplinModeState, textAfter: string, line: any) { const mode = state.openCharacter ? stex : markdownMode; if (!mode.indent) return CodeMirror.Pass; diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useKeymap.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useKeymap.ts index e16503794..97e311411 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useKeymap.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useKeymap.ts @@ -9,6 +9,7 @@ import { EventName } from '@joplin/lib/eventManager'; import normalizeAccelerator from '../../utils/normalizeAccelerator'; import { CodeMirrorVersion } from '../../utils/types'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useKeymap(CodeMirror: any) { function save() { diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useLineSorting.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useLineSorting.ts index c85ac581e..1bd2f92e1 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useLineSorting.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useLineSorting.ts @@ -1,6 +1,8 @@ // Duplicates AceEditors line sorting function // https://discourse.joplinapp.org/t/sort-lines/8874/2 +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useLineSorting(CodeMirror: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied CodeMirror.commands.sortSelectedLines = function(cm: any) { const ranges = cm.listSelections(); // Batches the insert operations, if this wasn't done the inserts diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useListIdent.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useListIdent.ts index 9e507d785..6e2cbea29 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useListIdent.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useListIdent.ts @@ -4,12 +4,15 @@ import markdownUtils from '@joplin/lib/markdownUtils'; // If the current line starts with `markup.list` token, // hitting `Tab` key indents the line instead of inserting tab at cursor. // hitting enter will insert a new list element, and unindent/delete an empty element +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useListIdent(CodeMirror: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function isSelection(anchor: any, head: any) { return anchor.line !== head.line || anchor.ch !== head.ch; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function getIndentLevel(cm: any, line: number) { const tokens = cm.getLineTokens(line); let indentLevel = 0; @@ -20,6 +23,7 @@ export default function useListIdent(CodeMirror: any) { return indentLevel; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function newListToken(cm: any, line: number) { const currentToken = markdownUtils.extractListToken(cm.getLine(line)); const indentLevel = getIndentLevel(cm, line); @@ -48,6 +52,7 @@ export default function useListIdent(CodeMirror: any) { } // Gets the character coordinates of the start and end of a list token + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function getListSpan(listTokens: any, line: string) { let start = listTokens[0].start; const token = markdownUtils.extractListToken(line); @@ -59,6 +64,7 @@ export default function useListIdent(CodeMirror: any) { return { start: start, end: start + token.length }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied CodeMirror.commands.smartListIndent = function(cm: any) { if (cm.getOption('disableInput')) return CodeMirror.Pass; @@ -93,6 +99,7 @@ export default function useListIdent(CodeMirror: any) { }); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied CodeMirror.commands.smartListUnindent = function(cm: any) { if (cm.getOption('disableInput')) return CodeMirror.Pass; @@ -129,6 +136,7 @@ export default function useListIdent(CodeMirror: any) { // This is a special case of insertList element because it happens when // vim is in normal mode and input is disabled and the cursor is not // necessarily at the end of line (but it should pretend it is + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied CodeMirror.commands.vimInsertListElement = function(cm: any) { cm.setOption('disableInput', false); @@ -144,6 +152,7 @@ export default function useListIdent(CodeMirror: any) { CodeMirror.Vim.handleKey(cm, 'i', 'macro'); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied CodeMirror.commands.insertListElement = function(cm: any) { if (cm.getOption('disableInput')) return CodeMirror.Pass; diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useScrollUtils.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useScrollUtils.ts index 3a70d63a9..a9e855816 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useScrollUtils.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v5/utils/useScrollUtils.ts @@ -1,4 +1,5 @@ // Helper functions to sync up scrolling +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useScrollUtils(CodeMirror: any) { CodeMirror.defineExtension('getScrollPercent', function() { const info = this.getScrollInfo(); diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/CodeMirror.tsx b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/CodeMirror.tsx index 9a8bf559a..c820771bd 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/CodeMirror.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/CodeMirror.tsx @@ -33,6 +33,7 @@ const logDebug = (message: string) => logger.debug(message); interface RenderedBody { html: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginAssets: any[]; } @@ -77,6 +78,7 @@ const CodeMirror = (props: NoteBodyEditorProps, ref: ForwardedRef { const resourceMds = await getResourcesFromPasteEvent(event); if (!resourceMds.length) return; @@ -183,6 +185,7 @@ const CodeMirror = (props: NoteBodyEditorProps, ref: ForwardedRef) => { return () => {}; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const pasteEventHandler = (_editor: any, event: Event) => { props.onEditorPaste(event); }; @@ -76,6 +77,7 @@ const Editor = (props: Props, ref: ForwardedRef) => { const path = shim.fsDriver().resolveRelativePathWithinDir(assetPath, name); return shim.fsDriver().readFile(path, 'utf8'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied postMessageHandler: (message: any) => { const plugin = PluginService.instance().pluginById(pluginId); return plugin.emitContentScriptMessage(contentScript.id, message); diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/useEditorCommands.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/useEditorCommands.ts index e1956252a..2829e1061 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/useEditorCommands.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/v6/useEditorCommands.ts @@ -32,6 +32,7 @@ const wrapSelectionWithStrings = (editor: CodeMirrorControl, string1: string, st }; interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied webviewRef: RefObject; editorRef: RefObject; editorContent: string; @@ -55,6 +56,7 @@ const useEditorCommands = (props: Props) => { }; return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied dropItems: async (cmd: any) => { if (cmd.type === 'notes') { editorRef.current.insertText(cmd.markdownTags.join('\n')); @@ -92,6 +94,7 @@ const useEditorCommands = (props: Props) => { focus('useEditorCommands::textLink', editorRef.current); if (url) wrapSelectionWithStrings(editorRef.current, '[', `](${url})`); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied insertText: (value: any) => editorRef.current.insertText(value), attachFile: async () => { const newBody = await commandAttachFileToBody( @@ -105,7 +108,9 @@ const useEditorCommands = (props: Props) => { 'editor.execCommand': (value: CommandValue) => { if (!('args' in value)) value.args = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if ((editorRef.current as any)[value.name]) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const result = (editorRef.current as any)[value.name](...value.args); return result; } else if (editorRef.current.supportsCommand(value.name)) { diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/PlainEditor/PlainEditor.tsx b/packages/app-desktop/gui/NoteEditor/NoteBody/PlainEditor/PlainEditor.tsx index 518e1a1e3..0fce31558 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/PlainEditor/PlainEditor.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/PlainEditor/PlainEditor.tsx @@ -36,6 +36,7 @@ const PlainEditor = (props: NoteBodyEditorProps, ref: ForwardedRef { props.onChange({ changeId: null, content: event.target.value }); }, [props.onChange]); diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx index f579f3ce6..566ffa3a3 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx @@ -67,6 +67,7 @@ function awfulInitHack(html: string): string { return html === '
' ? '

' : html; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function findEditableContainer(node: any): any { while (node) { if (node.classList && node.classList.contains('joplin-editable')) return node; @@ -76,6 +77,7 @@ function findEditableContainer(node: any): any { } let markupToHtml_ = new MarkupToHtml(); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function stripMarkup(markupLanguage: number, markup: string, options: any = null) { if (!markupToHtml_) markupToHtml_ = new MarkupToHtml(); return markupToHtml_.stripMarkup(markupLanguage, markup, options); @@ -87,9 +89,11 @@ interface LastOnChangeEventInfo { contentKey: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let dispatchDidUpdateIID_: any = null; let changeId_ = 1; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { const [editor, setEditor] = useState(null); const [scriptLoaded, setScriptLoaded] = useState(false); @@ -112,6 +116,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { }); const rootIdRef = useRef(`tinymce-${Date.now()}${Math.round(Math.random() * 10000)}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const editorRef = useRef(null); editorRef.current = editor; @@ -123,6 +128,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { usePluginServiceRegistration(ref); useContextMenu(editor, props.plugins, props.dispatch, props.htmlToMarkdown, props.markupToHtml); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const dispatchDidUpdate = (editor: any) => { if (dispatchDidUpdateIID_) shim.clearTimeout(dispatchDidUpdateIID_); dispatchDidUpdateIID_ = shim.setTimeout(() => { @@ -131,6 +137,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { }, 10); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const insertResourcesIntoContent = useCallback(async (filePaths: string[] = null, options: any = null) => { const resourceMd = await commandAttachFileToBody('', filePaths, options); if (!resourceMd) return; @@ -141,6 +148,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { const insertResourcesIntoContentRef = useRef(null); insertResourcesIntoContentRef.current = insertResourcesIntoContent; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onEditorContentClick = useCallback((event: any) => { const nodeName = event.target ? event.target.nodeName : ''; @@ -228,6 +236,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { if (commandProcessed) return true; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const additionalCommands: any = { selectedText: () => { return stripMarkup(MarkupToHtml.MARKUP_LANGUAGE_HTML, editor.selection.getContent()); @@ -235,6 +244,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { selectedHtml: () => { return editor.selection.getContent(); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied replaceSelection: (value: any) => { editor.selection.setContent(value); editor.fire(TinyMceEditorEvents.JoplinChange); @@ -313,6 +323,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { let cancelled = false; async function loadScripts() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const scriptsToLoad: any[] = [ { src: `${bridge().vendorDir()}/lib/tinymce/tinymce.min.js`, @@ -605,6 +616,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { `joplinInsertDateTime${toolbarPluginButtons}`, ]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const editors = await (window as any).tinymce.init({ selector: `#${rootIdRef.current}`, width: '100%', @@ -797,6 +809,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { // Set the initial content and load the plugin CSS and JS files // ----------------------------------------------------------------------------------------- + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const loadDocumentAssets = (themeId: number, editor: any, pluginAssets: any[]) => { const theme = themeStyle(themeId); @@ -813,13 +826,17 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { `gui/note-viewer/pluginAssets/highlight.js/${theme.codeThemeCss}`, ].concat( pluginAssets + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .filter((a: any) => a.mime === 'text/css') + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .map((a: any) => a.path), ); const allJsFiles = [].concat( pluginAssets + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .filter((a: any) => a.mime === 'application/javascript') + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .map((a: any) => a.path), ); @@ -1022,6 +1039,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { const prop_htmlToMarkdownRef = useRef(); prop_htmlToMarkdownRef.current = props.htmlToMarkdown; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const nextOnChangeEventInfo = useRef(null); async function execOnChangeEvent() { @@ -1053,6 +1071,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onChangeHandlerTimeoutRef = useRef(null); useEffect(() => { @@ -1081,6 +1100,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { }, 1000); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function onExecCommand(event: any) { const c: string = event.command; if (!c) return; @@ -1117,6 +1137,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onSetAttrib = (event: any) => { // Dispatch onChange when a link is edited if (event.attrElm[0].nodeName === 'A') { @@ -1140,6 +1161,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { // onChange even though nothing is changed. The alternative would be to // check the content before and after, but this is too slow, so let's // keep it this way for now. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function onKeyUp(event: any) { if (['Backspace', 'Delete', 'Enter', 'Tab'].includes(event.key)) { onChangeHandler(); @@ -1195,12 +1217,14 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function onCopy(event: any) { const copiedContent = editor.selection.getContent(); copyHtmlToClipboard(copiedContent); event.preventDefault(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function onCut(event: any) { const selectedContent = editor.selection.getContent(); copyHtmlToClipboard(selectedContent); @@ -1216,6 +1240,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function onKeyDown(event: any) { // It seems "paste as text" is handled automatically on Windows and Linux, // so we need to run the below code only on macOS. If we were to run this diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.ts index bf0ffffd7..1dc8115b3 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.ts @@ -4,6 +4,7 @@ const { buildStyle } = require('@joplin/lib/theme'); export default function styles(props: NoteBodyEditorProps) { const leftExtraToolbarContainerWidth = props.watchedNoteFiles.length > 0 ? 120 : 80; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return buildStyle(['TinyMCE', props.style.width, props.style.height, leftExtraToolbarContainerWidth], props.themeId, (theme: any) => { const extraToolbarContainer = { boxSizing: 'content-box', diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/joplinCommandToTinyMceCommands.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/joplinCommandToTinyMceCommands.ts index 2ccb9edb2..9fdbf7ff6 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/joplinCommandToTinyMceCommands.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/joplinCommandToTinyMceCommands.ts @@ -1,5 +1,6 @@ export interface TinyMceCommand { name: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value?: any; ui?: boolean; } 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 071104f16..3fdb69ed8 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/openEditDialog.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/openEditDialog.ts @@ -8,10 +8,12 @@ interface SourceInfo { openCharacters: string; closeCharacters: string; content: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied node: any; language: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function dialogTextArea_keyDown(event: any) { if (event.key === 'Tab') { window.requestAnimationFrame(() => focus('openEditDialog::dialogTextArea_keyDown', event.target)); @@ -34,6 +36,7 @@ function enableTextAreaTab(enable: boolean) { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function findBlockSource(node: any): SourceInfo { const sources = node.getElementsByClassName('joplin-source'); if (!sources.length) throw new Error('No source for node'); @@ -78,7 +81,7 @@ function editableInnerHtml(html: string): string { return editable[0].innerHTML; } -// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied export default function openEditDialog(editor: any, markupToHtml: any, dispatchDidUpdate: Function, editable: any) { const source = editable ? findBlockSource(editable) : newBlockSource(); @@ -89,6 +92,7 @@ export default function openEditDialog(editor: any, markupToHtml: any, dispatchD codeTextArea: source.content, languageInput: source.language, }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onSubmit: async (dialogApi: any) => { const newSource = newBlockSource(dialogApi.getData().languageInput, dialogApi.getData().codeTextArea, source); const md = `${newSource.openCharacters}${newSource.content.trim()}${newSource.closeCharacters}`; diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupToolbarButtons.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupToolbarButtons.ts index bbee28a65..cdda7304c 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupToolbarButtons.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupToolbarButtons.ts @@ -40,6 +40,7 @@ function buttonDefinitions(): ButtonDefinition[] { ]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function(editor: any) { const definitions = buttonDefinitions(); @@ -50,6 +51,7 @@ export default function(editor: any) { onAction: async function() { editor.execCommand('mceToggleFormat', false, def.name); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onSetup: function(api: any) { editor.formatter.formatChanged(def.name, (state: boolean) => { api.setActive(state); 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 b0c7c7a62..5ced08d1c 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.ts @@ -18,6 +18,7 @@ const menuUtils = new MenuUtils(CommandService.instance()); // x and y are the absolute coordinates, as returned by the context-menu event // handler on the webContent. This function will return null if the point is // not within the TinyMCE editor. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function contextMenuElement(editor: any, x: number, y: number) { if (!editor || !editor.getDoc()) return null; @@ -47,13 +48,14 @@ interface ContextMenuActionOptions { const contextMenuActionOptions: ContextMenuActionOptions = { current: null }; -// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied export default function(editor: any, plugins: PluginStates, dispatch: Function, htmlToMd: HtmlToMarkdownHandler, mdToHtml: MarkupToHtmlHandler) { useEffect(() => { if (!editor) return () => {}; const contextMenuItems = menuItems(dispatch, htmlToMd, mdToHtml); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function onContextMenu(_event: any, params: any) { const element = contextMenuElement(editor, params.x, params.y); if (!element) 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 3604acebf..7890d699e 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.ts @@ -2,6 +2,7 @@ import { useEffect, useCallback, useRef } from 'react'; import shim from '@joplin/lib/shim'; interface HookDependencies { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied editor: any; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onScroll: Function; @@ -43,6 +44,7 @@ export default function useScroll(dependencies: HookDependencies) { editor.getWin().scrollTo(0, maxScrollTop() * percent); }, [editor, maxScrollTop]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const scheduleOnScroll = useCallback((event: any) => { if (scrollTimeoutId_.current) { shim.clearTimeout(scrollTimeoutId_.current); diff --git a/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx b/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx index e99893244..389672c0f 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteEditor.tsx @@ -65,6 +65,7 @@ function NoteEditor(props: NoteEditorProps) { const [isReadOnly, setIsReadOnly] = useState(false); const editorRef = useRef(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const titleInputRef = useRef(); const isMountedRef = useRef(true); const noteSearchBarRef = useRef(null); @@ -124,6 +125,7 @@ function NoteEditor(props: NoteEditorProps) { return async function() { const note = await formNoteToNote(formNote); reg.logger().debug('Saving note...', note); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const savedNote: any = await Note.save(note); setFormNote((prev: FormNote) => { @@ -172,6 +174,7 @@ function NoteEditor(props: NoteEditorProps) { settingValue: getPluginSettingValue, }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const allAssets = useCallback(async (markupLanguage: number, options: AllAssetsOptions = null): Promise => { options = { contentMaxWidthTarget: '', @@ -220,6 +223,7 @@ function NoteEditor(props: NoteEditorProps) { // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied }, [formNote.id, previousNoteId]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onFieldChange = useCallback((field: string, value: any, changeId = 0) => { if (!isMountedRef.current) { // When the component is unmounted, various actions can happen which can @@ -280,6 +284,7 @@ function NoteEditor(props: NoteEditorProps) { const onBodyChange = useCallback((event: OnChangeEvent) => onFieldChange('body', event.content, event.changeId), [onFieldChange]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onTitleChange = useCallback((event: any) => onFieldChange('title', event.target.value), [onFieldChange]); // const onTitleKeydown = useCallback((event:any) => { @@ -318,6 +323,7 @@ function NoteEditor(props: NoteEditorProps) { } }, [formNote.id, props.syncUserId, shareCache]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onBodyWillChange = useCallback((event: any) => { handleProvisionalFlag(); @@ -339,6 +345,7 @@ function NoteEditor(props: NoteEditorProps) { const onMessage = useMessageHandler(scrollWhenReady, setScrollWhenReady, editorRef, setLocalSearchResultCount, props.dispatch, formNote, htmlToMarkdown, markupToHtml); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const externalEditWatcher_noteChange = useCallback((event: any) => { if (event.id === formNote.id) { const newFormNote = { @@ -352,6 +359,7 @@ function NoteEditor(props: NoteEditorProps) { // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied }, [formNote]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onNotePropertyChange = useCallback((event: any) => { setFormNote(formNote => { if (formNote.id !== event.note.id) return formNote; @@ -360,6 +368,7 @@ function NoteEditor(props: NoteEditorProps) { for (const key in event.note) { if (key === 'id') continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (newFormNote as any)[key] = event.note[key]; } @@ -401,6 +410,7 @@ function NoteEditor(props: NoteEditorProps) { }); }, [props.dispatch]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function renderNoNotes(rootStyle: any) { const emptyDivStyle = { backgroundColor: 'black', @@ -512,6 +522,7 @@ function NoteEditor(props: NoteEditorProps) { if (showRevisions) { const theme = themeStyle(props.themeId); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const revStyle: any = { // ...props.style, display: 'inline-flex', diff --git a/packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.tsx b/packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.tsx index 1f4ce2114..95d4f9697 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.tsx +++ b/packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.tsx @@ -36,12 +36,14 @@ interface Props { noteTitle: string; noteIsTodo: number; isProvisional: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied titleInputRef: any; onTitleChange(event: ChangeEvent): void; disabled: boolean; } function styles_(props: Props) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return buildStyle(['NoteEditorTitleBar'], props.themeId, (theme: any) => { return { titleInput: { @@ -78,6 +80,7 @@ function styles_(props: Props) { export default function NoteTitleBar(props: Props) { const styles = styles_(props); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onTitleKeydown = useCallback((event: any) => { const keyCode = event.keyCode; diff --git a/packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.ts b/packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.ts index 6d2859d61..34c9f850f 100644 --- a/packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.ts +++ b/packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.ts @@ -7,6 +7,7 @@ export const declaration: CommandDeclaration = { parentLabel: () => _('Focus'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async () => { diff --git a/packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.ts b/packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.ts index 32c4e7b5d..14913d066 100644 --- a/packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.ts +++ b/packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.ts @@ -8,6 +8,7 @@ export const declaration: CommandDeclaration = { parentLabel: () => _('Focus'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async () => { diff --git a/packages/app-desktop/gui/NoteEditor/commands/pasteAsText.ts b/packages/app-desktop/gui/NoteEditor/commands/pasteAsText.ts index 52ee9e924..6aff0d985 100644 --- a/packages/app-desktop/gui/NoteEditor/commands/pasteAsText.ts +++ b/packages/app-desktop/gui/NoteEditor/commands/pasteAsText.ts @@ -6,6 +6,7 @@ export const declaration: CommandDeclaration = { label: () => _('Paste as text'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async () => { diff --git a/packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.ts b/packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.ts index 8f12408a4..cfacc46a9 100644 --- a/packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.ts +++ b/packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.ts @@ -7,6 +7,7 @@ export const declaration: CommandDeclaration = { label: () => _('Search in current note'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async () => { diff --git a/packages/app-desktop/gui/NoteEditor/commands/showRevisions.ts b/packages/app-desktop/gui/NoteEditor/commands/showRevisions.ts index 3d3d61223..7eea83960 100644 --- a/packages/app-desktop/gui/NoteEditor/commands/showRevisions.ts +++ b/packages/app-desktop/gui/NoteEditor/commands/showRevisions.ts @@ -4,6 +4,7 @@ export const declaration: CommandDeclaration = { name: 'showRevisions', }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (comp: any): CommandRuntime => { return { execute: async () => { diff --git a/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.test.ts b/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.test.ts index 4b7f1410f..3a99d2b4e 100644 --- a/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.test.ts +++ b/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.test.ts @@ -1,6 +1,7 @@ import WhenClause from '@joplin/lib/services/WhenClause'; import { enabledCondition } from './editorCommandDeclarations'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const baseContext: Record = { modalDialogVisible: false, gotoAnythingVisible: false, @@ -64,6 +65,7 @@ describe('editorCommandDeclarations', () => { }, true, ], + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ])('should create the enabledCondition', (context: Record, expected: boolean) => { const condition = enabledCondition('textBold'); const wc = new WhenClause(condition); diff --git a/packages/app-desktop/gui/NoteEditor/styles/index.ts b/packages/app-desktop/gui/NoteEditor/styles/index.ts index 25d71265c..70145c1ed 100644 --- a/packages/app-desktop/gui/NoteEditor/styles/index.ts +++ b/packages/app-desktop/gui/NoteEditor/styles/index.ts @@ -3,6 +3,7 @@ import { NoteEditorProps } from '../utils/types'; const { buildStyle } = require('@joplin/lib/theme'); export default function styles(props: NoteEditorProps) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return buildStyle(['NoteEditor'], props.themeId, (theme: any) => { return { root: { diff --git a/packages/app-desktop/gui/NoteEditor/utils/contextMenu.ts b/packages/app-desktop/gui/NoteEditor/utils/contextMenu.ts index d9cf11afd..b5d5a28c9 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/contextMenu.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/contextMenu.ts @@ -28,6 +28,7 @@ function handleCopyToClipboard(options: ContextMenuOptions) { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function saveFileData(data: any, filename: string) { const newFilePath = await bridge().showSaveDialog({ defaultPath: filename }); if (!newFilePath) return; diff --git a/packages/app-desktop/gui/NoteEditor/utils/index.ts b/packages/app-desktop/gui/NoteEditor/utils/index.ts index 2b2cfd874..3b3189c2c 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/index.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/index.ts @@ -23,6 +23,7 @@ export async function htmlToMarkdown(markupLanguage: number, html: string, origi return newBody; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function formNoteToNote(formNote: FormNote): Promise { return { id: formNote.id, diff --git a/packages/app-desktop/gui/NoteEditor/utils/resourceHandling.ts b/packages/app-desktop/gui/NoteEditor/utils/resourceHandling.ts index 90659948b..18eb0f1d9 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/resourceHandling.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/resourceHandling.ts @@ -28,16 +28,19 @@ export async function handleResourceDownloadMode(noteBody: string) { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let resourceCache_: any = {}; export function clearResourceCache() { resourceCache_ = {}; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function attachedResources(noteBody: string): Promise { if (!noteBody) return {}; const resourceIds = await Note.linkedItemIdsByType(BaseModel.TYPE_RESOURCE, noteBody); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (let i = 0; i < resourceIds.length; i++) { const id = resourceIds[i]; @@ -62,6 +65,7 @@ export async function attachedResources(noteBody: string): Promise { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function commandAttachFileToBody(body: string, filePaths: string[] = null, options: any = null) { options = { createFileURL: false, @@ -103,6 +107,7 @@ export async function commandAttachFileToBody(body: string, filePaths: string[] return body; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function resourcesStatus(resourceInfos: any) { let lowestIndex = joplinRendererUtils.resourceStatusIndex('ready'); for (const id in resourceInfos) { @@ -113,6 +118,7 @@ export function resourcesStatus(resourceInfos: any) { return joplinRendererUtils.resourceStatusName(lowestIndex); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function getResourcesFromPasteEvent(event: any) { const output = []; const formats = clipboard.availableFormats(); diff --git a/packages/app-desktop/gui/NoteEditor/utils/types.ts b/packages/app-desktop/gui/NoteEditor/utils/types.ts index af1fa0bae..8597a5891 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/types.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/types.ts @@ -23,22 +23,29 @@ export interface NoteEditorProps { dispatch: Dispatch; selectedNoteIds: string[]; selectedFolderId: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied notes: any[]; watchedNoteFiles: string[]; isProvisional: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied editorNoteStatuses: any; syncStarted: boolean; decryptionStarted: boolean; bodyEditor: string; notesParentType: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied selectedNoteTags: any[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied lastEditorScrollPercents: any; selectedNoteHash: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied searches: any[]; selectedSearchId: string; customCss: string; noteVisiblePanes: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied watchedResources: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied highlightedWords: any[]; plugins: PluginStates; toolbarButtonInfos: ToolbarButtonInfo[]; @@ -65,6 +72,7 @@ export interface MarkupToHtmlOptions { replaceResourceInternalToExternalLinks?: boolean; resourceInfos?: ResourceInfos; contentMaxWidth?: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied plugins?: Record; bodyOnly?: boolean; mapsToLine?: boolean; @@ -80,7 +88,9 @@ export type MarkupToHtmlHandler = (markupLanguage: MarkupLanguage, markup: strin export type HtmlToMarkdownHandler = (markupLanguage: number, html: string, originalCss: string)=> Promise; export interface NoteBodyEditorProps { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ref: any; themeId: number; @@ -96,7 +106,9 @@ export interface NoteBodyEditorProps { contentMarkupLanguage: number; contentOriginalCss: string; onChange(event: OnChangeEvent): void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onWillChange(event: any): void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onMessage(event: any): void; onScroll(event: { percent: number }): void; markupToHtml: MarkupToHtmlHandler; @@ -105,8 +117,10 @@ export interface NoteBodyEditorProps { disabled: boolean; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied noteToolbar: any; setLocalSearchResultCount(count: number): void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied searchMarkers: any; visiblePanes: string[]; keyboardMode: string; @@ -131,6 +145,7 @@ export interface FormNote { body: string; parent_id: string; is_todo: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied bodyEditorContent?: any; markup_language: number; user_updated_time: number; @@ -191,7 +206,9 @@ export function defaultFormNote(): FormNote { } export interface ResourceInfo { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied localState: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied item: any; } @@ -207,22 +224,27 @@ export enum ScrollOptionTypes { export interface ScrollOptions { type: ScrollOptionTypes; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; } export interface OnChangeEvent { changeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied content: any; } export interface EditorCommand { name: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; } export interface CommandValue { name: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied args?: any; // Should be an array for CodeMirror or an object for TinyMCE ui?: boolean; // For TinyMCE only + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value?: any; // For TinyMCE only } diff --git a/packages/app-desktop/gui/NoteEditor/utils/useDropHandler.ts b/packages/app-desktop/gui/NoteEditor/utils/useDropHandler.ts index c76f19e62..cbf415416 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useDropHandler.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useDropHandler.ts @@ -3,6 +3,7 @@ import Note from '@joplin/lib/models/Note'; import { DragEvent as ReactDragEvent } from 'react'; interface HookDependencies { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied editorRef: any; } diff --git a/packages/app-desktop/gui/NoteEditor/utils/useFormNote.ts b/packages/app-desktop/gui/NoteEditor/utils/useFormNote.ts index 204361326..4c638c36f 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useFormNote.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useFormNote.ts @@ -25,7 +25,9 @@ export interface HookDependencies { decryptionStarted: boolean; noteId: string; isProvisional: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied titleInputRef: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied editorRef: any; onBeforeLoad(event: OnLoadEvent): void; onAfterLoad(event: OnLoadEvent): void; @@ -224,6 +226,7 @@ export default function useFormNote(dependencies: HookDependencies) { // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied }, [noteId, isProvisional, formNote]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onResourceChange = useCallback(async (event: any = null) => { const resourceIds = await Note.linkedResourceIds(formNote.body); if (!event || resourceIds.indexOf(event.id) >= 0) { diff --git a/packages/app-desktop/gui/NoteEditor/utils/useMarkupToHtml.ts b/packages/app-desktop/gui/NoteEditor/utils/useMarkupToHtml.ts index e591c1b53..3ed479fe1 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useMarkupToHtml.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useMarkupToHtml.ts @@ -12,6 +12,7 @@ interface HookDependencies { themeId: number; customCss: string; plugins: PluginStates; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied settingValue: (pluginId: string, key: string)=> any; whiteBackgroundNoteRendering: boolean; } @@ -27,6 +28,7 @@ export default function useMarkupToHtml(deps: HookDependencies) { // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied }, [plugins, customCss]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return useCallback(async (markupLanguage: number, md: string, options: MarkupToHtmlOptions = null): Promise => { options = { replaceResourceInternalToExternalLinks: false, diff --git a/packages/app-desktop/gui/NoteEditor/utils/useMessageHandler.ts b/packages/app-desktop/gui/NoteEditor/utils/useMessageHandler.ts index 341619ab4..5bfb7f19e 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useMessageHandler.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useMessageHandler.ts @@ -7,8 +7,9 @@ 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 +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied export default function useMessageHandler(scrollWhenReady: any, setScrollWhenReady: Function, editorRef: any, setLocalSearchResultCount: Function, dispatch: Function, formNote: FormNote, htmlToMd: HtmlToMarkdownHandler, mdToHtml: MarkupToHtmlHandler) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return useCallback(async (event: any) => { const msg = event.channel ? event.channel : ''; const args = event.args; diff --git a/packages/app-desktop/gui/NoteEditor/utils/useNoteSearchBar.ts b/packages/app-desktop/gui/NoteEditor/utils/useNoteSearchBar.ts index 1db80f0f0..2b8ed8e4c 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useNoteSearchBar.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useNoteSearchBar.ts @@ -27,6 +27,7 @@ function defaultLocalSearch(): LocalSearch { } export interface UseNoteSearchBarProps { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied noteSearchBarRef: MutableRefObject; } diff --git a/packages/app-desktop/gui/NoteEditor/utils/usePluginServiceRegistration.ts b/packages/app-desktop/gui/NoteEditor/utils/usePluginServiceRegistration.ts index 933c65820..5ff0dc172 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/usePluginServiceRegistration.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/usePluginServiceRegistration.ts @@ -1,6 +1,7 @@ import { useEffect } from 'react'; import PlatformImplementation from '../../../services/plugins/PlatformImplementation'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function usePluginServiceRegistration(ref: any) { useEffect(() => { PlatformImplementation.instance().registerComponent('textEditor', ref); diff --git a/packages/app-desktop/gui/NoteEditor/utils/useSearchMarkers.ts b/packages/app-desktop/gui/NoteEditor/utils/useSearchMarkers.ts index 84f78e9fd..1c0bf29dc 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useSearchMarkers.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useSearchMarkers.ts @@ -8,6 +8,7 @@ interface SearchMarkersOptions { } export interface SearchMarkers { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied keywords: any[]; options: SearchMarkersOptions; } @@ -24,7 +25,7 @@ function defaultSearchMarkers(): SearchMarkers { } -// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, 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 339a1e263..96f277b5f 100644 --- a/packages/app-desktop/gui/NoteEditor/utils/useWindowCommandHandler.ts +++ b/packages/app-desktop/gui/NoteEditor/utils/useWindowCommandHandler.ts @@ -20,8 +20,10 @@ interface HookDependencies { setShowLocalSearch: Function; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied noteSearchBarRef: any; editorRef: RefObject; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied titleInputRef: any; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied saveNoteAndWait: Function; @@ -34,6 +36,7 @@ function editorCommandRuntime( setFormNote: SetFormNoteCallback, ): CommandRuntime { return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execute: async (_context: CommandContext, ...args: any[]) => { if (!editorRef.current) { reg.logger().warn('Received command, but editor is gone', declaration.name); diff --git a/packages/app-desktop/gui/NoteList/utils/types.ts b/packages/app-desktop/gui/NoteList/utils/types.ts index a7101740d..bd2c929ff 100644 --- a/packages/app-desktop/gui/NoteList/utils/types.ts +++ b/packages/app-desktop/gui/NoteList/utils/types.ts @@ -5,6 +5,7 @@ import { Size } from '@joplin/utils/types'; import { Dispatch } from 'redux'; export interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied themeId: any; selectedNoteIds: string[]; notes: NoteEntity[]; @@ -17,10 +18,12 @@ export interface Props { noteSortOrder: string; uncompletedTodosOnTop: boolean; showCompletedTodos: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied resizableLayoutEventEmitter: any; isInsertingNotes: boolean; folders: FolderEntity[]; size: Size; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied searches: any[]; selectedSearchId: string; highlightedWords: string[]; diff --git a/packages/app-desktop/gui/NoteList/utils/useOnKeyDown.ts b/packages/app-desktop/gui/NoteList/utils/useOnKeyDown.ts index 8360f7b94..3cb5767a6 100644 --- a/packages/app-desktop/gui/NoteList/utils/useOnKeyDown.ts +++ b/packages/app-desktop/gui/NoteList/utils/useOnKeyDown.ts @@ -115,6 +115,7 @@ const useOnKeyDown = ( event.preventDefault(); const selectedNotes = BaseModel.modelsByIds(notes, noteIds); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const todos = selectedNotes.filter((n: any) => !!n.is_todo); if (!todos.length) return; diff --git a/packages/app-desktop/gui/NoteList/utils/useOnNoteClick.ts b/packages/app-desktop/gui/NoteList/utils/useOnNoteClick.ts index f88d780f7..0d5fdc94d 100644 --- a/packages/app-desktop/gui/NoteList/utils/useOnNoteClick.ts +++ b/packages/app-desktop/gui/NoteList/utils/useOnNoteClick.ts @@ -7,6 +7,7 @@ const useOnNoteClick = (dispatch: Dispatch, focusNote: FocusNote) => { const onNoteClick = useCallback((event: React.MouseEvent) => { const noteId = event.currentTarget.getAttribute('data-id'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const targetTagName = event.target ? (event.target as any).tagName : ''; // If we are for example on a checkbox, don't process the click since it diff --git a/packages/app-desktop/gui/NoteList/utils/useScroll.ts b/packages/app-desktop/gui/NoteList/utils/useScroll.ts index 450569b79..41277f414 100644 --- a/packages/app-desktop/gui/NoteList/utils/useScroll.ts +++ b/packages/app-desktop/gui/NoteList/utils/useScroll.ts @@ -86,6 +86,7 @@ const useScroll = (itemsPerLine: number, noteCount: number, itemSize: Size, list setScrollTopLikeYouMeanIt(newScrollTop); }, [itemsPerLine, noteCount, itemSize.height, scrollTop, listSize.height, maxScrollTop, setScrollTopLikeYouMeanIt]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onScroll = useCallback((event: any) => { // Ignore the scroll event if it has just been set programmatically. if (Date.now() - lastScrollSetTime.current < 500) return; diff --git a/packages/app-desktop/gui/NoteListControls/NoteListControls.tsx b/packages/app-desktop/gui/NoteListControls/NoteListControls.tsx index 1cb20a402..f38d1b811 100644 --- a/packages/app-desktop/gui/NoteListControls/NoteListControls.tsx +++ b/packages/app-desktop/gui/NoteListControls/NoteListControls.tsx @@ -33,14 +33,18 @@ interface Props { buttonVerticalGap: number; } -const StyledRoot = styled.div` +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; +type StyleProps = any; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; +const StyledRoot: any = styled.div` box-sizing: border-box; display: flex; flex-direction: column; - padding: ${(props: any) => props.padding}px; - background-color: ${(props: any) => props.theme.backgroundColor3}; - gap: ${(props: any) => props.buttonVerticalGap}px; -` as any; + padding: ${(props: StyleProps) => props.padding}px; + background-color: ${(props: StyleProps) => props.theme.backgroundColor3}; + gap: ${(props: StyleProps) => props.buttonVerticalGap}px; +`; const StyledButton = styled(Button)` width: auto; @@ -57,8 +61,8 @@ const StyledButton = styled(Button)` const StyledPairButtonL = styled(Button)` border-radius: 3px 0 0 3px; - min-width: ${(props: any) => buttonSizePx(props)}px; - max-width: ${(props: any) => buttonSizePx(props)}px; + min-width: ${(props: StyleProps) => buttonSizePx(props)}px; + max-width: ${(props: StyleProps) => buttonSizePx(props)}px; `; const StyledPairButtonR = styled(Button)` @@ -184,6 +188,7 @@ function NoteListControls(props: Props) { function sortOrderFieldIcon() { const field = props.sortOrderField; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const iconMap: any = { user_updated_time: 'far fa-calendar-alt', user_created_time: 'far fa-calendar-plus', diff --git a/packages/app-desktop/gui/NoteListControls/commands/focusSearch.ts b/packages/app-desktop/gui/NoteListControls/commands/focusSearch.ts index 88d847421..518f7ad34 100644 --- a/packages/app-desktop/gui/NoteListControls/commands/focusSearch.ts +++ b/packages/app-desktop/gui/NoteListControls/commands/focusSearch.ts @@ -6,6 +6,7 @@ export const declaration: CommandDeclaration = { label: () => _('Search in all the notes'), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const runtime = (searchBarRef: any): CommandRuntime => { return { execute: async () => { diff --git a/packages/app-desktop/gui/NoteListHeader/useDragAndDrop.test.ts b/packages/app-desktop/gui/NoteListHeader/useDragAndDrop.test.ts index 1bd7e40cc..5cb6b27d6 100644 --- a/packages/app-desktop/gui/NoteListHeader/useDragAndDrop.test.ts +++ b/packages/app-desktop/gui/NoteListHeader/useDragAndDrop.test.ts @@ -65,6 +65,7 @@ describe('useDragAndDrop', () => { ], ], ])('should drop columns', (columns, header, insertAt, expected) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const actual = dropHeaderAt(columns, header, insertAt as any).map(c => c.name); expect(actual).toEqual(expected); }); diff --git a/packages/app-desktop/gui/NoteListHeader/useDragAndDrop.ts b/packages/app-desktop/gui/NoteListHeader/useDragAndDrop.ts index aaaf93314..03ce572a0 100644 --- a/packages/app-desktop/gui/NoteListHeader/useDragAndDrop.ts +++ b/packages/app-desktop/gui/NoteListHeader/useDragAndDrop.ts @@ -83,6 +83,7 @@ export const dropHeaderAt = (columns: NoteListColumns, header: DraggedHeader, in return newColumns; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const setupDataTransfer = (event: React.DragEvent, dataType: string, image: HTMLImageElement, data: any) => { event.dataTransfer.setDragImage(image, 1, 1); event.dataTransfer.clearData(); @@ -218,6 +219,7 @@ export default (columns: NoteListColumns) => { }, []); const onResizerDragEnd: React.DragEventHandler = useCallback(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied document.removeEventListener('dragover', onResizerDragOver as any); }, [onResizerDragOver]); @@ -237,6 +239,7 @@ export default (columns: NoteListColumns) => { initBoundaries: boundaries, }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied document.addEventListener('dragover', onResizerDragOver as any); }, [columns, onResizerDragOver, emptyImage]); diff --git a/packages/app-desktop/gui/NoteListHeader/utils/validateColumns.test.ts b/packages/app-desktop/gui/NoteListHeader/utils/validateColumns.test.ts index e47726cf8..5060a5637 100644 --- a/packages/app-desktop/gui/NoteListHeader/utils/validateColumns.test.ts +++ b/packages/app-desktop/gui/NoteListHeader/utils/validateColumns.test.ts @@ -1,6 +1,7 @@ import { NoteListColumns, defaultListColumns } from '@joplin/lib/services/plugins/api/noteListType'; import validateColumns from './validateColumns'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const makeColumns = (props: any) => { const columns: NoteListColumns = []; for (const p of props) { diff --git a/packages/app-desktop/gui/NoteListItem/utils/prepareViewProps.ts b/packages/app-desktop/gui/NoteListItem/utils/prepareViewProps.ts index 4c893adf5..1f3451c33 100644 --- a/packages/app-desktop/gui/NoteListItem/utils/prepareViewProps.ts +++ b/packages/app-desktop/gui/NoteListItem/utils/prepareViewProps.ts @@ -14,6 +14,7 @@ const prepareViewProps = async ( folder: FolderEntity | null, itemIndex: number, ) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (const dep of dependencies) { @@ -40,6 +41,7 @@ const prepareViewProps = async ( // load by default. if (!(propName in note)) note = await Note.load(note.id); if (!(propName in note)) throw new Error(`Invalid dependency name: ${dep}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied output.note[propName] = (note as any)[propName]; } } @@ -51,6 +53,7 @@ const prepareViewProps = async ( if (!output.item) output.item = {}; if (!output.item.size) output.item.size = {}; if (!(propName in itemSize)) throw new Error(`Invalid dependency name: ${dep}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied output.item.size[propName] = (itemSize as any)[propName]; } diff --git a/packages/app-desktop/gui/NoteListItem/utils/useItemElement.ts b/packages/app-desktop/gui/NoteListItem/utils/useItemElement.ts index d4465d784..16a3b507e 100644 --- a/packages/app-desktop/gui/NoteListItem/utils/useItemElement.ts +++ b/packages/app-desktop/gui/NoteListItem/utils/useItemElement.ts @@ -3,6 +3,7 @@ import { Size } from '@joplin/utils/types'; import { useEffect, useState } from 'react'; import { ItemFlow } from '@joplin/lib/services/plugins/api/noteListType'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const useItemElement = (rootElement: HTMLDivElement, noteId: string, noteHtml: string, style: any, itemSize: Size, onClick: React.MouseEventHandler, flow: ItemFlow) => { const [itemElement, setItemElement] = useState(null); @@ -13,11 +14,13 @@ const useItemElement = (rootElement: HTMLDivElement, noteId: string, noteHtml: s element.setAttribute('data-id', noteId); element.className = 'note-list-item'; for (const [n, v] of Object.entries(style)) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (element.style as any)[n] = v; } if (flow === ItemFlow.LeftToRight) element.style.width = `${itemSize.width}px`; element.style.height = `${itemSize.height}px`; element.innerHTML = noteHtml; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied element.addEventListener('click', onClick as any); rootElement.appendChild(element); diff --git a/packages/app-desktop/gui/NoteListItem/utils/useItemEventHandlers.ts b/packages/app-desktop/gui/NoteListItem/utils/useItemEventHandlers.ts index 9d26ab1c1..6efce40cb 100644 --- a/packages/app-desktop/gui/NoteListItem/utils/useItemEventHandlers.ts +++ b/packages/app-desktop/gui/NoteListItem/utils/useItemEventHandlers.ts @@ -12,11 +12,13 @@ const useItemEventHandlers = (rootElement: HTMLDivElement, itemElement: HTMLDivE for (const input of inputs) { if (input.type === 'checkbox') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied input.addEventListener('change', onInputChange as any); processedCheckboxes.push(input); } if (input.type === 'text') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied input.addEventListener('change', onInputChange as any); processedTextInputs.push(input); } @@ -27,6 +29,7 @@ const useItemEventHandlers = (rootElement: HTMLDivElement, itemElement: HTMLDivE if (onClick) { for (const button of buttons) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied button.addEventListener('click', onClick as any); processedButtons.push(button); } @@ -34,14 +37,17 @@ const useItemEventHandlers = (rootElement: HTMLDivElement, itemElement: HTMLDivE return () => { for (const input of processedCheckboxes) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied input.removeEventListener('change', onInputChange as any); } for (const input of processedTextInputs) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied input.removeEventListener('change', onInputChange as any); } for (const button of processedButtons) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied button.removeEventListener('click', onClick as any); } }; diff --git a/packages/app-desktop/gui/NoteListItem/utils/useOnContextMenu.ts b/packages/app-desktop/gui/NoteListItem/utils/useOnContextMenu.ts index b58c685a9..84d9820d0 100644 --- a/packages/app-desktop/gui/NoteListItem/utils/useOnContextMenu.ts +++ b/packages/app-desktop/gui/NoteListItem/utils/useOnContextMenu.ts @@ -15,6 +15,7 @@ const useOnContextMenu = ( plugins: PluginStates, customCss: string, ) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return useCallback((event: any) => { const currentNoteId = event.currentTarget.getAttribute('data-id'); if (!currentNoteId) return; diff --git a/packages/app-desktop/gui/NoteListItem/utils/useRenderedNote.ts b/packages/app-desktop/gui/NoteListItem/utils/useRenderedNote.ts index b511b3c37..e5df5fa50 100644 --- a/packages/app-desktop/gui/NoteListItem/utils/useRenderedNote.ts +++ b/packages/app-desktop/gui/NoteListItem/utils/useRenderedNote.ts @@ -18,6 +18,7 @@ interface RenderedNote { html: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const hashContent = (content: any) => { return createHash('sha1').update(JSON.stringify(content)).digest('hex'); }; diff --git a/packages/app-desktop/gui/NoteListWrapper/NoteListWrapper.tsx b/packages/app-desktop/gui/NoteListWrapper/NoteListWrapper.tsx index 69b1f4069..96af332d5 100644 --- a/packages/app-desktop/gui/NoteListWrapper/NoteListWrapper.tsx +++ b/packages/app-desktop/gui/NoteListWrapper/NoteListWrapper.tsx @@ -21,6 +21,7 @@ import usePrevious from '../hooks/usePrevious'; const logger = Logger.create('NoteListWrapper'); interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied resizableLayoutEventEmitter: any; size: Size; visible: boolean; @@ -133,6 +134,7 @@ export default function NoteListWrapper(props: Props) { }, [props.size, noteListControlsHeight, theme.noteListHeaderHeight, isMultiColumns]); const onHeaderItemClick: OnItemClickHander = useCallback(event => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const field = depNameToNoteProp(event.name as any).split('.')[1]; if (!Setting.isAllowedEnumOption('notes.sortOrder.field', field)) { diff --git a/packages/app-desktop/gui/NotePropertiesDialog.tsx b/packages/app-desktop/gui/NotePropertiesDialog.tsx index d2ed420ce..c25eee638 100644 --- a/packages/app-desktop/gui/NotePropertiesDialog.tsx +++ b/packages/app-desktop/gui/NotePropertiesDialog.tsx @@ -36,14 +36,17 @@ interface FormNote { interface State { editedKey: string; formNote: FormNote; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied editedValue: any; } class NotePropertiesDialog extends React.Component { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private okButton: any; private keyToLabel_: Record; private styleKey_: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private styles_: any; public constructor(props: Props) { @@ -97,6 +100,7 @@ class NotePropertiesDialog extends React.Component { } public latLongFromLocation(location: string) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const o: any = {}; const l = location.split(','); if (l.length === 2) { @@ -202,6 +206,7 @@ class NotePropertiesDialog extends React.Component { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private buttonRow_click(event: any) { void this.closeDialog(event.buttonName === 'ok'); } @@ -211,6 +216,7 @@ class NotePropertiesDialog extends React.Component { if (this.props.onRevisionLinkClick) this.props.onRevisionLinkClick(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public editPropertyButtonClick(key: string, initialValue: any) { this.setState({ editedKey: key, @@ -218,9 +224,12 @@ class NotePropertiesDialog extends React.Component { }); shim.setTimeout(() => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if ((this.refs.editField as any).openCalendar) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (this.refs.editField as any).openCalendar(); } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied focus('NotePropertiesDialog::editPropertyButtonClick', (this.refs.editField as any)); } }, 100); @@ -235,8 +244,10 @@ class NotePropertiesDialog extends React.Component { if (this.state.editedKey.indexOf('_time') >= 0) { const dt = time.anythingToDateTime(this.state.editedValue, new Date()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (newFormNote as any)[this.state.editedKey] = time.formatMsToLocal(dt.getTime()); } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (newFormNote as any)[this.state.editedKey] = this.state.editedValue; } @@ -266,6 +277,7 @@ class NotePropertiesDialog extends React.Component { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public createNoteField(key: keyof FormNote, value: any) { const styles = this.styles(this.props.themeId); const theme = themeStyle(this.props.themeId); @@ -275,6 +287,7 @@ class NotePropertiesDialog extends React.Component { let editCompHandler = null; let editCompIcon = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onKeyDown = (event: any) => { if (event.keyCode === 13) { void this.saveProperty(); @@ -292,9 +305,11 @@ class NotePropertiesDialog extends React.Component { dateFormat={time.dateFormat()} timeFormat={time.timeFormat()} inputProps={{ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onKeyDown: (event: any) => onKeyDown(event), style: styles.input, }} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onChange={(momentObject: any) => { this.setState({ editedValue: momentObject }); }} @@ -398,9 +413,11 @@ class NotePropertiesDialog extends React.Component { } if (['user_updated_time', 'user_created_time', 'todo_completed'].indexOf(key) >= 0) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return time.formatMsToLocal((note as any)[key]); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (note as any)[key]; } @@ -413,6 +430,7 @@ class NotePropertiesDialog extends React.Component { if (formNote) { for (const key of Object.keys(formNote)) { if (key === 'deleted_time' && !formNote.deleted_time) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const comp = this.createNoteField(key as (keyof FormNote), (formNote as any)[key]); noteComps.push(comp); } diff --git a/packages/app-desktop/gui/NoteRevisionViewer.tsx b/packages/app-desktop/gui/NoteRevisionViewer.tsx index e4a827686..6367dda2d 100644 --- a/packages/app-desktop/gui/NoteRevisionViewer.tsx +++ b/packages/app-desktop/gui/NoteRevisionViewer.tsx @@ -35,6 +35,7 @@ interface State { class NoteRevisionViewerComponent extends React.PureComponent { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private viewerRef_: any; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private helpButton_onClick: Function; @@ -103,6 +104,7 @@ class NoteRevisionViewerComponent extends React.PureComponent { if (this.props.onBack) this.props.onBack(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private revisionList_onChange(event: any) { const value = event.target.value; @@ -154,6 +156,7 @@ class NoteRevisionViewerComponent extends React.PureComponent { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async webview_ipcMessage(event: any) { // For the revision view, we only support a minimal subset of the IPC messages. // For example, we don't need interactive checkboxes or sync between viewer and editor view. @@ -219,6 +222,7 @@ class NoteRevisionViewerComponent extends React.PureComponent { const viewer = ; return ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
{titleInput} {viewer} diff --git a/packages/app-desktop/gui/NoteSearchBar.tsx b/packages/app-desktop/gui/NoteSearchBar.tsx index 4dd101145..d4e5068ca 100644 --- a/packages/app-desktop/gui/NoteSearchBar.tsx +++ b/packages/app-desktop/gui/NoteSearchBar.tsx @@ -18,11 +18,13 @@ interface Props { resultCount: number; selectedIndex: number; visiblePanes: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; } class NoteSearchBar extends React.Component { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private backgroundColor: any; public constructor(props: Props) { @@ -51,6 +53,7 @@ class NoteSearchBar extends React.Component { return style; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public buttonIconComponent(iconName: string, clickHandler: any, isEnabled: boolean) { const theme = themeStyle(this.props.themeId); @@ -79,11 +82,13 @@ class NoteSearchBar extends React.Component { ); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private searchInput_change(event: any) { const query = event.currentTarget.value; this.triggerOnChange(query); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private searchInput_keyDown(event: any) { if (event.keyCode === 13) { // ENTER @@ -128,7 +133,9 @@ class NoteSearchBar extends React.Component { } public focus() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied focus('NoteSearchBar::focus', this.refs.searchInput as any); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (this.refs.searchInput as any).select(); } diff --git a/packages/app-desktop/gui/NoteTextViewer.tsx b/packages/app-desktop/gui/NoteTextViewer.tsx index b60dc7ff3..b1c7c8b42 100644 --- a/packages/app-desktop/gui/NoteTextViewer.tsx +++ b/packages/app-desktop/gui/NoteTextViewer.tsx @@ -8,18 +8,23 @@ interface Props { onDomReady: Function; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onIpcMessage: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied viewerStyle: any; contentMaxWidth?: number; themeId: number; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default class NoteTextViewerComponent extends React.Component { private initialized_ = false; private domReady_ = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private webviewRef_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private webviewListeners_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(props: any) { super(props); @@ -44,11 +49,13 @@ export default class NoteTextViewerComponent extends React.Component this.webview_message = this.webview_message.bind(this); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private webview_domReady(event: any) { this.domReady_ = true; if (this.props.onDomReady) this.props.onDomReady(event); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private webview_ipcMessage(event: any) { if (this.props.onIpcMessage) this.props.onIpcMessage(event); } @@ -57,6 +64,7 @@ export default class NoteTextViewerComponent extends React.Component this.webview_domReady({}); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private webview_message(event: any) { if (!event.data || event.data.target !== 'main') return; @@ -147,6 +155,7 @@ export default class NoteTextViewerComponent extends React.Component // Wrap WebView functions // ---------------------------------------------------------------- + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public send(channel: string, arg0: any = null, arg1: any = null) { const win = this.webviewRef_.current.contentWindow; diff --git a/packages/app-desktop/gui/NoteToolbar/NoteToolbar.tsx b/packages/app-desktop/gui/NoteToolbar/NoteToolbar.tsx index 8d5be99d7..46f1b26ef 100644 --- a/packages/app-desktop/gui/NoteToolbar/NoteToolbar.tsx +++ b/packages/app-desktop/gui/NoteToolbar/NoteToolbar.tsx @@ -9,12 +9,14 @@ const { buildStyle } = require('@joplin/lib/theme'); interface NoteToolbarProps { themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; toolbarButtonInfos: ToolbarButtonInfo[]; disabled: boolean; } function styles_(props: NoteToolbarProps) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return buildStyle('NoteToolbar', props.themeId, (theme: any) => { return { root: { @@ -33,6 +35,7 @@ function NoteToolbar(props: NoteToolbarProps) { const toolbarButtonUtils = new ToolbarButtonUtils(CommandService.instance()); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const mapStateToProps = (state: any) => { const whenClauseContext = stateToWhenClauseContext(state); diff --git a/packages/app-desktop/gui/OneDriveLoginScreen.tsx b/packages/app-desktop/gui/OneDriveLoginScreen.tsx index bf902d292..69df1b4ed 100644 --- a/packages/app-desktop/gui/OneDriveLoginScreen.tsx +++ b/packages/app-desktop/gui/OneDriveLoginScreen.tsx @@ -13,6 +13,7 @@ interface Props { themeId: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied class OneDriveLoginScreenComponent extends React.Component { public constructor(props: Props) { super(props); @@ -23,7 +24,9 @@ class OneDriveLoginScreenComponent extends React.Component { } public async componentDidMount() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const log = (s: any) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.setState((state: any) => { const authLog = state.authLog.slice(); authLog.push({ key: (Date.now() + Math.random()).toString(), text: s }); @@ -35,6 +38,7 @@ class OneDriveLoginScreenComponent extends React.Component { const syncTarget = reg.syncTarget(syncTargetId); const oneDriveApiUtils = new OneDriveApiNodeUtils(syncTarget.api()); const auth = await oneDriveApiUtils.oauthDance({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied log: (s: any) => log(s), }); @@ -81,6 +85,7 @@ class OneDriveLoginScreenComponent extends React.Component { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const mapStateToProps = (state: any) => { return { themeId: state.settings.theme, diff --git a/packages/app-desktop/gui/PdfViewer.tsx b/packages/app-desktop/gui/PdfViewer.tsx index 792eae65c..a6a5ebebc 100644 --- a/packages/app-desktop/gui/PdfViewer.tsx +++ b/packages/app-desktop/gui/PdfViewer.tsx @@ -8,6 +8,9 @@ import CommandService from '@joplin/lib/services/CommandService'; import styled from 'styled-components'; import { themeStyle } from '@joplin/lib/theme'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; +type StyleProps = any; + const Window = styled.div` height: 100%; width: 100%; @@ -15,8 +18,8 @@ const Window = styled.div` top: 0px; left: 0px; z-index: 999; - background-color: ${(props: any) => props.theme.backgroundColor}; - color: ${(props: any) => props.theme.color}; + background-color: ${(props: StyleProps) => props.theme.backgroundColor}; + color: ${(props: StyleProps) => props.theme.color}; `; const IFrame = styled.iframe` @@ -29,6 +32,7 @@ interface Props { themeId: number; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied resource: any; pageNo: number; } @@ -68,6 +72,7 @@ export default function PdfViewer(props: Props) { menu.popup({ window: bridge().window() }); }, [props.dispatch]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onMessage_ = useCallback(async (event: any) => { if (!event.data || !event.data.name) { return; diff --git a/packages/app-desktop/gui/PromptDialog.tsx b/packages/app-desktop/gui/PromptDialog.tsx index 4757a25a1..c34d2e33c 100644 --- a/packages/app-desktop/gui/PromptDialog.tsx +++ b/packages/app-desktop/gui/PromptDialog.tsx @@ -9,23 +9,31 @@ import makeAnimated from 'react-select/animated'; import { focus } from '@joplin/lib/utils/focusHandler'; interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied defaultValue: any; visible: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied buttons: any[]; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onClose: Function; inputType: string; description: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied answer?: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied autocomplete: any; label: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default class PromptDialog extends React.Component { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private answerInput_: any; private focusInput_: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private styles_: any; private styleKey_: string; private menuIsOpened_ = false; @@ -135,6 +143,7 @@ export default class PromptDialog extends React.Component { }; this.styles_.select = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied control: (provided: any) => { return { ...provided, minWidth: width * 0.2, @@ -142,12 +151,14 @@ export default class PromptDialog extends React.Component { fontFamily: theme.fontFamily, }; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied input: (provided: any) => { return { ...provided, minWidth: '20px', color: theme.color, }; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menu: (provided: any) => { return { ...provided, color: theme.color, @@ -155,6 +166,7 @@ export default class PromptDialog extends React.Component { backgroundColor: theme.backgroundColor, }; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied option: (provided: any, state: any) => { return { ...provided, color: theme.color, @@ -162,11 +174,13 @@ export default class PromptDialog extends React.Component { paddingLeft: `${10 + (state.data.indentDepth || 0) * 20}px`, }; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied multiValueLabel: (provided: any) => { return { ...provided, fontFamily: theme.fontFamily, }; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied multiValueRemove: (provided: any) => { return { ...provided, color: theme.color, @@ -174,6 +188,7 @@ export default class PromptDialog extends React.Component { }, }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.styles_.selectTheme = (tagTheme: any) => { return { ...tagTheme, borderRadius: 2, @@ -221,6 +236,7 @@ export default class PromptDialog extends React.Component { this.setState({ visible: false, answer: '' }); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onChange = (event: any) => { this.setState({ answer: event.target.value }); }; @@ -234,15 +250,18 @@ export default class PromptDialog extends React.Component { // return m.isValid() ? m.toDate() : null; // } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onDateTimeChange = (momentObject: any) => { this.setState({ answer: momentObject }); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onSelectChange = (newValue: any) => { this.setState({ answer: newValue }); this.focusInput_ = true; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onKeyDown = (event: any) => { if (event.key === 'Enter') { // If the dropdown is open, we don't close the dialog - instead @@ -263,10 +282,13 @@ export default class PromptDialog extends React.Component { let inputComp = null; if (this.props.inputType === 'datetime') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied inputComp = onDateTimeChange(momentObject)} />; } else if (this.props.inputType === 'tags') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied inputComp = onKeyDown(event)} />; } else if (this.props.inputType === 'dropdown') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied inputComp = onChange(event)} onKeyDown={event => onKeyDown(event)} />; diff --git a/packages/app-desktop/gui/ResizableLayout/ResizableLayout.tsx b/packages/app-desktop/gui/ResizableLayout/ResizableLayout.tsx index e01bebb97..79d1d7d26 100644 --- a/packages/app-desktop/gui/ResizableLayout/ResizableLayout.tsx +++ b/packages/app-desktop/gui/ResizableLayout/ResizableLayout.tsx @@ -33,8 +33,9 @@ function itemVisible(item: LayoutItem, moveMode: boolean) { return item.visible !== false; } -// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, 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 { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const style: any = { display: itemVisible(item, moveMode) ? 'flex' : 'none', flexDirection: item.direction, @@ -61,8 +62,11 @@ function renderContainer(item: LayoutItem, parent: LayoutItem | null, sizes: Lay className={className} style={style} size={size} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onResizeStart={onResizeStart as any} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onResize={onResize as any} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onResizeStop={onResizeStop as any} enable={enable} minWidth={'minWidth' in item ? item.minWidth : itemMinWidth} @@ -85,8 +89,10 @@ function renderContainer(item: LayoutItem, parent: LayoutItem | null, sizes: Lay function ResizableLayout(props: Props) { const eventEmitter = useRef(new EventEmitter()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const [resizedItem, setResizedItem] = useState(null); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function renderItemWrapper(comp: any, item: LayoutItem, parent: LayoutItem | null, size: Size, moveMode: boolean) { const moveOverlay = moveMode ? ( @@ -109,6 +115,7 @@ function ResizableLayout(props: Props) { ); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function renderLayoutItem(item: LayoutItem, parent: LayoutItem | null, sizes: LayoutItemSizes, isVisible: boolean, isLastChild: boolean): any { function onResizeStart() { setResizedItem({ @@ -119,10 +126,12 @@ function ResizableLayout(props: Props) { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function onResize(_event: any, direction: string, _refToElement: any, delta: any) { const newWidth = Math.max(itemMinWidth, resizedItem.initialWidth + delta.width); const newHeight = Math.max(itemMinHeight, resizedItem.initialHeight + delta.height); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newSize: any = {}; if (item.width) newSize.width = item.width; @@ -140,6 +149,7 @@ function ResizableLayout(props: Props) { eventEmitter.current.emit('resize'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function onResizeStop(_event: any, _direction: any, _refToElement: any, delta: any) { onResize(_event, _direction, _refToElement, delta); setResizedItem(null); @@ -177,6 +187,7 @@ function ResizableLayout(props: Props) { useWindowResizeEvent(eventEmitter); const sizes = useLayoutItemSizes(props.layout, props.moveMode); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function renderMoveModeBox(rootComp: any) { return ( diff --git a/packages/app-desktop/gui/ResizableLayout/utils/layoutItemProp.ts b/packages/app-desktop/gui/ResizableLayout/utils/layoutItemProp.ts index df64dcdf7..943ed3886 100644 --- a/packages/app-desktop/gui/ResizableLayout/utils/layoutItemProp.ts +++ b/packages/app-desktop/gui/ResizableLayout/utils/layoutItemProp.ts @@ -4,5 +4,6 @@ import { LayoutItem } from './types'; export default function layoutItemProp(layout: LayoutItem, key: string, propName: string) { const item = findItemByKey(layout, key); if (!item) throw new Error(`Could not find layout item: ${key}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (item as any)[propName]; } diff --git a/packages/app-desktop/gui/ResizableLayout/utils/movements.ts b/packages/app-desktop/gui/ResizableLayout/utils/movements.ts index eee79ca20..5fc1c1197 100644 --- a/packages/app-desktop/gui/ResizableLayout/utils/movements.ts +++ b/packages/app-desktop/gui/ResizableLayout/utils/movements.ts @@ -16,6 +16,7 @@ enum MovementDirection { Vertical = 2, } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function array_move(arr: any[], old_index: number, new_index: number) { arr = arr.slice(); if (new_index >= arr.length) { @@ -80,6 +81,7 @@ function moveItem(direction: MovementDirection, layout: LayoutItem, key: string, return !itemParents[item.key]; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const updatedLayout = produce(layout, (draft: any) => { iterateItems(draft, (itemIndex: number, item: LayoutItem, parent: LayoutItem) => { itemParents[item.key] = parent; @@ -121,6 +123,7 @@ function moveItem(direction: MovementDirection, layout: LayoutItem, key: string, // The new container takes the size of the item it // replaces. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newSize: any = {}; if (direction === MovementDirection.Horizontal) { if ('width' in targetChild) newSize.width = targetChild.width; diff --git a/packages/app-desktop/gui/ResizableLayout/utils/persist.test.ts b/packages/app-desktop/gui/ResizableLayout/utils/persist.test.ts index 015e8d854..b2b79d44e 100644 --- a/packages/app-desktop/gui/ResizableLayout/utils/persist.test.ts +++ b/packages/app-desktop/gui/ResizableLayout/utils/persist.test.ts @@ -42,6 +42,7 @@ describe('persist', () => { }); test('should load a layout', () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const layout: any = { key: 'root', children: [ diff --git a/packages/app-desktop/gui/ResizableLayout/utils/persist.ts b/packages/app-desktop/gui/ResizableLayout/utils/persist.ts index 98292efc9..02bd8a225 100644 --- a/packages/app-desktop/gui/ResizableLayout/utils/persist.ts +++ b/packages/app-desktop/gui/ResizableLayout/utils/persist.ts @@ -3,6 +3,7 @@ import produce from 'immer'; import iterateItems from './iterateItems'; import validateLayout from './validateLayout'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function saveLayout(layout: LayoutItem): any { const propertyWhiteList = [ 'visible', @@ -13,11 +14,13 @@ export function saveLayout(layout: LayoutItem): any { 'context', ]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return produce(layout, (draft: any) => { delete draft.width; delete draft.height; iterateItems(draft, (_itemIndex: number, item: LayoutItem, _parent: LayoutItem) => { for (const k of Object.keys(item)) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!propertyWhiteList.includes(k)) delete (item as any)[k]; } return true; @@ -25,6 +28,7 @@ export function saveLayout(layout: LayoutItem): any { }); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function loadLayout(layout: any, defaultLayout: LayoutItem, rootSize: Size): LayoutItem { let output: LayoutItem = null; diff --git a/packages/app-desktop/gui/ResizableLayout/utils/setLayoutItemProps.ts b/packages/app-desktop/gui/ResizableLayout/utils/setLayoutItemProps.ts index 8cf7cfa71..7921ecf62 100644 --- a/packages/app-desktop/gui/ResizableLayout/utils/setLayoutItemProps.ts +++ b/packages/app-desktop/gui/ResizableLayout/utils/setLayoutItemProps.ts @@ -2,11 +2,13 @@ import produce from 'immer'; import { LayoutItem } from './types'; import validateLayout from './validateLayout'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function setLayoutItemProps(layout: LayoutItem, key: string, props: any) { return validateLayout(produce(layout, (draftState: LayoutItem) => { function recurseFind(item: LayoutItem) { if (item.key === key) { for (const n in props) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (item as any)[n] = props[n]; } } else { diff --git a/packages/app-desktop/gui/ResizableLayout/utils/style.ts b/packages/app-desktop/gui/ResizableLayout/utils/style.ts index 922ae1025..5637cbd6e 100644 --- a/packages/app-desktop/gui/ResizableLayout/utils/style.ts +++ b/packages/app-desktop/gui/ResizableLayout/utils/style.ts @@ -4,6 +4,7 @@ import styled from 'styled-components'; // Need to use `attrs` otherwise styled-components creates many instances of the // style when the component is resized. // https://github.com/styled-components/styled-components/issues/1212 +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const StyledWrapperRoot: any = styled.div.attrs((props: any) => ({ style: { width: props.size.width, diff --git a/packages/app-desktop/gui/ResizableLayout/utils/types.ts b/packages/app-desktop/gui/ResizableLayout/utils/types.ts index e9e3b5a41..4f29f549a 100644 --- a/packages/app-desktop/gui/ResizableLayout/utils/types.ts +++ b/packages/app-desktop/gui/ResizableLayout/utils/types.ts @@ -20,6 +20,7 @@ export interface LayoutItem { resizableRight?: boolean; resizableBottom?: boolean; visible?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied context?: any; } diff --git a/packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.ts b/packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.ts index f9c1b7abb..ae0259db6 100644 --- a/packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.ts +++ b/packages/app-desktop/gui/ResizableLayout/utils/useLayoutItemSizes.ts @@ -38,7 +38,9 @@ function calculateChildrenSizes(item: LayoutItem, parent: LayoutItem | null, siz height: parentSize.height, }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const noWidthChildren: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const noHeightChildren: any[] = []; // The minimum space required for items with no defined size diff --git a/packages/app-desktop/gui/ResizableLayout/utils/useWindowResizeEvent.ts b/packages/app-desktop/gui/ResizableLayout/utils/useWindowResizeEvent.ts index 61b4df7a6..15c2a3833 100644 --- a/packages/app-desktop/gui/ResizableLayout/utils/useWindowResizeEvent.ts +++ b/packages/app-desktop/gui/ResizableLayout/utils/useWindowResizeEvent.ts @@ -1,6 +1,7 @@ import { useEffect } from 'react'; const debounce = require('debounce'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useWindowResizeEvent(eventEmitter: any) { useEffect(() => { const window_resize = debounce(() => { diff --git a/packages/app-desktop/gui/ResourceScreen.tsx b/packages/app-desktop/gui/ResourceScreen.tsx index 2a2056519..803600896 100644 --- a/packages/app-desktop/gui/ResourceScreen.tsx +++ b/packages/app-desktop/gui/ResourceScreen.tsx @@ -36,8 +36,11 @@ interface State { interface ResourceTable { resources: InnerResource[]; sorting: ActiveSorting; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onResourceClick: (resource: InnerResource)=> any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onResourceDelete: (resource: InnerResource)=> any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onToggleSorting: (order: SortingOrder)=> any; themeId: number; style: Style; @@ -212,6 +215,7 @@ class ResourceScreenComponent extends React.Component { const style = this.props.style; const theme = themeStyle(this.props.themeId); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const rootStyle: any = { ...style, overflowY: 'scroll', @@ -261,6 +265,7 @@ class ResourceScreenComponent extends React.Component { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const mapStateToProps = (state: any) => ({ themeId: state.settings.theme, }); diff --git a/packages/app-desktop/gui/Root.tsx b/packages/app-desktop/gui/Root.tsx index ed3d7d110..8ca26d208 100644 --- a/packages/app-desktop/gui/Root.tsx +++ b/packages/app-desktop/gui/Root.tsx @@ -58,28 +58,33 @@ interface RegisteredDialogProps { } interface RegisteredDialog { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied render: (props: RegisteredDialogProps, customProps: any)=> any; } const registeredDialogs: Record = { syncWizard: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied render: (props: RegisteredDialogProps, customProps: any) => { return ; }, }, masterPassword: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied render: (props: RegisteredDialogProps, customProps: any) => { return ; }, }, editFolder: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied render: (props: RegisteredDialogProps, customProps: any) => { return ; }, }, pdfViewer: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied render: (props: RegisteredDialogProps, customProps: any) => { return ; }, @@ -90,14 +95,9 @@ const GlobalStyle = createGlobalStyle` * { box-sizing: border-box; } - - /* - div, span, a { - font-family: ${(props: any) => props.theme.fontFamily}; - } - */ `; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let wcsTimeoutId_: any = null; async function initialize() { @@ -128,6 +128,7 @@ async function initialize() { }); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied class RootComponent extends React.Component { public async componentDidMount() { if (this.props.appState === 'starting') { @@ -200,6 +201,7 @@ class RootComponent extends React.Component { if (!props.dialogs.length) return null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any[] = []; for (const dialog of props.dialogs) { const md = registeredDialogs[dialog.name]; diff --git a/packages/app-desktop/gui/SearchBar/SearchBar.tsx b/packages/app-desktop/gui/SearchBar/SearchBar.tsx index 5cb8b06b1..a3b9bc016 100644 --- a/packages/app-desktop/gui/SearchBar/SearchBar.tsx +++ b/packages/app-desktop/gui/SearchBar/SearchBar.tsx @@ -20,6 +20,7 @@ export const Root = styled.div` `; interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied inputRef?: any; notesParentType: string; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied @@ -87,6 +88,7 @@ function SearchBar(props: Props) { // eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied }, [props.selectedNoteId]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function onChange(event: any) { if (event.value.length === 0) { // Revert to previous state if query string becomes empty @@ -116,8 +118,10 @@ function SearchBar(props: Props) { }, 300); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onKeyDown = useCallback((event: any) => { if (event.key === 'Escape') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (document.activeElement) blur('SearchBar::onKeyDown', document.activeElement as any); void onExitSearch(); } diff --git a/packages/app-desktop/gui/ShareFolderDialog/ShareFolderDialog.tsx b/packages/app-desktop/gui/ShareFolderDialog/ShareFolderDialog.tsx index d47bff6cd..555de9076 100644 --- a/packages/app-desktop/gui/ShareFolderDialog/ShareFolderDialog.tsx +++ b/packages/app-desktop/gui/ShareFolderDialog/ShareFolderDialog.tsx @@ -47,6 +47,7 @@ const StyledAddRecipient = styled.div` margin-bottom: 1em; `; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const StyledRecipient = styled(StyledMessage)` display: flex; flex-direction: row; @@ -68,8 +69,11 @@ const StyledRecipients = styled.div` margin-bottom: 10px; `; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied; +type StyleProps = any; + const StyledRecipientList = styled.div` - border: 1px solid ${(props: any) => props.theme.dividerColor}; + border: 1px solid ${(props: StyleProps) => props.theme.dividerColor}; border-radius: 3px; height: 300px; overflow-x: hidden; @@ -81,6 +85,7 @@ const StyledError = styled(StyledMessage)` margin-bottom: 1em; `; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const StyledShareState = styled(StyledMessage)` word-break: break-all; margin-bottom: 1em; @@ -187,12 +192,14 @@ function ShareFolderDialog(props: Props) { let errorSet = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const handleError = (error: any) => { if (!errorSet) setLatestError(error); errorSet = true; logger.error(error); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const defer = (error: any) => { if (error) handleError(error); setShareState(ShareState.Idle); @@ -229,6 +236,7 @@ function ShareFolderDialog(props: Props) { } }, [recipientPermissions, props.folderId, recipientEmail]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function recipientEmail_change(event: any) { setRecipientEmail(event.target.value); } diff --git a/packages/app-desktop/gui/ShareNoteDialog.tsx b/packages/app-desktop/gui/ShareNoteDialog.tsx index c7753fa15..36a029c03 100644 --- a/packages/app-desktop/gui/ShareNoteDialog.tsx +++ b/packages/app-desktop/gui/ShareNoteDialog.tsx @@ -28,6 +28,7 @@ interface Props { } function styles_(props: Props) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return buildStyle('ShareNoteDialog', props.themeId, (theme: any) => { return { root: { @@ -153,6 +154,7 @@ export function ShareNoteDialog(props: Props) { } }, [recursiveShare, notes]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const unshareNoteButton_click = async (event: any) => { await ShareService.instance().unshareNote(event.noteId); await ShareService.instance().refreshShares(); @@ -170,6 +172,7 @@ export function ShareNoteDialog(props: Props) { ); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const renderNoteList = (notes: any) => { const noteComps = []; for (const note of notes) { diff --git a/packages/app-desktop/gui/Sidebar/Sidebar.tsx b/packages/app-desktop/gui/Sidebar/Sidebar.tsx index 228d10a21..b05be2d65 100644 --- a/packages/app-desktop/gui/Sidebar/Sidebar.tsx +++ b/packages/app-desktop/gui/Sidebar/Sidebar.tsx @@ -50,8 +50,11 @@ interface Props { selectedFolderId: string; selectedTagId: string; selectedSmartFilterId: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied decryptionWorker: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied resourceFetcher: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied syncReport: any; tags: TagEntity[]; syncStarted: boolean; @@ -64,13 +67,16 @@ const commands = [ require('./commands/focusElementSideBar'), ]; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function ExpandIcon(props: any) { const theme = themeStyle(props.themeId); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const style: any = { width: 16, maxWidth: 16, opacity: 0.5, fontSize: Math.round(theme.toolbarIconSize * 0.8), display: 'flex', justifyContent: 'center' }; if (!props.isVisible) style.visibility = 'hidden'; return ; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function ExpandLink(props: any) { return props.hasChildren ? ( @@ -95,6 +101,7 @@ const renderFolderIcon = (folderIcon: FolderIcon) => { return
; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function FolderItem(props: any) { const { hasChildren, showFolderIcon, isExpanded, parentId, depth, selected, folderId, folderTitle, folderIcon, anchorRef, noteCount, onFolderDragStart_, onFolderDragOver_, onFolderDrop_, itemContextMenu, folderItem_click, onFolderToggleClick_, shareId } = props; @@ -141,12 +148,15 @@ const menuUtils = new MenuUtils(CommandService.instance()); const SidebarComponent = (props: Props) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const folderItemsOrder_ = useRef(); folderItemsOrder_.current = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const tagItemsOrder_ = useRef(); tagItemsOrder_.current = []; const rootRef = useRef(null); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const anchorItemRefs = useRef>({}); // This whole component is a bit of a mess and rather than passing @@ -205,6 +215,7 @@ const SidebarComponent = (props: Props) => { getFirstAnchorItemRef, ]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onFolderDragStart_ = useCallback((event: any) => { const folderId = event.currentTarget.getAttribute('data-folder-id'); if (!folderId) return; @@ -214,11 +225,13 @@ const SidebarComponent = (props: Props) => { event.dataTransfer.setData('text/x-jop-folder-ids', JSON.stringify([folderId])); }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onFolderDragOver_ = useCallback((event: any) => { if (event.dataTransfer.types.indexOf('text/x-jop-note-ids') >= 0) event.preventDefault(); if (event.dataTransfer.types.indexOf('text/x-jop-folder-ids') >= 0) event.preventDefault(); }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onFolderDrop_ = useCallback(async (event: any) => { const folderId = event.currentTarget.getAttribute('data-folder-id'); const dt = event.dataTransfer; @@ -245,6 +258,7 @@ const SidebarComponent = (props: Props) => { } }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onTagDrop_ = useCallback(async (event: any) => { const tagId = event.currentTarget.getAttribute('data-tag-id'); const dt = event.dataTransfer; @@ -260,6 +274,7 @@ const SidebarComponent = (props: Props) => { } }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onFolderToggleClick_ = useCallback((event: any) => { const folderId = event.currentTarget.getAttribute('data-folder-id'); @@ -279,6 +294,7 @@ const SidebarComponent = (props: Props) => { menu.popup({ window: bridge().window() }); }, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemContextMenu = useCallback(async (event: any) => { const itemId = event.currentTarget.getAttribute('data-id'); if (itemId === Folder.conflictFolderId()) return; @@ -457,6 +473,7 @@ const SidebarComponent = (props: Props) => { }); }, [props.dispatch]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const tagItem_click = useCallback((tag: any) => { props.dispatch({ type: 'TAG_SELECT', @@ -488,7 +505,9 @@ const SidebarComponent = (props: Props) => { return count ? {count} : null; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const renderExpandIcon = (theme: any, isExpanded: boolean, isVisible: boolean) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const style: any = { width: 16, maxWidth: 16, opacity: 0.5, fontSize: Math.round(theme.toolbarIconSize * 0.8), display: 'flex', justifyContent: 'center' }; if (!isVisible) style.visibility = 'hidden'; return ; @@ -530,6 +549,7 @@ const SidebarComponent = (props: Props) => { const renderFolderItem = (folder: FolderEntity, selected: boolean, hasChildren: boolean, depth: number) =>{ const anchorRef = anchorItemRef('folder', folder.id); const isExpanded = props.collapsedFolderIds.indexOf(folder.id) < 0; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let noteCount = (folder as any).note_count; // For now hide the count for folders in the trash because it doesn't work and getting it to @@ -540,6 +560,7 @@ const SidebarComponent = (props: Props) => { if (isExpanded) { for (let i = 0; i < props.folders.length; i++) { if (props.folders[i].parent_id === folder.id) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied noteCount -= (props.folders[i] as any).note_count; } } @@ -569,6 +590,7 @@ const SidebarComponent = (props: Props) => { />; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const renderTag = (tag: any, selected: boolean) => { const anchorRef = anchorItemRef('tag', tag.id); let noteCount = null; @@ -604,7 +626,7 @@ const SidebarComponent = (props: Props) => { ); }; - // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, 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; @@ -616,6 +638,7 @@ const SidebarComponent = (props: Props) => { ref={ref} {...extraProps} onContextMenu={contextMenuHandler} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onClick={(event: any) => { // if a custom click event is attached, trigger that. if (headerClick) { @@ -632,6 +655,7 @@ const SidebarComponent = (props: Props) => { ); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onKeyDown = useCallback((event: any) => { const keyCode = event.keyCode; const selectedItem = getSelectedItem(); diff --git a/packages/app-desktop/gui/Sidebar/commands/focusElementSideBar.ts b/packages/app-desktop/gui/Sidebar/commands/focusElementSideBar.ts index 7c0913327..4f880bc32 100644 --- a/packages/app-desktop/gui/Sidebar/commands/focusElementSideBar.ts +++ b/packages/app-desktop/gui/Sidebar/commands/focusElementSideBar.ts @@ -11,8 +11,11 @@ export const declaration: CommandDeclaration = { }; export interface RuntimeProps { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied getSelectedItem(): any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied getFirstAnchorItemRef(type: string): any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied anchorItemRefs: any; } diff --git a/packages/app-desktop/gui/Sidebar/styles/index.ts b/packages/app-desktop/gui/Sidebar/styles/index.ts index 1b1a1cbca..b8ce242d0 100644 --- a/packages/app-desktop/gui/Sidebar/styles/index.ts +++ b/packages/app-desktop/gui/Sidebar/styles/index.ts @@ -3,8 +3,11 @@ import Button from '../../Button/Button'; import { css } from 'styled-components'; const styled = require('styled-components').default; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied +type StyleProps = any; + export const StyledRoot = styled.div` - background-color: ${(props: any) => props.theme.backgroundColor2}; + background-color: ${(props: StyleProps) => props.theme.backgroundColor2}; width: 100%; height: 100%; overflow-x: hidden; @@ -14,12 +17,12 @@ export const StyledRoot = styled.div` `; export const StyledHeader = styled.div` - //height: ${(props: any) => props.theme.topRowHeight}px; + //height: ${(props: StyleProps) => props.theme.topRowHeight}px; //text-decoration: none; flex: 1; box-sizing: border-box; - padding: ${(props: any) => props.theme.mainPadding}px; - padding-bottom: ${(props: any) => props.theme.mainPadding / 2}px; + padding: ${(props: StyleProps) => props.theme.mainPadding}px; + padding-bottom: ${(props: StyleProps) => props.theme.mainPadding / 2}px; display: flex; align-items: center; user-select: none; @@ -28,21 +31,21 @@ export const StyledHeader = styled.div` `; export const StyledHeaderIcon = styled.i` - font-size: ${(props: any) => props.theme.toolbarIconSize}px; - color: ${(props: any) => props.theme.color2}; + font-size: ${(props: StyleProps) => props.theme.toolbarIconSize}px; + color: ${(props: StyleProps) => props.theme.color2}; margin-right: 8px; `; export const StyledAllNotesIcon = styled(StyledHeaderIcon)` - font-size: ${(props: any) => props.theme.toolbarIconSize * 0.8}px; - color: ${(props: any) => props.theme.colorFaded2}; + font-size: ${(props: StyleProps) => props.theme.toolbarIconSize * 0.8}px; + color: ${(props: StyleProps) => props.theme.colorFaded2}; margin-right: 8px; `; export const StyledHeaderLabel = styled.span` flex: 1; - color: ${(props: any) => props.theme.color2}; - font-size: ${(props: any) => Math.round(props.theme.fontSize * 1.1)}px; + color: ${(props: StyleProps) => props.theme.color2}; + font-size: ${(props: StyleProps) => Math.round(props.theme.fontSize * 1.1)}px; font-weight: bold; `; @@ -52,17 +55,17 @@ export const StyledListItem = styled.div` display: flex; flex-direction: row; align-items: center; - padding-left: ${(props: any) => props.theme.mainPadding + ('depth' in props ? props.depth : 0) * 16}px; - background: ${(props: any) => props.selected ? props.theme.selectedColor2 : 'none'}; - /*text-transform: ${(props: any) => props.isSpecialItem ? 'uppercase' : 'none'};*/ + padding-left: ${(props: StyleProps) => props.theme.mainPadding + ('depth' in props ? props.depth : 0) * 16}px; + background: ${(props: StyleProps) => props.selected ? props.theme.selectedColor2 : 'none'}; + /*text-transform: ${(props: StyleProps) => props.isSpecialItem ? 'uppercase' : 'none'};*/ transition: 0.1s; &:hover { - background-color: ${(props: any) => props.theme.backgroundColorHover2}; + background-color: ${(props: StyleProps) => props.theme.backgroundColorHover2}; } `; -function listItemTextColor(props: any) { +function listItemTextColor(props: StyleProps) { if (props.isConflictFolder) return props.theme.colorError2; if (props.isSpecialItem) return props.theme.colorFaded2; if (props.shareId) return props.theme.colorWarn2; @@ -70,11 +73,11 @@ function listItemTextColor(props: any) { } export const StyledListItemAnchor = styled.a` - font-size: ${(props: any) => Math.round(props.theme.fontSize * 1.0833333)}px; + font-size: ${(props: StyleProps) => Math.round(props.theme.fontSize * 1.0833333)}px; text-decoration: none; - color: ${(props: any) => listItemTextColor(props)}; + color: ${(props: StyleProps) => listItemTextColor(props)}; cursor: default; - opacity: ${(props: any) => props.selected || props.shareId ? 1 : 0.8}; + opacity: ${(props: StyleProps) => props.selected || props.shareId ? 1 : 0.8}; white-space: nowrap; display: flex; flex: 1; @@ -88,7 +91,7 @@ export const StyledShareIcon = styled.i` `; export const StyledExpandLink = styled.a` - color: ${(props: any) => props.theme.color2}; + color: ${(props: StyleProps) => props.theme.color2}; cursor: default; opacity: 0.8; text-decoration: none; @@ -102,7 +105,7 @@ export const StyledExpandLink = styled.a` `; export const StyledNoteCount = styled.div` - color: ${(props: any) => props.theme.colorFaded2}; + color: ${(props: StyleProps) => props.theme.colorFaded2}; padding-left: 8px; user-select: none; `; @@ -118,8 +121,8 @@ export const StyledAddButton = styled(Button)` `; export const StyledSyncReport = styled.div` - font-size: ${(props: any) => Math.round(props.theme.fontSize * 0.9)}px; - color: ${(props: any) => props.theme.color2}; + font-size: ${(props: StyleProps) => Math.round(props.theme.fontSize * 0.9)}px; + color: ${(props: StyleProps) => props.theme.color2}; opacity: 0.5; display: flex; flex-direction: column; @@ -130,7 +133,7 @@ export const StyledSyncReport = styled.div` `; export const StyledSyncReportText = styled.div` - color: ${(props: any) => props.theme.color2}; + color: ${(props: StyleProps) => props.theme.color2}; word-wrap: break-word; width: 100%; `; diff --git a/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx b/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx index 4f95f3a14..afe789e40 100644 --- a/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx +++ b/packages/app-desktop/gui/StatusScreen/StatusScreen.tsx @@ -14,6 +14,7 @@ import { writeFileSync } from 'fs'; interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied 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/StyleSheets/StyleSheetContainer.tsx b/packages/app-desktop/gui/StyleSheets/StyleSheetContainer.tsx index 462dc3145..d4d941ac0 100644 --- a/packages/app-desktop/gui/StyleSheets/StyleSheetContainer.tsx +++ b/packages/app-desktop/gui/StyleSheets/StyleSheetContainer.tsx @@ -14,9 +14,11 @@ import themeToCss from '@joplin/lib/services/style/themeToCss'; import { themeStyle } from '@joplin/lib/theme'; interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied themeId: any; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function(props: Props): any { const [styleSheetContent, setStyleSheetContent] = useState(''); diff --git a/packages/app-desktop/gui/SyncWizard/Dialog.tsx b/packages/app-desktop/gui/SyncWizard/Dialog.tsx index f1e0530c6..8096142ca 100644 --- a/packages/app-desktop/gui/SyncWizard/Dialog.tsx +++ b/packages/app-desktop/gui/SyncWizard/Dialog.tsx @@ -241,6 +241,7 @@ export default function(props: Props) { }, [props.dispatch]); function renderContent() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const boxes: any[] = []; for (const name of syncTargetNames) { diff --git a/packages/app-desktop/gui/TagList.tsx b/packages/app-desktop/gui/TagList.tsx index 5cfa9db6f..a1226c3fe 100644 --- a/packages/app-desktop/gui/TagList.tsx +++ b/packages/app-desktop/gui/TagList.tsx @@ -9,7 +9,9 @@ const { themeStyle } = require('@joplin/lib/theme'); interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied items: any[]; } @@ -32,6 +34,7 @@ function TagList(props: Props) { const tags = useMemo(() => { const output = props.items.slice(); const collator = getCollator(collatorLocale); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied output.sort((a: any, b: any) => { return collator.compare(a.title, b.title); }); diff --git a/packages/app-desktop/gui/ToggleEditorsButton/styles/index.ts b/packages/app-desktop/gui/ToggleEditorsButton/styles/index.ts index 761392596..a9aa8e981 100644 --- a/packages/app-desktop/gui/ToggleEditorsButton/styles/index.ts +++ b/packages/app-desktop/gui/ToggleEditorsButton/styles/index.ts @@ -2,12 +2,14 @@ import { Props, Value } from '../ToggleEditorsButton'; const { buildStyle } = require('@joplin/lib/theme'); export default function styles(props: Props) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return buildStyle(['ToggleEditorsButton', props.value], props.themeId, (theme: any) => { const iconSize = 15; const mdIconWidth = iconSize * 1.25; const buttonHeight = theme.toolbarHeight - 7; const mdIconPadding = Math.round((buttonHeight - iconSize) / 2) + 3; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const innerButton: any = { borderStyle: 'solid', borderColor: theme.color3, @@ -19,6 +21,7 @@ export default function styles(props: Props) { justifyContent: 'center', }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { button: { border: 'none', diff --git a/packages/app-desktop/gui/ToolbarBase.tsx b/packages/app-desktop/gui/ToolbarBase.tsx index 1c5d2b3bf..8500539e1 100644 --- a/packages/app-desktop/gui/ToolbarBase.tsx +++ b/packages/app-desktop/gui/ToolbarBase.tsx @@ -7,16 +7,20 @@ const { themeStyle } = require('@joplin/lib/theme'); interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied items: any[]; disabled: boolean; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied class ToolbarBaseComponent extends React.Component { public render() { const theme = themeStyle(this.props.themeId); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const style: any = { display: 'flex', flexDirection: 'row', boxSizing: 'border-box', @@ -24,6 +28,7 @@ class ToolbarBaseComponent extends React.Component { padding: theme.toolbarPadding, paddingRight: theme.mainPadding, ...this.props.style }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const groupStyle: any = { display: 'flex', flexDirection: 'row', @@ -31,8 +36,11 @@ class ToolbarBaseComponent extends React.Component { minWidth: 0, }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const leftItemComps: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const centerItemComps: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const rightItemComps: any[] = []; if (this.props.items) { @@ -84,6 +92,7 @@ class ToolbarBaseComponent extends React.Component { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const mapStateToProps = (state: any) => { return { themeId: state.settings.theme }; }; diff --git a/packages/app-desktop/gui/ToolbarButton/ToolbarButton.tsx b/packages/app-desktop/gui/ToolbarButton/ToolbarButton.tsx index 59aeee1cd..f12f5663b 100644 --- a/packages/app-desktop/gui/ToolbarButton/ToolbarButton.tsx +++ b/packages/app-desktop/gui/ToolbarButton/ToolbarButton.tsx @@ -17,9 +17,12 @@ function isFontAwesomeIcon(iconName: string) { return s.length === 2 && ['fa', 'fas'].includes(s[0]); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function getProp(props: Props, name: string, defaultValue: any = null) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (props.toolbarButtonInfo && (name in props.toolbarButtonInfo)) return (props.toolbarButtonInfo as any)[name]; if (!(name in props)) return defaultValue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (props as any)[name]; } diff --git a/packages/app-desktop/gui/ToolbarButton/styles/index.ts b/packages/app-desktop/gui/ToolbarButton/styles/index.ts index 69cc4ec52..00130e872 100644 --- a/packages/app-desktop/gui/ToolbarButton/styles/index.ts +++ b/packages/app-desktop/gui/ToolbarButton/styles/index.ts @@ -2,6 +2,7 @@ const styled = require('styled-components').default; const { css } = require('styled-components'); interface RootProps { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied readonly theme: any; readonly disabled: boolean; readonly hasTitle: boolean; @@ -33,6 +34,7 @@ export const StyledRoot = styled.a` `; interface IconProps { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied readonly theme: any; readonly title: string; } diff --git a/packages/app-desktop/gui/TrashNotification/TrashNotification.tsx b/packages/app-desktop/gui/TrashNotification/TrashNotification.tsx index 9526af691..d3d7338fe 100644 --- a/packages/app-desktop/gui/TrashNotification/TrashNotification.tsx +++ b/packages/app-desktop/gui/TrashNotification/TrashNotification.tsx @@ -29,6 +29,7 @@ export default (props: Props) => { output.options.types = notyfContext.options.types.map(type => { if (type.type === 'success') { type.background = theme.backgroundColor5; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (type.icon as any).color = theme.backgroundColor5; } return type; @@ -36,6 +37,7 @@ export default (props: Props) => { return output; }, [notyfContext, theme]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onCancelClick = useCallback(async (event: any) => { notyf.dismissAll(); diff --git a/packages/app-desktop/gui/dialogs.ts b/packages/app-desktop/gui/dialogs.ts index ad06172e7..5ff272a40 100644 --- a/packages/app-desktop/gui/dialogs.ts +++ b/packages/app-desktop/gui/dialogs.ts @@ -11,6 +11,7 @@ class Dialogs { await smalltalk.alert(title, message); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async confirm(message: string, title = '', options: any = {}) { try { await smalltalk.confirm(title, message, options); @@ -21,6 +22,7 @@ class Dialogs { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async prompt(message: string, title = '', defaultValue = '', options: any = null) { if (options === null) options = {}; diff --git a/packages/app-desktop/gui/hooks/useEffectDebugger.ts b/packages/app-desktop/gui/hooks/useEffectDebugger.ts index 6e3a16b5c..1e1e65698 100644 --- a/packages/app-desktop/gui/hooks/useEffectDebugger.ts +++ b/packages/app-desktop/gui/hooks/useEffectDebugger.ts @@ -1,9 +1,11 @@ import usePrevious from './usePrevious'; import { useEffect } from 'react'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useEffectDebugger(effectHook: any, dependencies: any, dependencyNames: any[] = []) { const previousDeps = usePrevious(dependencies, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const changedDeps = dependencies.reduce((accum: any, dependency: any, index: any) => { if (dependency !== previousDeps[index]) { const keyName = dependencyNames[index] || index; diff --git a/packages/app-desktop/gui/hooks/useImperativeHandlerDebugger.ts b/packages/app-desktop/gui/hooks/useImperativeHandlerDebugger.ts index 92f9b6df8..85f48be2e 100644 --- a/packages/app-desktop/gui/hooks/useImperativeHandlerDebugger.ts +++ b/packages/app-desktop/gui/hooks/useImperativeHandlerDebugger.ts @@ -1,9 +1,11 @@ import usePrevious from './usePrevious'; import { useImperativeHandle } from 'react'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useImperativeHandleDebugger(ref: any, effectHook: any, dependencies: any, dependencyNames: any[] = []) { const previousDeps = usePrevious(dependencies, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const changedDeps = dependencies.reduce((accum: any, dependency: any, index: any) => { if (dependency !== previousDeps[index]) { const keyName = dependencyNames[index] || index; diff --git a/packages/app-desktop/gui/hooks/usePrevious.ts b/packages/app-desktop/gui/hooks/usePrevious.ts index b3a8bb1ee..1b4828bb2 100644 --- a/packages/app-desktop/gui/hooks/usePrevious.ts +++ b/packages/app-desktop/gui/hooks/usePrevious.ts @@ -1,5 +1,6 @@ import { useEffect, useRef } from 'react'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function usePrevious(value: any, initialValue: any = null): any { const ref = useRef(initialValue); useEffect(() => { diff --git a/packages/app-desktop/gui/hooks/usePropsDebugger.ts b/packages/app-desktop/gui/hooks/usePropsDebugger.ts index 7bb66a61a..4d4da6d83 100644 --- a/packages/app-desktop/gui/hooks/usePropsDebugger.ts +++ b/packages/app-desktop/gui/hooks/usePropsDebugger.ts @@ -4,7 +4,9 @@ import useEffectDebugger from './useEffectDebugger'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function usePropsDebugger(props: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const dependencies: any[] = []; const dependencyNames: string[] = []; diff --git a/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx b/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx index 88a54852e..e8a56647b 100644 --- a/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx +++ b/packages/app-desktop/gui/lib/SearchInput/SearchInput.tsx @@ -6,6 +6,9 @@ import { _ } from '@joplin/lib/locale'; import StyledInput from '../../style/StyledInput'; const styled = require('styled-components').default; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied +type StyleProps = any; + export const Root = styled.div` position: relative; display: flex; @@ -18,12 +21,12 @@ export const SearchButton = styled.button` background: none; border: none; height: 100%; - opacity: ${(props: any) => props.disabled ? 0.5 : 1}; + opacity: ${(props: StyleProps) => props.disabled ? 0.5 : 1}; `; export const SearchButtonIcon = styled.span` - font-size: ${(props: any) => props.theme.toolbarIconSize}px; - color: ${(props: any) => props.theme.color4}; + font-size: ${(props: StyleProps) => props.theme.toolbarIconSize}px; + color: ${(props: StyleProps) => props.theme.color4}; `; export const SearchInput = styled(StyledInput)` @@ -33,6 +36,7 @@ export const SearchInput = styled(StyledInput)` `; interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied inputRef?: any; value: string; onChange(event: OnChangeEvent): void; @@ -56,6 +60,7 @@ export interface OnChangeEvent { export default function(props: Props) { const iconName = !props.searchStarted ? CommandService.instance().iconName('search') : 'fa fa-times'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onChange = useCallback((event: any) => { props.onChange({ value: event.currentTarget.value }); }, [props.onChange]); diff --git a/packages/app-desktop/gui/style/StyledInput.tsx b/packages/app-desktop/gui/style/StyledInput.tsx index a50db6e4d..5e6412849 100644 --- a/packages/app-desktop/gui/style/StyledInput.tsx +++ b/packages/app-desktop/gui/style/StyledInput.tsx @@ -1,24 +1,27 @@ const styled = require('styled-components').default; const Color = require('color'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied +type StyleProps = any; + const StyledInput = styled.input` - border: 1px solid ${(props: any) => Color(props.theme.color3).alpha(0.6)}; + border: 1px solid ${(props: StyleProps) => Color(props.theme.color3).alpha(0.6)}; border-radius: 3px; - font-size: ${(props: any) => props.theme.fontSize}px; - color: ${(props: any) => props.theme.color}; + font-size: ${(props: StyleProps) => props.theme.fontSize}px; + color: ${(props: StyleProps) => props.theme.color}; padding: 0 8px; - height: ${(props: any) => `${props.theme.toolbarHeight}px`}; - max-height: ${(props: any) => `${props.theme.toolbarHeight}px`}; + height: ${(props: StyleProps) => `${props.theme.toolbarHeight}px`}; + max-height: ${(props: StyleProps) => `${props.theme.toolbarHeight}px`}; box-sizing: border-box; - background-color: ${(props: any) => Color(props.theme.backgroundColor4).alpha(0.5)}; + background-color: ${(props: StyleProps) => Color(props.theme.backgroundColor4).alpha(0.5)}; &::placeholder { - color: ${(props: any) => props.theme.colorFaded}; + color: ${(props: StyleProps) => props.theme.colorFaded}; } &:focus { - background-color: ${(props: any) => props.theme.backgroundColor4}; - border: 1px solid ${(props: any) => props.theme.color3}; + background-color: ${(props: StyleProps) => props.theme.backgroundColor4}; + border: 1px solid ${(props: StyleProps) => props.theme.color3}; } `; diff --git a/packages/app-desktop/gui/utils/NoteListUtils.ts b/packages/app-desktop/gui/utils/NoteListUtils.ts index 5d022c20d..332d92431 100644 --- a/packages/app-desktop/gui/utils/NoteListUtils.ts +++ b/packages/app-desktop/gui/utils/NoteListUtils.ts @@ -44,25 +44,30 @@ export default class NoteListUtils { if (!includeEncryptedNotes && !includeDeletedNotes) { menu.append( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied new MenuItem(menuUtils.commandToStatefulMenuItem('setTags', noteIds) as any), ); menu.append( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied new MenuItem(menuUtils.commandToStatefulMenuItem('moveToFolder', noteIds) as any), ); menu.append( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied new MenuItem(menuUtils.commandToStatefulMenuItem('duplicateNote', noteIds) as any), ); if (singleNoteId) { const cmd = props.watchedNoteFiles.includes(singleNoteId) ? 'stopExternalEditing' : 'startExternalEditing'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menu.append(new MenuItem(menuUtils.commandToStatefulMenuItem(cmd, singleNoteId) as any)); } if (noteIds.length <= 1) { menu.append( new MenuItem( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menuUtils.commandToStatefulMenuItem('toggleNoteType', noteIds) as any, ), ); @@ -124,6 +129,7 @@ export default class NoteListUtils { if ([9, 10].includes(Setting.value('sync.target'))) { menu.append( new MenuItem( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menuUtils.commandToStatefulMenuItem('showShareNoteDialog', noteIds.slice()) as any, ), ); @@ -155,6 +161,7 @@ export default class NoteListUtils { exportMenu.append( new MenuItem( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menuUtils.commandToStatefulMenuItem('exportPdf', noteIds) as any, ), ); @@ -167,18 +174,21 @@ export default class NoteListUtils { if (includeDeletedNotes) { menu.append( new MenuItem( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menuUtils.commandToStatefulMenuItem('restoreNote', noteIds) as any, ), ); menu.append( new MenuItem( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menuUtils.commandToStatefulMenuItem('permanentlyDeleteNote', noteIds) as any, ), ); } else { menu.append( new MenuItem( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menuUtils.commandToStatefulMenuItem('deleteNote', noteIds) as any, ), ); @@ -192,6 +202,7 @@ export default class NoteListUtils { if (cmdService.isEnabled(info.view.commandName)) { menu.append( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied new MenuItem(menuUtils.commandToStatefulMenuItem(info.view.commandName, noteIds) as any), ); } diff --git a/packages/app-desktop/gui/utils/convertToScreenCoordinates.ts b/packages/app-desktop/gui/utils/convertToScreenCoordinates.ts index 5902cf451..7ab81c075 100644 --- a/packages/app-desktop/gui/utils/convertToScreenCoordinates.ts +++ b/packages/app-desktop/gui/utils/convertToScreenCoordinates.ts @@ -1,5 +1,6 @@ // Converts world coordinate to screen coordinates by applying the current // zoom. `windowContentZoomFactor` is the setting value. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function convertToScreenCoordinates(windowContentZoomFactor: number, o: any): any { const percent = windowContentZoomFactor / 100; diff --git a/packages/app-desktop/gui/utils/loadScript.ts b/packages/app-desktop/gui/utils/loadScript.ts index 986068ac2..6527c653b 100644 --- a/packages/app-desktop/gui/utils/loadScript.ts +++ b/packages/app-desktop/gui/utils/loadScript.ts @@ -5,6 +5,7 @@ const logger = Logger.create('loadScript'); export interface Script { id: string; src: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied attrs?: Record; } @@ -13,6 +14,7 @@ export const loadScript = async (script: Script) => { // eslint-disable-next-line no-console console.info('Loading script:', script); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let element: any = document.getElementById(script.id); if (element) { diff --git a/packages/app-desktop/integration-tests/util/setMessageBoxResponse.ts b/packages/app-desktop/integration-tests/util/setMessageBoxResponse.ts index a2a405782..9b29af963 100644 --- a/packages/app-desktop/integration-tests/util/setMessageBoxResponse.ts +++ b/packages/app-desktop/integration-tests/util/setMessageBoxResponse.ts @@ -30,6 +30,7 @@ const setMessageBoxResponse = (electronApp: ElectronApplication, responseMatch: checkboxChecked: false, // We're mocking, so include "as any" to prevent this from breaking when we upgrade // Electron. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied } as any); }, responseMatch); }; diff --git a/packages/app-desktop/plugins/GotoAnything.tsx b/packages/app-desktop/plugins/GotoAnything.tsx index e828d0059..5424a1b88 100644 --- a/packages/app-desktop/plugins/GotoAnything.tsx +++ b/packages/app-desktop/plugins/GotoAnything.tsx @@ -43,8 +43,10 @@ interface Props { themeId: number; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied folders: any[]; showCompletedTodos: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied userData: any; } @@ -97,9 +99,12 @@ class GotoAnything { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public dispatch: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static Dialog: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static manifest: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public onTrigger(event: any) { this.dispatch({ type: 'PLUGINLEGACY_DIALOG_SET', @@ -113,11 +118,16 @@ class GotoAnything { class Dialog extends React.PureComponent { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private styles_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private inputRef: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private itemListRef: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private listUpdateIID_: any; private markupToHtml_: MarkupToHtml; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private userCallback_: any = null; public constructor(props: Props) { @@ -234,6 +244,7 @@ class Dialog extends React.PureComponent { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public onKeyDown(event: any) { if (event.keyCode === 27) { // ESCAPE this.props.dispatch({ @@ -244,6 +255,7 @@ class Dialog extends React.PureComponent { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private modalLayer_onClick(event: any) { if (event.currentTarget === event.target) { this.props.dispatch({ @@ -258,6 +270,7 @@ class Dialog extends React.PureComponent { this.setState({ showHelp: !this.state.showHelp }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private input_onChange(event: any) { this.setState({ query: event.target.value }); @@ -342,14 +355,17 @@ class Dialog extends React.PureComponent { searchQuery = gotoAnythingStyleQuery(this.state.query); // SearchEngine returns the title normalized, that is why we need to // override this field below with the original title + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied results = (await SearchEngine.instance().search(searchQuery)) as any[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied resultsInBody = !!results.find((row: any) => row.fields.includes('body')); const resourceIds = results.filter(r => r.item_type === ModelType.Resource).map(r => r.item_id); const resources = await Resource.resourceOcrTextsByIds(resourceIds); if (!resultsInBody || this.state.query.length <= 1) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const notes = await Note.byIds(results.map((result: any) => result.id), { fields: ['id', 'title'] }); for (let i = 0; i < results.length; i++) { const row = results[i]; @@ -365,11 +381,14 @@ class Dialog extends React.PureComponent { // going to apply a limit to the number of fetched notes. // https://github.com/laurent22/joplin/issues/9944 if (!this.props.showCompletedTodos) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied results = results.filter((row: any) => !row.is_todo || !row.todo_completed); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const notes = await Note.byIds(results.map((result: any) => result.id).slice(0, limit), { fields: ['id', 'body', 'markup_language', 'is_todo', 'todo_completed', 'title'] }); // Can't make any sense of this code so... + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const notesById = notes.reduce((obj, { id, body, markup_language, title }) => ((obj[[id] as any] = { id, body, markup_language, title }), obj), {}); // Filter out search results that are associated with non-existing notes. @@ -410,6 +429,7 @@ class Dialog extends React.PureComponent { // e.g. 'Joplin is a free, open source' and 'open source note taking application' // will result in 'Joplin is a free, open source note taking application' const mergedIndices = mergeOverlappingIntervals(indices, 3); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied fragments = mergedIndices.map((f: any) => body.slice(f[0], f[1])).join(' ... '); // Add trailing ellipsis if the final fragment doesn't end where the note is ending if (mergedIndices.length && mergedIndices[mergedIndices.length - 1][1] !== body.length) fragments += ' ...'; @@ -450,6 +470,7 @@ class Dialog extends React.PureComponent { this.itemListRef.current.makeItemIndexVisible(index); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async gotoItem(item: any) { this.props.dispatch({ pluginName: PLUGIN_NAME, @@ -513,6 +534,7 @@ class Dialog extends React.PureComponent { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private listItem_onClick(event: any) { const itemId = event.currentTarget.getAttribute('data-id'); const parentId = event.currentTarget.getAttribute('data-parent-id'); @@ -550,6 +572,7 @@ class Dialog extends React.PureComponent { ); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public selectedItemIndex(results: any[] = undefined, itemId: string = undefined) { if (typeof results === 'undefined') results = this.state.results; if (typeof itemId === 'undefined') itemId = this.state.selectedItemId; @@ -566,6 +589,7 @@ class Dialog extends React.PureComponent { return { ...this.state.results[index], commandArgs: this.state.commandArgs }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private input_onKeyDown(event: any) { const keyCode = event.keyCode; diff --git a/packages/app-desktop/services/plugins/BackOffHandler.ts b/packages/app-desktop/services/plugins/BackOffHandler.ts index 8e9d5d8cc..019dc85bf 100644 --- a/packages/app-desktop/services/plugins/BackOffHandler.ts +++ b/packages/app-desktop/services/plugins/BackOffHandler.ts @@ -62,6 +62,7 @@ export default class BackOffHandler { return this.backOffIntervals_[effectiveIndex]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async wait(path: string, args: any) { const interval = this.backOffInterval(); if (!interval) return; diff --git a/packages/app-desktop/services/plugins/PlatformImplementation.ts b/packages/app-desktop/services/plugins/PlatformImplementation.ts index 97f681073..faa13a81e 100644 --- a/packages/app-desktop/services/plugins/PlatformImplementation.ts +++ b/packages/app-desktop/services/plugins/PlatformImplementation.ts @@ -13,6 +13,7 @@ const { clipboard, nativeImage } = require('electron'); const packageInfo = require('../../packageInfo'); interface Components { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied [key: string]: any; } @@ -72,6 +73,7 @@ export default class PlatformImplementation extends BasePlatformImplementation { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public registerComponent(name: string, component: any) { this.components_[name] = component; } diff --git a/packages/app-desktop/services/plugins/PluginRunner.ts b/packages/app-desktop/services/plugins/PluginRunner.ts index ef48c18df..2ffe3de1e 100644 --- a/packages/app-desktop/services/plugins/PluginRunner.ts +++ b/packages/app-desktop/services/plugins/PluginRunner.ts @@ -15,6 +15,7 @@ const logger = Logger.create('PluginRunner'); // Electron error messages are useless so wrap the renderer call and print // additional information when an error occurs. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function ipcRendererSend(message: string, args: any) { try { return ipcRenderer.send(message, args); @@ -34,15 +35,20 @@ export interface PluginMessage { pluginId: string; callbackId?: string; path?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied args?: any[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied result?: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied error?: any; mainWindowCallbackId?: string; } let callbackIndex = 1; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const callbackPromises: any = {}; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function mapEventIdsToHandlers(pluginId: string, arg: any) { if (Array.isArray(arg)) { for (let i = 0; i < arg.length; i++) { @@ -52,6 +58,7 @@ function mapEventIdsToHandlers(pluginId: string, arg: any) { } else if (typeof arg === 'string' && arg.indexOf('___plugin_event_') === 0) { const eventId = arg; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return async (...args: any[]) => { const callbackId = `cb_${pluginId}_${Date.now()}_${callbackIndex++}`; @@ -93,6 +100,7 @@ export default class PluginRunner extends BasePluginRunner { this.eventHandler = this.eventHandler.bind(this); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async eventHandler(eventHandlerId: string, args: any[]) { const cb = this.eventHandlers_[eventHandlerId]; return cb(...args); @@ -140,6 +148,7 @@ export default class PluginRunner extends BasePluginRunner { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ipcRenderer.on('pluginMessage', async (_event: any, message: PluginMessage) => { if (message.target !== PluginMessageTarget.MainWindow) return; if (message.pluginId !== plugin.id) return; @@ -174,7 +183,9 @@ export default class PluginRunner extends BasePluginRunner { // return; // } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let result: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let error: any = null; try { result = await executeSandboxCall(plugin.id, pluginApi, fullPath, mappedArgs, this.eventHandler); diff --git a/packages/app-desktop/services/plugins/UserWebview.tsx b/packages/app-desktop/services/plugins/UserWebview.tsx index d914d8aae..bf6e501f7 100644 --- a/packages/app-desktop/services/plugins/UserWebview.tsx +++ b/packages/app-desktop/services/plugins/UserWebview.tsx @@ -13,6 +13,9 @@ import { focus } from '@joplin/lib/utils/focusHandler'; const logger = Logger.create('UserWebview'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied +type StyleProps = any; + export interface Props { html: string; scripts: string[]; @@ -23,6 +26,7 @@ export interface Props { minHeight?: number; fitToContent?: boolean; borderBottom?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied theme?: any; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied onSubmit?: Function; @@ -35,13 +39,15 @@ export interface Props { const StyledFrame = styled.iframe<{ fitToContent: boolean; borderBottom: boolean }>` padding: 0; margin: 0; - width: ${(props: any) => props.fitToContent ? `${props.width}px` : '100%'}; - height: ${(props: any) => props.fitToContent ? `${props.height}px` : '100%'}; + width: ${(props: StyleProps) => props.fitToContent ? `${props.width}px` : '100%'}; + height: ${(props: StyleProps) => props.fitToContent ? `${props.height}px` : '100%'}; border: none; - border-bottom: ${(props: any) => props.borderBottom ? `1px solid ${props.theme.dividerColor}` : 'none'}; + border-bottom: ${(props: StyleProps) => props.borderBottom ? `1px solid ${props.theme.dividerColor}` : 'none'}; `; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function serializeForm(form: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; const formData = new FormData(form); for (const key of formData.keys()) { @@ -50,8 +56,10 @@ function serializeForm(form: any) { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function serializeForms(document: any) { const forms = document.getElementsByTagName('form'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; let untitledIndex = 0; @@ -63,6 +71,7 @@ function serializeForms(document: any) { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function UserWebview(props: Props, ref: any) { const minWidth = props.minWidth ? props.minWidth : 200; const minHeight = props.minHeight ? props.minHeight : 20; @@ -81,6 +90,7 @@ function UserWebview(props: Props, ref: any) { return viewRef.current.contentWindow; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function postMessage(name: string, args: any = null) { const win = frameWindow(); if (!win) return; diff --git a/packages/app-desktop/services/plugins/UserWebviewDialog.tsx b/packages/app-desktop/services/plugins/UserWebviewDialog.tsx index dc1c4e36f..9b3c4cb48 100644 --- a/packages/app-desktop/services/plugins/UserWebviewDialog.tsx +++ b/packages/app-desktop/services/plugins/UserWebviewDialog.tsx @@ -8,6 +8,9 @@ import UserWebviewDialogButtonBar from './UserWebviewDialogButtonBar'; import { focus } from '@joplin/lib/utils/focusHandler'; const styled = require('styled-components').default; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied +type StyleProps = any; + interface Props extends UserWebviewProps { buttons: ButtonSpec[]; fitToContent: boolean; @@ -29,12 +32,12 @@ const StyledRoot = styled.div` const Dialog = styled.div` display: flex; flex-direction: column; - background-color: ${(props: any) => props.theme.backgroundColor}; - padding: ${(props: any) => `${props.theme.mainPadding}px`}; + background-color: ${(props: StyleProps) => props.theme.backgroundColor}; + padding: ${(props: StyleProps) => `${props.theme.mainPadding}px`}; border-radius: 4px; box-shadow: 0 6px 10px #00000077; - width: ${(props: any) => props.fitToContent ? 'auto' : '90vw'}; - height: ${(props: any) => props.fitToContent ? 'auto' : '80vh'}; + width: ${(props: StyleProps) => props.fitToContent ? 'auto' : '90vw'}; + height: ${(props: StyleProps) => props.fitToContent ? 'auto' : '80vh'}; `; const UserWebViewWrapper = styled.div` diff --git a/packages/app-desktop/services/plugins/UserWebviewDialogButtonBar.tsx b/packages/app-desktop/services/plugins/UserWebviewDialogButtonBar.tsx index e3a2142e0..0dc646e1e 100644 --- a/packages/app-desktop/services/plugins/UserWebviewDialogButtonBar.tsx +++ b/packages/app-desktop/services/plugins/UserWebviewDialogButtonBar.tsx @@ -5,6 +5,9 @@ import { ButtonSpec } from '@joplin/lib/services/plugins/api/types'; const styled = require('styled-components').default; const { space } = require('styled-system'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied +type StyleProps = any; + interface Props { buttons: ButtonSpec[]; } @@ -14,7 +17,7 @@ const StyledRoot = styled.div` width: 100%; box-sizing: border-box; justify-content: flex-end; - padding-top: ${(props: any) => props.theme.mainPadding}px; + padding-top: ${(props: StyleProps) => props.theme.mainPadding}px; `; const StyledButton = styled(Button)`${space}`; @@ -22,7 +25,7 @@ const StyledButton = styled(Button)`${space}`; function buttonTitle(b: ButtonSpec) { if (b.title) return b.title; - const defaultTitles: any = { + const defaultTitles: Record = { 'ok': _('OK'), 'cancel': _('Cancel'), 'yes': _('Yes'), diff --git a/packages/app-desktop/services/plugins/hooks/useContentSize.ts b/packages/app-desktop/services/plugins/hooks/useContentSize.ts index 66442fb98..54382eb6e 100644 --- a/packages/app-desktop/services/plugins/hooks/useContentSize.ts +++ b/packages/app-desktop/services/plugins/hooks/useContentSize.ts @@ -6,6 +6,7 @@ interface Size { hash: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function(frameWindow: any, htmlHash: string, minWidth: number, minHeight: number, fitToContent: boolean, isReady: boolean) { const [contentSize, setContentSize] = useState({ width: minWidth, diff --git a/packages/app-desktop/services/plugins/hooks/useHtmlLoader.ts b/packages/app-desktop/services/plugins/hooks/useHtmlLoader.ts index 519ae0f98..8affdf09a 100644 --- a/packages/app-desktop/services/plugins/hooks/useHtmlLoader.ts +++ b/packages/app-desktop/services/plugins/hooks/useHtmlLoader.ts @@ -1,7 +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 +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied export default function(frameWindow: any, isReady: boolean, postMessage: Function, html: string) { const [loadedHtmlHash, setLoadedHtmlHash] = useState(''); @@ -12,6 +12,7 @@ export default function(frameWindow: any, isReady: boolean, postMessage: Functio useEffect(() => { if (!frameWindow) return () => {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function onMessage(event: any) { const data = event.data; diff --git a/packages/app-desktop/services/plugins/hooks/useSubmitHandler.ts b/packages/app-desktop/services/plugins/hooks/useSubmitHandler.ts index fefe21a8f..49a5b4919 100644 --- a/packages/app-desktop/services/plugins/hooks/useSubmitHandler.ts +++ b/packages/app-desktop/services/plugins/hooks/useSubmitHandler.ts @@ -1,17 +1,19 @@ import { useEffect } from 'react'; -// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied export default function(frameWindow: any, onSubmit: Function, onDismiss: Function, loadedHtmlHash: string) { const document = frameWindow && frameWindow.document ? frameWindow.document : null; useEffect(() => { if (!document) return () => {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function onFormSubmit(event: any) { event.preventDefault(); if (onSubmit) onSubmit(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function onKeyDown(event: any) { if (event.key === 'Escape') { if (onDismiss) onDismiss(); diff --git a/packages/app-desktop/services/plugins/hooks/useThemeCss.ts b/packages/app-desktop/services/plugins/hooks/useThemeCss.ts index 78b18b43c..e39c61fd9 100644 --- a/packages/app-desktop/services/plugins/hooks/useThemeCss.ts +++ b/packages/app-desktop/services/plugins/hooks/useThemeCss.ts @@ -9,6 +9,7 @@ interface HookDependencies { themeId: number; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function themeToCssVariables(theme: any) { const lines = []; lines.push(':root {'); diff --git a/packages/app-desktop/services/plugins/hooks/useViewIsReady.ts b/packages/app-desktop/services/plugins/hooks/useViewIsReady.ts index 18879b9d2..f3141d84c 100644 --- a/packages/app-desktop/services/plugins/hooks/useViewIsReady.ts +++ b/packages/app-desktop/services/plugins/hooks/useViewIsReady.ts @@ -1,5 +1,6 @@ import { useEffect, useState } from 'react'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useViewIsReady(viewRef: any) { // Just checking if the iframe is ready is not sufficient because its content // might not be ready (for example, IPC listeners might not be initialised). @@ -18,6 +19,7 @@ export default function useViewIsReady(viewRef: any) { setIFrameReady(true); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function onMessage(event: any) { const data = event.data; diff --git a/packages/app-desktop/services/plugins/hooks/useWebviewToPluginMessages.ts b/packages/app-desktop/services/plugins/hooks/useWebviewToPluginMessages.ts index 6d24a0361..3ebfb3c06 100644 --- a/packages/app-desktop/services/plugins/hooks/useWebviewToPluginMessages.ts +++ b/packages/app-desktop/services/plugins/hooks/useWebviewToPluginMessages.ts @@ -1,7 +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 +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, 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) => { @@ -17,6 +17,7 @@ export default function(frameWindow: any, isReady: boolean, pluginId: string, vi useEffect(() => { if (!frameWindow) return () => {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function onMessage_(event: any) { if (!event.data || !event.data.target) { diff --git a/packages/app-desktop/services/sortOrder/PerFolderSortOrderService.ts b/packages/app-desktop/services/sortOrder/PerFolderSortOrderService.ts index c8873c8a1..a0a4cf48a 100644 --- a/packages/app-desktop/services/sortOrder/PerFolderSortOrderService.ts +++ b/packages/app-desktop/services/sortOrder/PerFolderSortOrderService.ts @@ -91,6 +91,7 @@ export default class PerFolderSortOrderService { } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static onFolderSelectionMayChange(cause: string, event: any) { if (cause !== 'notesParentType' && cause !== 'selectedFolderId') return; this.folderState[cause] = event.value; diff --git a/packages/app-desktop/services/spellChecker/SpellCheckerServiceDriverNative.ts b/packages/app-desktop/services/spellChecker/SpellCheckerServiceDriverNative.ts index e2991c19b..ce933fef2 100644 --- a/packages/app-desktop/services/spellChecker/SpellCheckerServiceDriverNative.ts +++ b/packages/app-desktop/services/spellChecker/SpellCheckerServiceDriverNative.ts @@ -9,6 +9,7 @@ const logger = Logger.create('SpellCheckerServiceDriverNative'); export default class SpellCheckerServiceDriverNative extends SpellCheckerServiceDriverBase { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private session(): any { return bridge().window().webContents.session; } diff --git a/packages/app-desktop/tools/notarizeMacApp.ts b/packages/app-desktop/tools/notarizeMacApp.ts index 458db476a..fbe9944e6 100644 --- a/packages/app-desktop/tools/notarizeMacApp.ts +++ b/packages/app-desktop/tools/notarizeMacApp.ts @@ -73,6 +73,7 @@ export default async (params: Params) => { teamId: process.env.APPLE_ASC_PROVIDER, tool: 'notarytool', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied } as any); } catch (error) { console.error(error); diff --git a/packages/app-desktop/utils/checkForUpdatesUtils.test.ts b/packages/app-desktop/utils/checkForUpdatesUtils.test.ts index 792c2aac7..047758909 100644 --- a/packages/app-desktop/utils/checkForUpdatesUtils.test.ts +++ b/packages/app-desktop/utils/checkForUpdatesUtils.test.ts @@ -4,6 +4,7 @@ import { releases1, releases2 } from './checkForUpdatesUtilsTestData'; describe('checkForUpdates', () => { it('should extract version info and return the non-arm64 version', async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const testCases: [any, Platform, Architecture, boolean, Release][] = [ [ releases1, diff --git a/packages/app-desktop/utils/checkForUpdatesUtilsTestData.ts b/packages/app-desktop/utils/checkForUpdatesUtilsTestData.ts index 809511b49..fb3ec73dd 100644 --- a/packages/app-desktop/utils/checkForUpdatesUtilsTestData.ts +++ b/packages/app-desktop/utils/checkForUpdatesUtilsTestData.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const releases1: any = [ { 'url': 'https://api.github.com/repos/laurent22/joplin/releases/111428211', @@ -4043,6 +4044,7 @@ export const releases1: any = [ }, ]; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const releases2: any = [ { 'url': 'https://api.github.com/repos/laurent22/joplin/releases/111428211', diff --git a/packages/app-mobile/PluginAssetsLoader.ts b/packages/app-mobile/PluginAssetsLoader.ts index 4d9089a09..91a792c1d 100644 --- a/packages/app-mobile/PluginAssetsLoader.ts +++ b/packages/app-mobile/PluginAssetsLoader.ts @@ -7,6 +7,7 @@ import KvStore from '@joplin/lib/services/KvStore'; export default class PluginAssetsLoader { private static instance_: PluginAssetsLoader = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private logger_: any = null; public static instance() { @@ -15,6 +16,7 @@ export default class PluginAssetsLoader { return PluginAssetsLoader.instance_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setLogger(logger: any) { this.logger_ = logger; } diff --git a/packages/app-mobile/components/ActionButton.tsx b/packages/app-mobile/components/ActionButton.tsx index 12700c58c..c449d9358 100644 --- a/packages/app-mobile/components/ActionButton.tsx +++ b/packages/app-mobile/components/ActionButton.tsx @@ -30,6 +30,7 @@ const defaultOnPress = () => {}; // Returns a render function compatible with React Native Paper. const getIconRenderFunction = (iconName: string) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (props: any) => ; }; diff --git a/packages/app-mobile/components/BackButtonDialogBox.ts b/packages/app-mobile/components/BackButtonDialogBox.ts index 0905e1aa1..ed19c4932 100644 --- a/packages/app-mobile/components/BackButtonDialogBox.ts +++ b/packages/app-mobile/components/BackButtonDialogBox.ts @@ -2,6 +2,7 @@ const { BackButtonService } = require('../services/back-button.js'); const DialogBox = require('react-native-dialogbox').default; export default class BackButtonDialogBox extends DialogBox { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(props: any) { super(props); diff --git a/packages/app-mobile/components/CameraView.tsx b/packages/app-mobile/components/CameraView.tsx index f3ec968af..927005f68 100644 --- a/packages/app-mobile/components/CameraView.tsx +++ b/packages/app-mobile/components/CameraView.tsx @@ -10,7 +10,7 @@ import Setting from '@joplin/lib/models/Setting'; // We need this to suppress the useless warning // https://github.com/oblador/react-native-vector-icons/issues/1465 -// eslint-disable-next-line no-console +// eslint-disable-next-line no-console, @typescript-eslint/no-explicit-any -- Old code before rule was applied Icon.loadFont().catch((error: any) => { console.info(error); }); class CameraView extends Component { @@ -34,6 +34,7 @@ class CameraView extends Component { this.onLayout = this.onLayout.bind(this); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public onLayout(event: any) { this.setState({ screenWidth: event.nativeEvent.layout.width, @@ -86,7 +87,7 @@ class CameraView extends Component { } } - // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied public renderButton(onPress: Function, iconNameOrIcon: any, style: any) { let icon = null; @@ -113,10 +114,12 @@ class CameraView extends Component { ); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public fitRectIntoBounds(rect: any, bounds: any) { const rectRatio = rect.width / rect.height; const boundsRatio = bounds.width / bounds.height; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newDimensions: any = {}; // Rect is more landscape than bounds - fit to width @@ -166,6 +169,7 @@ class CameraView extends Component { const ratioButton = !displayRatios ? : this.renderButton(this.ratio_onPress, {Setting.value('camera.ratio')}, { flex: 1, flexDirection: 'row', justifyContent: 'flex-end', marginRight: 20 }); let cameraRatio = '4:3'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const cameraProps: any = {}; if (displayRatios) { @@ -182,6 +186,7 @@ class CameraView extends Component { { this.camera = ref; }} @@ -235,6 +240,7 @@ class CameraView extends Component { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const mapStateToProps = (state: any) => { return { cameraRatio: state.settings['camera.ratio'], diff --git a/packages/app-mobile/components/ExtendedWebView.tsx b/packages/app-mobile/components/ExtendedWebView.tsx index 544ebe744..f6877301c 100644 --- a/packages/app-mobile/components/ExtendedWebView.tsx +++ b/packages/app-mobile/components/ExtendedWebView.tsx @@ -21,6 +21,7 @@ export interface WebViewControl { injectJS(script: string): void; // message must be convertible to JSON + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied postMessage(message: any): void; } @@ -97,6 +98,7 @@ const ExtendedWebView = (props: Props, ref: Ref) => { true;`); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied postMessage(message: any) { webviewRef.current.postMessage(JSON.stringify(message)); }, @@ -165,6 +167,7 @@ const ExtendedWebView = (props: Props, ref: Ref) => { // It seems that `backgroundColor: theme.backgroundColor` does not // prevent the flash. backgroundColor: 'transparent', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ...(props.style as any), }} ref={webviewRef} diff --git a/packages/app-mobile/components/ModalDialog.tsx b/packages/app-mobile/components/ModalDialog.tsx index 3653cb408..6bd9f7346 100644 --- a/packages/app-mobile/components/ModalDialog.tsx +++ b/packages/app-mobile/components/ModalDialog.tsx @@ -21,6 +21,7 @@ interface State { } class ModalDialog extends React.Component { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private styles_: any; public constructor(props: Props) { diff --git a/packages/app-mobile/components/NoteBodyViewer/NoteBodyViewer.tsx b/packages/app-mobile/components/NoteBodyViewer/NoteBodyViewer.tsx index 4b1898349..c4f83dbbe 100644 --- a/packages/app-mobile/components/NoteBodyViewer/NoteBodyViewer.tsx +++ b/packages/app-mobile/components/NoteBodyViewer/NoteBodyViewer.tsx @@ -17,10 +17,12 @@ import useContentScripts from './hooks/useContentScripts'; interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied style: any; noteBody: string; noteMarkupLanguage: number; highlightedKeywords: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied noteResources: any; paddingBottom: number; initialScroll: number|null; @@ -99,6 +101,7 @@ export default function NoteBodyViewer(props: Props) { if (props.onLoadEnd) props.onLoadEnd(); }, [props.onLoadEnd]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const BackButtonDialogBox_ = BackButtonDialogBox as any; const { html, injectedJs } = useSource(tempDir, props.themeId); diff --git a/packages/app-mobile/components/NoteBodyViewer/bundledJs/Renderer.test.ts b/packages/app-mobile/components/NoteBodyViewer/bundledJs/Renderer.test.ts index 9933cba5d..5f4a910dd 100644 --- a/packages/app-mobile/components/NoteBodyViewer/bundledJs/Renderer.test.ts +++ b/packages/app-mobile/components/NoteBodyViewer/bundledJs/Renderer.test.ts @@ -109,6 +109,7 @@ describe('Renderer', () => { const renderer = makeRenderer({}); const requestPluginSetting = jest.fn(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const rerender = (pluginSettings: Record) => { return renderer.rerender( { language: MarkupLanguage.Markdown, markup: '```\ntest\n```' }, diff --git a/packages/app-mobile/components/NoteBodyViewer/bundledJs/Renderer.ts b/packages/app-mobile/components/NoteBodyViewer/bundledJs/Renderer.ts index 32f2faea8..985d9a21f 100644 --- a/packages/app-mobile/components/NoteBodyViewer/bundledJs/Renderer.ts +++ b/packages/app-mobile/components/NoteBodyViewer/bundledJs/Renderer.ts @@ -13,6 +13,7 @@ export interface RendererSetupOptions { resourceDownloadMode: string; }; fsDriver: RendererFsDriver; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginOptions: Record; } @@ -20,6 +21,7 @@ export interface RendererSettings { theme: string; onResourceLoaded: ()=> void; highlightedKeywords: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied resources: Record; codeTheme: string; noteHash: string; @@ -28,6 +30,7 @@ export interface RendererSettings { createEditPopupSyntax: string; destroyEditPopupSyntax: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginSettings: Record; requestPluginSetting: (pluginId: string, settingKey: string)=> void; } @@ -158,6 +161,7 @@ export default class Renderer { if (document.readyState === 'complete') { clearInterval(readyStateCheckInterval); if (this.setupOptions.settings.resourceDownloadMode === 'manual') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (window as any).webviewLib.setupResourceManualDownload(); } diff --git a/packages/app-mobile/components/NoteBodyViewer/bundledJs/noteBodyViewerBundle.ts b/packages/app-mobile/components/NoteBodyViewer/bundledJs/noteBodyViewerBundle.ts index 073922216..5dcc530a4 100644 --- a/packages/app-mobile/components/NoteBodyViewer/bundledJs/noteBodyViewerBundle.ts +++ b/packages/app-mobile/components/NoteBodyViewer/bundledJs/noteBodyViewerBundle.ts @@ -9,6 +9,7 @@ declare global { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied declare const webviewLib: any; const messenger = new WebViewToRNMessenger( @@ -16,10 +17,12 @@ const messenger = new WebViewToRNMessenger { return messenger.remoteApi.onPostMessage(message); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (window as any).webviewApi = { postMessage: messenger.remoteApi.onPostPluginMessage, }; diff --git a/packages/app-mobile/components/NoteBodyViewer/bundledJs/types.ts b/packages/app-mobile/components/NoteBodyViewer/bundledJs/types.ts index 61ae314e5..7029f0781 100644 --- a/packages/app-mobile/components/NoteBodyViewer/bundledJs/types.ts +++ b/packages/app-mobile/components/NoteBodyViewer/bundledJs/types.ts @@ -8,6 +8,7 @@ export interface RendererWebViewOptions { resourceDir: string; resourceDownloadMode: string; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginOptions: Record; } @@ -26,6 +27,7 @@ export interface NoteViewerLocalApi { export interface NoteViewerRemoteApi { onScroll(scrollTop: number): void; onPostMessage(message: string): void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onPostPluginMessage(contentScriptId: string, message: any): Promise; fsDriver: RendererFsDriver; } diff --git a/packages/app-mobile/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts b/packages/app-mobile/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts index 5f7d96e1e..86fdaf8c0 100644 --- a/packages/app-mobile/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts +++ b/packages/app-mobile/components/NoteBodyViewer/hooks/useOnResourceLongPress.ts @@ -14,6 +14,7 @@ interface Callbacks { onRequestEditResource: (message: string)=> void; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function useOnResourceLongPress(callbacks: Callbacks, dialogBoxRef: any) { const { onJoplinLinkClick, onRequestEditResource } = callbacks; diff --git a/packages/app-mobile/components/NoteBodyViewer/hooks/useRenderer.ts b/packages/app-mobile/components/NoteBodyViewer/hooks/useRenderer.ts index c8582898f..92548fee2 100644 --- a/packages/app-mobile/components/NoteBodyViewer/hooks/useRenderer.ts +++ b/packages/app-mobile/components/NoteBodyViewer/hooks/useRenderer.ts @@ -20,6 +20,7 @@ interface Props { tempDir: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onPostPluginMessage = async (contentScriptId: string, message: any) => { logger.debug(`Handling message from content script: ${contentScriptId}:`, message); diff --git a/packages/app-mobile/components/NoteBodyViewer/hooks/useRerenderHandler.ts b/packages/app-mobile/components/NoteBodyViewer/hooks/useRerenderHandler.ts index 0dce161f1..49472132a 100644 --- a/packages/app-mobile/components/NoteBodyViewer/hooks/useRerenderHandler.ts +++ b/packages/app-mobile/components/NoteBodyViewer/hooks/useRerenderHandler.ts @@ -75,6 +75,7 @@ const useRerenderHandler = (props: Props) => { createEditPopupSyntax, destroyEditPopupSyntax, pluginSettingKeys, ]; const previousDeps = usePrevious(effectDependencies, []); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const changedDeps = effectDependencies.reduce((accum: any, dependency: any, index: any) => { if (dependency !== previousDeps[index]) { return { ...accum, [index]: true }; @@ -104,6 +105,7 @@ const useRerenderHandler = (props: Props) => { return; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const pluginSettings: Record = { }; for (const key in pluginSettingKeys) { pluginSettings[key] = Setting.value(`plugin-${key}`); diff --git a/packages/app-mobile/components/NoteBodyViewer/hooks/useSource.ts b/packages/app-mobile/components/NoteBodyViewer/hooks/useSource.ts index 037deb459..0fb7a955c 100644 --- a/packages/app-mobile/components/NoteBodyViewer/hooks/useSource.ts +++ b/packages/app-mobile/components/NoteBodyViewer/hooks/useSource.ts @@ -7,6 +7,7 @@ import { themeStyle } from '../../global-style'; const useSource = (tempDirPath: string, themeId: number) => { const injectedJs = useMemo(() => { const subValues = Setting.subValues('markdown.plugin', Setting.toPlainObject()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const pluginOptions: any = {}; for (const n in subValues) { pluginOptions[n] = { enabled: subValues[n] }; diff --git a/packages/app-mobile/components/NoteEditor/ImageEditor/ImageEditor.tsx b/packages/app-mobile/components/NoteEditor/ImageEditor/ImageEditor.tsx index 3ee0ebdea..0712c52e8 100644 --- a/packages/app-mobile/components/NoteEditor/ImageEditor/ImageEditor.tsx +++ b/packages/app-mobile/components/NoteEditor/ImageEditor/ImageEditor.tsx @@ -308,6 +308,7 @@ const ImageEditor = (props: Props) => { } }, [props.onSave, onRequestCloseEditor, onReadyToLoadData]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const onError = useCallback((event: any) => { logger.error('ImageEditor: WebView error: ', event); }, []); diff --git a/packages/app-mobile/components/NoteEditor/ImageEditor/js-draw/createJsDrawEditor.test.ts b/packages/app-mobile/components/NoteEditor/ImageEditor/js-draw/createJsDrawEditor.test.ts index e71fbd340..c1a472caf 100644 --- a/packages/app-mobile/components/NoteEditor/ImageEditor/js-draw/createJsDrawEditor.test.ts +++ b/packages/app-mobile/components/NoteEditor/ImageEditor/js-draw/createJsDrawEditor.test.ts @@ -3,6 +3,7 @@ // Hide warnings from js-draw. // jsdom doesn't support ResizeObserver and HTMLCanvasElement.getContext. HTMLCanvasElement.prototype.getContext = () => null; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied window.ResizeObserver = class { public observe() { } } as any; import { describe, it, expect, jest } from '@jest/globals'; diff --git a/packages/app-mobile/components/NoteEditor/ImageEditor/js-draw/createJsDrawEditor.ts b/packages/app-mobile/components/NoteEditor/ImageEditor/js-draw/createJsDrawEditor.ts index 1fce3272f..80635cf89 100644 --- a/packages/app-mobile/components/NoteEditor/ImageEditor/js-draw/createJsDrawEditor.ts +++ b/packages/app-mobile/components/NoteEditor/ImageEditor/js-draw/createJsDrawEditor.ts @@ -8,6 +8,7 @@ import { ImageEditorCallbacks, LocalizedStrings } from './types'; import startAutosaveLoop from './startAutosaveLoop'; declare namespace ReactNativeWebView { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const postMessage: (data: any)=> void; } diff --git a/packages/app-mobile/components/NoteEditor/MarkdownToolbar/MarkdownToolbar.tsx b/packages/app-mobile/components/NoteEditor/MarkdownToolbar/MarkdownToolbar.tsx index 46ce84f7c..2dced3dc2 100644 --- a/packages/app-mobile/components/NoteEditor/MarkdownToolbar/MarkdownToolbar.tsx +++ b/packages/app-mobile/components/NoteEditor/MarkdownToolbar/MarkdownToolbar.tsx @@ -84,6 +84,7 @@ const MarkdownToolbar: React.FC = (props: MarkdownToolbarP ); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const useStyles = (styleProps: any, theme: Theme) => { return useMemo(() => { return StyleSheet.create({ diff --git a/packages/app-mobile/components/NoteEditor/MarkdownToolbar/ToolbarButton.tsx b/packages/app-mobile/components/NoteEditor/MarkdownToolbar/ToolbarButton.tsx index 55718114d..17272890b 100644 --- a/packages/app-mobile/components/NoteEditor/MarkdownToolbar/ToolbarButton.tsx +++ b/packages/app-mobile/components/NoteEditor/MarkdownToolbar/ToolbarButton.tsx @@ -14,6 +14,7 @@ interface ToolbarButtonProps { onActionComplete?: ()=> void; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const useStyles = (baseStyleSheet: any, baseButtonStyle: any, buttonSpec: ButtonSpec, visible: boolean, disabled: boolean) => { return useMemo(() => { const activatedStyle = buttonSpec.active ? baseStyleSheet.buttonActive : {}; diff --git a/packages/app-mobile/components/NoteEditor/MarkdownToolbar/types.ts b/packages/app-mobile/components/NoteEditor/MarkdownToolbar/types.ts index 552d78ba9..80b613353 100644 --- a/packages/app-mobile/components/NoteEditor/MarkdownToolbar/types.ts +++ b/packages/app-mobile/components/NoteEditor/MarkdownToolbar/types.ts @@ -35,6 +35,7 @@ export interface ButtonGroup { export interface StyleSheetData { themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied styles: any; } diff --git a/packages/app-mobile/components/NoteEditor/NoteEditor.tsx b/packages/app-mobile/components/NoteEditor/NoteEditor.tsx index ac22b1de0..6763f0044 100644 --- a/packages/app-mobile/components/NoteEditor/NoteEditor.tsx +++ b/packages/app-mobile/components/NoteEditor/NoteEditor.tsx @@ -160,6 +160,7 @@ const useEditorControl = ( supportsCommand(command: EditorCommandType) { return bodyControl.supportsCommand(command); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execCommand(command, ...args: any[]) { return bodyControl.execCommand(command, ...args); }, @@ -281,6 +282,7 @@ const useEditorControl = ( }, [webviewRef, bodyControl, setLinkDialogVisible, setSearchState]); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function NoteEditor(props: Props, ref: any) { const webviewRef = useRef(null); diff --git a/packages/app-mobile/components/NoteEditor/SearchPanel.tsx b/packages/app-mobile/components/NoteEditor/SearchPanel.tsx index a197a6d8c..ddbb9bf21 100644 --- a/packages/app-mobile/components/NoteEditor/SearchPanel.tsx +++ b/packages/app-mobile/components/NoteEditor/SearchPanel.tsx @@ -33,6 +33,7 @@ export interface SearchPanelProps { } interface ActionButtonProps { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied styles: any; themeId: number; iconName: string; @@ -54,6 +55,7 @@ const ActionButton = (props: ActionButtonProps) => { }; interface ToggleButtonProps { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied styles: any; themeId: number; iconName: string; @@ -147,6 +149,7 @@ export const SearchPanel = (props: SearchPanelProps) => { const state = props.searchState; const control = props.searchControl; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const updateSearchState = (changedData: any) => { const newState = { ...state, ...changedData }; control.setSearchState(newState); diff --git a/packages/app-mobile/components/NoteEditor/hooks/useCodeMirrorPlugins.ts b/packages/app-mobile/components/NoteEditor/hooks/useCodeMirrorPlugins.ts index 2ae5b73bb..7159c5916 100644 --- a/packages/app-mobile/components/NoteEditor/hooks/useCodeMirrorPlugins.ts +++ b/packages/app-mobile/components/NoteEditor/hooks/useCodeMirrorPlugins.ts @@ -42,6 +42,7 @@ const useCodeMirrorPlugins = (pluginStates: PluginStates) => { const path = shim.fsDriver().resolveRelativePathWithinDir(assetPath, name); return shim.fsDriver().readFile(path, 'utf8'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied postMessageHandler: async (message: any): Promise => { logger.debug(`Got message from plugin ${pluginId} content script ${contentScriptId}. Message:`, message); return plugin.emitContentScriptMessage(contentScriptId, message); diff --git a/packages/app-mobile/components/NoteEditor/hooks/useEditorCommandHandler.ts b/packages/app-mobile/components/NoteEditor/hooks/useEditorCommandHandler.ts index 7e2934245..bd6a1b2e4 100644 --- a/packages/app-mobile/components/NoteEditor/hooks/useEditorCommandHandler.ts +++ b/packages/app-mobile/components/NoteEditor/hooks/useEditorCommandHandler.ts @@ -8,6 +8,7 @@ const logger = Logger.create('useEditorCommandHandler'); const commandRuntime = (declaration: CommandDeclaration, editor: EditorControl) => { return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execute: async (_context: CommandContext, ...args: any[]) => { // Many editor CodeMirror commands are missing the editor. prefix. let commandName = declaration.name.replace(/^editor\./, ''); diff --git a/packages/app-mobile/components/NoteList.tsx b/packages/app-mobile/components/NoteList.tsx index 4911a700a..8376675f7 100644 --- a/packages/app-mobile/components/NoteList.tsx +++ b/packages/app-mobile/components/NoteList.tsx @@ -14,6 +14,7 @@ import { themeStyle } from './global-style'; interface NoteListProps { themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied dispatch: (action: any)=> void; notesSource: string; items: NoteEntity[]; @@ -24,6 +25,7 @@ interface NoteListProps { class NoteListComponent extends Component { private rootRef_: FlatList; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private styles_: Record>; public constructor(props: NoteListProps) { diff --git a/packages/app-mobile/components/ProfileSwitcher/ProfileSwitcher.tsx b/packages/app-mobile/components/ProfileSwitcher/ProfileSwitcher.tsx index ab8dc5bec..03dd9762c 100644 --- a/packages/app-mobile/components/ProfileSwitcher/ProfileSwitcher.tsx +++ b/packages/app-mobile/components/ProfileSwitcher/ProfileSwitcher.tsx @@ -112,6 +112,7 @@ export default (props: Props) => { ); }, [profileConfig]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const renderProfileItem = (event: any) => { const profile = event.item as Profile; const titleStyle = { fontWeight: profile.id === profileConfig.currentProfileId ? 'bold' : 'normal' }; diff --git a/packages/app-mobile/components/ScreenHeader.tsx b/packages/app-mobile/components/ScreenHeader.tsx index c7c7a5aa7..e8ef038e5 100644 --- a/packages/app-mobile/components/ScreenHeader.tsx +++ b/packages/app-mobile/components/ScreenHeader.tsx @@ -30,7 +30,7 @@ import { Dispatch } from 'redux'; // We need this to suppress the useless warning // https://github.com/oblador/react-native-vector-icons/issues/1465 -// eslint-disable-next-line no-console +// eslint-disable-next-line no-console, @typescript-eslint/no-explicit-any -- Old code before rule was applied Icon.loadFont().catch((error: any) => { console.info(error); }); // Rather than applying a padding to the whole bar, it is applied to each @@ -58,6 +58,7 @@ interface ScreenHeaderProps { selectedFolderId: string; notesParentType: string; noteSelectionEnabled: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied parentComponent: any; showUndoButton: boolean; undoButtonDisabled?: boolean; @@ -103,6 +104,7 @@ interface ScreenHeaderState { } class ScreenHeaderComponent extends PureComponent { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private cachedStyles: any; public dialogbox?: typeof DialogBox; public constructor(props: ScreenHeaderProps) { @@ -117,6 +119,7 @@ class ScreenHeaderComponent extends PureComponent { const allPluginViews = Object.values(this.props.plugins).map(plugin => Object.values(plugin.views)).flat(); const allPanels = allPluginViews.filter(view => view.containerType === ContainerType.Panel); @@ -467,6 +476,7 @@ class ScreenHeaderComponent extends PureComponent { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(props: any) { super(props); @@ -67,6 +69,7 @@ export default class SelectDateTimeDialog extends React.PureComponent this.onSetDate = this.onSetDate.bind(this); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public UNSAFE_componentWillReceiveProps(newProps: any) { if (newProps.date !== this.state.date) { this.setState({ date: newProps.date }); diff --git a/packages/app-mobile/components/SideMenu.ts b/packages/app-mobile/components/SideMenu.ts index 272a4c842..11f461bef 100644 --- a/packages/app-mobile/components/SideMenu.ts +++ b/packages/app-mobile/components/SideMenu.ts @@ -4,6 +4,7 @@ import { Dimensions } from 'react-native'; import { State } from '@joplin/lib/reducer'; class SideMenuComponent extends SideMenu_ { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public onLayoutChange(e: any) { const { width, height } = e.nativeEvent.layout; const openMenuOffsetPercentage = this.props.openMenuOffset / Dimensions.get('window').width; diff --git a/packages/app-mobile/components/app-nav.tsx b/packages/app-mobile/components/app-nav.tsx index 98c67e8e5..371a66c90 100644 --- a/packages/app-mobile/components/app-nav.tsx +++ b/packages/app-mobile/components/app-nav.tsx @@ -13,8 +13,11 @@ interface State { } interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied route: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied screens: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied dispatch: (action: any)=> void; themeId: number; } diff --git a/packages/app-mobile/components/base-screen.ts b/packages/app-mobile/components/base-screen.ts index 86aa9d253..961303306 100644 --- a/packages/app-mobile/components/base-screen.ts +++ b/packages/app-mobile/components/base-screen.ts @@ -2,6 +2,7 @@ import * as React from 'react'; import { StyleSheet } from 'react-native'; import { themeStyle } from './global-style'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const rootStyles_: Record = {}; class BaseScreenComponent extends React.Component { diff --git a/packages/app-mobile/components/global-style.ts b/packages/app-mobile/components/global-style.ts index 4808a9611..f80254a3c 100644 --- a/packages/app-mobile/components/global-style.ts +++ b/packages/app-mobile/components/global-style.ts @@ -14,8 +14,10 @@ const baseStyle = { lineHeight: '1.6em', }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const themeCache_: any = {}; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function addExtraStyles(style: any) { style.marginRight = style.margin; style.marginLeft = style.margin; @@ -75,8 +77,10 @@ function addExtraStyles(style: any) { return style; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function editorFont(fontId: any) { // IMPORTANT: The font mapping must match the one in Setting.js + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const fonts: any = { [Setting.FONT_DEFAULT]: null, [Setting.FONT_MENLO]: 'Menlo', diff --git a/packages/app-mobile/components/screens/ConfigScreen/ConfigScreen.tsx b/packages/app-mobile/components/screens/ConfigScreen/ConfigScreen.tsx index 0e194df85..c4859dcb2 100644 --- a/packages/app-mobile/components/screens/ConfigScreen/ConfigScreen.tsx +++ b/packages/app-mobile/components/screens/ConfigScreen/ConfigScreen.tsx @@ -33,6 +33,7 @@ import PluginStates, { getSearchText as getPluginStatesSearchText } from './plug import PluginUploadButton, { canInstallPluginsFromFile, buttonLabel as pluginUploadButtonSearchText } from './plugins/PluginUploadButton'; interface ConfigScreenState { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied settings: any; changedSettingKeys: string[]; @@ -48,12 +49,15 @@ interface ConfigScreenState { } interface ConfigScreenProps { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied settings: any; themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied navigation: any; } class ConfigScreenComponent extends BaseScreenComponent { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static navigationOptions(): any { return { header: null }; } @@ -218,11 +222,13 @@ class ConfigScreenComponent extends BaseScreenComponent void, options: any = null) { return ( void, options: any = null) => { const relatedText = [title]; if (typeof options === 'object' && options?.description) { @@ -565,6 +574,7 @@ class ConfigScreenComponent extends BaseScreenComponent this.onSectionLayout(key, event)}> {this.state.searching ? headerComponent : null} @@ -632,7 +643,7 @@ class ConfigScreenComponent extends BaseScreenComponent {label} + {/* eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied */} void updateSettingValue(key, value)} /> {descriptionComp} @@ -649,6 +661,7 @@ class ConfigScreenComponent extends BaseScreenComponent => { // When the user tries to enable biometrics unlock, we ask for the // fingerprint or Face ID, and if it's correct we save immediately. If @@ -672,7 +685,9 @@ class ConfigScreenComponent extends BaseScreenComponent { const handled = await this.handleSetting(key, value); if (!handled) shared.updateSettingValue(this, key, value); @@ -690,11 +705,14 @@ class ConfigScreenComponent extends BaseScreenComponent { return shared.updateSettingValue(this, key, value); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any[] = []; for (const key of featureFlagKeys) { output.push(this.renderToggle(key, key, settings[key], updateSettingValue)); diff --git a/packages/app-mobile/components/screens/ConfigScreen/SectionSelector.tsx b/packages/app-mobile/components/screens/ConfigScreen/SectionSelector.tsx index fc95d41eb..ad9d058f4 100644 --- a/packages/app-mobile/components/screens/ConfigScreen/SectionSelector.tsx +++ b/packages/app-mobile/components/screens/ConfigScreen/SectionSelector.tsx @@ -13,6 +13,7 @@ interface Props { width: number|undefined; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied settings: any; selectedSectionName: string|null; openSection: (sectionName: string)=> void; diff --git a/packages/app-mobile/components/screens/ConfigScreen/SettingComponent.tsx b/packages/app-mobile/components/screens/ConfigScreen/SettingComponent.tsx index 47b5fba30..503d20f9a 100644 --- a/packages/app-mobile/components/screens/ConfigScreen/SettingComponent.tsx +++ b/packages/app-mobile/components/screens/ConfigScreen/SettingComponent.tsx @@ -15,6 +15,7 @@ interface Props { settingId: string; // The value associated with the given settings key + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; styles: ConfigScreenStyles; @@ -27,6 +28,7 @@ interface Props { const SettingComponent: React.FunctionComponent = props => { const themeId = props.themeId; const theme = themeStyle(themeId); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = null; const md = Setting.settingMetadata(props.settingId); @@ -50,6 +52,7 @@ const SettingComponent: React.FunctionComponent = props => { ; const PluginBox: React.FC = props => { diff --git a/packages/app-mobile/components/screens/ConfigScreen/plugins/testUtils/pluginServiceSetup.ts b/packages/app-mobile/components/screens/ConfigScreen/plugins/testUtils/pluginServiceSetup.ts index 2193d8670..bbb5a3771 100644 --- a/packages/app-mobile/components/screens/ConfigScreen/plugins/testUtils/pluginServiceSetup.ts +++ b/packages/app-mobile/components/screens/ConfigScreen/plugins/testUtils/pluginServiceSetup.ts @@ -1,6 +1,7 @@ import PluginService from '@joplin/lib/services/plugins/PluginService'; const pluginServiceSetup = () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const runner = { run: ()=> {}, stop: ()=>{} } as any; PluginService.instance().initialize( '2.14.0', { joplin: {} }, runner, { dispatch: ()=>{}, getState: ()=>{} }, diff --git a/packages/app-mobile/components/screens/ConfigScreen/types.ts b/packages/app-mobile/components/screens/ConfigScreen/types.ts index 2d82cb934..0252f72bc 100644 --- a/packages/app-mobile/components/screens/ConfigScreen/types.ts +++ b/packages/app-mobile/components/screens/ConfigScreen/types.ts @@ -7,4 +7,5 @@ export interface CustomSettingSection { keywords: string[]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type UpdateSettingValueCallback = (key: string, value: any)=> Promise; diff --git a/packages/app-mobile/components/screens/LogScreen.tsx b/packages/app-mobile/components/screens/LogScreen.tsx index b0db7ce02..5381b4dd0 100644 --- a/packages/app-mobile/components/screens/LogScreen.tsx +++ b/packages/app-mobile/components/screens/LogScreen.tsx @@ -20,10 +20,12 @@ const logger = Logger.create('LogScreen'); interface Props { themeId: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied navigation: any; } interface State { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied logEntries: any[]; showErrorsOnly: boolean; filter: string|undefined; @@ -31,8 +33,10 @@ interface State { class LogScreenComponent extends BaseScreenComponent { private readonly menuOptions_: MenuOptionType[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private styles_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static navigationOptions(): any { return { header: null }; } @@ -57,6 +61,7 @@ class LogScreenComponent extends BaseScreenComponent { ]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private refreshLogTimeout: any = null; public override componentDidUpdate(_prevProps: Props, prevState: State) { if ((prevState?.filter ?? '') !== (this.state.filter ?? '')) { @@ -86,6 +91,7 @@ class LogScreenComponent extends BaseScreenComponent { } private async onSharePress() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const allEntries: any[] = await this.getLogEntries(this.state.showErrorsOnly); const logData = allEntries.map(entry => this.formatLogEntry(entry)).join('\n'); @@ -119,6 +125,7 @@ class LogScreenComponent extends BaseScreenComponent { const theme = themeStyle(this.props.themeId); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const styles: any = { row: { flexDirection: 'row', @@ -171,10 +178,12 @@ class LogScreenComponent extends BaseScreenComponent { void this.refreshLogEntries(!this.state.showErrorsOnly); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private formatLogEntry(item: any) { return `${time.formatMsToLocal(item.timestamp, 'MM-DDTHH:mm:ss')}: ${item.message}`; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private onRenderLogRow = ({ item }: any) => { let textStyle = this.styles().rowText; if (item.level === Logger.LEVEL_WARN) textStyle = this.styles().rowTextWarn; diff --git a/packages/app-mobile/components/screens/Note.tsx b/packages/app-mobile/components/screens/Note.tsx index 4093b2514..c681be853 100644 --- a/packages/app-mobile/components/screens/Note.tsx +++ b/packages/app-mobile/components/screens/Note.tsx @@ -64,6 +64,7 @@ import debounce from '../../utils/debounce'; import { focus } from '@joplin/lib/utils/focusHandler'; const urlUtils = require('@joplin/lib/urlUtils'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const emptyArray: any[] = []; const logger = Logger.create('screens/Note'); @@ -90,6 +91,7 @@ interface State { mode: 'view'|'edit'; readOnly: boolean; folder: FolderEntity|null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied lastSavedNote: any; isLoading: boolean; titleTextInputHeight: number; @@ -119,23 +121,34 @@ class NoteScreenComponent extends BaseScreenComponent implements B // a re-render. private lastBodyScroll: number|undefined = undefined; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private saveActionQueues_: any; private doFocusUpdate_: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private styles_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private editorRef: any; private titleTextFieldRef: RefObject; private navHandler: OnNavigateCallback; private backHandler: ()=> Promise; private undoRedoService_: UndoRedoService; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private noteTagDialog_closeRequested: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private onJoplinLinkClick_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private refreshResource: (resource: any, noteBody?: string)=> Promise; private selection: SelectionRange; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private menuOptionsCache_: Record; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private focusUpdateIID_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private folderPickerOptions_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public dialogbox: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static navigationOptions(): any { return { header: null }; } @@ -287,6 +300,7 @@ class NoteScreenComponent extends BaseScreenComponent implements B } }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.refreshResource = async (resource: any, noteBody: string = null) => { if (noteBody === null && this.state.note && this.state.note.body) noteBody = this.state.note.body; if (noteBody === null) return; @@ -349,6 +363,7 @@ class NoteScreenComponent extends BaseScreenComponent implements B const undoState = await this.undoRedoService_[type](this.undoState()); if (!undoState) return; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.setState((state: any) => { const newNote = { ...state.note }; newNote.body = undoState.body; @@ -390,6 +405,7 @@ class NoteScreenComponent extends BaseScreenComponent implements B this.styles_ = {}; // TODO: Clean up these style names and nesting + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const styles: any = { screen: { flex: 1, @@ -512,10 +528,12 @@ class NoteScreenComponent extends BaseScreenComponent implements B void this.requestGeoLocationPermissions(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public onMarkForDownload(event: any) { void ResourceFetcher.instance().markForDownload(event.resourceId); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public componentDidUpdate(prevProps: any, prevState: any) { if (this.doFocusUpdate_) { this.doFocusUpdate_ = false; @@ -604,6 +622,7 @@ class NoteScreenComponent extends BaseScreenComponent implements B shared.noteComponent_change(this, 'body', event.value); }, 100); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private onPlainEditorSelectionChange = (event: NativeSyntheticEvent) => { this.selection = event.nativeEvent.selection; }; @@ -635,6 +654,7 @@ class NoteScreenComponent extends BaseScreenComponent implements B Keyboard.dismiss(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async saveOneProperty(name: string, value: any) { await shared.saveOneProperty(this, name, value); } @@ -666,6 +686,7 @@ class NoteScreenComponent extends BaseScreenComponent implements B (width: number, height: number) => { resolve({ width: width, height: height }); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (error: any) => { reject(error); }, @@ -868,6 +889,7 @@ class NoteScreenComponent extends BaseScreenComponent implements B this.setState({ showCamera: true }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private cameraView_onPhoto(data: any) { void this.attachFile( { @@ -1333,6 +1355,7 @@ class NoteScreenComponent extends BaseScreenComponent implements B } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async folderPickerOptions_valueChanged(itemValue: any) { const note = this.state.note; const isProvisionalNote = this.props.provisionalNoteIds.includes(note.id); @@ -1601,6 +1624,7 @@ class NoteScreenComponent extends BaseScreenComponent implements B { this.dialogbox = dialogbox; }} diff --git a/packages/app-mobile/components/screens/NoteTagsDialog.tsx b/packages/app-mobile/components/screens/NoteTagsDialog.tsx index e3e1cdafe..58098256b 100644 --- a/packages/app-mobile/components/screens/NoteTagsDialog.tsx +++ b/packages/app-mobile/components/screens/NoteTagsDialog.tsx @@ -13,7 +13,7 @@ const naturalCompare = require('string-natural-compare'); // We need this to suppress the useless warning // https://github.com/oblador/react-native-vector-icons/issues/1465 -// eslint-disable-next-line no-console +// eslint-disable-next-line no-console, @typescript-eslint/no-explicit-any -- Old code before rule was applied Icon.loadFont().catch((error: any) => { console.info(error); }); interface Props { @@ -39,6 +39,7 @@ interface State { } class NoteTagsDialogComponent extends React.Component { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private styles_: any; public constructor(props: Props) { diff --git a/packages/app-mobile/components/screens/Notes.tsx b/packages/app-mobile/components/screens/Notes.tsx index 142b450f3..ce440735c 100644 --- a/packages/app-mobile/components/screens/Notes.tsx +++ b/packages/app-mobile/components/screens/Notes.tsx @@ -20,6 +20,7 @@ import { NoteEntity } from '@joplin/lib/services/database/types'; import { itemIsInTrash } from '@joplin/lib/services/trash'; const { ALL_NOTES_FILTER_ID } = require('@joplin/lib/reserved-ids.js'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied class NotesScreenComponent extends BaseScreenComponent { private onAppStateChangeSub_: NativeEventSubscription = null; @@ -110,12 +111,14 @@ class NotesScreenComponent extends BaseScreenComponent { BackButtonService.removeHandler(this.backHandler); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async componentDidUpdate(prevProps: any) { if (prevProps.notesOrder !== this.props.notesOrder || prevProps.selectedFolderId !== this.props.selectedFolderId || prevProps.selectedTagId !== this.props.selectedTagId || prevProps.selectedSmartFilterId !== this.props.selectedSmartFilterId || prevProps.notesParentType !== this.props.notesParentType || prevProps.uncompletedTodosOnTop !== this.props.uncompletedTodosOnTop || prevProps.showCompletedTodos !== this.props.showCompletedTodos) { await this.refreshNotes(this.props); } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async refreshNotes(props: any = null) { if (props === null) props = this.props; @@ -169,6 +172,7 @@ class NotesScreenComponent extends BaseScreenComponent { } }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public parentItem(props: any = null) { if (!props) props = this.props; @@ -292,6 +296,7 @@ class NotesScreenComponent extends BaseScreenComponent { {actionButtonComp} { this.dialogbox = dialogbox; }} @@ -319,6 +324,8 @@ const NotesScreen = connect((state: AppState) => { noteSelectionEnabled: state.noteSelectionEnabled, notesOrder: stateUtils.notesOrder(state.settings), }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied })(NotesScreenComponent as any); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default NotesScreen as any; diff --git a/packages/app-mobile/components/screens/UpgradeSyncTargetScreen.tsx b/packages/app-mobile/components/screens/UpgradeSyncTargetScreen.tsx index 349cde906..3e3a8c55b 100644 --- a/packages/app-mobile/components/screens/UpgradeSyncTargetScreen.tsx +++ b/packages/app-mobile/components/screens/UpgradeSyncTargetScreen.tsx @@ -7,6 +7,7 @@ const { connect } = require('react-redux'); import { themeStyle } from '../global-style'; import ScreenHeader from '../ScreenHeader'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function UpgradeSyncTargetScreen(props: any) { const upgradeResult = useSyncTargetUpgrade(); @@ -65,6 +66,7 @@ function UpgradeSyncTargetScreen(props: any) { ); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default connect((state: any) => { return { themeId: state.settings.theme, diff --git a/packages/app-mobile/components/screens/encryption-config.tsx b/packages/app-mobile/components/screens/encryption-config.tsx index d64a38821..b34873634 100644 --- a/packages/app-mobile/components/screens/encryption-config.tsx +++ b/packages/app-mobile/components/screens/encryption-config.tsx @@ -16,6 +16,7 @@ import { getDefaultMasterKey, setupAndDisableEncryption, toggleAndSetupEncryptio import { useMemo, useRef, useState } from 'react'; interface Props { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied themeId: any; masterKeys: MasterKeyEntity[]; passwords: Record; @@ -40,6 +41,7 @@ const EncryptionConfigScreen = (props: Props) => { const nonExistingMasterKeyIds = props.notLoadedMasterKeys.slice(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const theme: any = useMemo(() => { return themeStyle(props.themeId); }, [props.themeId]); @@ -92,6 +94,7 @@ const EncryptionConfigScreen = (props: Props) => { const password = inputPasswords[mk.id] ? inputPasswords[mk.id] : ''; const passwordOk = passwordChecks[mk.id] === true ? '✔' : '❌'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const inputStyle: any = { flex: 1, marginRight: 10, color: theme.color }; inputStyle.borderBottomWidth = 1; inputStyle.borderBottomColor = theme.dividerColor; @@ -201,6 +204,7 @@ const EncryptionConfigScreen = (props: Props) => { const renderMasterPassword = () => { if (!props.encryptionEnabled && !props.masterKeys.length) return null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const inputStyle: any = { flex: 1, marginRight: 10, color: theme.color }; inputStyle.borderBottomWidth = 1; inputStyle.borderBottomColor = theme.dividerColor; diff --git a/packages/app-mobile/components/screens/search.tsx b/packages/app-mobile/components/screens/search.tsx index 5bcaec1f9..900367b7c 100644 --- a/packages/app-mobile/components/screens/search.tsx +++ b/packages/app-mobile/components/screens/search.tsx @@ -17,17 +17,21 @@ import { NoteEntity } from '@joplin/lib/services/database/types'; // We need this to suppress the useless warning // https://github.com/oblador/react-native-vector-icons/issues/1465 -// eslint-disable-next-line no-console +// eslint-disable-next-line no-console, @typescript-eslint/no-explicit-any -- Old code before rule was applied Icon.loadFont().catch((error: any) => { console.info(error); }); class SearchScreenComponent extends BaseScreenComponent { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private state: any = null; private isMounted_ = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private styles_: any = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private scheduleSearchTimer_: any = null; public static navigationOptions() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return { header: null } as any; } @@ -45,6 +49,7 @@ class SearchScreenComponent extends BaseScreenComponent { if (this.styles_[this.props.themeId]) return this.styles_[this.props.themeId]; this.styles_ = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const styles: any = { body: { flex: 1, @@ -199,6 +204,7 @@ class SearchScreenComponent extends BaseScreenComponent { item.id} renderItem={event => } /> { this.dialogbox = dialogbox; }} diff --git a/packages/app-mobile/components/side-menu-content.tsx b/packages/app-mobile/components/side-menu-content.tsx index adbb2309e..9788b65ab 100644 --- a/packages/app-mobile/components/side-menu-content.tsx +++ b/packages/app-mobile/components/side-menu-content.tsx @@ -22,7 +22,7 @@ const { substrWithEllipsis } = require('@joplin/lib/string-utils'); // We need this to suppress the useless warning // https://github.com/oblador/react-native-vector-icons/issues/1465 -// eslint-disable-next-line no-console +// eslint-disable-next-line no-console, @typescript-eslint/no-explicit-any -- Old code before rule was applied Icon.loadFont().catch((error: any) => { console.info(error); }); interface Props { @@ -32,8 +32,11 @@ interface Props { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied dispatch: Function; collapsedFolderIds: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied syncReport: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied decryptionWorker: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied resourceFetcher: any; syncOnlyOverWifi: boolean; isOnMobileData: boolean; @@ -55,6 +58,7 @@ const syncIconRotation = syncIconRotationValue.interpolate({ const folderIconRightMargin = 10; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let syncIconAnimation: any; const SideMenuContentComponent = (props: Props) => { @@ -63,6 +67,7 @@ const SideMenuContentComponent = (props: Props) => { const styles_ = useMemo(() => { const theme = themeStyle(props.themeId); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const styles: any = { menu: { flex: 1, @@ -147,6 +152,7 @@ const SideMenuContentComponent = (props: Props) => { const folder = folderOrAll as FolderEntity; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const menuItems: any[] = []; if (folder && folder.id === getTrashFolderId()) { @@ -370,6 +376,7 @@ const SideMenuContentComponent = (props: Props) => { if (actionDone === 'auth') props.dispatch({ type: 'SIDE_MENU_CLOSE' }); }, [performSync, props.dispatch]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const renderFolderIcon = (folderId: string, theme: any, folderIcon: FolderIcon) => { if (!folderIcon) { if (folderId === getTrashFolderId()) { @@ -393,6 +400,7 @@ const SideMenuContentComponent = (props: Props) => { const renderFolderItem = (folder: FolderEntity, selected: boolean, hasChildren: boolean, depth: number) => { const theme = themeStyle(props.themeId); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const folderButtonStyle: any = { flex: 1, flexDirection: 'row', @@ -404,6 +412,7 @@ const SideMenuContentComponent = (props: Props) => { if (selected) folderButtonStyle.backgroundColor = theme.selectedColor; folderButtonStyle.paddingLeft = depth * 10 + theme.marginLeft; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const iconWrapperStyle: any = { paddingLeft: 10, paddingRight: 10 }; if (selected) iconWrapperStyle.backgroundColor = theme.selectedColor; diff --git a/packages/app-mobile/plugins/PlatformImplementation.ts b/packages/app-mobile/plugins/PlatformImplementation.ts index b57eaa56a..649ec55a2 100644 --- a/packages/app-mobile/plugins/PlatformImplementation.ts +++ b/packages/app-mobile/plugins/PlatformImplementation.ts @@ -12,6 +12,7 @@ import Clipboard from '@react-native-community/clipboard'; interface Components { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied [key: string]: any; } @@ -60,6 +61,7 @@ export default class PlatformImplementation extends BasePlatformImplementation { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public registerComponent(name: string, component: any) { this.components_[name] = component; } @@ -81,6 +83,7 @@ export default class PlatformImplementation extends BasePlatformImplementation { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public get nativeImage(): any { return null; } diff --git a/packages/app-mobile/plugins/PluginRunner/backgroundPage/initializeDialogWebView.ts b/packages/app-mobile/plugins/PluginRunner/backgroundPage/initializeDialogWebView.ts index d800af0e2..67a20b651 100644 --- a/packages/app-mobile/plugins/PluginRunner/backgroundPage/initializeDialogWebView.ts +++ b/packages/app-mobile/plugins/PluginRunner/backgroundPage/initializeDialogWebView.ts @@ -61,6 +61,7 @@ const initializeDialogWebView = (messageChannelId: string) => { }; const messenger = new WebViewToRNMessenger(messageChannelId, localApi); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (window as any).webviewApi = { postMessage: messenger.remoteApi.postMessage, onMessage: messenger.remoteApi.onMessage, @@ -71,6 +72,7 @@ const initializeDialogWebView = (messageChannelId: string) => { // If dialog content scripts were bundled with Webpack for NodeJS, // they may expect a global "exports" to be present. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (window as any).exports ??= {}; }; diff --git a/packages/app-mobile/plugins/PluginRunner/backgroundPage/initializePluginBackgroundIframe.ts b/packages/app-mobile/plugins/PluginRunner/backgroundPage/initializePluginBackgroundIframe.ts index 776914135..afe27eaa2 100644 --- a/packages/app-mobile/plugins/PluginRunner/backgroundPage/initializePluginBackgroundIframe.ts +++ b/packages/app-mobile/plugins/PluginRunner/backgroundPage/initializePluginBackgroundIframe.ts @@ -9,6 +9,7 @@ export const initializePluginBackgroundIframe = async (messageChannelId: string) const messenger = new WindowMessenger(messageChannelId, parent, localApi); await messenger.awaitRemoteReady(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (window as any).joplin = messenger.remoteApi.api.joplin; reportUnhandledErrors(messenger.remoteApi.onError); diff --git a/packages/app-mobile/plugins/PluginRunner/backgroundPage/utils/getFormData.ts b/packages/app-mobile/plugins/PluginRunner/backgroundPage/utils/getFormData.ts index fe05e883d..3d66136b6 100644 --- a/packages/app-mobile/plugins/PluginRunner/backgroundPage/utils/getFormData.ts +++ b/packages/app-mobile/plugins/PluginRunner/backgroundPage/utils/getFormData.ts @@ -5,6 +5,7 @@ const getFormData = () => { const serializeForm = (form: HTMLFormElement) => { const formData = new FormData(form); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const serializedData: Record = {}; for (const key of formData.keys()) { serializedData[key] = formData.get(key); diff --git a/packages/app-mobile/plugins/PluginRunner/backgroundPage/utils/wrapConsoleLog.ts b/packages/app-mobile/plugins/PluginRunner/backgroundPage/utils/wrapConsoleLog.ts index 53df3d6a8..8c12fc7e0 100644 --- a/packages/app-mobile/plugins/PluginRunner/backgroundPage/utils/wrapConsoleLog.ts +++ b/packages/app-mobile/plugins/PluginRunner/backgroundPage/utils/wrapConsoleLog.ts @@ -10,8 +10,10 @@ const wrapConsoleLog = (onLog: OnLogCallback) => { let inOnLogCallback = false; const wrapLogFunction = (key: keyof typeof console, logLevel: LogLevel) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const originalLog = (console[key] as any) ?? (()=>{}); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied console[key] = function(...args: any[]) { originalLog.call(this, ...args); if (inOnLogCallback) return; @@ -40,6 +42,7 @@ const wrapConsoleLog = (onLog: OnLogCallback) => { } finally { inOnLogCallback = false; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied } as any; }; diff --git a/packages/app-mobile/plugins/loadPlugins.ts b/packages/app-mobile/plugins/loadPlugins.ts index 9cfa09fd7..4e70ea53e 100644 --- a/packages/app-mobile/plugins/loadPlugins.ts +++ b/packages/app-mobile/plugins/loadPlugins.ts @@ -12,6 +12,7 @@ const logger = Logger.create('loadPlugins'); type CancelEvent = { cancelled: boolean }; const loadPlugins = async ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginRunner: BasePluginRunner, pluginSettings: PluginSettings, store: Store, cancel: CancelEvent, ) => { try { diff --git a/packages/app-mobile/root.tsx b/packages/app-mobile/root.tsx index cb5c1c93a..0c5b9d15c 100644 --- a/packages/app-mobile/root.tsx +++ b/packages/app-mobile/root.tsx @@ -133,8 +133,10 @@ type SideMenuPosition = 'left' | 'right'; const logger = Logger.create('root'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let storeDispatch: any = function(_action: any) {}; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const logReducerAction = function(action: any) { if (['SIDE_MENU_OPEN_PERCENT', 'SYNC_REPORT_UPDATE'].indexOf(action.type) >= 0) return; @@ -148,6 +150,7 @@ const biometricsEnabled = (sensorInfo: SensorInfo): boolean => { return !!sensorInfo && sensorInfo.enabled; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const generalMiddleware = (store: any) => (next: any) => async (action: any) => { logReducerAction(action); PoorManIntervals.update(); // This function needs to be called regularly so put it here @@ -156,6 +159,7 @@ const generalMiddleware = (store: any) => (next: any) => async (action: any) => const newState = store.getState(); let doRefreshFolders = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await reduxSharedMiddleware(store, next, action, storeDispatch as any); if (action.type === 'NAV_GO') Keyboard.dismiss(); @@ -227,14 +231,17 @@ const generalMiddleware = (store: any) => (next: any) => async (action: any) => } if (doRefreshFolders) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await scheduleRefreshFolders((action: any) => storeDispatch(action)); } return result; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const navHistory: any[] = []; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function historyCanGoBackTo(route: any) { if (route.routeName === 'Note') return false; if (route.routeName === 'Folder') return false; @@ -262,6 +269,7 @@ const appDefaultState: AppState = { ...defaultState, sideMenuOpenPercent: 0, showPanelsDialog: false, }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const appReducer = (state = appDefaultState, action: any) => { let newState = state; let historyGoingBack = false; @@ -450,6 +458,7 @@ const appReducer = (state = appDefaultState, action: any) => { const store = createStore(appReducer, applyMiddleware(generalMiddleware)); storeDispatch = store.dispatch; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function resourceFetcher_downloadComplete(event: any) { if (event.encrypted) { void DecryptionWorker.instance().scheduleStart(); @@ -674,6 +683,7 @@ async function initialize(dispatch: Function) { reg.logger().info('Loading folders...'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await refreshFolders((action: any) => dispatch(action)); const tags = await Tag.allWithNotes(); @@ -813,6 +823,7 @@ class AppComponent extends React.Component { private urlOpenListener_: EmitterSubscription|null = null; private appStateChangeListener_: NativeEventSubscription|null = null; private themeChangeListener_: NativeEventSubscription|null = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private dropdownAlert_ = (_data: any) => new Promise(res => res); public constructor() { @@ -834,6 +845,7 @@ class AppComponent extends React.Component { PoorManIntervals.update(); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.handleOpenURL_ = (event: any) => { // logger.info('Sharing: handleOpenURL_: start'); @@ -998,6 +1010,7 @@ class AppComponent extends React.Component { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async componentDidUpdate(prevProps: any) { if (this.props.biometricsDone !== prevProps.biometricsDone && this.props.biometricsDone) { logger.info('Sharing: componentDidUpdate: biometricsDone'); @@ -1050,8 +1063,10 @@ class AppComponent extends React.Component { this.setState({ sideMenuWidth: this.getSideMenuWidth() }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public UNSAFE_componentWillReceiveProps(newProps: any) { if (newProps.syncStarted !== this.lastSyncStarted_) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!newProps.syncStarted) void refreshFolders((action: any) => this.props.dispatch(action)); this.lastSyncStarted_ = newProps.syncStarted; } @@ -1158,6 +1173,7 @@ class AppComponent extends React.Component { { shouldShowMainContent && } + {/* eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied */} (this.dropdownAlert_ = func)} /> { !shouldShowMainContent && { return { historyCanGoBack: state.historyCanGoBack, diff --git a/packages/app-mobile/services/AlarmServiceDriver.android.ts b/packages/app-mobile/services/AlarmServiceDriver.android.ts index 2576c8ddf..5a0737e96 100644 --- a/packages/app-mobile/services/AlarmServiceDriver.android.ts +++ b/packages/app-mobile/services/AlarmServiceDriver.android.ts @@ -29,6 +29,7 @@ export default class AlarmServiceDriver { } // Returns -1 if could not be found + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private alarmJoplinAlarmId(alarm: any): number { if (!alarm.data || !alarm.data.joplinNotificationId) { return -1; @@ -38,6 +39,7 @@ export default class AlarmServiceDriver { } private async alarmByJoplinNotificationId(joplinNotificationId: number) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const alarms: any[] = await ReactNativeAN.getScheduledAlarms(); for (const alarm of alarms) { const id = this.alarmJoplinAlarmId(alarm); diff --git a/packages/app-mobile/services/AlarmServiceDriver.ios.ts b/packages/app-mobile/services/AlarmServiceDriver.ios.ts index b6ada3995..abcb2f0ff 100644 --- a/packages/app-mobile/services/AlarmServiceDriver.ios.ts +++ b/packages/app-mobile/services/AlarmServiceDriver.ios.ts @@ -5,11 +5,13 @@ const PushNotificationIOS = require('@react-native-community/push-notification-i export default class AlarmServiceDriver { private hasPermission_: boolean = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private inAppNotificationHandler_: any = null; private logger_: Logger; public constructor(logger: Logger) { this.logger_ = logger; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied PushNotificationIOS.addEventListener('localNotification', (instance: any) => { if (!this.inAppNotificationHandler_) return; @@ -31,16 +33,19 @@ export default class AlarmServiceDriver { throw new Error('Available only for non-persistent alarms'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setInAppNotificationHandler(v: any) { this.inAppNotificationHandler_ = v; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async hasPermissions(perm: any = null) { if (perm !== null) return perm.alert && perm.badge && perm.sound; if (this.hasPermission_ !== null) return this.hasPermission_; return new Promise((resolve) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied PushNotificationIOS.checkPermissions(async (perm: any) => { const ok = await this.hasPermissions(perm); this.hasPermission_ = ok; @@ -50,6 +55,7 @@ export default class AlarmServiceDriver { } public async requestPermissions() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = { alert: 1, badge: 1, @@ -71,6 +77,7 @@ export default class AlarmServiceDriver { } // ID must be a string and userInfo must be supplied otherwise cancel won't work + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const iosNotification: any = { id: `${notification.id}`, alertTitle: notification.title, diff --git a/packages/app-mobile/services/voiceTyping/vosk.android.ts b/packages/app-mobile/services/voiceTyping/vosk.android.ts index 20bc89bd9..855e997a5 100644 --- a/packages/app-mobile/services/voiceTyping/vosk.android.ts +++ b/packages/app-mobile/services/voiceTyping/vosk.android.ts @@ -85,6 +85,7 @@ const languageModelUrl = (locale: string) => { if (!url.includes('{lang}')) url += '/{lang}.zip'; return url.replace(/\{lang\}/g, lang); } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (defaultSupportedLanguages as any)[lang]; } }; @@ -159,6 +160,7 @@ export const startRecording = (vosk: Vosk, options: StartOptions): Recorder => { state_ = State.Recording; const result: string[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const eventHandlers: any[] = []; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied let finalResultPromiseResolve: Function = null; diff --git a/packages/app-mobile/services/voiceTyping/vosk.ios.ts b/packages/app-mobile/services/voiceTyping/vosk.ios.ts index 02cb0e329..fc390a79f 100644 --- a/packages/app-mobile/services/voiceTyping/vosk.ios.ts +++ b/packages/app-mobile/services/voiceTyping/vosk.ios.ts @@ -1,5 +1,6 @@ // Currently disabled on iOS +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type Vosk = any; export { Vosk }; @@ -22,6 +23,7 @@ export const modelIsDownloaded = async (_locale: string) => { }; export const getVosk = async (_locale: string) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return {} as any; }; diff --git a/packages/app-mobile/setupQuickActions.ts b/packages/app-mobile/setupQuickActions.ts index 29c702ba9..889b62972 100644 --- a/packages/app-mobile/setupQuickActions.ts +++ b/packages/app-mobile/setupQuickActions.ts @@ -40,7 +40,7 @@ export default (dispatch: Function, folderId: string) => { void Note.save({ parent_id: folderId, is_todo: isTodo, - // 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/no-explicit-any -- Old code before rule was applied, Old code before rule was applied }, { provisional: true }).then((newNote: any) => { dispatch({ type: 'NAV_GO', @@ -53,7 +53,7 @@ export default (dispatch: Function, folderId: string) => { DeviceEventEmitter.addListener('quickActionShortcut', handleQuickAction); - // 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/no-explicit-any -- Old code before rule was applied, Old code before rule was applied QuickActions.popInitialAction().then(handleQuickAction).catch((reason: any) => reg.logger().error(reason)); }; diff --git a/packages/app-mobile/utils/ShareExtension.ts b/packages/app-mobile/utils/ShareExtension.ts index 3d26d5661..617d46126 100644 --- a/packages/app-mobile/utils/ShareExtension.ts +++ b/packages/app-mobile/utils/ShareExtension.ts @@ -15,6 +15,7 @@ const ShareExtension = (NativeModules.ShareExtension) ? data: () => NativeModules.ShareExtension.data(), close: () => NativeModules.ShareExtension.close(), shareURL: (Platform.OS === 'ios') ? NativeModules.ShareExtension.getConstants().SHARE_EXTENSION_SHARE_URL : '', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied addShareListener: (Platform.OS === 'android') ? ((handler: (event: any)=> void) => { if (!eventEmitter) { eventEmitter = new NativeEventEmitter(NativeModules.ShareExtension); diff --git a/packages/app-mobile/utils/debounce.tsx b/packages/app-mobile/utils/debounce.tsx index 892856266..f29964006 100644 --- a/packages/app-mobile/utils/debounce.tsx +++ b/packages/app-mobile/utils/debounce.tsx @@ -1,8 +1,10 @@ import PoorManIntervals from '@joplin/lib/PoorManIntervals'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function debounce(func: (...args: any[])=> void, timeout: number) { let timer: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (...args: any[]) => { PoorManIntervals.clearTimeout(timer); timer = PoorManIntervals.setTimeout(() => { func.apply(this, args); }, timeout); diff --git a/packages/app-mobile/utils/fs-driver/fs-driver-rn.ts b/packages/app-mobile/utils/fs-driver/fs-driver-rn.ts index 8653c7313..8bf4f9899 100644 --- a/packages/app-mobile/utils/fs-driver/fs-driver-rn.ts +++ b/packages/app-mobile/utils/fs-driver/fs-driver-rn.ts @@ -56,6 +56,7 @@ export default class FsDriverRN extends FsDriverBase { // Requires that the file already exists. // TODO: Update for compatibility with fs-driver-node's appendFile (which does not // require that the file exists). + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public appendFile(path: string, content: any, rawEncoding = 'base64') { const encoding = normalizeEncoding(rawEncoding); @@ -66,6 +67,7 @@ export default class FsDriverRN extends FsDriverBase { } // Encoding can be either "utf8", "utf-8", or "base64" + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public writeFile(path: string, content: any, rawEncoding = 'base64') { const encoding = normalizeEncoding(rawEncoding); @@ -84,6 +86,7 @@ export default class FsDriverRN extends FsDriverBase { } // Returns a format compatible with Node.js format + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private rnfsStatToStd_(stat: any, path: string) { let birthtime; const mtime = stat.lastModified ? new Date(stat.lastModified) : stat.mtime; @@ -104,12 +107,14 @@ export default class FsDriverRN extends FsDriverBase { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async readDirStats(path: string, options: any = null) { if (!options) options = {}; if (!('recursive' in options)) options.recursive = false; const isScoped = isScopedUri(path); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let stats: any[] = []; try { if (isScoped) { @@ -121,6 +126,7 @@ export default class FsDriverRN extends FsDriverBase { throw new Error(`Could not read directory: ${path}: ${error.message}`); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let output: any[] = []; for (let i = 0; i < stats.length; i++) { const stat = stats[i]; @@ -227,6 +233,7 @@ export default class FsDriverRN extends FsDriverBase { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public close(_handle: any): Promise { // Nothing return null; @@ -282,6 +289,7 @@ export default class FsDriverRN extends FsDriverBase { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async readFileChunk(handle: any, length: number, rawEncoding = 'base64') { if (!handle?.stat) { throw new JoplinError('File does not exist (reading file chunk).', 'ENOENT'); @@ -314,6 +322,7 @@ export default class FsDriverRN extends FsDriverBase { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async tarExtract(options: any) { await tarExtract({ cwd: RNFS.DocumentDirectoryPath, @@ -321,6 +330,7 @@ export default class FsDriverRN extends FsDriverBase { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async tarCreate(options: any, filePaths: string[]) { await tarCreate({ cwd: RNFS.DocumentDirectoryPath, diff --git a/packages/app-mobile/utils/initializeCommandService.ts b/packages/app-mobile/utils/initializeCommandService.ts index aa3087e43..53e685221 100644 --- a/packages/app-mobile/utils/initializeCommandService.ts +++ b/packages/app-mobile/utils/initializeCommandService.ts @@ -19,6 +19,7 @@ const registerCommands = (commands: CommandSpecification[]) => { } }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const initializeCommandService = (store: Store) => { CommandService.instance().initialize(store, Setting.value('env') === 'dev', stateToWhenClauseContext); for (const declaration of editorCommandDeclarations) { diff --git a/packages/app-mobile/utils/ipc/WebViewToRNMessenger.ts b/packages/app-mobile/utils/ipc/WebViewToRNMessenger.ts index 5e67418ba..e25f400d2 100644 --- a/packages/app-mobile/utils/ipc/WebViewToRNMessenger.ts +++ b/packages/app-mobile/utils/ipc/WebViewToRNMessenger.ts @@ -24,6 +24,7 @@ export default class WebViewToRNMessenger exten }; protected override postMessage(message: SerializableData): void { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (window as any).ReactNativeWebView.postMessage(JSON.stringify(message)); } diff --git a/packages/app-mobile/utils/types.ts b/packages/app-mobile/utils/types.ts index f76377647..1776d1344 100644 --- a/packages/app-mobile/utils/types.ts +++ b/packages/app-mobile/utils/types.ts @@ -4,8 +4,10 @@ export interface AppState extends State { sideMenuOpenPercent: number; showPanelsDialog: boolean; isOnMobileData: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied route: any; smartFilterId: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied noteSideMenuOptions: any; disableSideMenuGestures: boolean; themeId: number; diff --git a/packages/default-plugins/build.ts b/packages/default-plugins/build.ts index c9dd16a6d..2660116ba 100644 --- a/packages/default-plugins/build.ts +++ b/packages/default-plugins/build.ts @@ -6,20 +6,24 @@ const yargs = require('yargs'); const build = () => { yargs .usage('$0 [args]') + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .command('build ', 'build all', (yargs: any) => { yargs.positional('outputDir', { type: 'string', describe: 'Path to the parent directory for built output', }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied }, async (args: any) => { await buildAll(args.outputDir); process.exit(0); }) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .command('patch-plugin ', 'Edit the patch file for the given plugin ID', (yargs: any) => { yargs.positional('plugin', { type: 'string', describe: 'ID of the plugin to patch', }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied }, async (args: any) => { await editPatch(args.plugin, null); process.exit(0); diff --git a/packages/default-plugins/utils/waitForCliInput.ts b/packages/default-plugins/utils/waitForCliInput.ts index 282b15a4b..363cb1686 100644 --- a/packages/default-plugins/utils/waitForCliInput.ts +++ b/packages/default-plugins/utils/waitForCliInput.ts @@ -3,6 +3,7 @@ const readline = require('readline/promises'); /* eslint-disable no-console */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let readlineInterface: any = null; const waitForCliInput = async () => { readlineInterface ??= readline.createInterface({ diff --git a/packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.test.ts b/packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.test.ts index b22ebed9d..229d1cdaa 100644 --- a/packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.test.ts +++ b/packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.test.ts @@ -161,12 +161,14 @@ describe('CodeMirror5Emulation', () => { codeMirror.defineExtension('defineExtensionShouldOverride', testExtensionFn1); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (codeMirror as any).defineExtensionShouldOverride(); expect(testExtensionFn1).toHaveBeenCalledTimes(1); expect(testExtensionFn2).toHaveBeenCalledTimes(0); codeMirror.defineExtension('defineExtensionShouldOverride', testExtensionFn2); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (codeMirror as any).defineExtensionShouldOverride(); expect(testExtensionFn1).toHaveBeenCalledTimes(1); expect(testExtensionFn2).toHaveBeenCalledTimes(1); diff --git a/packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.ts b/packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.ts index 64f1d8a11..b8ee9aaca 100644 --- a/packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.ts +++ b/packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.ts @@ -14,13 +14,16 @@ const { pregQuote } = require('@joplin/lib/string-utils-common'); type CodeMirror5Command = (codeMirror: CodeMirror5Emulation)=> void; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type EditorEventCallback = (editor: CodeMirror5Emulation, ...args: any[])=> void; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type OptionUpdateCallback = (editor: CodeMirror5Emulation, newVal: any, oldVal: any)=> void; type OverlayType = StreamParser|{ query: RegExp }; interface CodeMirror5OptionRecord { onUpdate: OptionUpdateCallback; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; } @@ -53,10 +56,12 @@ export default class CodeMirror5Emulation extends BaseCodeMirror5Emulation { private _options: Record = Object.create(null); private _decorator: Decorator; private _decoratorExtension: Extension; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private _userExtensions: Record = Object.create(null); private _builtInOptions: CodeMirror5BuiltInOptions; // Used by some plugins to store state. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public state: Record = Object.create(null); public Vim = Vim; @@ -167,6 +172,7 @@ export default class CodeMirror5Emulation extends BaseCodeMirror5Emulation { ); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static signal(target: CodeMirror5Emulation, eventName: string, ...args: any[]) { const listeners = target._events[eventName] ?? []; @@ -272,6 +278,7 @@ export default class CodeMirror5Emulation extends BaseCodeMirror5Emulation { handle: lineNumber, text: line.text, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied gutterMarkers: [] as any[], textClass: ['cm-line', ...this._decorator.getLineClasses(lineNumber)], bgClass: '', @@ -297,6 +304,7 @@ export default class CodeMirror5Emulation extends BaseCodeMirror5Emulation { pos: DocumentPosition|DocumentPositionRange, margin?: number, ): void { const isPosition = (arg: unknown): arg is DocumentPosition => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (arg as any).line !== undefined && (arg as any).ch !== undefined; }; @@ -307,11 +315,14 @@ export default class CodeMirror5Emulation extends BaseCodeMirror5Emulation { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public defineExtension(name: string, value: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (CodeMirror5Emulation.prototype as any)[name] = value; this._userExtensions[name] = value; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public defineOption(name: string, defaultValue: any, onUpdate: OptionUpdateCallback) { this._options[name] = { value: defaultValue, @@ -321,6 +332,7 @@ export default class CodeMirror5Emulation extends BaseCodeMirror5Emulation { } // Override codemirror-vim's setOption to allow user-defined options + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override setOption(name: string, value: any) { if (name in this._options) { const oldValue = this._options[name].value; @@ -333,6 +345,7 @@ export default class CodeMirror5Emulation extends BaseCodeMirror5Emulation { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override getOption(name: string): any { if (name in this._options) { return this._options[name].value; @@ -357,6 +370,7 @@ export default class CodeMirror5Emulation extends BaseCodeMirror5Emulation { // codemirror-vim's API doesn't match the API docs here -- it expects addOverlay // to return a SearchQuery. As such, this override returns "any". + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override addOverlay(modeObject: OverlayType): any { if ('query' in modeObject) { return super.addOverlay(modeObject); @@ -365,6 +379,7 @@ export default class CodeMirror5Emulation extends BaseCodeMirror5Emulation { return this._decorator.addOverlay(modeObject); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override removeOverlay(overlay?: OverlayType): void { super.removeOverlay(overlay); this._decorator.removeOverlay(overlay); @@ -458,6 +473,7 @@ export default class CodeMirror5Emulation extends BaseCodeMirror5Emulation { // as any: Required to properly extend the base class -- without this, // the commands dictionary isn't known (by TypeScript) to have the same // properties as the commands dictionary in the parent class. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return commands as any; })(); @@ -494,6 +510,7 @@ export default class CodeMirror5Emulation extends BaseCodeMirror5Emulation { return commandName in CodeMirror5Emulation.commands || typeof this._userExtensions[commandName] === 'function'; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public execCommand(name: string, ...args: any[]) { if (!this.commandExists(name)) { this.logMessage(`Unsupported CodeMirror command, ${name}`); diff --git a/packages/editor/CodeMirror/CodeMirror5Emulation/Decorator.ts b/packages/editor/CodeMirror/CodeMirror5Emulation/Decorator.ts index cd5d111e3..4833dee96 100644 --- a/packages/editor/CodeMirror/CodeMirror5Emulation/Decorator.ts +++ b/packages/editor/CodeMirror/CodeMirror5Emulation/Decorator.ts @@ -142,6 +142,7 @@ export default class Decorator { } private _decorationCache: Record = Object.create(null); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private _overlays: (StreamParser)[] = []; private classNameToCssDecoration(className: string, isLineDecoration: boolean, id?: number) { @@ -272,6 +273,7 @@ export default class Decorator { ); let lastPos = 0; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (reader as any).baseToken ??= (): null => null; while (!reader.eol()) { @@ -334,6 +336,7 @@ export default class Decorator { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public removeOverlay(overlay: any) { this._overlays = this._overlays.filter(other => other !== overlay); diff --git a/packages/editor/CodeMirror/CodeMirrorControl.ts b/packages/editor/CodeMirror/CodeMirrorControl.ts index f7a7a1a72..4ff54dfc4 100644 --- a/packages/editor/CodeMirror/CodeMirrorControl.ts +++ b/packages/editor/CodeMirror/CodeMirrorControl.ts @@ -17,6 +17,7 @@ interface Callbacks { onLogMessage: LogMessageCallback; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type EditorUserCommand = (...args: any[])=> any; export default class CodeMirrorControl extends CodeMirror5Emulation implements EditorControl { @@ -38,6 +39,7 @@ export default class CodeMirrorControl extends CodeMirror5Emulation implements E return name in editorCommands || this._userCommands.has(name) || super.commandExists(name); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public override execCommand(name: string, ...args: any[]) { let commandOutput; if (this._userCommands.has(name)) { diff --git a/packages/editor/CodeMirror/editorCommands/editorCommands.ts b/packages/editor/CodeMirror/editorCommands/editorCommands.ts index 954f4709e..5e292bd7a 100644 --- a/packages/editor/CodeMirror/editorCommands/editorCommands.ts +++ b/packages/editor/CodeMirror/editorCommands/editorCommands.ts @@ -13,6 +13,7 @@ import sortSelectedLines from './sortSelectedLines'; import { closeSearchPanel, findNext, findPrevious, openSearchPanel, replaceAll, replaceNext } from '@codemirror/search'; import { focus } from '@joplin/lib/utils/focusHandler'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type EditorCommandFunction = (editor: EditorView, ...args: any[])=> void|any; const replaceSelectionCommand = (editor: EditorView, toInsert: string) => { diff --git a/packages/editor/CodeMirror/pluginApi/PluginLoader.ts b/packages/editor/CodeMirror/pluginApi/PluginLoader.ts index a48efaa81..f285e9ed9 100644 --- a/packages/editor/CodeMirror/pluginApi/PluginLoader.ts +++ b/packages/editor/CodeMirror/pluginApi/PluginLoader.ts @@ -5,6 +5,7 @@ import codeMirrorRequire from './codeMirrorRequire'; let pluginScriptIdCounter = 0; let pluginLoaderCounter = 0; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type OnScriptLoadCallback = (exports: any)=> void; type OnPluginRemovedCallback = ()=> void; @@ -27,10 +28,13 @@ export default class PluginLoader { // addPlugin works by creating `; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const processImgTag = (baseDir: string, _name: string, attrs: any): string => { const src = attrValue(attrs, 'src'); if (!src) return null; @@ -140,6 +146,7 @@ const processImgTag = (baseDir: string, _name: string, attrs: any): string => { return ``; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const processAnchorTag = (baseDir: string, _name: string, attrs: any): string => { const href = attrValue(attrs, 'href'); if (!href) return null; @@ -185,6 +192,7 @@ export default async function htmlpack(inputFile: string, outputFile: string): P const parser = new htmlparser2.Parser({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onopentag: (name: string, attrs: any) => { name = name.toLowerCase(); diff --git a/packages/lib/ArrayUtils.ts b/packages/lib/ArrayUtils.ts index 24026da45..9e68723c5 100644 --- a/packages/lib/ArrayUtils.ts +++ b/packages/lib/ArrayUtils.ts @@ -1,9 +1,11 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const unique = function(array: T[]): T[] { return array.filter((elem, index, self) => { return index === self.indexOf(elem); }); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const removeElement = function(array: T[], element: T): T[] { const index = array.indexOf(element); if (index < 0) return array; @@ -13,6 +15,7 @@ export const removeElement = function(array: T[], element: T): T[ }; // https://stackoverflow.com/a/10264318/561309 +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const binarySearch = function(items: any[], value: any) { let startIndex = 0, stopIndex = items.length - 1, @@ -34,6 +37,7 @@ export const binarySearch = function(items: any[], value: any) { return items[middle] !== value ? -1 : middle; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const findByKey = function(array: any[], key: any, value: any) { for (let i = 0; i < array.length; i++) { const o = array[i]; @@ -43,6 +47,7 @@ export const findByKey = function(array: any[], key: any, value: any) { return null; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const contentEquals = function(array1: any[], array2: any[]) { if (array1 === array2) return true; if (!array1.length && !array2.length) return true; @@ -58,9 +63,11 @@ export const contentEquals = function(array1: any[], array2: any[]) { // Merges multiple overlapping intervals into a single interval // e.g. [0, 25], [20, 50], [75, 100] --> [0, 50], [75, 100] +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const mergeOverlappingIntervals = function(intervals: any[], limit: number) { intervals.sort((a, b) => a[0] - b[0]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const stack: any[] = []; if (intervals.length) { stack.push(intervals[0]); @@ -78,6 +85,7 @@ export const mergeOverlappingIntervals = function(intervals: any[], limit: numbe return stack; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const shuffle = function(array: any[]) { array = array.slice(); for (let i = array.length - 1; i > 0; i--) { @@ -91,7 +99,9 @@ export const shuffle = function(array: any[]) { // Used to replace lodash.pull, so that we don't need to import the whole // package. Not optimised. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const pull = (array: any[], ...elements: any[]) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any[] = []; for (const e of array) { if (elements.includes(e)) continue; diff --git a/packages/lib/AsyncActionQueue.ts b/packages/lib/AsyncActionQueue.ts index 8073125fc..95e2f7e2f 100644 --- a/packages/lib/AsyncActionQueue.ts +++ b/packages/lib/AsyncActionQueue.ts @@ -6,6 +6,7 @@ export interface QueueItemAction { export interface QueueItem { action: QueueItemAction; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied context: any; } @@ -23,6 +24,7 @@ export default class AsyncActionQueue { private queue_: QueueItem[] = []; private interval_: number; private intervalType_: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private scheduleProcessingIID_: any = null; private processing_ = false; @@ -31,6 +33,7 @@ export default class AsyncActionQueue { this.intervalType_ = intervalType; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public push(action: QueueItemAction, context: any = null) { this.queue_.push({ action: action, diff --git a/packages/lib/BaseApplication.ts b/packages/lib/BaseApplication.ts index 1c65ae59b..8fb0515a4 100644 --- a/packages/lib/BaseApplication.ts +++ b/packages/lib/BaseApplication.ts @@ -80,8 +80,11 @@ export const safeModeFlagFilename = 'force-safe-mode-on-next-start'; export default class BaseApplication { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private eventEmitter_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private scheduleAutoAddResourcesIID_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private database_: any = null; private profileConfig_: ProfileConfig = null; @@ -91,8 +94,10 @@ export default class BaseApplication { // Note: this is basically a cache of state.selectedFolderId. It should *only* // be derived from the state and not set directly since that would make the // state and UI out of sync. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected currentFolder_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected store_: Store = null; private rotatingLogs: RotatingLogs; @@ -155,6 +160,7 @@ export default class BaseApplication { this.switchCurrentFolder(newFolder); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public switchCurrentFolder(folder: any) { if (!this.hasGui()) { this.currentFolder_ = { ...folder }; @@ -199,6 +205,7 @@ export default class BaseApplication { process.exit(code); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async refreshNotes(state: any, useSelectedNoteId = false, noteHash = '') { let parentType = state.notesParentType; let parentId = null; @@ -303,6 +310,7 @@ export default class BaseApplication { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private resourceFetcher_downloadComplete(event: any) { if (event.encrypted) { void DecryptionWorker.instance().scheduleStart(); @@ -313,6 +321,7 @@ export default class BaseApplication { ResourceFetcher.instance().scheduleAutoAddResources(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public reducerActionToString(action: any) { const o = [action.type]; if ('id' in action) o.push(action.id); @@ -334,6 +343,7 @@ export default class BaseApplication { } public generalMiddlewareFn() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const middleware = (store: any) => (next: any) => (action: any) => { return this.generalMiddleware(store, next, action); }; @@ -341,7 +351,9 @@ export default class BaseApplication { return middleware; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected async applySettingsSideEffects(action: any = null) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const sideEffects: any = { 'dateFormat': async () => { time.setLocale(Setting.value('locale')); @@ -416,6 +428,7 @@ export default class BaseApplication { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected async generalMiddleware(store: any, next: any, action: any) { // appLogger.debug('Reducer action', this.reducerActionToString(action)); @@ -425,6 +438,7 @@ export default class BaseApplication { let refreshNotesUseSelectedNoteId = false; let refreshNotesHash = ''; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await reduxSharedMiddleware(store, next, action, ((action: any) => { this.dispatch(action); }) as any); const newState = store.getState() as State; @@ -560,23 +574,28 @@ export default class BaseApplication { if (doRefreshFolders) { if (doRefreshFolders === 'now') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await refreshFolders((action: any) => this.dispatch(action)); } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await scheduleRefreshFolders((action: any) => this.dispatch(action)); } } return result; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public dispatch(action: any) { if (this.store()) return this.store().dispatch(action); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public reducer(state: any = defaultState, action: any) { return reducer(state, action); } public initRedux() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.store_ = createStore(this.reducer, applyMiddleware(this.generalMiddlewareFn() as any)); setStore(this.store_); @@ -607,6 +626,7 @@ export default class BaseApplication { flagContent = flagContent.trim(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let flags: any = splitCommandString(flagContent); flags.splice(0, 0, 'cmd'); flags.splice(0, 0, 'node'); @@ -630,6 +650,7 @@ export default class BaseApplication { shim.setInterval(() => { void processLogs(); }, 24 * 60 * 60 * 1000); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async start(argv: string[], options: StartOptions = null): Promise { options = { keychainEnabled: true, diff --git a/packages/lib/BaseModel.ts b/packages/lib/BaseModel.ts index 0b2108f9c..ec5eda40a 100644 --- a/packages/lib/BaseModel.ts +++ b/packages/lib/BaseModel.ts @@ -60,6 +60,7 @@ class BaseModel { // TODO: This ancient part of Joplin about model types is a bit of a // mess and should be refactored properly. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static typeEnum_: any[] = [ ['TYPE_NOTE', ModelType.Note], ['TYPE_FOLDER', ModelType.Folder], @@ -98,6 +99,7 @@ class BaseModel { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public static dispatch: Function = function() {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static saveMutexes_: any = {}; private static db_: JoplinDatabase; @@ -110,10 +112,12 @@ class BaseModel { throw new Error('Must be overriden'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static setDb(db: any) { this.db_ = db; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static addModelMd(model: any): any { if (!model) return model; @@ -138,6 +142,7 @@ class BaseModel { return false; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static byId(items: any[], id: string) { for (let i = 0; i < items.length; i++) { if (items[i].id === id) return items[i]; @@ -146,6 +151,7 @@ class BaseModel { } public static defaultValues(fieldNames: string[]) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (const n of fieldNames) { output[n] = this.db().fieldDefaultValue(this.tableName(), n); @@ -153,6 +159,7 @@ class BaseModel { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static modelIndexById(items: any[], id: string) { for (let i = 0; i < items.length; i++) { if (items[i].id === id) return i; @@ -160,6 +167,7 @@ class BaseModel { return -1; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static modelsByIds(items: any[], ids: string[]) { const output = []; for (let i = 0; i < items.length; i++) { @@ -214,6 +222,7 @@ class BaseModel { return temp; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static fieldType(name: string, defaultValue: any = null) { const fields = this.fields(); for (let i = 0; i < fields.length; i++) { @@ -227,7 +236,9 @@ class BaseModel { return this.db().tableFields(this.tableName()); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static removeUnknownFields(model: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newModel: any = {}; for (const n in model) { if (!model.hasOwnProperty(n)) continue; @@ -239,6 +250,7 @@ class BaseModel { public static new() { const fields = this.fields(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (let i = 0; i < fields.length; i++) { const f = fields[i]; @@ -247,6 +259,7 @@ class BaseModel { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static modOptions(options: any) { if (!options) { options = {}; @@ -259,13 +272,14 @@ class BaseModel { return options; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static count(options: any = null) { if (!options) options = {}; let sql = `SELECT count(*) as total FROM \`${this.tableName()}\``; if (options.where) sql += ` WHERE ${options.where}`; return this.db() .selectOne(sql) - // 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/no-explicit-any -- Old code before rule was applied, Old code before rule was applied .then((r: any) => { return r ? r['total'] : 0; }); @@ -283,12 +297,14 @@ class BaseModel { return this.modelSelectAll(`SELECT * FROM \`${this.tableName()}\` WHERE \`id\` LIKE ?`, [`${partialId}%`]); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static applySqlOptions(options: LoadOptions, sql: string, params: any[] = null) { if (!options) options = {}; if (options.order && options.order.length) { sql += ` ORDER BY ${paginationToSql({ limit: options.limit, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied order: options.order as any, page: 1, caseInsensitive: options.caseInsensitive, @@ -300,9 +316,11 @@ class BaseModel { return { sql: sql, params: params }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async allIds(options: any = null) { const q = this.applySqlOptions(options, `SELECT id FROM \`${this.tableName()}\``); const rows = await this.db().selectAll(q.sql, q.params); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return rows.map((r: any) => r.id); } @@ -311,6 +329,7 @@ class BaseModel { if (!options.fields) options.fields = '*'; let sql = `SELECT ${this.db().escapeFields(options.fields)} FROM \`${this.tableName()}\``; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let params: any[] = []; if (options.where) { sql += ` WHERE ${options.where}`; @@ -332,6 +351,7 @@ class BaseModel { return this.modelSelectAll(q.sql); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async search(options: any = null) { if (!options) options = {}; if (!options.fields) options.fields = '*'; @@ -354,6 +374,7 @@ class BaseModel { return this.modelSelectAll(query.sql, query.params); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async modelSelectOne(sqlOrSqlQuery: string | SqlQuery, params: any[] = null) { if (params === null) params = []; let sql = ''; @@ -374,6 +395,7 @@ class BaseModel { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async modelSelectAll(sqlOrSqlQuery: string | SqlQuery, params: any[] = null): Promise { if (params === null) params = []; let sql = ''; @@ -399,6 +421,7 @@ class BaseModel { return this.db().escapeFieldsToString(options.fields); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static loadByField(fieldName: string, fieldValue: any, options: LoadOptions = null) { if (!options) options = {}; if (!('caseInsensitive' in options)) options.caseInsensitive = false; @@ -408,6 +431,7 @@ class BaseModel { return this.modelSelectOne(sql, [fieldValue]); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static loadByFields(fields: any, options: LoadOptions = null) { if (!options) options = {}; if (!('caseInsensitive' in options)) options.caseInsensitive = false; @@ -423,11 +447,14 @@ class BaseModel { return this.modelSelectOne(sql, params); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static loadByTitle(fieldValue: any) { return this.modelSelectOne(`SELECT * FROM \`${this.tableName()}\` WHERE \`title\` = ?`, [fieldValue]); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static diffObjects(oldModel: any, newModel: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; const fields = this.diffObjectsFields(oldModel, newModel); for (let i = 0; i < fields.length; i++) { @@ -437,6 +464,7 @@ class BaseModel { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static diffObjectsFields(oldModel: any, newModel: any) { const output = []; for (const n in newModel) { @@ -449,14 +477,17 @@ class BaseModel { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static modelsAreSame(oldModel: any, newModel: any) { const diff = this.diffObjects(oldModel, newModel); delete diff.type_; return !Object.getOwnPropertyNames(diff).length; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static saveMutex(modelOrId: any) { const noLockMutex = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied acquire: function(): any { return null; }, @@ -476,7 +507,7 @@ class BaseModel { return mutex; } - // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied public static releaseSaveMutex(modelOrId: any, release: Function) { if (!release) return; if (!modelOrId) return release(); @@ -492,7 +523,9 @@ class BaseModel { release(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static saveQuery(o: any, options: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let temp: any = {}; const fieldNames = this.fieldNames(); for (let i = 0; i < fieldNames.length; i++) { @@ -505,6 +538,7 @@ class BaseModel { // be part of the final list of fields if autoTimestamp is on. // id also will stay. if (!options.isNew && options.fields) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const filtered: any = {}; for (const k in temp) { if (!temp.hasOwnProperty(k)) continue; @@ -517,6 +551,7 @@ class BaseModel { o = temp; let modelId = temp.id; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let query: any = {}; const timeNow = time.unixMs(); @@ -569,6 +604,7 @@ class BaseModel { return query; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static userSideValidation(o: any) { if (o.id && !o.id.match(/^[a-f0-9]{32}$/)) { throw new Error('Validation error: ID must a 32-characters lowercase hexadecimal string'); @@ -580,6 +616,7 @@ class BaseModel { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async save(o: any, options: SaveOptions = null) { // When saving, there's a mutex per model ID. This is because the model returned from this function // is basically its input `o` (instead of being read from the database, for performance reasons). @@ -651,6 +688,7 @@ class BaseModel { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static isNew(object: any, options: any) { if (options && 'isNew' in options) { // options.isNew can be "auto" too @@ -661,6 +699,7 @@ class BaseModel { return !object.id; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static filterArray(models: any[]) { const output = []; for (let i = 0; i < models.length; i++) { @@ -669,6 +708,7 @@ class BaseModel { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static filter(model: any) { if (!model) return model; @@ -721,6 +761,7 @@ class BaseModel { for (let i = 0; i < BaseModel.typeEnum_.length; i++) { const e = BaseModel.typeEnum_[i]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (BaseModel as any)[e[0]] = e[1]; } diff --git a/packages/lib/BaseSyncTarget.ts b/packages/lib/BaseSyncTarget.ts index 66b1ba5b5..52cb0d941 100644 --- a/packages/lib/BaseSyncTarget.ts +++ b/packages/lib/BaseSyncTarget.ts @@ -16,12 +16,17 @@ export default class BaseSyncTarget { public static dispatch: Function = () => {}; private synchronizer_: Synchronizer = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private initState_: any = null; private logger_: Logger = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private options_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private db_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected fileApi_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(db: any, options: any = null) { this.db_ = db; this.options_ = options; @@ -49,6 +54,7 @@ export default class BaseSyncTarget { return false; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public option(name: string, defaultValue: any = null) { return this.options_ && name in this.options_ ? this.options_[name] : defaultValue; } @@ -66,6 +72,7 @@ export default class BaseSyncTarget { } // If [] is returned it means all platforms are supported + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static unsupportedPlatforms(): any[] { return []; } @@ -96,6 +103,7 @@ export default class BaseSyncTarget { throw new Error('initSynchronizer() not implemented'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected async initFileApi(): Promise { throw new Error('initFileApi() not implemented'); } @@ -109,6 +117,7 @@ export default class BaseSyncTarget { // Usually each sync target should create and setup its own file API via initFileApi() // but for testing purposes it might be convenient to provide it here so that multiple // clients can share and sync to the same file api (see test-utils.js) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setFileApi(v: any) { this.fileApi_ = v; } @@ -149,6 +158,7 @@ export default class BaseSyncTarget { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async checkConfig(_options: any): Promise { throw new Error('Not implemented'); } diff --git a/packages/lib/ClipperServer.ts b/packages/lib/ClipperServer.ts index 31ed88d72..683a0acca 100644 --- a/packages/lib/ClipperServer.ts +++ b/packages/lib/ClipperServer.ts @@ -17,6 +17,7 @@ export default class ClipperServer { private logger_: Logger; private startState_: StartState = StartState.Idle; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private server_: any = null; private port_: number = null; private api_: Api = null; @@ -39,9 +40,11 @@ export default class ClipperServer { return this.api_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public initialize(actionApi: any = null) { this.api_ = new Api(() => { return Setting.value('api.token'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied }, (action: any) => { this.dispatch(action); }, actionApi); } @@ -58,6 +61,7 @@ export default class ClipperServer { this.dispatch_ = d; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public dispatch(action: any) { if (!this.dispatch_) throw new Error('dispatch not set!'); this.dispatch_(action); @@ -119,7 +123,9 @@ export default class ClipperServer { this.server_ = require('http').createServer(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.server_.on('request', async (request: any, response: any) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const writeCorsHeaders = (code: any, contentType = 'application/json', additionalHeaders: any = null) => { const headers = { @@ -132,18 +138,21 @@ export default class ClipperServer { response.writeHead(code, headers); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const writeResponseJson = (code: any, object: any) => { writeCorsHeaders(code); response.write(JSON.stringify(object)); response.end(); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const writeResponseText = (code: any, text: any) => { writeCorsHeaders(code, 'text/plain'); response.write(text); response.end(); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const writeResponseInstance = (code: any, instance: any) => { if (instance.type === 'attachment') { const filename = instance.attachmentFilename ? instance.attachmentFilename : 'file'; @@ -157,6 +166,7 @@ export default class ClipperServer { } }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const writeResponse = (code: any, response: any) => { if (response instanceof ApiResponse) { writeResponseInstance(code, response); @@ -173,6 +183,7 @@ export default class ClipperServer { const url = urlParser.parse(request.url, true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const execRequest = async (request: any, body = '', files: RequestFile[] = []) => { try { const response = await this.api_.route(request.method, url.pathname, url.query, body, files); @@ -198,6 +209,7 @@ export default class ClipperServer { if (contentType.indexOf('multipart/form-data') === 0) { const form = new multiparty.Form(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied form.parse(request, (error: any, fields: any, files: any) => { if (error) { writeResponse(error.httpCode ? error.httpCode : 500, error.message); @@ -210,6 +222,7 @@ export default class ClipperServer { if (request.method === 'POST' || request.method === 'PUT') { let body = ''; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied request.on('data', (data: any) => { body += data; }); diff --git a/packages/lib/HtmlToMd.ts b/packages/lib/HtmlToMd.ts index d32b8e38b..0150df7ad 100644 --- a/packages/lib/HtmlToMd.ts +++ b/packages/lib/HtmlToMd.ts @@ -17,6 +17,7 @@ export interface ParseOptions { export default class HtmlToMd { public parse(html: string, options: ParseOptions = {}) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const turndownOpts: any = { headingStyle: 'atx', anchorNames: options.anchorNames ? options.anchorNames.map(n => n.trim().toLowerCase()) : [], @@ -38,6 +39,7 @@ export default class HtmlToMd { if (options.convertEmbeddedPdfsToLinks) { // Turndown ignores empty tags, so we need to handle this case separately // https://github.com/mixmark-io/turndown/issues/293#issuecomment-588984202 + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied turndownOpts.blankReplacement = (content: string, node: any) => { if (node.matches('object')) { return pdfRule.replacement(content, node, {}); @@ -51,6 +53,7 @@ export default class HtmlToMd { turndown.remove('style'); const pdfRule = { filter: ['embed', 'object'], + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied replacement: function(_content: string, node: any, _options: any) { // We are setting embedded_pdf as name so that we can later distinguish them from normal links and create resources for them. if (node.matches('embed') && node.getAttribute('src') && pdfUrlRegex.test(node.getAttribute('src'))) { diff --git a/packages/lib/InMemoryCache.ts b/packages/lib/InMemoryCache.ts index d210e39d8..268eaa7fa 100644 --- a/packages/lib/InMemoryCache.ts +++ b/packages/lib/InMemoryCache.ts @@ -10,6 +10,7 @@ // scale. interface Record { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; expiredTime: number; } @@ -55,6 +56,7 @@ export default class Cache { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public value(key: string, defaultValue: any = undefined): any { this.checkExpiredRecords(); if (key in this.records_) return this.records_[key].value; @@ -62,6 +64,7 @@ export default class Cache { return defaultValue; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setValue(key: string, value: any, ttl = 0) { this.checkExpiredRecords(); diff --git a/packages/lib/JoplinDatabase.ts b/packages/lib/JoplinDatabase.ts index 138772cfc..abf56c18f 100644 --- a/packages/lib/JoplinDatabase.ts +++ b/packages/lib/JoplinDatabase.ts @@ -125,6 +125,7 @@ INSERT INTO version (version) VALUES (1); export interface TableField { name: string; type: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied default: any; description?: string; } @@ -139,8 +140,10 @@ export default class JoplinDatabase extends Database { private tableFields_: Record = null; private version_: number = null; private tableFieldNames_: Record = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private tableDescriptions_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(driver: any) { super(driver); } @@ -149,6 +152,7 @@ export default class JoplinDatabase extends Database { return this.initialized_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async open(options: any) { await super.open(options); return this.initialize(); @@ -167,6 +171,7 @@ export default class JoplinDatabase extends Database { return output.slice(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public tableFields(tableName: string, options: any = null) { if (options === null) options = {}; @@ -224,6 +229,7 @@ export default class JoplinDatabase extends Database { } public createDefaultRow(tableName: string) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const row: any = {}; const fields = this.tableFields(tableName); for (let i = 0; i < fields.length; i++) { diff --git a/packages/lib/JoplinError.ts b/packages/lib/JoplinError.ts index 74be7aecd..bc3c5ded2 100644 --- a/packages/lib/JoplinError.ts +++ b/packages/lib/JoplinError.ts @@ -1,8 +1,10 @@ export default class JoplinError extends Error { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public code: any = null; public details = ''; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(message: string, code: any = null, details: string = null) { super(message); this.code = code; diff --git a/packages/lib/JoplinServerApi.ts b/packages/lib/JoplinServerApi.ts index 6dbb81291..5dfb745c6 100644 --- a/packages/lib/JoplinServerApi.ts +++ b/packages/lib/JoplinServerApi.ts @@ -107,11 +107,13 @@ export default class JoplinServerApi { return this.session_ ? this.session_.user_id : ''; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static connectionErrorMessage(error: any) { const msg = error && error.message ? error.message : 'Unknown error'; return _('Could not connect to Joplin Server. Please check the Synchronisation options in the config screen. Full error was:\n\n%s', msg); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private hidePasswords(o: any): any { if (typeof o === 'string') { try { @@ -130,6 +132,7 @@ export default class JoplinServerApi { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private requestToCurl_(url: string, options: any) { const output = []; output.push('curl'); @@ -151,6 +154,7 @@ export default class JoplinServerApi { return output.join(' '); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async exec_(method: string, path = '', query: Record = null, body: any = null, headers: any = null, options: ExecOptions = null) { if (headers === null) headers = {}; if (options === null) options = {}; @@ -165,6 +169,7 @@ export default class JoplinServerApi { if (sessionId) headers['X-API-AUTH'] = sessionId; headers['X-API-MIN-VERSION'] = '2.6.0'; // Need server 2.6 for new lock support + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const fetchOptions: any = {}; fetchOptions.headers = headers; fetchOptions.method = method; @@ -195,6 +200,7 @@ export default class JoplinServerApi { logger.debug(this.requestToCurl_(url, fetchOptions)); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let response: any = null; if (options.source === 'file' && (method === 'POST' || method === 'PUT')) { @@ -229,6 +235,7 @@ export default class JoplinServerApi { return new JoplinError(message, code, `${method} ${path}: ${message} (${code}): ${shortResponseText()}`); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let responseJson_: any = null; const loadResponseJson = async () => { if (!responseText) return null; @@ -287,6 +294,7 @@ export default class JoplinServerApi { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async exec(method: string, path = '', query: Record = null, body: any = null, headers: any = null, options: ExecOptions = null) { for (let i = 0; i < 2; i++) { try { diff --git a/packages/lib/ObjectUtils.ts b/packages/lib/ObjectUtils.ts index 49fda340b..6eb0529f9 100644 --- a/packages/lib/ObjectUtils.ts +++ b/packages/lib/ObjectUtils.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function sortByValue(object: any) { const temp = []; for (const k in object) { @@ -17,6 +18,7 @@ export function sortByValue(object: any) { return v1 < v2 ? -1 : +1; }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (let i = 0; i < temp.length; i++) { const item = temp[i]; @@ -26,6 +28,7 @@ export function sortByValue(object: any) { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function fieldsEqual(o1: any, o2: any) { if ((!o1 || !o2) && o1 !== o2) return false; @@ -42,7 +45,9 @@ export function fieldsEqual(o1: any, o2: any) { return true; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function convertValuesToFunctions(o: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (const n in o) { if (!o.hasOwnProperty(n)) continue; @@ -53,6 +58,7 @@ export function convertValuesToFunctions(o: any) { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function isEmpty(o: any) { if (!o) return true; return Object.keys(o).length === 0 && o.constructor === Object; diff --git a/packages/lib/SyncTargetNone.ts b/packages/lib/SyncTargetNone.ts index 2ade2c19f..12e3a7998 100644 --- a/packages/lib/SyncTargetNone.ts +++ b/packages/lib/SyncTargetNone.ts @@ -25,6 +25,7 @@ export default class SyncTargetNone extends BaseSyncTarget { } protected async initSynchronizer() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return null as any; } } diff --git a/packages/lib/SyncTargetOneDrive.ts b/packages/lib/SyncTargetOneDrive.ts index efb463e87..7827d3280 100644 --- a/packages/lib/SyncTargetOneDrive.ts +++ b/packages/lib/SyncTargetOneDrive.ts @@ -10,12 +10,14 @@ const { FileApiDriverOneDrive } = require('./file-api-driver-onedrive.js'); export default class SyncTargetOneDrive extends BaseSyncTarget { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private api_: any; public static id() { return 3; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(db: any, options: any = null) { super(db, options); this.api_ = null; @@ -71,6 +73,7 @@ export default class SyncTargetOneDrive extends BaseSyncTarget { this.api_ = new OneDriveApi(this.oneDriveParameters().id, this.oneDriveParameters().secret, isPublic); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.api_.on('authRefreshed', (a: any) => { this.logger().info('Saving updated OneDrive auth.'); Setting.setValue(`sync.${this.syncTargetId()}.auth`, a ? JSON.stringify(a) : null); diff --git a/packages/lib/Synchronizer.ts b/packages/lib/Synchronizer.ts index 3ba2ea086..9e0419ddb 100644 --- a/packages/lib/Synchronizer.ts +++ b/packages/lib/Synchronizer.ts @@ -37,6 +37,7 @@ const { Dirnames } = require('./services/synchronizer/utils/types'); const logger = Logger.create('Synchronizer'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function isCannotSyncError(error: any): boolean { if (!error) return false; if (['rejectedByTarget', 'fileNotFound'].indexOf(error.code) >= 0) return true; @@ -64,6 +65,7 @@ export default class Synchronizer { private state_ = 'idle'; private cancelling_ = false; public maxResourceSize_: number = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private downloadQueue_: any = null; private clientId_: string; private lockHandler_: LockHandler; @@ -80,6 +82,7 @@ export default class Synchronizer { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private onProgress_: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private progressReport_: any = {}; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied @@ -152,6 +155,7 @@ export default class Synchronizer { this.shareService_ = v; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setEncryptionService(v: any) { this.encryptionService_ = v; } @@ -177,16 +181,19 @@ export default class Synchronizer { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static reportHasErrors(report: any): boolean { return !!report && !!report.errors && !!report.errors.length; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static completionTime(report: any): string { const duration = report.completedTime - report.startTime; if (duration > 1000) return `${Math.round(duration / 1000)}s`; return `${duration}ms`; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static reportToLines(report: any) { const lines = []; if (report.createLocal) lines.push(_('Created local items: %d.', report.createLocal)); @@ -203,6 +210,7 @@ export default class Synchronizer { return lines; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public logSyncOperation(action: SyncAction | 'cancelling' | 'starting' | 'fetchingTotal' | 'fetchingProcessed' | 'finished', local: any = null, remote: RemoteItem = null, message: string = null, actionCount = 1) { const line = ['Sync']; line.push(action); @@ -241,12 +249,14 @@ export default class Synchronizer { // Make sure we only send a **copy** of the report since it // is mutated within this class. Should probably use a lib // for this but for now this simple fix will do. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const reportCopy: any = {}; for (const n in this.progressReport_) reportCopy[n] = this.progressReport_[n]; if (reportCopy.errors) reportCopy.errors = this.progressReport_.errors.slice(); this.dispatch({ type: 'SYNC_REPORT_UPDATE', report: reportCopy }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async logSyncSummary(report: any) { logger.info('Operations completed: '); for (const n in report) { @@ -343,10 +353,12 @@ export default class Synchronizer { return localInfo; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async apiCall(fnName: string, ...args: any[]) { if (this.syncTargetIsLocked_) throw new JoplinError('Sync target is locked - aborting API call', 'lockError'); try { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output = await (this.api() as any)[fnName](...args); return output; } catch (error) { @@ -367,10 +379,12 @@ export default class Synchronizer { // 1. UPLOAD: Send to the sync target the items that have changed since the last sync. // 2. DELETE_REMOTE: Delete on the sync target, the items that have been deleted locally. // 3. DELTA: Find on the sync target the items that have been modified or deleted and apply the changes locally. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async start(options: any = null) { if (!options) options = {}; if (this.state() !== 'idle') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const error: any = new Error(sprintf('Synchronisation is already in progress. State: %s', this.state())); error.code = 'alreadyStarted'; throw error; @@ -404,6 +418,7 @@ export default class Synchronizer { this.logSyncOperation('starting', null, null, `Starting synchronisation to target ${syncTargetId}... supportsAccurateTimestamp = ${this.api().supportsAccurateTimestamp}; supportsMultiPut = ${this.api().supportsMultiPut}} [${synchronizationId}]`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const handleCannotSyncItem = async (ItemClass: typeof BaseItem, syncTargetId: any, item: any, cannotSyncReason: string, itemLocation: any = null) => { await ItemClass.saveSyncDisabled(syncTargetId, item, cannotSyncReason, itemLocation); }; @@ -517,6 +532,7 @@ export default class Synchronizer { syncLock = await this.lockHandler().acquireLock(LockType.Sync, this.lockClientType(), this.clientId_); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.lockHandler().startAutoLockRefresh(syncLock, (error: any) => { logger.warn('Could not refresh lock - cancelling sync. Error was:', error); this.syncTargetIsLocked_ = true; @@ -563,6 +579,7 @@ export default class Synchronizer { const result = await BaseItem.itemsThatNeedSync(syncTargetId); const locals = result.items; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await itemUploader.preUploadItems(result.items.filter((it: any) => result.neverSyncedItemIds.includes(it.id))); for (let i = 0; i < locals.length; i++) { @@ -587,6 +604,7 @@ export default class Synchronizer { let reason = ''; let remoteContent = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const getConflictType = (conflictedItem: any) => { if (conflictedItem.type_ === BaseModel.TYPE_NOTE) return SyncAction.NoteConflict; if (conflictedItem.type_ === BaseModel.TYPE_RESOURCE) return SyncAction.ResourceConflict; @@ -696,6 +714,7 @@ export default class Synchronizer { const remoteContentPath = resourceRemotePath(local.id); const result = await Resource.fullPathForSyncUpload(local); const resource = result.resource; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied local = resource as any; const localResourceContentPath = result.path; @@ -778,6 +797,7 @@ export default class Synchronizer { local, syncTargetId, itemIsReadOnly, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (action: any) => this.dispatch(action), ); @@ -946,6 +966,7 @@ export default class Synchronizer { if (!content.user_updated_time) content.user_updated_time = content.updated_time; if (!content.user_created_time) content.user_created_time = content.created_time; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = { autoTimestamp: false, nextQueries: BaseItem.updateSyncTimeQueries(syncTargetId, content, time.unixMs()), @@ -1140,6 +1161,7 @@ export default class Synchronizer { withErrors: Synchronizer.reportHasErrors(this.progressReport_), }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await checkDisabledSyncItemsNotification((action: any) => this.dispatch(action)); this.onProgress_ = function() {}; diff --git a/packages/lib/TaskQueue.ts b/packages/lib/TaskQueue.ts index a40e1aa75..453db6cb8 100644 --- a/packages/lib/TaskQueue.ts +++ b/packages/lib/TaskQueue.ts @@ -2,6 +2,7 @@ import time from './time'; import Setting from './models/Setting'; import Logger, { LoggerWrapper } from '@joplin/utils/Logger'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type TaskCallback = ()=> Promise; interface Task { @@ -11,6 +12,7 @@ interface Task { interface TaskResult { id: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied result: any; error?: Error; } @@ -76,6 +78,7 @@ export default class TaskQueue { this.processingQueue_ = true; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const completeTask = (task: Task, result: any, error: Error) => { delete this.processingTasks_[task.id]; @@ -103,7 +106,7 @@ export default class TaskQueue { // the task to complete, but still want to capture the result. task .callback() - // eslint-disable-next-line promise/prefer-await-to-then + // eslint-disable-next-line promise/prefer-await-to-then, @typescript-eslint/no-explicit-any -- Old code before rule was applied .then((result: any) => { completeTask(task, result, null); }) diff --git a/packages/lib/components/shared/config/config-shared.ts b/packages/lib/components/shared/config/config-shared.ts index 9c669abd2..baf2a3e39 100644 --- a/packages/lib/components/shared/config/config-shared.ts +++ b/packages/lib/components/shared/config/config-shared.ts @@ -13,6 +13,7 @@ const logger = Logger.create('config-shared'); interface ConfigScreenState { checkSyncConfigResult: { ok: boolean; errorMessage: string }|'checking'|null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied settings: any; changedSettingKeys: string[]; showAdvancedSettings: boolean; @@ -26,11 +27,14 @@ export const defaultScreenState: ConfigScreenState = { }; interface ConfigScreenComponent { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied settingToComponent(settingId: string, setting: any): ReactNode; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied sectionToComponent(sectionName: string, section: any, settings: any, isSelected: boolean): ReactNode; state: Partial; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied setState(callbackOrNew: any, callback?: ()=> void): void; } @@ -65,6 +69,7 @@ export const advancedSettingsButton_click = (comp: ConfigScreenComponent) => { }); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const checkSyncConfig = async (comp: ConfigScreenComponent, settings: any) => { const syncTargetId = settings['sync.target']; const SyncTargetClass = SyncTargetRegistry.classById(syncTargetId); @@ -100,6 +105,7 @@ export const checkSyncConfigMessages = (comp: ConfigScreenComponent) => { return output; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const updateSettingValue = (comp: ConfigScreenComponent, key: string, value: any, callback?: ()=> void) => { if (!callback) callback = () => {}; @@ -166,6 +172,7 @@ export const saveSettings = async (comp: ConfigScreenComponent) => { return true; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const settingsToComponents = (comp: ConfigScreenComponent, device: AppType, settings: any) => { const keys = Setting.keys(true, device); const settingComps = []; @@ -185,6 +192,7 @@ export const settingsToComponents = (comp: ConfigScreenComponent, device: AppTyp return settingComps; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type SettingsSelectorState = { device: AppType; settings: any }; const deviceSelector = (state: SettingsSelectorState) => state.device; const settingsSelector = (state: SettingsSelectorState) => state.settings; @@ -278,6 +286,7 @@ export const settingsSections = createSelector( ); export const settingsToComponents2 = ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied comp: ConfigScreenComponent, device: AppType, settings: any, selectedSectionName = '', ) => { const sectionComps: ReactNode[] = []; diff --git a/packages/lib/components/shared/config/plugins/useOnInstallHandler.ts b/packages/lib/components/shared/config/plugins/useOnInstallHandler.ts index cf5fb69e2..da8df24f5 100644 --- a/packages/lib/components/shared/config/plugins/useOnInstallHandler.ts +++ b/packages/lib/components/shared/config/plugins/useOnInstallHandler.ts @@ -22,6 +22,7 @@ const useOnInstallHandler = ( return React.useCallback(async (event: ItemEvent) => { const pluginId = event.item.manifest.id; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied setInstallingPluginIds((prev: any) => { return { ...prev, [pluginId]: true, @@ -57,6 +58,7 @@ const useOnInstallHandler = ( onPluginSettingsChange({ value: newSettings }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied setInstallingPluginIds((prev: any) => { return { ...prev, [pluginId]: false, diff --git a/packages/lib/components/shared/config/shouldShowMissingPasswordWarning.ts b/packages/lib/components/shared/config/shouldShowMissingPasswordWarning.ts index c70dc5c9e..a722ff046 100644 --- a/packages/lib/components/shared/config/shouldShowMissingPasswordWarning.ts +++ b/packages/lib/components/shared/config/shouldShowMissingPasswordWarning.ts @@ -1,5 +1,6 @@ import SyncTargetRegistry from '../../../SyncTargetRegistry'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const shouldShowMissingPasswordWarning = (syncTargetId: number, settings: any) => { const syncTargetClass = SyncTargetRegistry.classById(syncTargetId); diff --git a/packages/lib/components/shared/note-screen-shared.ts b/packages/lib/components/shared/note-screen-shared.ts index 9cbf324b5..5955c6ab1 100644 --- a/packages/lib/components/shared/note-screen-shared.ts +++ b/packages/lib/components/shared/note-screen-shared.ts @@ -13,12 +13,16 @@ import ItemChange from '../../models/ItemChange'; import BaseItem from '../../models/BaseItem'; export interface BaseNoteScreenComponent { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied props: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied state: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied setState: (newState: any)=> void; scheduleSave(): void; scheduleFocusUpdate(): void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied attachFile(asset: any, fileType: any): void; lastLoadedNoteId_?: string; } @@ -26,17 +30,24 @@ export interface BaseNoteScreenComponent { interface Shared { noteExists?: (noteId: string)=> Promise; handleNoteDeletedWhileEditing_?: (note: NoteEntity)=> Promise; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied saveNoteButton_press?: (comp: BaseNoteScreenComponent, folderId: string, options: any)=> Promise; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied saveOneProperty?: (comp: BaseNoteScreenComponent, name: string, value: any)=> void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied noteComponent_change?: (comp: BaseNoteScreenComponent, propName: string, propValue: any)=> void; clearResourceCache?: ()=> void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied attachedResources?: (noteBody: string)=> Promise; isModified?: (comp: BaseNoteScreenComponent)=> boolean; initState?: (comp: BaseNoteScreenComponent)=> Promise; toggleIsTodo_onPress?: (comp: BaseNoteScreenComponent)=> void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied toggleCheckboxRange?: (ipcMessage: string, noteBody: string)=> any; toggleCheckbox?: (ipcMessage: string, noteBody: string)=> string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied installResourceHandling?: (refreshResourceHandler: any)=> void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied uninstallResourceHandling?: (refreshResourceHandler: any)=> void; } @@ -65,6 +76,7 @@ shared.handleNoteDeletedWhileEditing_ = async (note: NoteEntity) => { return Note.load(newNote.id); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied shared.saveNoteButton_press = async function(comp: BaseNoteScreenComponent, folderId: string = null, options: any = null) { options = { autoTitle: true, ...options }; @@ -120,6 +132,7 @@ shared.saveNoteButton_press = async function(comp: BaseNoteScreenComponent, fold note.body = stateNote.body; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newState: any = { lastSavedNote: { ...note }, note: note, @@ -161,12 +174,14 @@ shared.saveNoteButton_press = async function(comp: BaseNoteScreenComponent, fold releaseMutex(); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied shared.saveOneProperty = async function(comp: BaseNoteScreenComponent, name: string, value: any) { let note = { ...comp.state.note }; const recreatedNote = await shared.handleNoteDeletedWhileEditing_(note); if (recreatedNote) note = recreatedNote; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let toSave: any = { id: note.id }; toSave[name] = value; toSave = await Note.save(toSave); @@ -178,7 +193,9 @@ shared.saveOneProperty = async function(comp: BaseNoteScreenComponent, name: str }); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied shared.noteComponent_change = function(comp: BaseNoteScreenComponent, propName: string, propValue: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newState: any = {}; const note = { ...comp.state.note }; @@ -189,6 +206,7 @@ shared.noteComponent_change = function(comp: BaseNoteScreenComponent, propName: comp.scheduleSave(); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let resourceCache_: any = {}; shared.clearResourceCache = function() { @@ -199,6 +217,7 @@ shared.attachedResources = async function(noteBody: string) { if (!noteBody) return {}; const resourceIds = await Note.linkedItemIdsByType(BaseModel.TYPE_RESOURCE, noteBody); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (let i = 0; i < resourceIds.length; i++) { const id = resourceIds[i]; @@ -325,22 +344,27 @@ function toggleCheckboxLine(ipcMessage: string, noteBody: string) { shared.toggleCheckboxRange = function(ipcMessage: string, noteBody: string) { const [lineIndex, line] = toggleCheckboxLine(ipcMessage, noteBody).slice(1); const from = { line: lineIndex, ch: 0 }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const to = { line: lineIndex, ch: (line as any).length }; return { line, from, to }; }; shared.toggleCheckbox = function(ipcMessage: string, noteBody: string) { const [newBody, lineIndex, line] = toggleCheckboxLine(ipcMessage, noteBody); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (newBody as any)[lineIndex as any] = line; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (newBody as any).join('\n'); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied shared.installResourceHandling = function(refreshResourceHandler: any) { ResourceFetcher.instance().on('downloadComplete', refreshResourceHandler); ResourceFetcher.instance().on('downloadStarted', refreshResourceHandler); DecryptionWorker.instance().on('resourceDecrypted', refreshResourceHandler); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied shared.uninstallResourceHandling = function(refreshResourceHandler: any) { ResourceFetcher.instance().off('downloadComplete', refreshResourceHandler); ResourceFetcher.instance().off('downloadStarted', refreshResourceHandler); diff --git a/packages/lib/components/shared/reduxSharedMiddleware.ts b/packages/lib/components/shared/reduxSharedMiddleware.ts index 86c8dc06f..1f6f82c9d 100644 --- a/packages/lib/components/shared/reduxSharedMiddleware.ts +++ b/packages/lib/components/shared/reduxSharedMiddleware.ts @@ -11,8 +11,10 @@ import shim from '../../shim'; import { Dispatch } from 'redux'; import { State } from '../../reducer'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let sortNoteListTimeout: any = null; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default async (store: any, _next: any, action: any, dispatch: Dispatch) => { const newState: State = store.getState(); diff --git a/packages/lib/components/shared/side-menu-shared.ts b/packages/lib/components/shared/side-menu-shared.ts index 35a13849b..df95d64f8 100644 --- a/packages/lib/components/shared/side-menu-shared.ts +++ b/packages/lib/components/shared/side-menu-shared.ts @@ -13,7 +13,9 @@ interface Props { tags?: TagEntity[]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type RenderFolderItem = (folder: FolderEntity, selected: boolean, hasChildren: boolean, depth: number)=> any; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type RenderTagItem = (tag: TagEntity, selected: boolean)=> any; function folderHasChildren_(folders: FolderEntity[], folderId: string) { @@ -43,6 +45,7 @@ function folderIsCollapsed(folders: FolderEntity[], folderId: string, collapsedF } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function renderFoldersRecursive_(props: Props, renderItem: RenderFolderItem, items: any[], parentId: string, depth: number, order: string[]) { const folders = props.folders; for (let i = 0; i < folders.length; i++) { diff --git a/packages/lib/database-driver-better-sqlite.ts b/packages/lib/database-driver-better-sqlite.ts index 20eb3cff4..ec8ff8f56 100644 --- a/packages/lib/database-driver-better-sqlite.ts +++ b/packages/lib/database-driver-better-sqlite.ts @@ -17,31 +17,37 @@ interface Options { export default class DatabaseDriverBetterSqlite { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private db_: any = null; public open(options: Options) { this.db_ = new Database(options.name); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public sqliteErrorToJsError(error: any, sql: string = null, params: any[] = null) { console.error(error.toString(), ' ---- ', sql, params); const msg = [error.toString()]; if (sql) msg.push(sql); if (params) msg.push(params); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = new Error(msg.join(': ')); if (error.code) output.code = error.code; return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async selectOne(sql: string, params: any[] = null) { return this.db_.prepare(sql).get(params ? params : []); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async selectAll(sql: string, params: any[] = null) { return this.db_.prepare(sql).all(params ? params : []); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async exec(sql: string, params: any[] = null) { return this.db_.prepare(sql).run(params ? params : []); } diff --git a/packages/lib/database.ts b/packages/lib/database.ts index a4b021aa8..e98cd7709 100644 --- a/packages/lib/database.ts +++ b/packages/lib/database.ts @@ -5,6 +5,7 @@ import { SqlParams, SqlQuery, StringOrSqlQuery } from './services/database/types const Mutex = require('async-mutex').Mutex; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type Row = Record; export default class Database { @@ -16,6 +17,7 @@ export default class Database { protected debugMode_ = false; private sqlQueryLogEnabled_ = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private driver_: any; private logger_ = new Logger(); private logExcludedQueryTypes_: string[] = []; @@ -23,6 +25,7 @@ export default class Database { private profilingEnabled_ = false; private queryId_ = 1; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(driver: any) { this.driver_ = driver; } @@ -34,6 +37,7 @@ export default class Database { // Converts the SQLite error to a regular JS error // so that it prints a stacktrace when passed to // console.error() + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public sqliteErrorToJsError(error: any, sql: string = null, params: SqlParams = null) { return this.driver().sqliteErrorToJsError(error, sql, params); } @@ -50,6 +54,7 @@ export default class Database { return this.driver_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async open(options: any) { try { await this.driver().open(options); @@ -172,6 +177,7 @@ export default class Database { return this.tryCall('selectAll', sql, params); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async selectAllFields(sql: string, params: SqlParams, field: string): Promise { const rows = await this.tryCall('selectAll', sql, params); const output = []; @@ -225,6 +231,7 @@ export default class Database { if (s) s = s.toUpperCase(); if (s === 'INTEGER') s = 'INT'; if (!(`TYPE_${s}` in this)) throw new Error(`Unknown fieldType: ${s}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (this as any)[`TYPE_${s}`]; } if (type === 'syncTarget') { @@ -248,6 +255,7 @@ export default class Database { return undefined; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static formatValue(type: number, value: any) { if (value === null || value === undefined) return null; if (type === this.TYPE_INT) return Number(value); @@ -270,6 +278,7 @@ export default class Database { if (params !== null && params.length) this.logger().debug(JSON.stringify(params)); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static insertQuery(tableName: string, data: Record) { if (!data || !Object.keys(data).length) throw new Error('Data is empty'); @@ -291,6 +300,7 @@ export default class Database { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static updateQuery(tableName: string, data: Record, where: string | Record) { if (!data || !Object.keys(data).length) throw new Error('Data is empty'); @@ -350,6 +360,7 @@ export default class Database { return sql.trim().split('\n'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public wrapQueries(queries: any[]) { const output = []; for (let i = 0; i < queries.length; i++) { @@ -358,6 +369,7 @@ export default class Database { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public wrapQuery(sql: any, params: SqlParams = null): SqlQuery { if (!sql) throw new Error(`Cannot wrap empty string: ${sql}`); diff --git a/packages/lib/dom.ts b/packages/lib/dom.ts index afa744101..75a939f82 100644 --- a/packages/lib/dom.ts +++ b/packages/lib/dom.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const isInsideContainer = (node: any, className: string): boolean => { while (node) { if (node.classList && node.classList.contains(className)) return true; @@ -6,6 +7,7 @@ export const isInsideContainer = (node: any, className: string): boolean => { return false; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const waitForElement = async (parent: any, id: string): Promise => { return new Promise((resolve, reject) => { const iid = setInterval(() => { diff --git a/packages/lib/downloadController.ts b/packages/lib/downloadController.ts index 5be7265a4..baedc8940 100644 --- a/packages/lib/downloadController.ts +++ b/packages/lib/downloadController.ts @@ -11,6 +11,7 @@ export interface DownloadController { maxImagesCount: number; imageCountExpected: number; printStats(imagesCountExpected: number): void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied handleChunk(request: any): (chunk: any)=> void; limitMessage(): string; } @@ -64,7 +65,9 @@ export class LimitedDownloadController implements DownloadController { return this.imageCountExpected_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public handleChunk(request: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (chunk: any) => { try { this.totalBytes += chunk.length; diff --git a/packages/lib/errorUtils.ts b/packages/lib/errorUtils.ts index 5c673947d..d333fb1de 100644 --- a/packages/lib/errorUtils.ts +++ b/packages/lib/errorUtils.ts @@ -3,8 +3,10 @@ // This wraps an error message, allowing to set a prefix, // while preserving all the important properties // in particular the stack trace and original error message. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function wrapError(prefix: string, error: any) { if (!error) throw new Error('Unknown error'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newError: any = new Error([prefix, error.message || ''].join(': ')); if ('name' in error) newError.name = error.name; diff --git a/packages/lib/eventManager.ts b/packages/lib/eventManager.ts index 157a0b02f..caab6ffb9 100644 --- a/packages/lib/eventManager.ts +++ b/packages/lib/eventManager.ts @@ -22,9 +22,12 @@ export enum EventName { export class EventManager { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private emitter_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private appStatePrevious_: any; private appStateWatchedProps_: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private appStateListeners_: any; public constructor() { @@ -44,6 +47,7 @@ export class EventManager { return this.emitter_.on(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public emit(eventName: EventName, object: any = null) { return this.emitter_.emit(eventName, object); } @@ -68,6 +72,7 @@ export class EventManager { return this.removeListener(`filter:${filterName}`, callback); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async filterEmit(filterName: string, object: any) { let output = object; const listeners = this.emitter_.listeners(`filter:${filterName}`); @@ -112,6 +117,7 @@ export class EventManager { this.appStateListeners_[propName].splice(idx, 1); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private stateValue_(state: any, propName: string) { const parts = propName.split('.'); let s = state; @@ -125,6 +131,7 @@ export class EventManager { // This function works by keeping a copy of the watched props and, whenever this function // is called, comparing the previous and new values and emitting events if they have changed. // The appStateEmit function should be called from a middleware. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public appStateEmit(state: any) { if (!this.appStateWatchedProps_.length) return; @@ -150,6 +157,7 @@ export class EventManager { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public once(eventName: string, callback: any) { return this.emitter_.once(eventName, callback); } diff --git a/packages/lib/file-api-driver-joplinServer.ts b/packages/lib/file-api-driver-joplinServer.ts index e193898c0..43bc1f41e 100644 --- a/packages/lib/file-api-driver-joplinServer.ts +++ b/packages/lib/file-api-driver-joplinServer.ts @@ -49,7 +49,9 @@ export default class FileApiDriverJoplinServer { return 3; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private metadataToStat_(md: any, path: string, isDeleted = false, rootPath: string) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { path: rootPath ? path.substr(rootPath.length + 1) : path, updated_time: md.updated_time, @@ -66,6 +68,7 @@ export default class FileApiDriverJoplinServer { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private metadataToStats_(mds: any[], rootPath: string) { const output = []; for (let i = 0; i < mds.length; i++) { @@ -90,6 +93,7 @@ export default class FileApiDriverJoplinServer { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async delta(path: string, options: any) { const context = options ? options.context : null; let cursor = context ? context.cursor : null; @@ -99,6 +103,7 @@ export default class FileApiDriverJoplinServer { const query = cursor ? { cursor } : {}; const response = await this.api().exec('GET', `${this.apiFilePath_(path)}/delta`, query); const stats = response.items + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .filter((item: any) => { // We don't need to know about lock changes, since this // is handled by the LockHandler. @@ -114,6 +119,7 @@ export default class FileApiDriverJoplinServer { if (item.item_name.indexOf('.resource/') === 0) return false; return true; }) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .map((item: any) => { return this.metadataToStat_(item, item.item_name, item.type === 3, ''); }); @@ -136,6 +142,7 @@ export default class FileApiDriverJoplinServer { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async list(path: string, options: any = null) { options = { context: null, @@ -153,6 +160,7 @@ export default class FileApiDriverJoplinServer { const results = await this.api().exec('GET', `${this.apiFilePath_(searchPath)}/children`, query); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newContext: any = {}; if (results.cursor) newContext.cursor = results.cursor; @@ -160,9 +168,11 @@ export default class FileApiDriverJoplinServer { items: this.metadataToStats_(results.items, isUsingWildcard ? path : ''), hasMore: results.has_more, context: newContext, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied } as any; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async get(path: string, options: any) { if (!options) options = {}; if (!options.responseFormat) options.responseFormat = 'text'; @@ -180,14 +190,17 @@ export default class FileApiDriverJoplinServer { // they can have names such as ".resources/xxxxxxxxxx' } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private isRejectedBySyncTargetError(error: any) { return error.code === 413 || error.code === 409 || error.httpCode === 413 || error.httpCode === 409; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private isReadyOnlyError(error: any) { return error && error.code === 'isReadOnly'; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async put(path: string, content: any, options: any = null) { try { const output = await this.api().exec('PUT', `${this.apiFilePath_(path)}/content`, options && options.shareId ? { share_id: options.shareId } : null, content, { @@ -207,9 +220,11 @@ export default class FileApiDriverJoplinServer { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async multiPut(items: MultiPutItem[], options: any = null) { const output = await this.api().exec('PUT', 'api/batch_items', null, { items: items }, null, options); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied for (const [, response] of Object.entries(output.items)) { if (response.error && this.isRejectedBySyncTargetError(response.error)) { response.error.code = 'rejectedByTarget'; diff --git a/packages/lib/file-api-driver-memory.ts b/packages/lib/file-api-driver-memory.ts index 755aa30a6..3e95b1fff 100644 --- a/packages/lib/file-api-driver-memory.ts +++ b/packages/lib/file-api-driver-memory.ts @@ -4,7 +4,9 @@ import { basicDelta, MultiPutItem } from './file-api'; export default class FileApiDriverMemory { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private items_: any[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private deletedItems_: any[]; public constructor() { @@ -12,6 +14,7 @@ export default class FileApiDriverMemory { this.deletedItems_ = []; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private encodeContent_(content: any) { if (content instanceof Buffer) { return content.toString('base64'); @@ -28,6 +31,7 @@ export default class FileApiDriverMemory { return true; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private decodeContent_(content: any) { if (!content) return ''; return Buffer.from(content, 'base64').toString('utf-8'); @@ -61,6 +65,7 @@ export default class FileApiDriverMemory { return Promise.resolve(item ? { ...item } : null); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async setTimestamp(path: string, timestampMs: number): Promise { const item = this.itemByPath(path); if (!item) return Promise.reject(new Error(`File not found: ${path}`)); @@ -90,6 +95,7 @@ export default class FileApiDriverMemory { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async get(path: string, options: any) { const item = this.itemByPath(path); if (!item) return Promise.resolve(null); @@ -112,6 +118,7 @@ export default class FileApiDriverMemory { this.items_.push(this.newItem(path, true)); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async put(path: string, content: any, options: any = null) { if (!options) options = {}; @@ -130,7 +137,9 @@ export default class FileApiDriverMemory { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async multiPut(items: MultiPutItem[], options: any = null) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { items: {}, }; @@ -164,6 +173,7 @@ export default class FileApiDriverMemory { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async move(oldPath: string, newPath: string): Promise { const sourceItem = this.itemByPath(oldPath); if (!sourceItem) return Promise.reject(new Error(`Path not found: ${oldPath}`)); @@ -175,6 +185,7 @@ export default class FileApiDriverMemory { this.items_ = []; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async delta(path: string, options: any = null) { const getStatFn = async (path: string) => { const output = this.items_.slice(); diff --git a/packages/lib/file-api-driver.test.ts b/packages/lib/file-api-driver.test.ts index efbc24a04..1fb6dbbbb 100644 --- a/packages/lib/file-api-driver.test.ts +++ b/packages/lib/file-api-driver.test.ts @@ -55,6 +55,7 @@ describe('file-api-driver', () => { await fileApi().put('subdir/test2.txt', 'testing2'); const files = await fileApi().list('subdir'); expect(files.items.length).toBe(2); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(files.items.map((f: any) => f.path).sort()).toEqual(['test1.txt', 'test2.txt'].sort()); })); diff --git a/packages/lib/file-api.ts b/packages/lib/file-api.ts index 95d0bdc89..7c7003596 100644 --- a/packages/lib/file-api.ts +++ b/packages/lib/file-api.ts @@ -34,12 +34,14 @@ export interface RemoteItem { // exact Joplin item updated_time value. jop_updated_time?: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied jopItem?: any; } export interface PaginatedList { items: RemoteItem[]; hasMore: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied context: any; } @@ -51,6 +53,7 @@ export const getSupportsDeltaWithItems = (deltaResponse: PaginatedList) => { return 'jopItem' in deltaResponse.items[0]; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function requestCanBeRepeated(error: any) { const errorCode = typeof error === 'object' && error.code ? error.code : null; @@ -99,7 +102,9 @@ async function tryAndRepeat(fn: Function, count: number) { class FileApi { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private baseDir_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private driver_: any; private logger_: Logger = new Logger(); private syncTargetId_: number = null; @@ -110,7 +115,7 @@ class FileApi { private remoteDateMutex_ = new Mutex(); private initialized_ = false; - // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied public constructor(baseDir: string | Function, driver: any) { this.baseDir_ = baseDir; this.driver_ = driver; @@ -266,7 +271,7 @@ class FileApi { } // DRIVER MUST RETURN PATHS RELATIVE TO `path` - // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars + // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any -- Old code before rule was applied public async list(path = '', options: any = null): Promise { if (!options) options = {}; if (!('includeHidden' in options)) options.includeHidden = false; @@ -287,10 +292,12 @@ class FileApi { } if (!options.includeDirs) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied result.items = result.items.filter((f: any) => !f.isDir); } if (options.syncItemsOnly) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied result.items = result.items.filter((f: any) => !f.isDir && BaseItem.isSystemPath(f.path)); } @@ -320,6 +327,7 @@ class FileApi { } // Returns UTF-8 encoded string by default, or a Response if `options.target = 'file'` + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public get(path: string, options: any = null) { if (!options) options = {}; if (!options.encoding) options.encoding = 'utf8'; @@ -327,6 +335,7 @@ class FileApi { return tryAndRepeat(() => this.driver_.get(this.fullPath(path), options), this.requestRepeatCount()); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async put(path: string, content: any, options: any = null) { logger.debug(`put ${this.fullPath(path)}`, options); @@ -337,6 +346,7 @@ class FileApi { return tryAndRepeat(() => this.driver_.put(this.fullPath(path), content, options), this.requestRepeatCount()); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async multiPut(items: MultiPutItem[], options: any = null) { if (!this.driver().supportsMultiPut) throw new Error('Multi PUT not supported'); return tryAndRepeat(() => this.driver_.multiPut(items, options), this.requestRepeatCount()); @@ -362,6 +372,7 @@ class FileApi { return tryAndRepeat(() => this.driver_.clearRoot(this.baseDir()), this.requestRepeatCount()); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public delta(path: string, options: any = null): Promise { logger.debug(`delta ${this.fullPath(path)}`); return tryAndRepeat(() => this.driver_.delta(this.fullPath(path), options), this.requestRepeatCount()); @@ -384,7 +395,9 @@ class FileApi { } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function basicDeltaContextFromOptions_(options: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { timestamp: 0, filesAtTimestamp: [], @@ -409,7 +422,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 +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied async function basicDelta(path: string, getDirStatFn: Function, options: any) { const outputLimit = 50; const itemIds = await options.allItemIdsHandler(); @@ -435,9 +448,11 @@ async function basicDelta(path: string, getDirStatFn: Function, options: any) { // Stats are cached until all items have been processed (until hasMore is false) if (newContext.statsCache === null) { newContext.statsCache = await getDirStatFn(path); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied newContext.statsCache.sort((a: any, b: any) => { return a.updated_time - b.updated_time; }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied newContext.statIdsCache = newContext.statsCache.filter((item: any) => BaseItem.isSystemPath(item.path)).map((item: any) => BaseItem.pathToId(item.path)); newContext.statIdsCache.sort(); // Items must be sorted to use binary search below } diff --git a/packages/lib/folders-screen-utils.ts b/packages/lib/folders-screen-utils.ts index 6b63b9bed..4ceba7eeb 100644 --- a/packages/lib/folders-screen-utils.ts +++ b/packages/lib/folders-screen-utils.ts @@ -5,6 +5,7 @@ import shim from './shim'; import { FolderLoadOptions } from './models/utils/types'; const refreshCalls_: boolean[] = []; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let scheduleRefreshFoldersIID_: any = null; export const allForDisplay = async (options: FolderLoadOptions = {}) => { diff --git a/packages/lib/fs-driver-base.ts b/packages/lib/fs-driver-base.ts index 62be46124..8d062cc61 100644 --- a/packages/lib/fs-driver-base.ts +++ b/packages/lib/fs-driver-base.ts @@ -22,10 +22,12 @@ export default class FsDriverBase { throw new Error('Not implemented: stat()'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async readFile(_path: string, _encoding = 'utf8'): Promise { throw new Error('Not implemented: readFile'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async appendFile(_path: string, _content: string, _encoding = 'base64'): Promise { throw new Error('Not implemented: appendFile'); } @@ -55,14 +57,17 @@ export default class FsDriverBase { return this.move(source, dest); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async readFileChunk(_handle: any, _length: number, _encoding = 'base64'): Promise { throw new Error('Not implemented: readFileChunk'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async open(_path: string, _mode: any): Promise { throw new Error('Not implemented: open'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async close(_handle: any): Promise { throw new Error('Not implemented: close'); } @@ -203,10 +208,12 @@ export default class FsDriverBase { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async tarExtract(_options: any) { throw new Error('Not implemented: tarExtract'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async tarCreate(_options: any, _filePaths: string[]) { throw new Error('Not implemented: tarCreate'); } diff --git a/packages/lib/fs-driver-node.ts b/packages/lib/fs-driver-node.ts index 3b3dd87f9..2807af1a5 100644 --- a/packages/lib/fs-driver-node.ts +++ b/packages/lib/fs-driver-node.ts @@ -5,9 +5,11 @@ const fs = require('fs-extra'); export default class FsDriverNode extends FsDriverBase { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private fsErrorToJsError_(error: any, path: string = null) { let msg = error.toString(); if (path !== null) msg += `. Path: ${path}`; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = new Error(msg); if (error.code) output.code = error.code; return output; @@ -99,10 +101,12 @@ export default class FsDriverNode extends FsDriverBase { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async setTimestamp(path: string, timestampDate: any) { return fs.utimes(path, timestampDate, timestampDate); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async readDirStats(path: string, options: any = null) { if (!options) options = {}; if (!('recursive' in options)) options.recursive = false; @@ -127,6 +131,7 @@ export default class FsDriverNode extends FsDriverBase { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async open(path: string, mode: any) { try { return await fs.open(path, mode); @@ -135,6 +140,7 @@ export default class FsDriverNode extends FsDriverBase { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async close(handle: any) { try { return await fs.close(handle); @@ -174,6 +180,7 @@ export default class FsDriverNode extends FsDriverBase { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async readFileChunk(handle: any, length: number, encoding = 'base64') { // let buffer = new Buffer(length); let buffer = Buffer.alloc(length); @@ -193,10 +200,12 @@ export default class FsDriverNode extends FsDriverBase { return md5File(path); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async tarExtract(options: any) { await require('tar').extract(options); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async tarCreate(options: any, filePaths: string[]) { await require('tar').create(options, filePaths); } diff --git a/packages/lib/geolocation-node.ts b/packages/lib/geolocation-node.ts index 43e43ff07..ff1e24e2e 100644 --- a/packages/lib/geolocation-node.ts +++ b/packages/lib/geolocation-node.ts @@ -18,6 +18,7 @@ interface CurrentPositionOptions {} type GeoipService = ()=> Promise; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const fetchJson = async (url: string): Promise => { let r = await shim.fetch(url); if (!r.ok) throw new Error(`Could not get geolocation: ${await r.text()}`); diff --git a/packages/lib/hooks/useAsyncEffect.ts b/packages/lib/hooks/useAsyncEffect.ts index c0bf8a696..945aac879 100644 --- a/packages/lib/hooks/useAsyncEffect.ts +++ b/packages/lib/hooks/useAsyncEffect.ts @@ -7,6 +7,7 @@ export interface AsyncEffectEvent { export type EffectFunction = (event: AsyncEffectEvent)=> Promise; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function(effect: EffectFunction, dependencies: any[]) { useEffect(() => { const event: AsyncEffectEvent = { cancelled: false }; diff --git a/packages/lib/hooks/useElementSize.ts b/packages/lib/hooks/useElementSize.ts index 6838331ef..5616d0080 100644 --- a/packages/lib/hooks/useElementSize.ts +++ b/packages/lib/hooks/useElementSize.ts @@ -7,6 +7,7 @@ interface Size { height: number; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function useElementSize(elementRef: any): Size { const [size, setSize] = useState({ width: 0, diff --git a/packages/lib/hooks/useEventListener.ts b/packages/lib/hooks/useEventListener.ts index c2b1304b4..34a144e74 100644 --- a/packages/lib/hooks/useEventListener.ts +++ b/packages/lib/hooks/useEventListener.ts @@ -2,11 +2,15 @@ import shim from '../shim'; const { useEffect, useRef } = shim.react(); function useEventListener( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied eventName: any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied handler: any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied element?: any, ) { // Create a ref that stores handler + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const savedHandler = useRef(); useEffect(() => { diff --git a/packages/lib/hooks/usePrevious.ts b/packages/lib/hooks/usePrevious.ts index 1e35adb0c..d5cc56bcb 100644 --- a/packages/lib/hooks/usePrevious.ts +++ b/packages/lib/hooks/usePrevious.ts @@ -2,6 +2,7 @@ import shim from '../shim'; const { useRef, useEffect } = shim.react(); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const usePrevious = (value: any, initialValue: any = null) => { const ref = useRef(initialValue); useEffect(() => { diff --git a/packages/lib/htmlUtils.ts b/packages/lib/htmlUtils.ts index 63f96eb7d..67fb11e32 100644 --- a/packages/lib/htmlUtils.ts +++ b/packages/lib/htmlUtils.ts @@ -35,6 +35,7 @@ const selfClosingElements = [ class HtmlUtils { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public headAndBodyHtml(doc: any) { const output = []; if (doc.head) output.push(doc.head.innerHTML); @@ -87,6 +88,7 @@ class HtmlUtils { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public replaceImageUrls(html: string, callback: Function) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return this.processImageTags(html, (data: any) => { const newSrc = callback(data.src); return { @@ -159,6 +161,7 @@ class HtmlUtils { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public attributesHtml(attr: any) { const output = []; diff --git a/packages/lib/import-enex-md-gen.ts b/packages/lib/import-enex-md-gen.ts index 92d7b0edc..8aaa36f55 100644 --- a/packages/lib/import-enex-md-gen.ts +++ b/packages/lib/import-enex-md-gen.ts @@ -25,6 +25,7 @@ enum SectionType { interface Section { type: SectionType; parent: Section; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied lines: any[]; isHeader?: boolean; } @@ -54,6 +55,7 @@ interface ParserState { inPre: boolean; inQuote: boolean; lists: ParserStateList[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied anchorAttributes: any[]; spanAttributes: string[]; tags: ParserStateTag[]; @@ -325,6 +327,7 @@ function simplifyString(s: string): string { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function collapseWhiteSpaceAndAppend(lines: string[], state: any, text: string) { if (state.inCode.length) { lines.push(text); @@ -454,8 +457,10 @@ function isNewLineBlock(s: string) { return s === BLOCK_OPEN || s === BLOCK_CLOSE; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function attributeToLowerCase(node: any) { if (!node.attributes) return {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (const n in node.attributes) { if (!node.attributes.hasOwnProperty(n)) continue; @@ -464,6 +469,7 @@ function attributeToLowerCase(node: any) { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function cssValue(context: any, style: string, propName: string | string[]): string { if (!style) return null; @@ -474,6 +480,7 @@ function cssValue(context: any, style: string, propName: string | string[]): str if (!o.stylesheet.rules.length) return null; for (const propName of propNames) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const prop = o.stylesheet.rules[0].declarations.find((d: any) => d.property.toLowerCase() === propName); if (prop && prop.value) return prop.value.trim().toLowerCase(); } @@ -485,6 +492,7 @@ function cssValue(context: any, style: string, propName: string | string[]): str } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function isInvisibleBlock(context: any, attributes: any) { const display = cssValue(context, attributes.style, 'display'); return display && display.indexOf('none') === 0; @@ -504,6 +512,7 @@ function trimBlockOpenAndClose(lines: string[]): string[] { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function isSpanWithStyle(attributes: any) { if (attributes) { if ('style' in attributes) { @@ -515,6 +524,7 @@ function isSpanWithStyle(attributes: any) { return false; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function isSpanStyleBold(attributes: any) { let style = attributes.style; if (!style) return false; @@ -529,12 +539,14 @@ function isSpanStyleBold(attributes: any) { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function isSpanStyleItalic(attributes: any) { let style = attributes.style; style = style.replace(/\s+/g, ''); return (style.toLowerCase().includes('font-style:italic')); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function displaySaxWarning(context: any, message: string) { const line = []; const parser = context ? context._parser : null; @@ -545,6 +557,7 @@ function displaySaxWarning(context: any, message: string) { console.warn(line.join(': ')); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function isCodeBlock(context: any, nodeName: string, attributes: any) { if (nodeName === 'code') return true; @@ -564,6 +577,7 @@ function isCodeBlock(context: any, nodeName: string, attributes: any) { return false; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function isHighlight(context: any, _nodeName: string, attributes: any) { if (attributes && attributes.style) { // Evernote uses various inconsistent CSS prefixes: so far I've found @@ -586,6 +600,7 @@ function isHighlight(context: any, _nodeName: string, attributes: any) { return false; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function enexXmlToMdArray(stream: any, resources: ResourceEntity[], tasks: ExtractedTask[]): Promise { const remainingResources = resources.slice(); @@ -619,6 +634,7 @@ function enexXmlToMdArray(stream: any, resources: ResourceEntity[], tasks: Extra parent: null, }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied saxStream.on('error', (e: any) => { console.warn(e); }); @@ -660,6 +676,7 @@ function enexXmlToMdArray(stream: any, resources: ResourceEntity[], tasks: Extra section.lines = collapseWhiteSpaceAndAppend(section.lines, state, text); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied saxStream.on('opentag', function(node: any) { const nodeAttributes = attributeToLowerCase(node); const n = node.name.toLowerCase(); @@ -1262,6 +1279,7 @@ function drawTable(table: Section) { if (flatRender) { line.push(BLOCK_OPEN); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let currentCells: any[] = []; const renderCurrentCells = () => { @@ -1343,6 +1361,7 @@ function drawTable(table: Section) { lines.push(BLOCK_CLOSE); if (caption) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const captionLines: any[] = renderLines(caption.lines); lines = lines.concat(captionLines); } @@ -1404,6 +1423,7 @@ function postProcessMarkdown(lines: string[]) { // A "line" can be some Markdown text, or it can be a section, like a table, // etc. so this function returns an array of strings. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function renderLine(line: any) { if (typeof line === 'object' && line.type === 'table') { // A table @@ -1434,6 +1454,7 @@ function renderLine(line: any) { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function renderLines(lines: any[]) { let mdLines: string[] = []; for (let i = 0; i < lines.length; i++) { diff --git a/packages/lib/import-enex.ts b/packages/lib/import-enex.ts index 1b1623658..e5bc1ee5d 100644 --- a/packages/lib/import-enex.ts +++ b/packages/lib/import-enex.ts @@ -77,15 +77,19 @@ async function decodeBase64File(sourceFilePath: string, destFilePath: string) { resolve(null); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied sourceStream.on('error', (error: any) => reject(error)); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied destStream.on('error', (error: any) => reject(error)); }); } function removeUndefinedProperties(note: NoteEntity) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (const n in note) { if (!note.hasOwnProperty(n)) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const v = (note as any)[n]; if (v === undefined || v === null) continue; output[n] = v; @@ -180,8 +184,11 @@ async function saveNoteResources(note: ExtractedNote) { const resource = note.resources[i]; const toSave: ResourceEntity = { ...resource }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied delete (toSave as any).dataFilePath; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied delete (toSave as any).dataEncoding; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied delete (toSave as any).hasData; toSave.file_extension = resource.filename ? safeFileExtension(fileExtension(resource.filename)) : ''; @@ -228,6 +235,7 @@ export interface ImportOptions { } async function saveNoteToStorage(note: ExtractedNote) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied note = Note.filter(note as any); const result = { @@ -251,6 +259,7 @@ async function saveNoteToStorage(note: ExtractedNote) { interface Node { name: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied attributes: Record; } @@ -341,8 +350,10 @@ interface ParseNotesResult { const parseNotes = async (parentFolderId: string, filePath: string, importOptions: ImportOptions = null): Promise => { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied function handleSaxStreamEvent(fn: Function) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return function(...args: any[]) { // Pass the parser to the wrapped function for debugging purposes + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (this._parser) (fn as any)._parser = this._parser; try { @@ -378,9 +389,11 @@ const parseNotes = async (parentFolderId: string, filePath: string, importOption const nodes: Node[] = []; // LIFO list of nodes so that we know in which node we are in the onText event let note: ExtractedNote = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let noteAttributes: Record = null; let noteResource: ExtractedResource = null; let noteTask: ExtractedTask = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let noteResourceAttributes: Record = null; let noteResourceRecognition: NoteResourceRecognition = null; const notes: ExtractedNote[] = []; @@ -389,6 +402,7 @@ const parseNotes = async (parentFolderId: string, filePath: string, importOption const createdNoteIds: string[] = []; const noteTitlesToIds: Record = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const createErrorWithNoteTitle = (fnThis: any, error: any) => { const line = []; @@ -408,6 +422,7 @@ const parseNotes = async (parentFolderId: string, filePath: string, importOption return error; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied stream.on('error', function(error: any) { importOptions.onError(createErrorWithNoteTitle(this, error)); }); @@ -502,6 +517,7 @@ const parseNotes = async (parentFolderId: string, filePath: string, importOption return true; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied saxStream.on('error', function(error: any) { importOptions.onError(createErrorWithNoteTitle(this, error)); @@ -533,7 +549,9 @@ const parseNotes = async (parentFolderId: string, filePath: string, importOption fs.appendFileSync(noteResource.dataFilePath, text); } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!(n in noteResource)) (noteResource as any)[n] = ''; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (noteResource as any)[n] += text; } } else if (noteTask) { @@ -593,6 +611,7 @@ const parseNotes = async (parentFolderId: string, filePath: string, importOption } })); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied saxStream.on('cdata', handleSaxStreamEvent((data: any) => { const n = currentNodeName(); @@ -635,6 +654,7 @@ const parseNotes = async (parentFolderId: string, filePath: string, importOption note.longitude = noteAttributes.longitude; note.altitude = noteAttributes.altitude; note.author = noteAttributes.author ? noteAttributes.author.trim() : ''; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied note.is_todo = noteAttributes['reminder-order'] !== '0' && !!noteAttributes['reminder-order'] as any; note.todo_due = dateToTimestamp(noteAttributes['reminder-time'], 0); note.todo_completed = dateToTimestamp(noteAttributes['reminder-done-time'], 0); diff --git a/packages/lib/locale.ts b/packages/lib/locale.ts index 1201bef26..a37308404 100644 --- a/packages/lib/locale.ts +++ b/packages/lib/locale.ts @@ -462,7 +462,9 @@ const codeToCountry_: CodeToCountryMap = { ZW: ['Zimbabwe', 'Zimbabwe'], }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let supportedLocales_: any = null; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let localeStats_: any = null; const loadedLocales_: Record> = {}; @@ -681,10 +683,12 @@ export const toIso639Alpha3 = (code: string) => { return info.alpha3; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function _(s: string, ...args: any[]): string { return stringByLocale(currentLocale_, s, ...args); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function _n(singular: string, plural: string, n: number, ...args: any[]) { if (['en_GB', 'en_US'].includes(currentLocale_)) { if (n > 1) return _(plural, ...args); @@ -710,6 +714,7 @@ function _n(singular: string, plural: string, n: number, ...args: any[]) { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const stringByLocale = (locale: string, s: string, ...args: any[]): string => { const strings = localeStrings(locale); const result = strings[s]; diff --git a/packages/lib/markdownUtils.ts b/packages/lib/markdownUtils.ts index 9cbcb624e..b051e297e 100644 --- a/packages/lib/markdownUtils.ts +++ b/packages/lib/markdownUtils.ts @@ -70,7 +70,7 @@ const markdownUtils = { }, prependBaseUrl(md: string, baseUrl: string) { - // eslint-disable-next-line no-useless-escape + // eslint-disable-next-line no-useless-escape, @typescript-eslint/no-explicit-any -- Old code before rule was applied return md.replace(/(\]\()([^\s\)]+)(.*?\))/g, (_match: any, before: string, url: string, after: string) => { return before + urlUtils.prependBaseUrl(url, baseUrl) + after; }); @@ -88,6 +88,7 @@ const markdownUtils = { let linkType = onlyType; if (linkType === 'pdf') linkType = 'link_open'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const searchUrls = (tokens: any[]) => { for (let i = 0; i < tokens.length; i++) { const token = tokens[i]; diff --git a/packages/lib/markupLanguageUtils.ts b/packages/lib/markupLanguageUtils.ts index 1a0cb951c..33f6f5aa8 100644 --- a/packages/lib/markupLanguageUtils.ts +++ b/packages/lib/markupLanguageUtils.ts @@ -43,6 +43,7 @@ export class MarkupLanguageUtils { // desktop and mobile applications. public newMarkupToHtml(_plugins: PluginStates = null, options: Options = null) { const subValues = Setting.subValues('markdown.plugin', Setting.toPlainObject()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const pluginOptions: any = {}; for (const n in subValues) { pluginOptions[n] = { enabled: subValues[n] }; diff --git a/packages/lib/models/Alarm.ts b/packages/lib/models/Alarm.ts index 6a01238ae..48f336b79 100644 --- a/packages/lib/models/Alarm.ts +++ b/packages/lib/models/Alarm.ts @@ -29,11 +29,13 @@ export default class Alarm extends BaseModel { public static async alarmIdsWithoutNotes() { // https://stackoverflow.com/a/4967229/561309 const alarms = await this.db().selectAll('SELECT alarms.id FROM alarms LEFT JOIN notes ON alarms.note_id = notes.id WHERE notes.id IS NULL'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return alarms.map((a: any) => { return a.id; }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async makeNotification(alarm: any, note: any = null): Promise { if (!note) { note = await Note.load(alarm.note_id); diff --git a/packages/lib/models/BaseItem.ts b/packages/lib/models/BaseItem.ts index 9e28a1a20..2c72415c0 100644 --- a/packages/lib/models/BaseItem.ts +++ b/packages/lib/models/BaseItem.ts @@ -20,6 +20,7 @@ const moment = require('moment'); export interface ItemsThatNeedDecryptionResult { hasMore: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied items: any[]; } @@ -45,7 +46,9 @@ export interface EncryptedItemsStats { export default class BaseItem extends BaseModel { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static encryptionService_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static revisionService_: any = null; public static shareService_: ShareService = null; private static syncShareCache_: ShareState | null = null; @@ -54,6 +57,7 @@ export default class BaseItem extends BaseModel { // - itemsThatNeedSync() // - syncedItems() + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static syncItemDefinitions_: any[] = [ { type: BaseModel.TYPE_NOTE, className: 'Note' }, { type: BaseModel.TYPE_FOLDER, className: 'Folder' }, @@ -76,6 +80,7 @@ export default class BaseItem extends BaseModel { return true; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static loadClass(className: string, classRef: any) { for (let i = 0; i < BaseItem.syncItemDefinitions_.length; i++) { if (BaseItem.syncItemDefinitions_[i].className === className) { @@ -151,6 +156,7 @@ export default class BaseItem extends BaseModel { return r.total; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static systemPath(itemOrId: any, extension: string = null) { if (extension === null) extension = 'md'; @@ -161,6 +167,7 @@ export default class BaseItem extends BaseModel { public static isSystemPath(path: string) { // 1b175bb38bba47baac22b0b47f778113.md if (!path || !path.length) return false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let p: any = path.split('/'); p = p[p.length - 1]; p = p.split('.'); @@ -168,6 +175,7 @@ export default class BaseItem extends BaseModel { return p[0].length === 32 && p[1] === 'md'; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static itemClass(item: any): typeof BaseItem { if (!item) throw new Error('Item cannot be null'); @@ -210,6 +218,7 @@ export default class BaseItem extends BaseModel { public static pathToId(path: string): string { const p = path.split('/'); const s = p[p.length - 1].split('.'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let name: any = s[0]; if (!name) return name; name = name.split('-'); @@ -233,6 +242,7 @@ export default class BaseItem extends BaseModel { if (!ids.length) return []; const classes = this.syncItemClassNames(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let output: any[] = []; for (let i = 0; i < classes.length; i++) { const ItemClass = this.getClass(classes[i]); @@ -243,6 +253,7 @@ export default class BaseItem extends BaseModel { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async loadItemsByTypeAndIds(itemType: ModelType, ids: string[], options: LoadOptions = null): Promise { if (!ids.length) return []; @@ -258,6 +269,7 @@ export default class BaseItem extends BaseModel { return result.length ? result[0] : null; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static loadItemByField(itemType: number, field: string, value: any) { const ItemClass = this.itemClass(itemType); return ItemClass.loadByField(field, value); @@ -351,6 +363,7 @@ export default class BaseItem extends BaseModel { return this.db().exec('DELETE FROM deleted_items WHERE item_id = ? AND sync_target = ?', [itemId, syncTarget]); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static serialize_format(propName: string, propValue: any) { if (['created_time', 'updated_time', 'sync_time', 'user_updated_time', 'user_created_time'].indexOf(propName) >= 0) { if (!propValue) return ''; @@ -373,6 +386,7 @@ export default class BaseItem extends BaseModel { .replace(/\r/g, '\\r'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static unserialize_format(type: ModelType, propName: string, propValue: any) { if (propName[propName.length - 1] === '_') return propValue; // Private property @@ -401,6 +415,7 @@ export default class BaseItem extends BaseModel { : propValue; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async serialize(item: any, shownKeys: any[] = null) { if (shownKeys === null) { shownKeys = this.itemClass(item).fieldNames(); @@ -409,6 +424,7 @@ export default class BaseItem extends BaseModel { item = this.filter(item); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; if ('title' in item && shownKeys.indexOf('title') >= 0) { @@ -476,6 +492,7 @@ export default class BaseItem extends BaseModel { } if (item.encryption_applied) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const e: any = new Error('Trying to encrypt item that is already encrypted'); e.code = 'cannotEncryptEncrypted'; throw e; @@ -498,11 +515,13 @@ export default class BaseItem extends BaseModel { // List of keys that won't be encrypted - mostly foreign keys required to link items // with each others and timestamp required for synchronisation. const keepKeys = ['id', 'note_id', 'tag_id', 'parent_id', 'share_id', 'updated_time', 'deleted_time', 'type_']; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const reducedItem: any = {}; for (let i = 0; i < keepKeys.length; i++) { const n = keepKeys[i]; if (!item.hasOwnProperty(n)) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied reducedItem[n] = (item as any)[n]; } @@ -511,6 +530,7 @@ export default class BaseItem extends BaseModel { return ItemClass.serialize(reducedItem); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async decrypt(item: any) { if (!item.encryption_cipher_text) throw new Error(`Item is not encrypted: ${item.id}`); @@ -527,6 +547,7 @@ export default class BaseItem extends BaseModel { public static async unserialize(content: string) { const lines = content.split('\n'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let output: any = {}; let state = 'readingProps'; const body: string[] = []; @@ -678,6 +699,7 @@ export default class BaseItem extends BaseModel { // // CHANGED: // 'SELECT * FROM [ITEMS] items JOIN sync_items s ON s.item_id = items.id WHERE sync_target = ? AND' + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let extraWhere: any = []; if (className === 'Note') extraWhere.push('is_conflict = 0'); if (className === 'Resource') extraWhere.push('encryption_blob_encrypted = 0'); @@ -741,6 +763,7 @@ export default class BaseItem extends BaseModel { changedItems = await ItemClass.modelSelectAll(sql); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const neverSyncedItemIds = neverSyncedItem.map((it: any) => it.id); const items = neverSyncedItem.concat(changedItems); @@ -755,6 +778,7 @@ export default class BaseItem extends BaseModel { } public static syncItemClassNames(): string[] { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return BaseItem.syncItemDefinitions_.map((def: any) => { return def.className; }); @@ -771,6 +795,7 @@ export default class BaseItem extends BaseModel { } public static syncItemTypes(): ModelType[] { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return BaseItem.syncItemDefinitions_.map((def: any) => { return def.type; }); @@ -805,6 +830,7 @@ export default class BaseItem extends BaseModel { return r ? r.total : 0; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static updateSyncTimeQueries(syncTarget: number, item: any, syncTime: number, syncDisabled = false, syncDisabledReason = '', itemLocation: number = null) { const itemType = item.type_; const itemId = item.id; @@ -824,11 +850,13 @@ export default class BaseItem extends BaseModel { ]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async saveSyncTime(syncTarget: number, item: any, syncTime: number) { const queries = this.updateSyncTimeQueries(syncTarget, item, syncTime); return this.db().transactionExecBatch(queries); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async saveSyncDisabled(syncTargetId: number, item: any, syncDisabledReason: string, itemLocation: number = null) { const syncTime = 'sync_time' in item ? item.sync_time : 0; const queries = this.updateSyncTimeQueries(syncTargetId, item, syncTime, true, syncDisabledReason, itemLocation); @@ -859,6 +887,7 @@ export default class BaseItem extends BaseModel { await this.db().transactionExecBatch(queries); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static displayTitle(item: any) { if (!item) return ''; if (item.encryption_applied) return `🔑 ${_('Encrypted')}`; @@ -881,6 +910,7 @@ export default class BaseItem extends BaseModel { ); const items = await ItemClass.modelSelectAll(sql); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const ids = items.map((item: any) => { return item.id; }); @@ -917,6 +947,7 @@ export default class BaseItem extends BaseModel { await this.db().exec('UPDATE sync_items SET force_sync = 1'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async save(o: any, options: SaveOptions = null) { if (!options) options = {}; @@ -948,6 +979,7 @@ export default class BaseItem extends BaseModel { return super.save(o, options); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static markdownTag(itemOrId: any) { const item = typeof itemOrId === 'object' ? itemOrId : { id: itemOrId, @@ -962,6 +994,7 @@ export default class BaseItem extends BaseModel { return output.join(''); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static isMarkdownTag(md: any) { if (!md) return false; return !!md.match(/^\[.*?\]\(:\/[0-9a-zA-Z]{32}\)$/); diff --git a/packages/lib/models/Folder.test.ts b/packages/lib/models/Folder.test.ts index 417e45952..6a553d731 100644 --- a/packages/lib/models/Folder.test.ts +++ b/packages/lib/models/Folder.test.ts @@ -138,6 +138,7 @@ describe('models/Folder', () => { { const folders = await Folder.all({ includeConflictFolder: false }); await Folder.addNoteCounts(folders); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const foldersById: any = {}; // eslint-disable-next-line github/array-foreach -- Old code before rule was applied folders.forEach((f: FolderEntity) => { foldersById[f.id] = f; }); @@ -152,6 +153,7 @@ describe('models/Folder', () => { { const folders = await Folder.all({ includeConflictFolder: true }); await Folder.addNoteCounts(folders); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const foldersById: any = {}; // eslint-disable-next-line github/array-foreach -- Old code before rule was applied folders.forEach((f: FolderEntity) => { foldersById[f.id] = f; }); @@ -178,6 +180,7 @@ describe('models/Folder', () => { const folders = await Folder.all(); await Folder.addNoteCounts(folders, false); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const foldersById: any = {}; // eslint-disable-next-line github/array-foreach -- Old code before rule was applied folders.forEach((f: FolderEntity) => { foldersById[f.id] = f; }); diff --git a/packages/lib/models/Folder.ts b/packages/lib/models/Folder.ts index 4602a9e77..19e82eb13 100644 --- a/packages/lib/models/Folder.ts +++ b/packages/lib/models/Folder.ts @@ -43,6 +43,7 @@ export default class Folder extends BaseItem { } public static fieldToLabel(field: string) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const fieldsToLabels: any = { title: _('title'), last_note_user_updated_time: _('updated date'), @@ -98,6 +99,7 @@ export default class Folder extends BaseItem { } public static async deleteAllByShareId(shareId: string, deleteOptions: DeleteOptions = null) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const tableNameToClasses: Record = { 'folders': Folder, 'notes': Note, @@ -301,6 +303,7 @@ export default class Folder extends BaseItem { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static handleTitleNaturalSorting(items: FolderEntity[], options: any) { if (options.order?.length > 0 && options.order[0].by === 'title') { const collator = getCollator(); @@ -628,12 +631,14 @@ export default class Folder extends BaseItem { // Clear the "share_id" property for the items that are associated with a // share that no longer exists. public static async updateNoLongerSharedItems(activeShareIds: string[]) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const tableNameToClasses: Record = { 'folders': Folder, 'notes': Note, 'resources': Resource, }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const report: any = {}; for (const tableName of ['folders', 'notes', 'resources']) { @@ -656,6 +661,7 @@ export default class Folder extends BaseItem { report[tableName] = rows.length; for (const row of rows) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const toSave: any = { id: row.id, share_id: '', @@ -671,6 +677,7 @@ export default class Folder extends BaseItem { logger.debug('updateNoLongerSharedItems:', report); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async allAsTree(folders: FolderEntity[] = null, options: any = null) { interface FolderWithNotes extends FolderEntity { notes?: NoteEntity[]; @@ -750,6 +757,7 @@ export default class Folder extends BaseItem { } public static buildTree(folders: FolderEntity[]): FolderEntityWithChildren[] { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const idToFolders: Record = {}; for (let i = 0; i < folders.length; i++) { idToFolders[folders[i].id] = { ...folders[i] }; @@ -860,6 +868,7 @@ export default class Folder extends BaseItem { // manually creating a folder. They shouldn't be done for example when the folders // are being synced to avoid any strange side-effects. Technically it's possible to // have folders and notes with duplicate titles (or no title), or with reserved words. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async save(o: FolderEntity, options: any = null) { if (!options) options = {}; diff --git a/packages/lib/models/ItemChange.ts b/packages/lib/models/ItemChange.ts index 9ab106cc1..afec9175e 100644 --- a/packages/lib/models/ItemChange.ts +++ b/packages/lib/models/ItemChange.ts @@ -11,7 +11,9 @@ export interface ChangeSinceIdOptions { export default class ItemChange extends BaseModel { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static addChangeMutex_: any = new Mutex(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static saveCalls_: any[] = []; public static TYPE_CREATE = 1; @@ -31,6 +33,7 @@ export default class ItemChange extends BaseModel { return BaseModel.TYPE_ITEM_CHANGE; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async addMulti(itemType: ModelType, itemIds: string[], type: number, changeSource: any = null, beforeChangeItemJsons: string[] = null) { if (!itemIds.length) return; @@ -76,6 +79,7 @@ export default class ItemChange extends BaseModel { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async add(itemType: ModelType, itemId: string, type: number, changeSource: any = null, beforeChangeItemJson: string = null) { await this.addMulti(itemType, [itemId], type, changeSource, beforeChangeItemJson ? [beforeChangeItemJson] : null); } diff --git a/packages/lib/models/Migration.ts b/packages/lib/models/Migration.ts index a6c48f2f6..8406bd10d 100644 --- a/packages/lib/models/Migration.ts +++ b/packages/lib/models/Migration.ts @@ -1,6 +1,7 @@ import BaseModel from '../BaseModel'; import migration42 from '../migrations/42'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const migrationScripts: Record = { 20: require('../migrations/20.js'), 27: require('../migrations/27.js'), diff --git a/packages/lib/models/Note.test.ts b/packages/lib/models/Note.test.ts index 85c057f79..78b532c88 100644 --- a/packages/lib/models/Note.test.ts +++ b/packages/lib/models/Note.test.ts @@ -109,6 +109,7 @@ describe('models/Note', () => { for (let i = 0; i < testCases.length; i++) { const t = testCases[i]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const input: any = t[0]; const note1 = await Note.save(input); diff --git a/packages/lib/models/Note.ts b/packages/lib/models/Note.ts index 597a781f5..83dfa8b1f 100644 --- a/packages/lib/models/Note.ts +++ b/packages/lib/models/Note.ts @@ -30,6 +30,7 @@ interface PreviewsOptions { dir: string; }[]; conditions?: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied conditionsParams?: any[]; fields?: string[] | string; uncompletedTodosOnTop?: boolean; @@ -44,7 +45,9 @@ export default class Note extends BaseItem { public static updateGeolocationEnabled_ = true; private static geolocationUpdating_ = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static geolocationCache_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static dueDateObjects_: any; public static tableName() { @@ -138,6 +141,7 @@ export default class Note extends BaseItem { if (!body || body.length <= 32) return []; const links = urlUtils.extractResourceUrls(body); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemIds = links.map((l: any) => l.itemId); return unique(itemIds); } @@ -168,6 +172,7 @@ export default class Note extends BaseItem { return this.linkedItemIdsByType(BaseModel.TYPE_NOTE, body); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async replaceResourceInternalToExternalLinks(body: string, options: any = null) { options = { useAbsolutePaths: false, ...options }; @@ -196,6 +201,7 @@ export default class Note extends BaseItem { return body; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async replaceResourceExternalToInternalLinks(body: string, options: any = null) { options = { useAbsolutePaths: false, ...options }; @@ -271,11 +277,13 @@ export default class Note extends BaseItem { } // Note: sort logic must be duplicated in previews(). + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static sortNotes(notes: NoteEntity[], orders: any[], uncompletedTodosOnTop: boolean) { const noteOnTop = (note: NoteEntity) => { return uncompletedTodosOnTop && note.is_todo && !note.todo_completed; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const noteFieldComp = (f1: any, f2: any) => { if (f1 === f2) return 0; return f1 < f2 ? -1 : +1; @@ -307,7 +315,9 @@ export default class Note extends BaseItem { for (let i = 0; i < orders.length; i++) { const order = orders[i]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let aProp = (a as any)[order.by]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let bProp = (b as any)[order.by]; if (typeof aProp === 'string') aProp = aProp.toLowerCase(); if (typeof bProp === 'string') bProp = bProp.toLowerCase(); @@ -326,10 +336,12 @@ export default class Note extends BaseItem { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static previewFieldsWithDefaultValues(options: any = null) { return Note.defaultValues(this.previewFields(options)); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static previewFields(options: any = null) { options = { includeTimestamps: true, ...options }; @@ -350,6 +362,7 @@ export default class Note extends BaseItem { return Array.isArray(escaped) ? escaped.join(',') : escaped; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async loadFolderNoteByField(folderId: string, field: string, value: any) { if (!folderId) throw new Error('folderId is undefined'); @@ -494,6 +507,7 @@ export default class Note extends BaseItem { results = results.map(n => { n = { ...n }; for (const field of autoAddedFields) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied delete (n as any)[field]; } return n; @@ -503,12 +517,14 @@ export default class Note extends BaseItem { return results; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static preview(noteId: string, options: any = null) { if (!options) options = { fields: null }; const excludeConflictsSql = options.excludeConflicts ? 'is_conflict = 0 AND' : ''; return this.modelSelectOne(`SELECT ${this.previewFieldsSql(options.fields)} FROM notes WHERE ${excludeConflictsSql} id = ?`, [noteId]); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async search(options: any = null): Promise { if (!options) options = {}; if (!options.conditions) options.conditions = []; @@ -662,11 +678,13 @@ export default class Note extends BaseItem { return note; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async duplicateMultipleNotes(noteIds: string[], options: any = null) { // if options.uniqueTitle is true, a unique title for the duplicated file will be assigned. const ensureUniqueTitle = options && options.ensureUniqueTitle; for (const noteId of noteIds) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const noteOptions: any = {}; // If ensureUniqueTitle is truthy, set the original note's name as root for the unique title. @@ -692,6 +710,7 @@ export default class Note extends BaseItem { return newBody; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async duplicate(noteId: string, options: any = null) { const changes = options && options.changes; const uniqueTitle = options && options.uniqueTitle; @@ -711,11 +730,13 @@ export default class Note extends BaseItem { ]; for (const field of fieldsToReset) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied delete (newNote as any)[field]; } for (const n in changes) { if (!changes.hasOwnProperty(n)) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (newNote as any)[n] = changes[n]; } @@ -791,6 +812,7 @@ export default class Note extends BaseItem { if (oldNote) { for (const field in o) { if (!o.hasOwnProperty(field)) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if ((o as any)[field] !== (oldNote as any)[field]) { changedFields.push(field); } @@ -845,6 +867,7 @@ export default class Note extends BaseItem { const processIds = ids.splice(0, 50); const notes = await Note.byIds(processIds); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const beforeChangeItems: any = {}; for (const note of notes) { beforeChangeItems[note.id] = toTrash ? null : JSON.stringify(note); @@ -858,6 +881,7 @@ export default class Note extends BaseItem { 'updated_time = ?', ]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const params: any[] = [ now, now, @@ -957,6 +981,7 @@ export default class Note extends BaseItem { // Update the note "order" field without changing the user timestamps, // which is generally what we want. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static async updateNoteOrder_(note: NoteEntity, order: any) { return Note.save({ ...note, order: order, user_updated_time: note.user_updated_time, @@ -1121,6 +1146,7 @@ export default class Note extends BaseItem { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static handleTitleNaturalSorting(items: NoteEntity[], options: any) { if (options.order.length > 0 && options.order[0].by === 'title') { const collator = getCollator(); diff --git a/packages/lib/models/NoteResource.ts b/packages/lib/models/NoteResource.ts index a5d1ee3dc..671d3890a 100644 --- a/packages/lib/models/NoteResource.ts +++ b/packages/lib/models/NoteResource.ts @@ -74,9 +74,11 @@ export default class NoteResource extends BaseModel { public static async associatedNoteIds(resourceId: string): Promise { const rows = await this.modelSelectAll('SELECT note_id FROM note_resources WHERE resource_id = ? AND is_associated = 1', [resourceId]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return rows.map((r: any) => r.note_id); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async associatedResourceNotes(resourceIds: string[], options: LoadOptions = null): Promise> { if (!resourceIds.length) return {}; @@ -168,6 +170,7 @@ export default class NoteResource extends BaseModel { `, [cutOffTime], ); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return output.map((r: any) => r.resource_id); } diff --git a/packages/lib/models/Resource.ts b/packages/lib/models/Resource.ts index 387935a3d..db26dd2cd 100644 --- a/packages/lib/models/Resource.ts +++ b/packages/lib/models/Resource.ts @@ -37,6 +37,7 @@ export default class Resource extends BaseItem { public static shareService_: ShareService = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static fsDriver_: any; public static tableName() { @@ -61,6 +62,7 @@ export default class Resource extends BaseItem { return isSupportedImageMimeType(type); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static fetchStatuses(resourceIds: string[]): Promise { if (!resourceIds.length) return Promise.resolve([]); return this.db().selectAll(`SELECT resource_id, fetch_status FROM resource_local_states WHERE resource_id IN ("${resourceIds.join('","')}")`); @@ -214,6 +216,7 @@ export default class Resource extends BaseItem { const share = resource.share_id ? await this.shareService().shareById(resource.share_id) : null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!getEncryptionEnabled() || !itemCanBeEncrypted(resource as any, share)) { // Normally not possible since itemsThatNeedSync should only return decrypted items if (resource.encryption_blob_encrypted) throw new Error('Trying to access encrypted resource but encryption is currently disabled'); @@ -241,6 +244,7 @@ export default class Resource extends BaseItem { return { path: encryptedPath, resource: resourceCopy }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static markupTag(resource: any, markupLanguage: MarkupLanguage = MarkupLanguage.Markdown) { let tagAlt = resource.alt ? resource.alt : resource.title; if (!tagAlt) tagAlt = ''; @@ -287,15 +291,18 @@ export default class Resource extends BaseItem { return resourceUrlToId(url); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async localState(resourceOrId: any): Promise { return ResourceLocalState.byResourceId(typeof resourceOrId === 'object' ? resourceOrId.id : resourceOrId); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static setLocalStateQueries(resourceOrId: any, state: ResourceLocalStateEntity) { const id = typeof resourceOrId === 'object' ? resourceOrId.id : resourceOrId; return ResourceLocalState.saveQueries({ ...state, resource_id: id }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async setLocalState(resourceOrId: any, state: ResourceLocalStateEntity) { const id = typeof resourceOrId === 'object' ? resourceOrId.id : resourceOrId; await ResourceLocalState.save({ ...state, resource_id: id }); @@ -455,6 +462,7 @@ export default class Resource extends BaseItem { return folder.id; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static async resourceConflictFolder(): Promise { const conflictFolderTitle = _('Conflicts (attachments)'); const Folder = this.getClass('Folder'); @@ -564,6 +572,7 @@ export default class Resource extends BaseItem { const makeQuery = (useRowValue: boolean): SqlQuery => { const whereSql = useRowValue ? '(updated_time, id) > (?, ?)' : 'updated_time > ?'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const params: any[] = [updatedTime]; if (useRowValue) { params.push(id); diff --git a/packages/lib/models/Revision.test.ts b/packages/lib/models/Revision.test.ts index 169067831..0406fd3b0 100644 --- a/packages/lib/models/Revision.test.ts +++ b/packages/lib/models/Revision.test.ts @@ -49,6 +49,7 @@ describe('models/Revision', () => { for (const t of testCases) { const [expected, input] = t; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(Revision.isEmptyRevision(input as any)).toBe(expected); } }); diff --git a/packages/lib/models/Revision.ts b/packages/lib/models/Revision.ts index cc54db82b..75453c9b9 100644 --- a/packages/lib/models/Revision.ts +++ b/packages/lib/models/Revision.ts @@ -9,6 +9,7 @@ const { sprintf } = require('sprintf-js'); const dmp = new DiffMatchPatch(); export interface ObjectPatch { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied new: Record; deleted: string[]; } @@ -83,6 +84,7 @@ export default class Revision extends BaseItem { return true; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static createObjectPatch(oldObject: any, newObject: any) { if (!oldObject) oldObject = {}; @@ -111,6 +113,7 @@ export default class Revision extends BaseItem { return patch.replace(/[\n\r]/g, ''); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static applyObjectPatch(object: any, patch: string) { const parsedPatch: ObjectPatch = JSON.parse(this.sanitizeObjectPatch(patch)); const output = { ...object }; @@ -347,6 +350,7 @@ export default class Revision extends BaseItem { return existingRev && existingRev.item_updated_time === updatedTime; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static parsePatch(patch: any): any[] { return patch ? JSON.parse(patch) : []; } diff --git a/packages/lib/models/Search.ts b/packages/lib/models/Search.ts index cff712c31..89f57cbdf 100644 --- a/packages/lib/models/Search.ts +++ b/packages/lib/models/Search.ts @@ -12,8 +12,10 @@ export default class Search extends BaseModel { } public static keywords(query: string) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let output: any = query.trim(); output = output.split(/[\s\t\n]+/); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied output = output.filter((o: any) => !!o); return output; } diff --git a/packages/lib/models/Setting.test.ts b/packages/lib/models/Setting.test.ts index 529c2db65..5e4f3c953 100644 --- a/packages/lib/models/Setting.test.ts +++ b/packages/lib/models/Setting.test.ts @@ -6,6 +6,7 @@ import { defaultProfileConfig } from '../services/profileConfig/types'; import { createNewProfile, saveProfileConfig } from '../services/profileConfig'; import initProfile from '../services/profileConfig/initProfile'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function loadSettingsFromFile(): Promise { return JSON.parse(await readFile(Setting.settingFilePath, 'utf8')); } diff --git a/packages/lib/models/Setting.ts b/packages/lib/models/Setting.ts index 1d8f94c69..36e974fe6 100644 --- a/packages/lib/models/Setting.ts +++ b/packages/lib/models/Setting.ts @@ -49,6 +49,7 @@ export enum SettingStorage { // This is the definition of a setting item export interface SettingItem { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; type: SettingItemType; public: boolean; @@ -60,10 +61,13 @@ export interface SettingItem { label?(): string; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied description?: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied options?(): any; optionsOrder?(): string[]; appTypes?: AppType[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show?(settings: any): boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied filter?(value: any): any; secure?: boolean; advanced?: boolean; @@ -99,6 +103,7 @@ export interface SettingItems { // They are saved to database at regular intervals. interface CacheItem { key: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; } @@ -183,6 +188,7 @@ interface SettingSections { interface DefaultMigration { name: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied previousDefault: any; } @@ -298,6 +304,7 @@ class Setting extends BaseModel { isDemo: false, appName: 'joplin', appId: 'SET_ME', // Each app should set this identifier + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied appType: 'SET_ME' as any, // 'cli' or 'mobile' resourceDirName: '', resourceDir: '', @@ -318,10 +325,13 @@ class Setting extends BaseModel { public static allowFileStorage = true; private static metadata_: SettingItems = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static keychainService_: any = null; private static keys_: string[] = null; private static cache_: CacheItem[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static saveTimeoutId_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static changeEventTimeoutId_: any = null; private static customMetadata_: SettingItems = {}; private static customSections_: SettingSections = {}; @@ -388,6 +398,7 @@ class Setting extends BaseModel { return this.keychainService_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static setKeychainService(s: any) { this.keychainService_ = s; } @@ -412,6 +423,7 @@ class Setting extends BaseModel { // public for the mobile and desktop apps because they are handled separately in menus. const themeOptions = () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; output[Setting.THEME_LIGHT] = _('Light'); output[Setting.THEME_DARK] = _('Dark'); @@ -484,6 +496,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { try { return settings['sync.target'] === SyncTargetRegistry.nameToId('filesystem'); @@ -491,6 +504,7 @@ class Setting extends BaseModel { return false; } }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied filter: (value: any) => { return value ? rtrimSlashes(value) : ''; }, @@ -504,6 +518,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('nextcloud'); }, @@ -516,6 +531,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('nextcloud'); }, @@ -527,6 +543,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('nextcloud'); }, @@ -539,6 +556,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('webdav'); }, @@ -551,6 +569,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('webdav'); }, @@ -562,6 +581,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('webdav'); }, @@ -574,6 +594,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { try { return settings['sync.target'] === SyncTargetRegistry.nameToId('amazon_s3'); @@ -593,6 +614,7 @@ class Setting extends BaseModel { value: 'https://s3.amazonaws.com/', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('amazon_s3'); }, @@ -607,6 +629,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('amazon_s3'); }, @@ -621,6 +644,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('amazon_s3'); }, @@ -632,6 +656,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('amazon_s3'); }, @@ -643,6 +668,7 @@ class Setting extends BaseModel { value: false, type: SettingItemType.Bool, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('amazon_s3'); }, @@ -654,6 +680,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('joplinServer'); }, @@ -672,6 +699,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('joplinServer'); }, @@ -683,6 +711,7 @@ class Setting extends BaseModel { value: '', type: SettingItemType.String, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return settings['sync.target'] === SyncTargetRegistry.nameToId('joplinServer'); }, @@ -804,6 +833,7 @@ class Setting extends BaseModel { public: true, label: () => _('Date format'), options: () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = {}; const now = new Date('2017-01-30T12:00:00').getTime(); options[Setting.DATE_FORMAT_1] = time.formatMsToLocal(now, Setting.DATE_FORMAT_1); @@ -827,6 +857,7 @@ class Setting extends BaseModel { public: true, label: () => _('Time format'), options: () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = {}; const now = new Date('2017-01-30T20:30:00').getTime(); options[Setting.TIME_FORMAT_1] = time.formatMsToLocal(now, Setting.TIME_FORMAT_1); @@ -944,6 +975,7 @@ class Setting extends BaseModel { options: () => { const Note = require('./Note').default; const noteSortFields = ['user_updated_time', 'user_created_time', 'title', 'order', 'todo_due', 'todo_completed']; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = {}; for (let i = 0; i < noteSortFields.length; i++) { options[noteSortFields[i]] = toTitleCase(Note.fieldToLabel(noteSortFields[i])); @@ -1040,6 +1072,7 @@ class Setting extends BaseModel { options: () => { const Folder = require('./Folder').default; const folderSortFields = ['title', 'last_note_user_updated_time']; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = {}; for (let i = 0; i < folderSortFields.length; i++) { options[folderSortFields[i]] = toTitleCase(Folder.fieldToLabel(folderSortFields[i])); @@ -1094,6 +1127,7 @@ class Setting extends BaseModel { section: 'note', public: true, appTypes: [AppType.Mobile], + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => settings['editor.mobile.removeSpaceBelowToolbar'], label: () => 'Remove extra space below the markdown toolbar', description: () => 'Works around bug on some devices where the markdown toolbar does not touch the bottom of the screen.', @@ -1506,6 +1540,7 @@ class Setting extends BaseModel { advanced: true, label: () => _('Keyboard Mode'), options: () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; output[''] = _('Default'); output['emacs'] = _('Emacs'); @@ -1573,6 +1608,7 @@ class Setting extends BaseModel { type: SettingItemType.String, section: 'sync', advanced: true, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return [ SyncTargetRegistry.nameToId('amazon_s3'), @@ -1592,6 +1628,7 @@ class Setting extends BaseModel { type: SettingItemType.Bool, advanced: true, section: 'sync', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => { return (shim.isNode() || shim.mobilePlatform() === 'android') && [ @@ -1866,6 +1903,7 @@ class Setting extends BaseModel { unitLabel: (value: number = null) => { return value === null ? _('days') : _('%d days', value); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied show: (settings: any) => settings['trash.autoDeletionEnabled'], label: () => _('Keep notes in the trash for'), storage: SettingStorage.File, @@ -2122,6 +2160,7 @@ class Setting extends BaseModel { // saving to database shouldn't). When the keychain works, the secure keys // are deleted from the database and transferred to the keychain in saveAll(). + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const rowKeys = rows.map((r: any) => r.key); const secureKeys = this.keys(false, null, { secureOnly: true }); const secureItems: CacheItem[] = []; @@ -2174,6 +2213,7 @@ class Setting extends BaseModel { public static toPlainObject() { const keys = this.keys(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const keyToValues: any = {}; for (let i = 0; i < keys.length; i++) { keyToValues[keys[i]] = this.value(keys[i]); @@ -2188,11 +2228,14 @@ class Setting extends BaseModel { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static setConstant(key: string, value: any) { if (!(key in this.constants_)) throw new Error(`Unknown constant key: ${key}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (this.constants_ as any)[key] = value; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static setValue(key: string, value: any) { if (!this.cache_) throw new Error('Settings have not been initialized!'); @@ -2251,6 +2294,7 @@ class Setting extends BaseModel { this.scheduleChangeEvent(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static incValue(key: string, inc: any) { return this.setValue(key, this.value(key) + inc); } @@ -2263,6 +2307,7 @@ class Setting extends BaseModel { // If yes, then it just returns 'true'. If its not present then, it will // update it and return 'false' public static setArrayValue(settingName: string, value: string): boolean { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const settingValue: any[] = this.value(settingName); if (settingValue.includes(value)) return true; settingValue.push(value); @@ -2270,12 +2315,14 @@ class Setting extends BaseModel { return false; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static objectValue(settingKey: string, objectKey: string, defaultValue: any = null) { const o = this.value(settingKey); if (!o || !(objectKey in o)) return defaultValue; return o[objectKey]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static setObjectValue(settingKey: string, objectKey: string, value: any) { let o = this.value(settingKey); if (typeof o !== 'object') o = {}; @@ -2326,6 +2373,7 @@ class Setting extends BaseModel { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static valueToString(key: string, value: any) { const md = this.settingMetadata(key); value = this.formatValue(key, value); @@ -2338,11 +2386,13 @@ class Setting extends BaseModel { throw new Error(`Unhandled value type: ${md.type}`); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static filterValue(key: string, value: any) { const md = this.settingMetadata(key); return md.filter ? md.filter(value) : value; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static formatValue(key: string | SettingItemType, value: any) { const type = typeof key === 'string' ? this.settingMetadata(key).type : key; @@ -2385,6 +2435,7 @@ class Setting extends BaseModel { // with strict equality and the value is updated only if changed. However if the caller acquire // an object and change a key, the objects will be detected as equal. By returning a copy // we avoid this problem. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function copyIfNeeded(value: any) { if (value === null || value === undefined) return value; if (Array.isArray(value)) return value.slice(); @@ -2393,6 +2444,7 @@ class Setting extends BaseModel { } if (key in this.constants_) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const v = (this.constants_ as any)[key]; const output = typeof v === 'function' ? v() : v; if (output === 'SET_ME') throw new Error(`SET_ME constant has not been set: ${key}`); @@ -2412,6 +2464,7 @@ class Setting extends BaseModel { } // This function returns the default value if the setting key does not exist. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static valueNoThrow(key: string, defaultValue: any) { if (!this.keyExists(key)) return defaultValue; return this.value(key); @@ -2432,6 +2485,7 @@ class Setting extends BaseModel { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static enumOptionLabel(key: string, value: any) { const options = this.enumOptions(key); for (const n in options) { @@ -2458,6 +2512,7 @@ class Setting extends BaseModel { return output.join(', '); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static isAllowedEnumOption(key: string, value: any) { const options = this.enumOptions(key); return !!options[value]; @@ -2467,9 +2522,11 @@ class Setting extends BaseModel { // { sync.5.path: 'http://example', sync.5.username: 'testing' } // and baseKey is 'sync.5', the function will return // { path: 'http://example', username: 'testing' } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static subValues(baseKey: string, settings: any, options: any = null) { const includeBaseKeyInName = !!options && !!options.includeBaseKeyInName; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (const key in settings) { if (!settings.hasOwnProperty(key)) continue; @@ -2617,6 +2674,7 @@ class Setting extends BaseModel { const metadata = this.metadata(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (const key in metadata) { if (!metadata.hasOwnProperty(key)) continue; @@ -2669,7 +2727,9 @@ class Setting extends BaseModel { public static groupMetadatasBySections(metadatas: SettingItem[]): MetadataBySection { const sections = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const generalSection: any = { name: 'general', metadatas: [] }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const nameToSections: any = {}; nameToSections['general'] = generalSection; sections.push(generalSection); diff --git a/packages/lib/models/Tag.ts b/packages/lib/models/Tag.ts index 837e4c232..c43e7d150 100644 --- a/packages/lib/models/Tag.ts +++ b/packages/lib/models/Tag.ts @@ -30,6 +30,7 @@ export default class Tag extends BaseItem { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async notes(tagId: string, options: any = null) { if (options === null) options = {}; @@ -136,6 +137,7 @@ export default class Tag extends BaseItem { return await Tag.modelSelectAll('SELECT * FROM tags_with_note_count'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async searchAllWithNotes(options: any) { if (!options) options = {}; if (!options.conditions) options.conditions = []; @@ -143,6 +145,7 @@ export default class Tag extends BaseItem { return this.search(options); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async tagsByNoteId(noteId: string, options: any = null) { options = { ...options, @@ -215,6 +218,7 @@ export default class Tag extends BaseItem { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async save(o: TagEntity, options: any = null) { options = { dispatchUpdateAction: true, userSideValidation: false, ...options }; diff --git a/packages/lib/models/settings/FileHandler.ts b/packages/lib/models/settings/FileHandler.ts index ab90fc180..6db9ed109 100644 --- a/packages/lib/models/settings/FileHandler.ts +++ b/packages/lib/models/settings/FileHandler.ts @@ -4,6 +4,7 @@ import Setting from '../Setting'; const logger = Logger.create('Settings'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type SettingValues = Record; export default class FileHandler { diff --git a/packages/lib/models/settings/settingValidations.ts b/packages/lib/models/settings/settingValidations.ts index b1d5488da..23cca5fcb 100644 --- a/packages/lib/models/settings/settingValidations.ts +++ b/packages/lib/models/settings/settingValidations.ts @@ -5,6 +5,7 @@ import Resource from '../Resource'; import Setting from '../Setting'; // Should return an error message if there's a problem, and an empty string if not. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type ValidationHandler = (oldValue: any, newValue: any)=> Promise; const validations: Record = { @@ -39,6 +40,7 @@ const validations: Record = { }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const validateSetting = async (settingName: string, oldValue: any, newValue: any) => { if (oldValue === newValue) return ''; if (!validations[settingName]) return ''; @@ -46,6 +48,7 @@ const validateSetting = async (settingName: string, oldValue: any, newValue: any return await validations[settingName](oldValue, newValue); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default async (settingKeys: string[], newValues: Record) => { for (const key of settingKeys) { const oldValue = Setting.value(key); diff --git a/packages/lib/models/utils/paginatedFeed.ts b/packages/lib/models/utils/paginatedFeed.ts index 94bbe09d7..731276ff1 100755 --- a/packages/lib/models/utils/paginatedFeed.ts +++ b/packages/lib/models/utils/paginatedFeed.ts @@ -2,6 +2,7 @@ import paginationToSql from './paginationToSql'; import { Pagination, PaginationOrder } from './types'; export interface ModelFeedPage { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied items: any[]; has_more: boolean; total?: number; @@ -9,11 +10,13 @@ export interface ModelFeedPage { export interface WhereQuery { sql: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied params?: any[]; } // Note: this method might return more fields than was requested as it will // also return fields that are necessary for pagination. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default async function(db: any, tableName: string, pagination: Pagination, whereQuery: WhereQuery = null, fields: string[] = null): Promise { fields = fields ? fields.slice() : ['id']; diff --git a/packages/lib/models/utils/readOnly.ts b/packages/lib/models/utils/readOnly.ts index 89adead30..0f4f10ee8 100644 --- a/packages/lib/models/utils/readOnly.ts +++ b/packages/lib/models/utils/readOnly.ts @@ -46,6 +46,7 @@ export const checkIfItemCanBeChanged = (itemType: ModelType, changeSource: numbe } }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const checkIfItemCanBeAddedToFolder = async (itemType: ModelType, Folder: any, changeSource: number, shareState: ShareState, parentId: string) => { if (needsShareReadOnlyChecks(itemType, changeSource, shareState) && parentId) { const parentFolder = await Folder.load(parentId, { fields: ['id', 'share_id'] }); @@ -101,6 +102,7 @@ export const itemIsReadOnlySync = (itemType: ModelType, changeSource: number, it return !shareUser.can_write; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const itemIsReadOnly = async (BaseItem: any, itemType: ModelType, changeSource: number, itemId: string, userId: string, shareState: ShareState): Promise => { // if (!needsShareReadOnlyChecks(itemType, changeSource, shareState)) return false; const item: ItemSlice = await BaseItem.loadItem(itemType, itemId, { fields: ['id', 'share_id', 'deleted_time'] }); diff --git a/packages/lib/models/utils/types.ts b/packages/lib/models/utils/types.ts index 53f05d761..b4b7e7973 100644 --- a/packages/lib/models/utils/types.ts +++ b/packages/lib/models/utils/types.ts @@ -22,6 +22,7 @@ export interface LoadOptions { caseInsensitive?: boolean; fields?: string | string[]; where?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied whereParams?: any[]; order?: { by: string; @@ -40,6 +41,7 @@ export interface FolderLoadOptions extends LoadOptions { export interface SaveOptions { isNew?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied oldItem?: any; userSideValidation?: boolean; nextQueries?: SqlQuery[]; diff --git a/packages/lib/models/utils/userData.ts b/packages/lib/models/utils/userData.ts index fef6386bf..a07925b8e 100644 --- a/packages/lib/models/utils/userData.ts +++ b/packages/lib/models/utils/userData.ts @@ -86,6 +86,7 @@ export const setItemUserData = async (itemType: ModelType, itemId: string, na if (itemType === ModelType.Note) itemToSave.parent_id = item.parent_id; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const saveOptions: any = { autoTimestamp: false }; if (itemType === ModelType.Note) return Note.save(itemToSave, saveOptions); diff --git a/packages/lib/net-utils.ts b/packages/lib/net-utils.ts index 2aedc08c3..a5009f80a 100644 --- a/packages/lib/net-utils.ts +++ b/packages/lib/net-utils.ts @@ -10,6 +10,7 @@ export async function ip() { return ip.ip; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function findAvailablePort(tcpPortUsed: any, possiblePorts: number[], extraRandomPortsToTry = 20) { for (let i = 0; i < extraRandomPortsToTry; i++) { possiblePorts.push(Math.floor(8000 + Math.random() * 2000)); @@ -26,6 +27,7 @@ export async function findAvailablePort(tcpPortUsed: any, possiblePorts: number[ return port; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function mimeTypeFromHeaders(headers: Record) { if (!headers || !headers['content-type']) return null; diff --git a/packages/lib/ntp.ts b/packages/lib/ntp.ts index 6e8606de3..fae6ac4af 100644 --- a/packages/lib/ntp.ts +++ b/packages/lib/ntp.ts @@ -25,6 +25,7 @@ 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); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ntpClient().getNetworkTime(s.domain, s.port, (error: any, date: Date) => { if (error) { reject(error); diff --git a/packages/lib/onedrive-api.ts b/packages/lib/onedrive-api.ts index e9a61d42b..01a631073 100644 --- a/packages/lib/onedrive-api.ts +++ b/packages/lib/onedrive-api.ts @@ -13,9 +13,12 @@ export default class OneDriveApi { private clientId_: string; private clientSecret_: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private auth_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private accountProperties_: any = null; private isPublic_: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private listeners_: Record; // `isPublic` is to tell OneDrive whether the application is a "public" one (Mobile and desktop @@ -37,6 +40,7 @@ export default class OneDriveApi { return this.isPublic_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public dispatch(eventName: string, param: any) { const ls = this.listeners_[eventName]; for (let i = 0; i < ls.length; i++) { @@ -57,10 +61,12 @@ export default class OneDriveApi { return 'https://login.microsoftonline.com/common/oauth2/nativeclient'; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public auth(): any { return this.auth_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setAuth(auth: any) { this.auth_ = auth; this.dispatch('authRefreshed', this.auth()); @@ -96,6 +102,7 @@ export default class OneDriveApi { } public async execTokenRequest(code: string, redirectUri: string) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const body: any = {}; body['client_id'] = this.clientId(); if (!this.isPublic()) body['client_secret'] = this.clientSecret(); @@ -127,11 +134,13 @@ export default class OneDriveApi { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public oneDriveErrorResponseToError(errorResponse: any) { if (!errorResponse) return new Error('Undefined error'); if (errorResponse.error) { const e = errorResponse.error; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = new Error(e.message); if (e.code) output.code = e.code; if (e.innerError) output.innerError = e.innerError; @@ -141,6 +150,7 @@ export default class OneDriveApi { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async uploadChunk(url: string, handle: any, buffer: any, options: any) { options = { ...options }; if (!options.method) { options.method = 'POST'; } @@ -163,6 +173,7 @@ export default class OneDriveApi { return response; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async uploadBigFile(url: string, options: any) { const response = await shim.fetch(url, { method: 'POST', @@ -234,7 +245,9 @@ export default class OneDriveApi { // { Authorization: "token here" } // Intended to be used for before logging objects that could potentially have an // Authorization token. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public authorizationTokenRemoved(data: any, depth = 0) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newData: any = {}; if (!data || typeof data !== 'object') { @@ -256,6 +269,7 @@ export default class OneDriveApi { return newData; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async exec(method: string, path: string, query: any = null, data: any = null, options: any = null) { if (!path) throw new Error('Path is required'); @@ -297,6 +311,7 @@ export default class OneDriveApi { options.headers['Authorization'] = `bearer ${this.token()}`; options.headers['User-Agent'] = `ISV|Joplin|Joplin/${shim.appVersion()}`; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const handleRequestRepeat = async (error: any, sleepSeconds: number = null) => { sleepSeconds ??= (i + 1) * 5; logger.info(`Got error below - retrying (${i})...`); @@ -409,6 +424,7 @@ export default class OneDriveApi { throw new Error(`Could not execute request after multiple attempts: ${method} ${url}`); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setAccountProperties(accountProperties: any) { this.accountProperties_ = accountProperties; } @@ -425,6 +441,7 @@ export default class OneDriveApi { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async execJson(method: string, path: string, query: any = null, data: any = null) { const response = await this.exec(method, path, query, data); const errorResponseText = await response.text(); @@ -438,6 +455,7 @@ export default class OneDriveApi { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async execText(method: string, path: string, query: any = null, data: any = null) { const response = await this.exec(method, path, query, data); const output = await response.text(); @@ -450,6 +468,7 @@ export default class OneDriveApi { throw new Error(_('Cannot refresh token: authentication data is missing. Starting the synchronisation again may fix the problem.')); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const body: any = {}; body['client_id'] = this.clientId(); if (!this.isPublic()) body['client_secret'] = this.clientSecret(); diff --git a/packages/lib/reducer.ts b/packages/lib/reducer.ts index 6ec1a2599..738f92339 100644 --- a/packages/lib/reducer.ts +++ b/packages/lib/reducer.ts @@ -16,6 +16,7 @@ const { ALL_NOTES_FILTER_ID } = require('./reserved-ids'); const { createSelectorCreator, defaultMemoize } = require('reselect'); const { createCachedSelector } = require('re-reselect'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const additionalReducers: any[] = []; additionalReducers.push({ @@ -31,8 +32,11 @@ additionalReducers.push({ }); interface StateLastSelectedNotesIds { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied Folder: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied Tag: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied Search: any; } @@ -45,6 +49,7 @@ interface StateDecryptionWorker { state: string; itemIndex: number; itemCount: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied decryptedItemCounts: any; decryptedItemCount: number; skippedItemCount: number; @@ -66,9 +71,12 @@ export interface State { notesSource: string; notesParentType: string; folders: FolderEntity[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied tags: any[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied masterKeys: any[]; notLoadedMasterKeys: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied searches: any[]; highlightedWords: string[]; selectedNoteIds: string[]; @@ -80,13 +88,17 @@ export interface State { selectedSmartFilterId: string; lastSelectedNotesIds: StateLastSelectedNotesIds; showSideMenu: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied screens: any; historyCanGoBack: boolean; syncStarted: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied syncReport: any; searchQuery: string; searchResults: ProcessResultsRow[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied settings: Record; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied sharedData: any; appState: string; biometricsDone: boolean; @@ -96,12 +108,17 @@ export interface State { collapsedFolderIds: string[]; clipperServer: StateClipperServer; decryptionWorker: StateDecryptionWorker; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied selectedNoteTags: any[]; resourceFetcher: StateResourceFetcher; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied backwardHistoryNotes: any[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied forwardHistoryNotes: any[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginsLegacy: any; provisionalNoteIds: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied editorNoteStatuses: any; isInsertingNotes: boolean; hasEncryptedItems: boolean; @@ -199,25 +216,31 @@ export const defaultState: State = { }; for (const additionalReducer of additionalReducers) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (defaultState as any)[additionalReducer.stateRootKey] = additionalReducer.defaultState; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let store_: Store = null; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function setStore(v: Store) { store_ = v; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function store(): Store { return store_; } export const MAX_HISTORY = 200; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const derivedStateCache_: any = {}; // Allows, for a given state, to return the same derived // objects, to prevent unnecessary updates on calling components. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const cacheEnabledOutput = (key: string, output: any) => { key = `${key}_${JSON.stringify(output)}`; if (derivedStateCache_[key]) return derivedStateCache_[key]; @@ -228,6 +251,7 @@ const cacheEnabledOutput = (key: string, output: any) => { const createShallowArrayEqualSelector = createSelectorCreator( defaultMemoize, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (prev: any[], next: any[]) => { if (prev.length !== next.length) return false; for (let i = 0; i < prev.length; i++) { @@ -238,9 +262,12 @@ const createShallowArrayEqualSelector = createSelectorCreator( ); const selectArrayShallow = createCachedSelector( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (state: any) => state.array, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (array: any[]) => array, )({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied keySelector: (_state: any, cacheKey: any) => { return cacheKey; }, @@ -251,6 +278,7 @@ class StateUtils { // Given an input array, this selector ensures that the same array is returned // if its content hasn't changed. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public selectArrayShallow(props: any, cacheKey: any) { return selectArrayShallow(props, cacheKey); } @@ -259,6 +287,7 @@ class StateUtils { return state.selectedNoteIds.length === 1; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public notesOrder(stateSettings: any) { if (stateSettings['notes.sortOrder.field'] === 'order') { return cacheEnabledOutput('notesOrder', [ @@ -281,6 +310,7 @@ class StateUtils { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public foldersOrder(stateSettings: any) { return cacheEnabledOutput('foldersOrder', [ { @@ -310,15 +340,18 @@ class StateUtils { public lastSelectedNoteIds(state: State): string[] { const parent = this.parentItem(state); if (!parent) return []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output = (state.lastSelectedNotesIds as any)[parent.type][parent.id]; return output ? output : []; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public selectedNote(state: State): any { const noteId = this.selectedNoteId(state); return noteId ? BaseModel.byId(state.notes, noteId) : null; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public selectedNoteId(state: State): any { return state.selectedNoteIds.length ? state.selectedNoteIds[0] : null; } @@ -327,6 +360,7 @@ class StateUtils { export const stateUtils: StateUtils = new StateUtils(); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function arrayHasEncryptedItems(array: any[]) { for (let i = 0; i < array.length; i++) { if (array[i].encryption_applied) return true; @@ -341,6 +375,7 @@ function stateHasEncryptedItems(state: State) { return false; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function folderSetCollapsed(draft: Draft, action: any) { const collapsedFolderIds = draft.collapsedFolderIds.slice(); const idx = collapsedFolderIds.indexOf(action.id); @@ -356,12 +391,16 @@ function folderSetCollapsed(draft: Draft, action: any) { draft.collapsedFolderIds = collapsedFolderIds; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function removeAdjacentDuplicates(items: any[]) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return items.filter((item: any, idx: number) => (idx >= 1) ? items[idx - 1].id !== item.id : true); } // When deleting a note, tag or folder +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function handleItemDelete(draft: Draft, action: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const map: any = { FOLDER_DELETE: ['folders', 'selectedFolderId', true], NOTE_DELETE: ['notes', 'selectedNoteIds', false], @@ -373,9 +412,11 @@ function handleItemDelete(draft: Draft, action: any) { const selectedItemKey = map[action.type][1]; const isSingular = map[action.type][2]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const selectedItemKeys = isSingular ? [(draft as any)[selectedItemKey]] : (draft as any)[selectedItemKey]; const isSelected = selectedItemKeys.includes(action.id); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const items = (draft as any)[listKey]; const newItems = []; let newSelectedIndexes: number[] = []; @@ -416,12 +457,14 @@ function handleItemDelete(draft: Draft, action: any) { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (draft as any)[listKey] = newItems; const newIds = []; for (let i = 0; i < newSelectedIndexes.length; i++) { newIds.push(newItems[newSelectedIndexes[i]].id); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (draft as any)[selectedItemKey] = isSingular ? newIds[0] : newIds; if ((newIds.length === 0) && draft.notesParentType !== 'Folder') { @@ -429,6 +472,7 @@ function handleItemDelete(draft: Draft, action: any) { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function updateOneItem(draft: Draft, action: any, keyName = '') { let itemsKey = null; if (keyName) { itemsKey = keyName; } else { @@ -437,6 +481,7 @@ function updateOneItem(draft: Draft, action: any, keyName = '') { if (action.type === 'MASTERKEY_UPDATE_ONE') itemsKey = 'masterKeys'; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newItems = (draft as any)[itemsKey].slice(); const item = action.item; @@ -452,6 +497,7 @@ function updateOneItem(draft: Draft, action: any, keyName = '') { if (!found) newItems.push(item); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (draft as any)[itemsKey] = newItems; } @@ -529,6 +575,7 @@ export const getNotesParent = (state: State): NotesParent => { return { type, selectedItemId }; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function changeSelectedFolder(draft: Draft, action: any, options: any = null) { if (!options) options = {}; draft.selectedFolderId = 'folderId' in action ? action.folderId : action.id; @@ -542,6 +589,7 @@ function changeSelectedFolder(draft: Draft, action: any, options: any = n } function recordLastSelectedNoteIds(draft: Draft, noteIds: string[]) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newOnes: any = { ...draft.lastSelectedNotesIds }; const parent = stateUtils.parentItem(draft); if (!parent) return; @@ -552,6 +600,7 @@ function recordLastSelectedNoteIds(draft: Draft, noteIds: string[]) { draft.lastSelectedNotesIds = newOnes; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function changeSelectedNotes(draft: Draft, action: any, options: any = null) { if (!options) options = {}; @@ -594,6 +643,7 @@ function changeSelectedNotes(draft: Draft, action: any, options: any = nu recordLastSelectedNoteIds(draft, draft.selectedNoteIds); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function removeItemFromArray(array: any[], property: any, value: any) { for (let i = 0; i !== array.length; ++i) { const currentItem = array[i]; @@ -606,7 +656,9 @@ function removeItemFromArray(array: any[], property: any, value: any) { return array; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const getContextFromHistory = (ctx: any) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const result: any = {}; result.notesParentType = ctx.notesParentType; if (result.notesParentType === 'Folder') { @@ -643,6 +695,7 @@ function getNoteHistoryInfo(state: State) { return null; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function handleHistory(draft: Draft, action: any) { const currentNote = getNoteHistoryInfo(draft); switch (action.type) { @@ -756,6 +809,7 @@ function handleHistory(draft: Draft, action: any) { } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const reducer = produce((draft: Draft = defaultState, action: any) => { // const reducer = (state:State = defaultState, action:any) => { @@ -812,10 +866,12 @@ const reducer = produce((draft: Draft = defaultState, action: any) => { break; case 'NOTE_SELECT_ALL': + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied draft.selectedNoteIds = draft.notes.map((n: any) => n.id); break; case 'NOTE_SELECT_ALL_TOGGLE': { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const allSelected = draft.notes.every((n: any) => draft.selectedNoteIds.includes(n.id)); if (allSelected) { draft.selectedNoteIds = []; @@ -919,6 +975,7 @@ const reducer = produce((draft: Draft = defaultState, action: any) => { for (const n in modNote) { if (!modNote.hasOwnProperty(n)) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (newNotes[i] as any)[n] = (modNote as any)[n]; } } else { @@ -1204,6 +1261,7 @@ const reducer = produce((draft: Draft = defaultState, action: any) => { const decryptionWorker = { ...draft.decryptionWorker }; for (const n in action) { if (!action.hasOwnProperty(n) || n === 'type') continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (decryptionWorker as any)[n] = action[n]; } draft.decryptionWorker = decryptionWorker; diff --git a/packages/lib/registry.ts b/packages/lib/registry.ts index 956551a11..69607812f 100644 --- a/packages/lib/registry.ts +++ b/packages/lib/registry.ts @@ -5,15 +5,20 @@ import SyncTargetRegistry from './SyncTargetRegistry'; class Registry { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private syncTargets_: any = {}; private logger_: Logger = null; private schedSyncCalls_: boolean[] = []; private waitForReSyncCalls_: boolean[] = []; private setupRecurrentCalls_: boolean[] = []; private timerCallbackCalls_: boolean[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private showErrorMessageBoxHandler_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private scheduleSyncId_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private recurrentSyncId_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private db_: any; private isOnMobileData_ = false; @@ -30,6 +35,7 @@ class Registry { this.logger_ = l; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setShowErrorMessageBoxHandler(v: any) { this.showErrorMessageBoxHandler_ = v; } @@ -86,6 +92,7 @@ class Registry { } }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public scheduleSync = async (delay: number = null, syncOptions: any = null, doWifiConnectionCheck = false) => { this.schedSyncCalls_.push(true); @@ -157,6 +164,7 @@ class Registry { this.logger().info('Starting scheduled sync'); const options = { ...syncOptions, context: context }; if (!options.saveContextHandler) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied options.saveContextHandler = (newContext: any) => { Setting.setValue(contextKey, JSON.stringify(newContext)); }; @@ -224,6 +232,7 @@ class Registry { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setDb = (v: any) => { this.db_ = v; }; diff --git a/packages/lib/services/AlarmService.ts b/packages/lib/services/AlarmService.ts index bef157ea4..3f9959c70 100644 --- a/packages/lib/services/AlarmService.ts +++ b/packages/lib/services/AlarmService.ts @@ -5,10 +5,12 @@ import Note from '../models/Note'; export default class AlarmService { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private static driver_: any; private static logger_: Logger; // private static inAppNotificationHandler_:any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static setDriver(v: any) { this.driver_ = v; @@ -28,6 +30,7 @@ export default class AlarmService { return this.logger_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static setInAppNotificationHandler(v: any) { // this.inAppNotificationHandler_ = v; if (this.driver_.setInAppNotificationHandler) this.driver_.setInAppNotificationHandler(v); @@ -50,6 +53,7 @@ export default class AlarmService { // When passing a note, make sure it has all the required properties // (better to pass a complete note or else just the ID) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async updateNoteNotification(noteOrId: any, isDeleted = false) { try { let note = null; diff --git a/packages/lib/services/AlarmServiceDriverNode.ts b/packages/lib/services/AlarmServiceDriverNode.ts index 774b11f5c..84b6ada7a 100644 --- a/packages/lib/services/AlarmServiceDriverNode.ts +++ b/packages/lib/services/AlarmServiceDriverNode.ts @@ -11,7 +11,9 @@ interface Options { export default class AlarmServiceDriverNode { private appName_: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private notifications_: any = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private service_: any = null; public constructor(options: Options) { @@ -20,6 +22,7 @@ export default class AlarmServiceDriverNode { this.appName_ = options.appName; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setService(s: any) { this.service_ = s; } @@ -43,6 +46,7 @@ export default class AlarmServiceDriverNode { } private displayDefaultNotification(notification: Notification) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const o: any = { appID: this.appName_, title: notification.title, @@ -57,6 +61,7 @@ export default class AlarmServiceDriverNode { this.logger().info('AlarmServiceDriverNode::scheduleNotification: Triggering notification (default):', o); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied notifier.notify(o, (error: any, response: any) => { this.logger().info('AlarmServiceDriverNode::scheduleNotification: node-notifier response:', error, response); }); @@ -74,8 +79,10 @@ export default class AlarmServiceDriverNode { // // In fact it's likely that we could use this on other platforms too try { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = { body: notification.body ? notification.body : '-', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onerror: (error: any) => { this.logger().error('AlarmServiceDriverNode::displayMacNotification', error); }, diff --git a/packages/lib/services/CommandService.test.ts b/packages/lib/services/CommandService.test.ts index 3640287d9..bd28aa2d8 100644 --- a/packages/lib/services/CommandService.test.ts +++ b/packages/lib/services/CommandService.test.ts @@ -21,6 +21,7 @@ function newService(): CommandService { return service; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function createCommand(name: string, options: any): TestCommand { const declaration: CommandDeclaration = { name: name, @@ -237,6 +238,7 @@ describe('services_CommandService', () => { let propValue = null; registerCommand(service, createCommand('test1', { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execute: (_context: any, greeting: string) => { propValue = greeting; }, diff --git a/packages/lib/services/CommandService.ts b/packages/lib/services/CommandService.ts index 3284d74d7..479c0013e 100644 --- a/packages/lib/services/CommandService.ts +++ b/packages/lib/services/CommandService.ts @@ -15,9 +15,11 @@ export interface CommandContext { } export interface CommandRuntime { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execute(context: CommandContext, ...args: any[]): Promise; enabledCondition?: EnabledCondition; // Used for the (optional) toolbar button title + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied mapStateToTitle?(state: any): string; } @@ -60,7 +62,9 @@ interface Commands { } interface ReduxStore { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied dispatch(action: any): void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied getState(): any; } @@ -96,12 +100,13 @@ export default class CommandService extends BaseService { } private commands_: Commands = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied 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 + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied public initialize(store: any, devMode: boolean, stateToWhenClauseContext: Function) { utils.store = store; this.store_ = store; @@ -199,24 +204,28 @@ export default class CommandService extends BaseService { command.runtime = runtime; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public registerCommands(commands: any[]) { for (const command of commands) { CommandService.instance().registerRuntime(command.declaration.name, command.runtime()); } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public unregisterCommands(commands: any[]) { for (const command of commands) { CommandService.instance().unregisterRuntime(command.declaration.name); } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public componentRegisterCommands(component: any, commands: any[]) { for (const command of commands) { CommandService.instance().registerRuntime(command.declaration.name, command.runtime(component)); } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public componentUnregisterCommands(commands: any[]) { for (const command of commands) { CommandService.instance().unregisterRuntime(command.declaration.name); @@ -232,12 +241,14 @@ export default class CommandService extends BaseService { private createContext(): CommandContext { return { state: this.store_.getState(), + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied dispatch: (action: any) => { this.store_.dispatch(action); }, }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async execute(commandName: string, ...args: any[]): Promise { const command = this.commandByName(commandName); // Some commands such as "showModalMessage" can be executed many @@ -248,6 +259,7 @@ export default class CommandService extends BaseService { return command.runtime.execute(this.createContext(), ...args); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public scheduleExecute(commandName: string, args: any) { shim.setTimeout(() => { void this.execute(commandName, args); @@ -265,6 +277,7 @@ export default class CommandService extends BaseService { // When looping on commands and checking their enabled state, the whenClauseContext // should be specified (created using currentWhenClauseContext) to avoid having // to re-create it on each call. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public isEnabled(commandName: string, whenClauseContext: any = null): boolean { const command = this.commandByName(commandName); if (!command || !command.runtime) return false; @@ -278,6 +291,7 @@ export default class CommandService extends BaseService { // The title is dynamic and derived from the state, which is why the state is passed // as an argument. Title can be used for example to display the alarm date on the // "set alarm" toolbar button. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public title(commandName: string, state: any = null): string { const command = this.commandByName(commandName); if (!command || !command.runtime) return null; diff --git a/packages/lib/services/DecryptionWorker.ts b/packages/lib/services/DecryptionWorker.ts index 749c2f7fc..6c952ae4f 100644 --- a/packages/lib/services/DecryptionWorker.ts +++ b/packages/lib/services/DecryptionWorker.ts @@ -14,6 +14,7 @@ interface DecryptionResult { skippedItemCount?: number; decryptedItemCounts?: number; decryptedItemCount?: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied error: any; } @@ -25,7 +26,9 @@ export default class DecryptionWorker { private logger_: Logger; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied public dispatch: Function = () => {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private scheduleId_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private eventEmitter_: any; private kvStore_: KvStore = null; private maxDecryptionAttempts_ = 2; @@ -62,6 +65,7 @@ export default class DecryptionWorker { return DecryptionWorker.instance_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setEncryptionService(v: any) { this.encryptionService_ = v; } @@ -112,12 +116,14 @@ export default class DecryptionWorker { await this.kvStore().deleteByPrefix('decrypt:'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public dispatchReport(report: any) { const action = { ...report }; action.type = 'DECRYPTION_WORKER_SET'; this.dispatch(action); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async start_(options: any = null): Promise { if (options === null) options = {}; if (!('masterKeyNotLoadedHandler' in options)) options.masterKeyNotLoadedHandler = 'throw'; @@ -163,6 +169,7 @@ export default class DecryptionWorker { this.state_ = 'started'; const excludedIds = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const decryptedItemCounts: any = {}; let skippedItemCount = 0; @@ -293,6 +300,7 @@ export default class DecryptionWorker { return finalReport; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async start(options: any = {}) { this.startCalls_.push(true); let output = null; diff --git a/packages/lib/services/ExternalEditWatcher.ts b/packages/lib/services/ExternalEditWatcher.ts index f6d57a302..2f8b49f02 100644 --- a/packages/lib/services/ExternalEditWatcher.ts +++ b/packages/lib/services/ExternalEditWatcher.ts @@ -17,9 +17,13 @@ export default class ExternalEditWatcher { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private bridge_: Function; private logger_: Logger = new Logger(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private watcher_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private eventEmitter_: any = new EventEmitter(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private skipNextChangeEvent_: any = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private chokidar_: any = chokidar; private static instance_: ExternalEditWatcher; @@ -44,13 +48,16 @@ export default class ExternalEditWatcher { }; return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied openAndWatch: async (args: any) => { const note = await loadNote(args.noteId); return this.openAndWatch(note); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied stopWatching: async (args: any) => { return this.stopWatching(args.noteId); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied noteIsWatched: async (args: any) => { const note = await loadNote(args.noteId); return this.noteIsWatched(note); @@ -154,6 +161,7 @@ export default class ExternalEditWatcher { }); // Hack to support external watcher on some linux applications (gedit, gvim, etc) // taken from https://github.com/paulmillr/chokidar/issues/591 + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.watcher_.on('raw', async (event: string, _path: string, options: any) => { const watchedPath: string = options.watchedPath; this.logger().debug(`ExternalEditWatcher: Raw event: ${event}: ${watchedPath}`); @@ -174,6 +182,7 @@ export default class ExternalEditWatcher { } private noteFilePathToId_(path: string) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let id: any = toSystemSlashes(path, 'linux').split('/'); if (!id.length) throw new Error(`Invalid path: ${path}`); id = id[id.length - 1]; diff --git a/packages/lib/services/ExternalEditWatcher/utils.ts b/packages/lib/services/ExternalEditWatcher/utils.ts index 283ca60dd..1c79d1d5a 100644 --- a/packages/lib/services/ExternalEditWatcher/utils.ts +++ b/packages/lib/services/ExternalEditWatcher/utils.ts @@ -9,6 +9,7 @@ import shim from '../../shim'; const logger = Logger.create('ExternalEditWatcher/utils'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const spawnCommand = async (path: string, args: string[], options: any) => { return new Promise((resolve, reject) => { // App bundles need to be opened using the `open` command. @@ -28,6 +29,7 @@ const spawnCommand = async (path: string, args: string[], options: any) => { path = 'open'; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const wrapError = (error: any) => { if (!error) return error; const msg = error.message ? [error.message] : []; @@ -47,6 +49,7 @@ const spawnCommand = async (path: string, args: string[], options: any) => { } }, 100); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied subProcess.on('error', (error: any) => { shim.clearInterval(iid); reject(wrapError(error)); @@ -71,6 +74,7 @@ const textEditorCommand = () => { }; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const openFileWithExternalEditor = async (filePath: string, bridge: any) => { const cmd = textEditorCommand(); if (!cmd) { diff --git a/packages/lib/services/KeymapService.ts b/packages/lib/services/KeymapService.ts index 11e12e8a1..602290987 100644 --- a/packages/lib/services/KeymapService.ts +++ b/packages/lib/services/KeymapService.ts @@ -127,6 +127,7 @@ export default class KeymapService extends BaseService { private customKeymapPath: string; private defaultKeymapItems: KeymapItem[]; private lastSaveTime_: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private modifiersRegExp: any; public constructor() { @@ -383,6 +384,7 @@ export default class KeymapService extends BaseService { if (!isValid) throw new Error(_('Accelerator "%s" is not valid.', accelerator)); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public domToElectronAccelerator(event: any) { const parts = []; diff --git a/packages/lib/services/KvStore.ts b/packages/lib/services/KvStore.ts index 96f8c6ff9..16220111e 100644 --- a/packages/lib/services/KvStore.ts +++ b/packages/lib/services/KvStore.ts @@ -8,7 +8,9 @@ enum ValueType { export default class KvStore extends BaseService { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private incMutex_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private db_: any = null; private static instance_: KvStore = null; @@ -28,6 +30,7 @@ export default class KvStore extends BaseService { this.incMutex_ = new Mutex(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setDb(v: any) { this.db_ = v; } @@ -37,12 +40,14 @@ export default class KvStore extends BaseService { return this.db_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private typeFromValue_(value: any) { if (typeof value === 'string') return ValueType.Text; if (typeof value === 'number') return ValueType.Int; throw new Error(`Unsupported value type: ${typeof value}`); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private formatValues_(kvs: any[]) { const output = []; for (const kv of kvs) { @@ -52,6 +57,7 @@ export default class KvStore extends BaseService { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private formatValue_(value: any, type: ValueType): string | number { if (type === ValueType.Int) return Number(value); if (type === ValueType.Text) return `${value}`; @@ -61,9 +67,11 @@ export default class KvStore extends BaseService { public async value(key: string): Promise { const r = await this.db().selectOne('SELECT `value`, `type` FROM key_values WHERE `key` = ?', [key]); if (!r) return null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return this.formatValue_(r.value, r.type) as any; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async setValue(key: string, value: any) { const t = Date.now(); await this.db().exec('INSERT OR REPLACE INTO key_values (`key`, `value`, `type`, `updated_time`) VALUES (?, ?, ?, ?)', [key, value, this.typeFromValue_(value), t]); diff --git a/packages/lib/services/NavService.ts b/packages/lib/services/NavService.ts index 3ffcf2cc7..c1be0190d 100644 --- a/packages/lib/services/NavService.ts +++ b/packages/lib/services/NavService.ts @@ -6,6 +6,7 @@ export default class NavService { public static dispatch: Function = () => {}; private static handlers_: OnNavigateCallback[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static async go(routeName: string, additionalProps: Record|null = null) { if (this.handlers_.length) { const r = await this.handlers_[this.handlers_.length - 1](); diff --git a/packages/lib/services/PostMessageService.ts b/packages/lib/services/PostMessageService.ts index 67a8241e5..c383d5de5 100644 --- a/packages/lib/services/PostMessageService.ts +++ b/packages/lib/services/PostMessageService.ts @@ -40,12 +40,15 @@ export enum ResponderComponentType { export interface MessageResponse { responseId: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied response: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied error: any; } type MessageResponder = (message: MessageResponse)=> void; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type ViewMessageHandler = (message: any)=> void; interface Message { @@ -55,6 +58,7 @@ interface Message { from: MessageParticipant; to: MessageParticipant; id: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied content: any; } @@ -110,6 +114,7 @@ export default class PostMessageService { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private sendResponse(message: Message, responseContent: any, error: any) { let responder: MessageResponder = null; @@ -131,6 +136,7 @@ export default class PostMessageService { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private responder(type: ResponderComponentType, viewId: string): any { return this.responders_[[type, viewId].join(':')]; } diff --git a/packages/lib/services/ReportService.ts b/packages/lib/services/ReportService.ts index 5c4af3658..6f6a2321b 100644 --- a/packages/lib/services/ReportService.ts +++ b/packages/lib/services/ReportService.ts @@ -71,6 +71,7 @@ export default class ReportService { return row.join(','); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public csvCreate(rows: any[]) { const output = []; for (let i = 0; i < rows.length; i++) { @@ -79,6 +80,7 @@ export default class ReportService { return output.join('\n'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async basicItemList(option: any = null) { if (!option) option = {}; if (!option.format) option.format = 'array'; @@ -103,6 +105,7 @@ export default class ReportService { } public async syncStatus(syncTarget: number) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { items: {}, total: {}, diff --git a/packages/lib/services/ResourceEditWatcher/index.ts b/packages/lib/services/ResourceEditWatcher/index.ts index 91566f596..517becfbc 100644 --- a/packages/lib/services/ResourceEditWatcher/index.ts +++ b/packages/lib/services/ResourceEditWatcher/index.ts @@ -28,12 +28,16 @@ export default class ResourceEditWatcher { private static instance_: ResourceEditWatcher; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private logger_: any; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private dispatch: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private watcher_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private chokidar_: any; private watchedItems_: WatchedItems = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private eventEmitter_: any; private tempDir_ = ''; private openItem_: OpenItemFn; @@ -46,7 +50,7 @@ export default class ResourceEditWatcher { this.eventEmitter_ = new EventEmitter(); } - // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied public initialize(logger: any, dispatch: Function, openItem: OpenItemFn) { this.logger_ = logger; this.dispatch = dispatch; @@ -84,15 +88,19 @@ export default class ResourceEditWatcher { public externalApi() { return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied openAndWatch: async ({ resourceId }: any) => { return this.openAndWatch(resourceId); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied watch: async ({ resourceId }: any) => { await this.watch(resourceId); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied stopWatching: async ({ resourceId }: any) => { return this.stopWatching(resourceId); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied isWatched: async ({ resourceId }: any) => { return !!this.watchedItemByResourceId(resourceId); }, @@ -170,6 +178,7 @@ export default class ResourceEditWatcher { // times per seconds, even when nothing is changed. useFsEvents: false, }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.watcher_.on('all', (event: any, path: string) => { path = path ? toSystemSlashes(path, 'linux') : ''; @@ -197,6 +206,7 @@ export default class ResourceEditWatcher { // that event is not event triggered. // https://github.com/laurent22/joplin/issues/3407 // + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.watcher_.on('raw', (event: string, _path: string, options: any) => { const watchedPath = options.watchedPath ? toSystemSlashes(options.watchedPath, 'linux') : ''; diff --git a/packages/lib/services/ResourceEditWatcher/reducer.ts b/packages/lib/services/ResourceEditWatcher/reducer.ts index 69fd4be11..af45f50b0 100644 --- a/packages/lib/services/ResourceEditWatcher/reducer.ts +++ b/packages/lib/services/ResourceEditWatcher/reducer.ts @@ -4,6 +4,7 @@ export const defaultState = { watchedResources: {}, }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const reducer = produce((draft: Draft, action: any) => { if (action.type.indexOf('RESOURCE_EDIT_WATCHER_') !== 0) return; diff --git a/packages/lib/services/ResourceFetcher.ts b/packages/lib/services/ResourceFetcher.ts index d1d546cac..2b8606c58 100644 --- a/packages/lib/services/ResourceFetcher.ts +++ b/packages/lib/services/ResourceFetcher.ts @@ -12,20 +12,28 @@ export default class ResourceFetcher extends BaseService { public static instance_: ResourceFetcher; - // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied public dispatch: Function = (_o: any) => {}; private logger_: Logger = new Logger(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private queue_: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private fetchingItems_: any = {}; private maxDownloads_ = 3; private addingResources_ = false; private eventEmitter_ = new EventEmitter(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private autoAddResourcesCalls_: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private fileApi_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private updateReportIID_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private scheduleQueueProcessIID_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private scheduleAutoAddResourcesIID_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(fileApi: any = null) { super(); this.setFileApi(fileApi); @@ -55,6 +63,7 @@ export default class ResourceFetcher extends BaseService { return this.logger_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setFileApi(v: any) { if (v !== null && typeof v !== 'function') throw new Error(`fileApi must be a function that returns the API. Type is ${typeof v}`); this.fileApi_ = v; @@ -244,6 +253,7 @@ export default class ResourceFetcher extends BaseService { this.logger().info(`ResourceFetcher: Auto-added resources: ${count}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await notifyDisabledSyncItems((action: any) => this.dispatch(action)); } finally { this.addingResources_ = false; diff --git a/packages/lib/services/ResourceService.ts b/packages/lib/services/ResourceService.ts index 9cdaf4d62..db91d7a68 100644 --- a/packages/lib/services/ResourceService.ts +++ b/packages/lib/services/ResourceService.ts @@ -18,7 +18,9 @@ export default class ResourceService extends BaseService { private isIndexing_ = false; private maintenanceCalls_: boolean[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private maintenanceTimer1_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private maintenanceTimer2_: any = null; public async indexNoteResources() { @@ -50,6 +52,7 @@ export default class ResourceService extends BaseService { if (!changes.length) break; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const noteIds = changes.map((a: any) => a.item_id); const notes = await Note.modelSelectAll(`SELECT id, title, body, encryption_applied FROM notes WHERE id IN ("${noteIds.join('","')}")`); diff --git a/packages/lib/services/RevisionService.ts b/packages/lib/services/RevisionService.ts index 45e130716..9fa02867c 100644 --- a/packages/lib/services/RevisionService.ts +++ b/packages/lib/services/RevisionService.ts @@ -25,9 +25,13 @@ export default class RevisionService extends BaseService { // notes never benefited from revisions so the first time they are modified, a copy of // the original note is saved. The goal is to have at least one revision in case the note // is deleted or modified as a result of a bug or user mistake. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private isOldNotesCache_: any = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private maintenanceCalls_: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private maintenanceTimer1_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private maintenanceTimer2_: any = null; private isCollecting_ = false; public isRunningInBackground_ = false; @@ -52,9 +56,11 @@ export default class RevisionService extends BaseService { private noteMetadata_(note: NoteEntity) { const excludedFields = ['type_', 'title', 'body', 'created_time', 'updated_time', 'encryption_applied', 'encryption_cipher_text', 'is_conflict']; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const md: any = {}; for (const k in note) { if (excludedFields.indexOf(k) >= 0) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied md[k] = (note as any)[k]; } @@ -231,6 +237,7 @@ export default class RevisionService extends BaseService { }; output.updated_time = output.user_updated_time; output.created_time = output.user_created_time; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (output as any).type_ = BaseModel.TYPE_NOTE; if (!('markup_language' in output)) output.markup_language = MarkupLanguage.Markdown; diff --git a/packages/lib/services/SettingUtils.ts b/packages/lib/services/SettingUtils.ts index 022604b33..c94c75a6b 100644 --- a/packages/lib/services/SettingUtils.ts +++ b/packages/lib/services/SettingUtils.ts @@ -13,6 +13,7 @@ import { migrateLocalSyncInfo } from './synchronizer/syncInfoUtils'; // In other words, it's not possible to load the settings without the KS service and it's not // possible to initialise the KS service without the settings. // The solution is to fetch just the client ID directly from the database. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function loadKeychainServiceAndSettings(KeychainServiceDriver: any) { const clientIdSetting = await Setting.loadOne('clientId'); const clientId = clientIdSetting ? clientIdSetting.value : uuid.create(); diff --git a/packages/lib/services/UndoRedoService.ts b/packages/lib/services/UndoRedoService.ts index fb154c161..a705ed098 100644 --- a/packages/lib/services/UndoRedoService.ts +++ b/packages/lib/services/UndoRedoService.ts @@ -3,6 +3,7 @@ const EventEmitter = require('events'); class UndoQueue { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private inner_: any[] = []; private size_ = 20; @@ -10,6 +11,7 @@ class UndoQueue { return this.inner_.pop(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public push(e: any) { this.inner_.push(e); while (this.length > this.size_) { @@ -21,6 +23,7 @@ class UndoQueue { return this.inner_.length; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public at(index: number): any { return this.inner_[index]; } @@ -32,6 +35,7 @@ export default class UndoRedoService { private pushAsyncQueue: AsyncActionQueue = new AsyncActionQueue(700); private undoStates: UndoQueue = new UndoQueue(); private redoStates: UndoQueue = new UndoQueue(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private eventEmitter: any = new EventEmitter(); private isUndoing = false; @@ -49,18 +53,21 @@ export default class UndoRedoService { return this.eventEmitter.removeListener(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public push(state: any) { this.undoStates.push(state); this.redoStates = new UndoQueue(); this.eventEmitter.emit('stackChange'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public schedulePush(state: any) { this.pushAsyncQueue.push(async () => { this.push(state); }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async undo(redoState: any) { if (this.isUndoing) return; if (!this.canUndo) throw new Error('Nothing to undo'); @@ -73,6 +80,7 @@ export default class UndoRedoService { return state; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async redo(undoState: any) { if (this.isUndoing) return; if (!this.canRedo) throw new Error('Nothing to redo'); diff --git a/packages/lib/services/WhenClause.ts b/packages/lib/services/WhenClause.ts index 47563c6a4..b9d0382fe 100644 --- a/packages/lib/services/WhenClause.ts +++ b/packages/lib/services/WhenClause.ts @@ -10,6 +10,7 @@ interface AdvancedExpression { // __sub_1 || test3 compiledText: string; // { __sub_1: "test1 && test2" } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied subExpressions: any; } @@ -17,6 +18,7 @@ function parseAdvancedExpression(advancedExpression: string): AdvancedExpression let subExpressionIndex = -1; let subExpressions = ''; let currentSubExpressionKey = ''; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const subContext: any = {}; let inBrackets = false; @@ -65,6 +67,7 @@ export default class WhenClause { this.validate_ = validate; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private createContext(ctx: any): IContext { return { getValue: (key: string) => { @@ -79,9 +82,11 @@ export default class WhenClause { return this.ruleCache_[exp]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public evaluate(context: any): boolean { if (this.validate_) this.validate(context); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const subContext: any = {}; for (const k in this.expression_.subExpressions) { @@ -93,6 +98,7 @@ export default class WhenClause { return this.rules(this.expression_.compiledText).evaluate(this.createContext(fullContext)); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public validate(context: any) { const keys = this.rules(this.expression_.original.replace(/[()]/g, ' ')).keys(); for (const key of keys) { diff --git a/packages/lib/services/commands/MenuUtils.ts b/packages/lib/services/commands/MenuUtils.ts index f58b4e9e0..aa90ba777 100644 --- a/packages/lib/services/commands/MenuUtils.ts +++ b/packages/lib/services/commands/MenuUtils.ts @@ -11,6 +11,7 @@ export interface MenuItem { label?: string; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied click?: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied role?: any; type?: string; accelerator?: string; @@ -23,10 +24,12 @@ interface MenuItems { } interface MenuItemProps { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied [key: string]: any; } interface MenuItemPropsCache { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied [key: string]: any; } @@ -36,6 +39,7 @@ interface MenuItemCache { const createShallowObjectEqualSelector = createSelectorCreator( defaultMemoize, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (prev: any, next: any) => { if (Object.keys(prev).length !== Object.keys(next).length) return false; for (const n in prev) { @@ -48,9 +52,12 @@ const createShallowObjectEqualSelector = createSelectorCreator( // This selector ensures that for the given command names, the same toolbar // button array is returned if the underlying toolbar buttons have not changed. const selectObjectByCommands = createCachedSelector( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (state: any) => state.array, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (array: any[]) => array, )({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied keySelector: (_state: any, commandNames: string[]) => { return commandNames.join('_'); }, @@ -95,6 +102,7 @@ export default class MenuUtils { return item; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public commandToStatefulMenuItem(commandName: string, ...args: any[]): MenuItem { const whenClauseContext = this.service.currentWhenClauseContext(); @@ -123,6 +131,7 @@ export default class MenuUtils { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public commandsToMenuItemProps(commandNames: string[], whenClauseContext: any): MenuItemProps { const output: MenuItemProps = {}; @@ -154,6 +163,7 @@ export default class MenuUtils { output.push(menuItem); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (output.length) output.splice(0, 0, { type: 'separator' } as any); return output; diff --git a/packages/lib/services/commands/ToolbarButtonUtils.ts b/packages/lib/services/commands/ToolbarButtonUtils.ts index aaf5df5e4..5097554d3 100644 --- a/packages/lib/services/commands/ToolbarButtonUtils.ts +++ b/packages/lib/services/commands/ToolbarButtonUtils.ts @@ -34,6 +34,7 @@ export default class ToolbarButtonUtils { return this.service_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private commandToToolbarButton(commandName: string, whenClauseContext: any): ToolbarButtonInfo { const newEnabled = this.service.isEnabled(commandName, whenClauseContext); const newTitle = this.service.title(commandName); @@ -70,11 +71,13 @@ export default class ToolbarButtonUtils { // This method ensures that if the provided commandNames and state hasn't changed // the output also won't change. Invididual toolbarButtonInfo also won't changed // if the state they use hasn't changed. This is to avoid useless renders of the toolbars. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public commandsToToolbarButtons(commandNames: string[], whenClauseContext: any): ToolbarButtonInfo[] { const output: ToolbarButtonInfo[] = []; for (const commandName of commandNames) { if (commandName === '-') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied output.push(separatorItem as any); continue; } diff --git a/packages/lib/services/commands/propsHaveChanged.ts b/packages/lib/services/commands/propsHaveChanged.ts index e2488ae7e..af71e252f 100644 --- a/packages/lib/services/commands/propsHaveChanged.ts +++ b/packages/lib/services/commands/propsHaveChanged.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function propsHaveChanged(previous: any, next: any): boolean { if (!previous && next) return true; if (previous && !next) return true; diff --git a/packages/lib/services/database/isSqliteSyntaxError.ts b/packages/lib/services/database/isSqliteSyntaxError.ts index f997c9316..1b28c47f0 100644 --- a/packages/lib/services/database/isSqliteSyntaxError.ts +++ b/packages/lib/services/database/isSqliteSyntaxError.ts @@ -1,4 +1,5 @@ // Syntax errors have a code 0 (no error) so we need to check the message. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default (sqliteError: any) => { return sqliteError.message && sqliteError.message.includes('syntax error'); }; diff --git a/packages/lib/services/debug/populateDatabase.ts b/packages/lib/services/debug/populateDatabase.ts index 1c5545c01..1b0cf06b5 100644 --- a/packages/lib/services/debug/populateDatabase.ts +++ b/packages/lib/services/debug/populateDatabase.ts @@ -13,6 +13,7 @@ export interface Options { subFolderDepth?: number; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function randomIndex(array: any[]): number { return Math.round(Math.random() * (array.length - 1)); } @@ -26,6 +27,7 @@ function randomIndexes(arrayLength: number, count: number): number[] { return arr; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function randomElements(array: any[], count: number): any[] { const indexes = randomIndexes(array.length, count); const output = []; @@ -35,6 +37,7 @@ function randomElements(array: any[], count: number): any[] { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function randomElement(array: any[]): any { const idx = randomIndex(array); return array[idx]; @@ -42,6 +45,7 @@ function randomElement(array: any[]): any { // Use the constants below to define how many folders, notes and tags // should be created. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default async function populateDatabase(db: any, options: Options = null) { options = { folderCount: 0, @@ -64,6 +68,7 @@ export default async function populateDatabase(db: any, options: Options = null) let rootFolderCount = 0; for (let i = 0; i < options.folderCount; i++) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const folder: any = { title: `folder${i}`, }; @@ -113,6 +118,7 @@ export default async function populateDatabase(db: any, options: Options = null) } for (let i = 0; i < options.noteCount; i++) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const note: any = { title: `note${i}`, body: `This is note num. ${i}` }; const parentIndex = randomIndex(createdFolderIds); note.parent_id = createdFolderIds[parentIndex]; diff --git a/packages/lib/services/e2ee/EncryptionService.ts b/packages/lib/services/e2ee/EncryptionService.ts index 109e765d4..cb73acffe 100644 --- a/packages/lib/services/e2ee/EncryptionService.ts +++ b/packages/lib/services/e2ee/EncryptionService.ts @@ -26,8 +26,11 @@ interface DecryptedMasterKey { } export interface EncryptionCustomHandler { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied context?: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied encrypt(context: any, hexaBytes: string, password: string): Promise; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied decrypt(context: any, hexaBytes: string, password: string): Promise; } @@ -53,6 +56,7 @@ export default class EncryptionService { public static instance_: EncryptionService = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public static fsDriver_: any = null; // Note: 1 MB is very slow with Node and probably even worse on mobile. @@ -110,6 +114,7 @@ export default class EncryptionService { public activeMasterKeyId() { const id = getActiveMasterKeyId(); if (!id) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const error: any = new Error('No master key is defined as active. Check this: Either one or more master keys exist but no password was provided for any of them. Or no master key exist. Or master keys and password exist, but none was set as active.'); error.code = 'noActiveMasterKey'; throw error; @@ -142,6 +147,7 @@ export default class EncryptionService { public loadedMasterKey(id: string) { if (!this.decryptedMasterKeys_[id]) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const error: any = new Error(`Master key is not loaded: ${id}`); error.code = 'masterKeyNotLoaded'; error.masterKeyId = id; @@ -170,6 +176,7 @@ export default class EncryptionService { } private async randomHexString(byteCount: number) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const bytes: any[] = await shim.randomBytes(byteCount); return bytes .map(a => { @@ -213,6 +220,7 @@ export default class EncryptionService { private async generateMasterKeyContent_(password: string, options: EncryptOptions = null) { options = { encryptionMethod: this.defaultMasterKeyEncryptionMethod_, ...options }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const bytes: any[] = await shim.randomBytes(256); const hexaBytes = bytes.map(a => hexPad(a.toString(16), 2)).join(''); @@ -258,6 +266,7 @@ export default class EncryptionService { return true; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private wrapSjclError(sjclError: any) { const error = new Error(sjclError.message); error.stack = sjclError.stack; @@ -415,6 +424,7 @@ export default class EncryptionService { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async encryptAbstract_(source: any, destination: any, options: EncryptOptions = null) { options = { encryptionMethod: this.defaultEncryptionMethod(), ...options }; @@ -449,9 +459,11 @@ export default class EncryptionService { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async decryptAbstract_(source: any, destination: any, options: EncryptOptions = null) { if (!options) options = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const header: any = await this.decodeHeaderSource_(source); const masterKeyPlainText = this.loadedMasterKey(header.masterKeyId).plainText; @@ -490,8 +502,10 @@ export default class EncryptionService { } private stringWriter_() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { data: [], + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied append: async function(data: any) { output.data.push(data); }, @@ -503,6 +517,7 @@ export default class EncryptionService { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async fileReader_(path: string, encoding: any) { const handle = await this.fsDriver().open(path, 'r'); const reader = { @@ -517,8 +532,10 @@ export default class EncryptionService { return reader; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async fileWriter_(path: string, encoding: any) { return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied append: async (data: any) => { return this.fsDriver().appendFile(path, data, encoding); }, @@ -526,6 +543,7 @@ export default class EncryptionService { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async encryptString(plainText: any, options: EncryptOptions = null): Promise { const source = this.stringReader_(plainText); const destination = this.stringWriter_(); @@ -533,6 +551,7 @@ export default class EncryptionService { return destination.result(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async decryptString(cipherText: any, options: EncryptOptions = null): Promise { const source = this.stringReader_(cipherText); const destination = this.stringWriter_(); @@ -591,11 +610,13 @@ export default class EncryptionService { } public headerTemplate(version: number) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const r = (this.headerTemplates_ as any)[version]; if (!r) throw new Error(`Unknown header version: ${version}`); return r; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public encodeHeader_(header: any) { // Sanity check if (header.masterKeyId.length !== 32) throw new Error(`Invalid master key ID size: ${header.masterKeyId}`); @@ -607,11 +628,13 @@ export default class EncryptionService { return `JED01${encryptionMetadata}`; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async decodeHeaderString(cipherText: any) { const source = this.stringReader_(cipherText); return this.decodeHeaderSource_(source); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async decodeHeaderSource_(source: any) { const identifier = await source.read(5); if (!isValidHeaderIdentifier(identifier)) throw new JoplinError(`Invalid encryption identifier. Data is not actually encrypted? ID was: ${identifier}`, 'invalidIdentifier'); @@ -622,7 +645,9 @@ export default class EncryptionService { return this.decodeHeaderBytes_(identifier + mdSizeHex + md); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public decodeHeaderBytes_(headerHexaBytes: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const reader: any = this.stringReader_(headerHexaBytes, true); const identifier = reader.read(3); const version = parseInt(reader.read(2), 16); @@ -631,6 +656,7 @@ export default class EncryptionService { parseInt(reader.read(6), 16); // Read the size and move the reader pointer forward + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (let i = 0; i < template.fields.length; i++) { @@ -658,6 +684,7 @@ export default class EncryptionService { return [EncryptionMethod.SJCL, EncryptionMethod.SJCL1a, EncryptionMethod.SJCL1b, EncryptionMethod.SJCL2, EncryptionMethod.SJCL3, EncryptionMethod.SJCL4].indexOf(method) >= 0; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async itemIsEncrypted(item: any) { if (!item) throw new Error('No item'); const ItemClass = BaseItem.itemClass(item); diff --git a/packages/lib/services/e2ee/types.ts b/packages/lib/services/e2ee/types.ts index 7899d1556..a274b6998 100644 --- a/packages/lib/services/e2ee/types.ts +++ b/packages/lib/services/e2ee/types.ts @@ -11,6 +11,7 @@ export interface MasterKeyEntity { hasBeenUsed?: boolean; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type RSAKeyPair = any; // Depends on implementation // This is the interface that each platform must implement. Data is passed as diff --git a/packages/lib/services/interop/InteropService.test.ts b/packages/lib/services/interop/InteropService.test.ts index 2d273c58a..c8123655f 100644 --- a/packages/lib/services/interop/InteropService.test.ts +++ b/packages/lib/services/interop/InteropService.test.ts @@ -20,6 +20,7 @@ async function recreateExportDir() { await fs.mkdirp(dir); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function fieldsEqual(model1: any, model2: any, fieldNames: string[]) { for (let i = 0; i < fieldNames.length; i++) { const f = fieldNames[i]; @@ -30,6 +31,7 @@ function fieldsEqual(model1: any, model2: any, fieldNames: string[]) { function memoryExportModule() { interface Item { type: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied object: any; } @@ -60,6 +62,7 @@ function memoryExportModule() { result.destPath = context.destPath; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProcessItem: async (_context: CustomExportContext, itemType: number, item: any) => { result.items.push({ type: itemType, @@ -67,6 +70,7 @@ function memoryExportModule() { }); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProcessResource: async (_context: CustomExportContext, resource: any, filePath: string) => { result.resources.push({ filePath: filePath, @@ -139,6 +143,7 @@ describe('services_InteropService', () => { await service.import({ path: filePath }); const allFolders = await Folder.all(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(allFolders.map((f: any) => f.title).sort().join(' - ')).toBe('folder - folder (1)'); })); @@ -591,6 +596,7 @@ describe('services_InteropService', () => { const filePath = `${exportDir()}/example.test`; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const result: any = { destPath: '', itemTypes: [], @@ -603,6 +609,7 @@ describe('services_InteropService', () => { const module: Module = makeExportModule({ type: ModuleType.Exporter, description: 'Test Export Module', + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied format: 'testing' as any, fileExtensions: ['test'], }, () => { @@ -611,11 +618,13 @@ describe('services_InteropService', () => { result.destPath = context.destPath; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProcessItem: async (_context: CustomExportContext, itemType: number, item: any) => { result.itemTypes.push(itemType); result.items.push(item); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProcessResource: async (_context: CustomExportContext, resource: any, filePath: string) => { result.resources.push(resource); result.filePaths.push(filePath); @@ -630,6 +639,7 @@ describe('services_InteropService', () => { const service = InteropService.instance(); service.registerModule(module); await service.export({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied format: 'testing' as any, path: filePath, }); @@ -637,6 +647,7 @@ describe('services_InteropService', () => { expect(result.destPath).toBe(filePath); expect(result.itemTypes.sort().join('_')).toBe('1_1_2_4'); expect(result.items.length).toBe(4); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(result.items.map((o: any) => o.title).sort().join('_')).toBe('folder1_note1_note2_photo.jpg'); expect(result.resources.length).toBe(1); expect(result.resources[0].title).toBe('photo.jpg'); diff --git a/packages/lib/services/interop/InteropService.ts b/packages/lib/services/interop/InteropService.ts index 4a74b53df..9b76daaba 100644 --- a/packages/lib/services/interop/InteropService.ts +++ b/packages/lib/services/interop/InteropService.ts @@ -27,6 +27,7 @@ export default class InteropService { private defaultModules_: Module[]; private userModules_: Module[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private eventEmitter_: any = null; private static instance_: InteropService; @@ -301,7 +302,9 @@ export default class InteropService { return result; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private normalizeItemForExport(_itemType: ModelType, item: any): any { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const override: any = {}; if ('is_shared' in item) override.is_shared = 0; if ('share_id' in item) override.share_id = ''; @@ -326,11 +329,13 @@ export default class InteropService { let sourceFolderIds = options.sourceFolderIds ? options.sourceFolderIds : []; const sourceNoteIds = options.sourceNoteIds ? options.sourceNoteIds : []; const result: ImportExportResult = { warnings: [] }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToExport: any[] = []; options.onProgress?.(ExportProgressState.QueuingItems, null); let totalItemsToProcess = 0; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queueExportItem = (itemType: number, itemOrId: any) => { totalItemsToProcess ++; itemsToExport.push({ @@ -404,6 +409,7 @@ export default class InteropService { await exporter.init(exportPath, options); const typeOrder = [BaseModel.TYPE_FOLDER, BaseModel.TYPE_RESOURCE, BaseModel.TYPE_NOTE, BaseModel.TYPE_TAG, BaseModel.TYPE_NOTE_TAG]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const context: any = { resourcePaths: {}, }; diff --git a/packages/lib/services/interop/InteropService_Exporter_Base.ts b/packages/lib/services/interop/InteropService_Exporter_Base.ts index 3570b08ca..1fb98cdf7 100644 --- a/packages/lib/services/interop/InteropService_Exporter_Base.ts +++ b/packages/lib/services/interop/InteropService_Exporter_Base.ts @@ -6,12 +6,16 @@ import { type ExportMetadata } from './Module'; import { ExportOptions } from './types'; export default class InteropService_Exporter_Base { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private context_: any = {}; private metadata_: ExportMetadata = null; public async init(_destDir: string, _options: ExportOptions = {}) {} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async prepareForProcessingItemType(_itemType: number, _itemsToExport: any[]) {} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async processItem(_itemType: number, _item: any) {} + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async processResource(_resource: any, _filePath: string) {} public async close() {} @@ -23,6 +27,7 @@ export default class InteropService_Exporter_Base { return this.metadata_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public updateContext(context: any) { this.context_ = { ...this.context_, ...context }; } diff --git a/packages/lib/services/interop/InteropService_Exporter_Custom.ts b/packages/lib/services/interop/InteropService_Exporter_Custom.ts index cb53e0225..738df065c 100644 --- a/packages/lib/services/interop/InteropService_Exporter_Custom.ts +++ b/packages/lib/services/interop/InteropService_Exporter_Custom.ts @@ -3,9 +3,13 @@ import InteropService_Exporter_Base from './InteropService_Exporter_Base'; import { ExportOptions } from './types'; interface CustomImporter { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onInit(context: any): Promise; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProcessItem(context: any, itemType: number, item: any): Promise; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProcessResource(context: any, resource: any, filePath: string): Promise; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onClose(context: any): Promise; } @@ -28,10 +32,12 @@ export default class InteropService_Exporter_Custom extends InteropService_Expor return this.module_.onInit(this.customContext_); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async processItem(itemType: number, item: any) { return this.module_.onProcessItem(this.customContext_, itemType, item); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async processResource(resource: any, filePath: string) { return this.module_.onProcessResource(this.customContext_, resource, filePath); } diff --git a/packages/lib/services/interop/InteropService_Exporter_Html.ts b/packages/lib/services/interop/InteropService_Exporter_Html.ts index a6929cb55..8cb2b4fff 100644 --- a/packages/lib/services/interop/InteropService_Exporter_Html.ts +++ b/packages/lib/services/interop/InteropService_Exporter_Html.ts @@ -24,9 +24,11 @@ export default class InteropService_Exporter_Html extends InteropService_Exporte private resourceDir_: string; private markupToHtml_: MarkupToHtml; private resources_: ResourceEntity[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private style_: any; private packIntoSingleFile_ = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async init(path: string, options: any = {}) { this.customCss_ = options.customCss ? options.customCss : ''; @@ -86,6 +88,7 @@ export default class InteropService_Exporter_Html extends InteropService_Exporte return newBody; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async processItem(_itemType: number, item: any) { if ([BaseModel.TYPE_NOTE, BaseModel.TYPE_FOLDER].indexOf(item.type_) < 0) return; @@ -152,6 +155,7 @@ export default class InteropService_Exporter_Html extends InteropService_Exporte } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async processResource(resource: any, filePath: string) { const destResourcePath = `${this.resourceDir_}/${basename(filePath)}`; await shim.fsDriver().copy(filePath, destResourcePath); diff --git a/packages/lib/services/interop/InteropService_Exporter_Jex.ts b/packages/lib/services/interop/InteropService_Exporter_Jex.ts index 5f6966cf8..2b7bacd6b 100644 --- a/packages/lib/services/interop/InteropService_Exporter_Jex.ts +++ b/packages/lib/services/interop/InteropService_Exporter_Jex.ts @@ -18,16 +18,19 @@ export default class InteropService_Exporter_Jex extends InteropService_Exporter await this.rawExporter_.init(this.tempDir_); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async processItem(itemType: number, item: any) { return this.rawExporter_.processItem(itemType, item); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async processResource(resource: any, filePath: string) { return this.rawExporter_.processResource(resource, filePath); } public async close() { const stats = await shim.fsDriver().readDirStats(this.tempDir_, { recursive: true }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const filePaths = stats.filter((a: any) => !a.isDirectory()).map((a: any) => a.path); if (!filePaths.length) throw new Error(_('There is no data to export.')); diff --git a/packages/lib/services/interop/InteropService_Exporter_Md.test.ts b/packages/lib/services/interop/InteropService_Exporter_Md.test.ts index 10773c57a..befaf825d 100644 --- a/packages/lib/services/interop/InteropService_Exporter_Md.test.ts +++ b/packages/lib/services/interop/InteropService_Exporter_Md.test.ts @@ -34,7 +34,9 @@ describe('interop/InteropService_Exporter_Md', () => { const exporter = new InteropService_Exporter_Md(); await exporter.init(exportDir()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToExport: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queueExportItem = (itemType: number, itemOrId: any) => { itemsToExport.push({ type: itemType, @@ -76,7 +78,9 @@ describe('interop/InteropService_Exporter_Md', () => { const exporter = new InteropService_Exporter_Md(); await exporter.init(exportDir()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToExport: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queueExportItem = (itemType: number, itemOrId: any) => { itemsToExport.push({ type: itemType, @@ -122,7 +126,9 @@ describe('interop/InteropService_Exporter_Md', () => { const exporter = new InteropService_Exporter_Md(); await exporter.init(exportDir()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToExport: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queueExportItem = (itemType: number, itemOrId: any) => { itemsToExport.push({ type: itemType, @@ -149,7 +155,9 @@ describe('interop/InteropService_Exporter_Md', () => { const exporter = new InteropService_Exporter_Md(); await exporter.init(exportDir()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToExport: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queueExportItem = (itemType: number, itemOrId: any) => { itemsToExport.push({ type: itemType, @@ -176,7 +184,9 @@ describe('interop/InteropService_Exporter_Md', () => { const exporter = new InteropService_Exporter_Md(); await exporter.init(exportDir()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToExport: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queueExportItem = (itemType: number, itemOrId: any) => { itemsToExport.push({ type: itemType, @@ -213,7 +223,9 @@ describe('interop/InteropService_Exporter_Md', () => { const exporter = new InteropService_Exporter_Md(); await exporter.init(exportDir()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToExport: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queueExportItem = (itemType: number, itemOrId: any) => { itemsToExport.push({ type: itemType, @@ -244,7 +256,9 @@ describe('interop/InteropService_Exporter_Md', () => { const exporter = new InteropService_Exporter_Md(); await exporter.init(exportDir()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToExport: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queueExportItem = (itemType: number, itemOrId: any) => { itemsToExport.push({ type: itemType, @@ -281,7 +295,9 @@ describe('interop/InteropService_Exporter_Md', () => { const exporter = new InteropService_Exporter_Md(); await exporter.init(exportDir()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToExport: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queueExportItem = (itemType: number, itemOrId: any) => { itemsToExport.push({ type: itemType, @@ -326,6 +342,7 @@ describe('interop/InteropService_Exporter_Md', () => { await exporter.processResource(resource2, Resource.fullPath(resource2)); await exporter.processResource(resource3, Resource.fullPath(resource3)); await exporter.processResource(resource4, Resource.fullPath(resource3)); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const context: any = { resourcePaths: {}, }; @@ -354,7 +371,9 @@ describe('interop/InteropService_Exporter_Md', () => { const exporter = new InteropService_Exporter_Md(); await exporter.init(exportDir()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToExport: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queueExportItem = (itemType: number, itemOrId: any) => { itemsToExport.push({ type: itemType, @@ -406,7 +425,9 @@ describe('interop/InteropService_Exporter_Md', () => { const exporter = new InteropService_Exporter_Md(); await exporter.init(exportDir()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToExport: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queueExportItem = (itemType: number, itemOrId: any) => { itemsToExport.push({ type: itemType, diff --git a/packages/lib/services/interop/InteropService_Exporter_Md.ts b/packages/lib/services/interop/InteropService_Exporter_Md.ts index a2ef0dafc..28b338505 100644 --- a/packages/lib/services/interop/InteropService_Exporter_Md.ts +++ b/packages/lib/services/interop/InteropService_Exporter_Md.ts @@ -23,6 +23,7 @@ export default class InteropService_Exporter_Md extends InteropService_Exporter_ await shim.fsDriver().mkdir(this.resourceDir_); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async makeDirPath_(item: any, pathPart: string = null, findUniqueFilename = true) { let output = ''; while (true) { @@ -39,6 +40,7 @@ export default class InteropService_Exporter_Md extends InteropService_Exporter_ } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async replaceLinkedItemIdsByRelativePaths_(item: any) { const relativePathToRoot = await this.makeDirPath_(item, '..'); @@ -66,7 +68,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 + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied private async replaceItemIdsByRelativePaths_(noteBody: string, linkedItemIds: string[], paths: any, fn_createRelativePath: Function) { let newBody = noteBody; @@ -79,9 +81,11 @@ export default class InteropService_Exporter_Md extends InteropService_Exporter_ return newBody; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async prepareForProcessingItemType(itemType: number, itemsToExport: any[]) { if (itemType === BaseModel.TYPE_NOTE) { // Create unique file path for the note + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const context: any = { notePaths: {}, }; @@ -115,6 +119,7 @@ export default class InteropService_Exporter_Md extends InteropService_Exporter_ return await Note.replaceResourceInternalToExternalLinks(await Note.serialize(modNote, ['body'])); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async processItem(_itemType: number, item: any) { if ([BaseModel.TYPE_NOTE, BaseModel.TYPE_FOLDER].indexOf(item.type_) < 0) return; diff --git a/packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.ts b/packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.ts index dc1f92948..631d618eb 100644 --- a/packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.ts +++ b/packages/lib/services/interop/InteropService_Exporter_Md_frontmatter.ts @@ -48,6 +48,7 @@ export const fieldOrder = ['title', 'updated', 'created', 'source', 'author', 'l export default class InteropService_Exporter_Md_frontmatter extends InteropService_Exporter_Md { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async prepareForProcessingItemType(itemType: number, itemsToExport: any[]) { await super.prepareForProcessingItemType(itemType, itemsToExport); diff --git a/packages/lib/services/interop/InteropService_Exporter_Raw.ts b/packages/lib/services/interop/InteropService_Exporter_Raw.ts index 3ca0bf318..6ad8d5632 100644 --- a/packages/lib/services/interop/InteropService_Exporter_Raw.ts +++ b/packages/lib/services/interop/InteropService_Exporter_Raw.ts @@ -16,6 +16,7 @@ export default class InteropService_Exporter_Raw extends InteropService_Exporter await shim.fsDriver().mkdir(this.resourceDir_); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async processItem(itemType: number, item: any) { const ItemClass = BaseItem.getClassByItemType(itemType); const serialized = await ItemClass.serialize(item); @@ -23,6 +24,7 @@ export default class InteropService_Exporter_Raw extends InteropService_Exporter await shim.fsDriver().writeFile(filePath, serialized, 'utf-8'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async processResource(_resource: any, filePath: string) { const destResourcePath = `${this.resourceDir_}/${basename(filePath)}`; await shim.fsDriver().copy(filePath, destResourcePath); diff --git a/packages/lib/services/interop/InteropService_Importer_Base.ts b/packages/lib/services/interop/InteropService_Importer_Base.ts index cab8b1249..32caec358 100644 --- a/packages/lib/services/interop/InteropService_Importer_Base.ts +++ b/packages/lib/services/interop/InteropService_Importer_Base.ts @@ -12,6 +12,7 @@ export default class InteropService_Importer_Base { protected sourcePath_ = ''; protected options_: ImportOptions = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setMetadata(md: any) { this.metadata_ = md; } @@ -20,6 +21,7 @@ export default class InteropService_Importer_Base { return this.metadata_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async init(sourcePath: string, options: any) { this.sourcePath_ = sourcePath; this.options_ = options; diff --git a/packages/lib/services/interop/InteropService_Importer_Custom.ts b/packages/lib/services/interop/InteropService_Importer_Custom.ts index 6c7c46bd8..cbde2d043 100644 --- a/packages/lib/services/interop/InteropService_Importer_Custom.ts +++ b/packages/lib/services/interop/InteropService_Importer_Custom.ts @@ -3,6 +3,7 @@ import { ImportExportResult } from './types'; interface CustomImporter { onExec( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied context: { sourcePath: string; options: any; warnings: string[] } ): Promise; } @@ -20,6 +21,7 @@ export default class InteropService_Importer_Custom extends InteropService_Impor // When passing the options to the plugin, we strip off any function // because they won't serialized over ipc. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const processedOptions: any = {}; if (this.options_) { diff --git a/packages/lib/services/interop/InteropService_Importer_EnexToMd.ts b/packages/lib/services/interop/InteropService_Importer_EnexToMd.ts index 19717b7c1..0f2578a32 100644 --- a/packages/lib/services/interop/InteropService_Importer_EnexToMd.ts +++ b/packages/lib/services/interop/InteropService_Importer_EnexToMd.ts @@ -16,6 +16,7 @@ const doImportEnex = async (destFolder: FolderEntity, sourcePath: string, option await importEnex(destFolder.id, sourcePath, options); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const enexImporterExec = async (result: ImportExportResult, destinationFolder: FolderEntity, sourcePath: string, fileExtensions: string[], options: any) => { sourcePath = rtrimSlashes(sourcePath); diff --git a/packages/lib/services/interop/InteropService_Importer_Md_frontmatter.ts b/packages/lib/services/interop/InteropService_Importer_Md_frontmatter.ts index 23e2d1ecd..1570738e2 100644 --- a/packages/lib/services/interop/InteropService_Importer_Md_frontmatter.ts +++ b/packages/lib/services/interop/InteropService_Importer_Md_frontmatter.ts @@ -33,6 +33,7 @@ function normalizeYamlWhitespace(yaml: string[]): string[] { // references: // https://pandoc.org/MANUAL.html#extension-yaml_metadata_block // https://github.com/hao203/rmarkdown-YAML +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function extractAuthor(author: any): string { if (!author) return ''; @@ -83,7 +84,9 @@ export default class InteropService_Importer_Md_frontmatter extends InteropServi return { header, body }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private toLowerCase(obj: Record): Record { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newObj: Record = {}; for (const key of Object.keys(obj)) { newObj[key.toLowerCase()] = obj[key]; diff --git a/packages/lib/services/interop/InteropService_Importer_Raw.test.ts b/packages/lib/services/interop/InteropService_Importer_Raw.test.ts index 4c463a884..4fc8a3f3a 100644 --- a/packages/lib/services/interop/InteropService_Importer_Raw.test.ts +++ b/packages/lib/services/interop/InteropService_Importer_Raw.test.ts @@ -217,6 +217,7 @@ describe('InteropService_Importer_Raw', () => { await InteropService.instance().import(importOptions); await InteropService.instance().import(importOptions); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const tree: any = await Folder.allAsTree(null, { includeNotes: true }); expect(tree[0].title).toBe('import test'); diff --git a/packages/lib/services/interop/InteropService_Importer_Raw.ts b/packages/lib/services/interop/InteropService_Importer_Raw.ts index fbcd44a32..abee8df17 100644 --- a/packages/lib/services/interop/InteropService_Importer_Raw.ts +++ b/packages/lib/services/interop/InteropService_Importer_Raw.ts @@ -15,7 +15,9 @@ import uuid from '../../uuid'; export default class InteropService_Importer_Raw extends InteropService_Importer_Base { public async exec(result: ImportExportResult) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemIdMap: any = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const createdResources: any = {}; const noteTagsToCreate = []; const destinationFolderId = this.options_.destinationFolderId; @@ -35,6 +37,7 @@ export default class InteropService_Importer_Raw extends InteropService_Importer const stats = await shim.fsDriver().readDirStats(this.sourcePath_); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const folderExists = function(stats: any[], folderId: string) { folderId = folderId.toLowerCase(); for (let i = 0; i < stats.length; i++) { @@ -45,6 +48,7 @@ export default class InteropService_Importer_Raw extends InteropService_Importer return false; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let defaultFolder_: any = null; const defaultFolder = async () => { if (defaultFolder_) return defaultFolder_; diff --git a/packages/lib/services/interop/Module.test.ts b/packages/lib/services/interop/Module.test.ts index 90b570e8d..aacd3adea 100644 --- a/packages/lib/services/interop/Module.test.ts +++ b/packages/lib/services/interop/Module.test.ts @@ -38,6 +38,7 @@ describe('Module', () => { it('should return correct default fullLabel for an ExportModule', () => { const testExportModule = makeExportModule({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied format: 'format_test_______TEST' as any, description: 'Testing...', }, () => new InteropService_Exporter_Base()); diff --git a/packages/lib/services/interop/Module.ts b/packages/lib/services/interop/Module.ts index c0a1ffe4d..7c1ce912c 100644 --- a/packages/lib/services/interop/Module.ts +++ b/packages/lib/services/interop/Module.ts @@ -100,6 +100,7 @@ export const makeExportModule = ( ): ExportModule => { const exporterDefaults: ExportMetadata = { ...defaultBaseMetadata, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied format: '' as any, type: ModuleType.Exporter, target: FileSystemItem.File, diff --git a/packages/lib/services/interop/types.ts b/packages/lib/services/interop/types.ts index 13ae6264d..0ffd14a44 100644 --- a/packages/lib/services/interop/types.ts +++ b/packages/lib/services/interop/types.ts @@ -42,11 +42,14 @@ export interface ImportOptions { format?: string; // modulePath?: string; destinationFolderId?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied destinationFolder?: any; outputFormat?: ImportModuleOutputFormat; // Only supported by some importers. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProgress?: (progressState: any, progress?: any)=> void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onError?: (error: any)=> void; defaultFolderTitle?: string; diff --git a/packages/lib/services/joplinCloudUtils.ts b/packages/lib/services/joplinCloudUtils.ts index 9092df799..6a4cb549d 100644 --- a/packages/lib/services/joplinCloudUtils.ts +++ b/packages/lib/services/joplinCloudUtils.ts @@ -7,6 +7,7 @@ import { _ } from '../locale'; type ActionType = 'LINK_USED' | 'COMPLETED' | 'ERROR'; type Action = { type: ActionType; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied payload?: any; }; diff --git a/packages/lib/services/noteList/defaultMultiColumnsRenderer.ts b/packages/lib/services/noteList/defaultMultiColumnsRenderer.ts index 3312caeaf..a26f44670 100644 --- a/packages/lib/services/noteList/defaultMultiColumnsRenderer.ts +++ b/packages/lib/services/noteList/defaultMultiColumnsRenderer.ts @@ -114,6 +114,7 @@ const renderer: ListRenderer = { `, }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onRenderNote: async (props: any) => { return { ...props, diff --git a/packages/lib/services/noteList/renderTemplate.test.ts b/packages/lib/services/noteList/renderTemplate.test.ts index b7514a443..42f042bd5 100644 --- a/packages/lib/services/noteList/renderTemplate.test.ts +++ b/packages/lib/services/noteList/renderTemplate.test.ts @@ -14,6 +14,7 @@ describe('renderTemplate', () => { width: 100, }, { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied name: 'note.titleHtml' as any, // Testing backward compatibility width: 200, }, diff --git a/packages/lib/services/noteList/renderTemplate.ts b/packages/lib/services/noteList/renderTemplate.ts index e9953eda7..1f42d74a3 100644 --- a/packages/lib/services/noteList/renderTemplate.ts +++ b/packages/lib/services/noteList/renderTemplate.ts @@ -6,10 +6,12 @@ import { objectValueFromPath } from '@joplin/utils/object'; interface Cell { name: ColumnName; styleHtml: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; contentHtml: ()=> string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const valueToString = (value: any) => { if (value === undefined || value === null) return ''; return value.toString(); diff --git a/packages/lib/services/noteList/renderViewProps.ts b/packages/lib/services/noteList/renderViewProps.ts index deb5097cf..e49edc4f5 100644 --- a/packages/lib/services/noteList/renderViewProps.ts +++ b/packages/lib/services/noteList/renderViewProps.ts @@ -12,6 +12,7 @@ export interface RenderViewPropsOptions { noteTitleHtml: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const renderViewProp = (name: ListRendererDependency, value: any, options: RenderViewPropsOptions): string => { const renderers: Partial string>> = { 'note.user_updated_time': () => time.formatMsToLocal(value), diff --git a/packages/lib/services/ocr/OcrService.ts b/packages/lib/services/ocr/OcrService.ts index 5ba209514..a5fc22a41 100644 --- a/packages/lib/services/ocr/OcrService.ts +++ b/packages/lib/services/ocr/OcrService.ts @@ -32,6 +32,7 @@ export default class OcrService { private driver_: OcrDriverBase; private isRunningInBackground_ = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private maintenanceTimer_: any = null; private pdfExtractDir_: string = null; private isProcessingResources_ = false; diff --git a/packages/lib/services/plugins/BasePlatformImplementation.ts b/packages/lib/services/plugins/BasePlatformImplementation.ts index 5f1b1fd73..c4b6392e3 100644 --- a/packages/lib/services/plugins/BasePlatformImplementation.ts +++ b/packages/lib/services/plugins/BasePlatformImplementation.ts @@ -7,6 +7,7 @@ import { Implementation as ImagingImplementation } from './api/JoplinImaging'; export interface JoplinViewsDialogs { showMessageBox(message: string): Promise; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied showOpenDialog(options: any): Promise; } @@ -25,10 +26,12 @@ export default class BasePlatformImplementation { throw new Error('Not implemented: versionInfo'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public get clipboard(): any { throw new Error('Not implemented: clipboard'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public get nativeImage(): any { throw new Error('Not implemented: nativeImage'); } @@ -37,6 +40,7 @@ export default class BasePlatformImplementation { throw new Error('Not implemented: window'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public registerComponent(_name: string, _component: any) { throw new Error('Not implemented: registerComponent'); } diff --git a/packages/lib/services/plugins/MenuController.ts b/packages/lib/services/plugins/MenuController.ts index 9696bba7f..24d2ecc5e 100644 --- a/packages/lib/services/plugins/MenuController.ts +++ b/packages/lib/services/plugins/MenuController.ts @@ -3,6 +3,7 @@ import ViewController from './ViewController'; export default class MenuController extends ViewController { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(id: string, pluginId: string, store: any, label: string, menuItems: MenuItem[], location: MenuItemLocation) { super(id, pluginId, store); diff --git a/packages/lib/services/plugins/MenuItemController.ts b/packages/lib/services/plugins/MenuItemController.ts index 8da6dc50b..90ea6344e 100644 --- a/packages/lib/services/plugins/MenuItemController.ts +++ b/packages/lib/services/plugins/MenuItemController.ts @@ -3,6 +3,7 @@ import ViewController from './ViewController'; export default class MenuItemController extends ViewController { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(id: string, pluginId: string, store: any, commandName: string, location: MenuItemLocation) { super(id, pluginId, store); diff --git a/packages/lib/services/plugins/Plugin.ts b/packages/lib/services/plugins/Plugin.ts index 11b39a0eb..4a34f5975 100644 --- a/packages/lib/services/plugins/Plugin.ts +++ b/packages/lib/services/plugins/Plugin.ts @@ -30,6 +30,7 @@ export default class Plugin { private contentScripts_: ContentScripts = {}; // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied private dispatch_: Function; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private eventEmitter_: any; private devMode_ = false; private builtIn_ = false; @@ -116,6 +117,7 @@ export default class Plugin { return this.eventEmitter_.removeListener(eventName, callback); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public emit(eventName: string, event: any = null) { return this.eventEmitter_.emit(eventName, event); } @@ -175,15 +177,18 @@ export default class Plugin { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public emitMessage(message: any) { if (!this.messageListener_) return; return this.messageListener_(message); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public onMessage(callback: any) { this.messageListener_ = callback; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public onContentScriptMessage(id: string, callback: any) { if (!this.contentScriptById(id)) { // The script could potentially be registered later on, but still @@ -194,6 +199,7 @@ export default class Plugin { this.contentScriptMessageListeners_[id] = callback; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public emitContentScriptMessage(id: string, message: any) { if (!this.contentScriptMessageListeners_[id]) return; return this.contentScriptMessageListeners_[id](message); diff --git a/packages/lib/services/plugins/PluginService.ts b/packages/lib/services/plugins/PluginService.ts index 345dabf42..45e130497 100644 --- a/packages/lib/services/plugins/PluginService.ts +++ b/packages/lib/services/plugins/PluginService.ts @@ -91,13 +91,16 @@ export default class PluginService extends BaseService { } private appVersion_: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private store_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private platformImplementation_: any = null; private plugins_: Plugins = {}; private runner_: BasePluginRunner = null; private startedPlugins_: Record = {}; private isSafeMode_ = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public initialize(appVersion: string, platformImplementation: any, runner: BasePluginRunner, store: any) { this.appVersion_ = appVersion; this.store_ = store; @@ -174,6 +177,7 @@ export default class PluginService extends BaseService { return this.plugins_[id]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public unserializePluginSettings(settings: any): PluginSettings { const output = { ...settings }; @@ -252,6 +256,7 @@ export default class PluginService extends BaseService { const unpackDir = `${Setting.value('cacheDir')}/${fname}`; const manifestFilePath = `${unpackDir}/manifest.json`; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let manifest: any = await this.loadManifestToObject(manifestFilePath); if (!manifest || manifest._package_hash !== hash) { @@ -278,6 +283,7 @@ export default class PluginService extends BaseService { // Loads the manifest as a simple object with no validation. Used only // when unpacking a package. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async loadManifestToObject(path: string): Promise { try { const manifestText = await shim.fsDriver().readFile(path, 'utf8'); @@ -347,6 +353,7 @@ export default class PluginService extends BaseService { const dataDir = `${Setting.value('pluginDataDir')}/${manifest.id}`; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const plugin = new Plugin(baseDir, manifest, scriptText, (action: any) => this.store_.dispatch(action), dataDir); for (const notice of deprecationNotices) { @@ -384,12 +391,14 @@ export default class PluginService extends BaseService { pluginPaths = pluginDirOrPaths; } else { pluginPaths = (await shim.fsDriver().readDirStats(pluginDirOrPaths)) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .filter((stat: any) => { if (stat.isDirectory()) return true; if (stat.path.toLowerCase().endsWith('.js')) return true; if (stat.path.toLowerCase().endsWith('.jpl')) return true; return false; }) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .map((stat: any) => `${pluginDirOrPaths}/${stat.path}`); } diff --git a/packages/lib/services/plugins/RepositoryApi.ts b/packages/lib/services/plugins/RepositoryApi.ts index d91d4f74f..35a63d753 100644 --- a/packages/lib/services/plugins/RepositoryApi.ts +++ b/packages/lib/services/plugins/RepositoryApi.ts @@ -204,6 +204,7 @@ export default class RepositoryApi { } for (const field of ['name', 'description']) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const v = (manifest as any)[field]; if (!v) continue; diff --git a/packages/lib/services/plugins/ToolbarButtonController.ts b/packages/lib/services/plugins/ToolbarButtonController.ts index bfada8d15..5e68bea1f 100644 --- a/packages/lib/services/plugins/ToolbarButtonController.ts +++ b/packages/lib/services/plugins/ToolbarButtonController.ts @@ -3,6 +3,7 @@ import ViewController from './ViewController'; export default class ToolbarButtonController extends ViewController { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(id: string, pluginId: string, store: any, commandName: string, location: ToolbarButtonLocation) { super(id, pluginId, store); diff --git a/packages/lib/services/plugins/ViewController.ts b/packages/lib/services/plugins/ViewController.ts index 30a5ce1c7..4b04169e3 100644 --- a/packages/lib/services/plugins/ViewController.ts +++ b/packages/lib/services/plugins/ViewController.ts @@ -1,6 +1,7 @@ import { ViewHandle } from './utils/createViewHandle'; export interface EmitMessageEvent { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied message: any; } @@ -8,18 +9,22 @@ export default class ViewController { private handle_: ViewHandle; private pluginId_: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private store_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(handle: ViewHandle, pluginId: string, store: any) { this.handle_ = handle; this.pluginId_ = pluginId; this.store_ = store; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected get storeView(): any { return this.store_.getState().pluginService.plugins[this.pluginId_].views[this.handle]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied protected get store(): any { return this.store_; } @@ -40,10 +45,12 @@ export default class ViewController { throw new Error('Must be overriden'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async emitMessage(event: EmitMessageEvent): Promise { console.warn('Calling ViewController.emitMessage - but not implemented', event); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public postMessage(message: any) { console.warn('Calling ViewController.postMessage - but not implemented', message); } diff --git a/packages/lib/services/plugins/WebviewController.ts b/packages/lib/services/plugins/WebviewController.ts index 34600c038..a5e17a16e 100644 --- a/packages/lib/services/plugins/WebviewController.ts +++ b/packages/lib/services/plugins/WebviewController.ts @@ -22,9 +22,11 @@ interface CloseResponse { // TODO: Copied from: // packages/app-desktop/gui/ResizableLayout/utils/findItemByKey.ts +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function findItemByKey(layout: any, key: string): any { if (!layout) throw new Error('Layout cannot be null'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function recurseFind(item: any): any { if (item.key === key) return item; @@ -50,6 +52,7 @@ export default class WebviewController extends ViewController { // True if a **panel** is shown in a modal window. private panelInModalMode_ = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(handle: ViewHandle, pluginId: string, store: any, baseDir: string, containerType: ContainerType) { super(handle, pluginId, store); this.baseDir_ = toSystemSlashes(baseDir, 'linux'); @@ -74,6 +77,7 @@ export default class WebviewController extends ViewController { return 'webview'; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private setStoreProp(name: string, value: any) { this.store.dispatch({ type: 'PLUGIN_VIEW_PROP_SET', @@ -110,6 +114,7 @@ export default class WebviewController extends ViewController { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public postMessage(message: any) { const messageId = `plugin_${Date.now()}${Math.random()}`; @@ -126,12 +131,14 @@ export default class WebviewController extends ViewController { } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async emitMessage(event: EmitMessageEvent): Promise { if (!this.messageListener_) return; return this.messageListener_(event.message); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public onMessage(callback: any) { this.messageListener_ = callback; } diff --git a/packages/lib/services/plugins/api/Global.ts b/packages/lib/services/plugins/api/Global.ts index f513f8369..1f20d712f 100644 --- a/packages/lib/services/plugins/api/Global.ts +++ b/packages/lib/services/plugins/api/Global.ts @@ -15,6 +15,7 @@ export default class Global { private joplin_: Joplin; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(implementation: any, plugin: Plugin, store: any) { this.joplin_ = new Joplin(implementation, plugin, store); } @@ -26,6 +27,7 @@ export default class Global { // To get webpack to work with Node module we need to set the parameter `target: "node"`, however // when setting this, the code generated by webpack will try to access the `process` global variable, // which won't be defined in the sandbox. So here we simply forward the variable, which makes it all work. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public get process(): any { return process; } diff --git a/packages/lib/services/plugins/api/Joplin.ts b/packages/lib/services/plugins/api/Joplin.ts index bf9bbed63..57867dde4 100644 --- a/packages/lib/services/plugins/api/Joplin.ts +++ b/packages/lib/services/plugins/api/Joplin.ts @@ -43,6 +43,7 @@ export default class Joplin { private window_: JoplinWindow = null; private implementation_: BasePlatformImplementation = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(implementation: BasePlatformImplementation, plugin: Plugin, store: any) { this.implementation_ = implementation; this.data_ = new JoplinData(plugin); @@ -127,6 +128,7 @@ export default class Joplin { * * desktop */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public require(_path: string): any { // Just a stub. Implementation has to be done within plugin process, in plugin_index.js } diff --git a/packages/lib/services/plugins/api/JoplinClipboard.ts b/packages/lib/services/plugins/api/JoplinClipboard.ts index 3b268ef4d..f9af50fde 100644 --- a/packages/lib/services/plugins/api/JoplinClipboard.ts +++ b/packages/lib/services/plugins/api/JoplinClipboard.ts @@ -2,9 +2,12 @@ export default class JoplinClipboard { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private electronClipboard_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private electronNativeImage_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(electronClipboard: any, electronNativeImage: any) { this.electronClipboard_ = electronClipboard; this.electronNativeImage_ = electronNativeImage; diff --git a/packages/lib/services/plugins/api/JoplinCommands.ts b/packages/lib/services/plugins/api/JoplinCommands.ts index 97ace1084..8c51a817b 100644 --- a/packages/lib/services/plugins/api/JoplinCommands.ts +++ b/packages/lib/services/plugins/api/JoplinCommands.ts @@ -78,6 +78,7 @@ export default class JoplinCommands { * await joplin.commands.execute('newFolder', "SOME_FOLDER_ID"); * ``` */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async execute(commandName: string, ...args: any[]): Promise { return CommandService.instance().execute(commandName, ...args); } @@ -107,6 +108,7 @@ export default class JoplinCommands { if ('iconName' in command) declaration.iconName = command.iconName; const runtime: CommandRuntime = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execute: (_context: CommandContext, ...args: any[]) => { return command.execute(...args); }, diff --git a/packages/lib/services/plugins/api/JoplinContentScripts.ts b/packages/lib/services/plugins/api/JoplinContentScripts.ts index b4c4fbb38..00d3cf43b 100644 --- a/packages/lib/services/plugins/api/JoplinContentScripts.ts +++ b/packages/lib/services/plugins/api/JoplinContentScripts.ts @@ -48,6 +48,7 @@ export default class JoplinContentScripts { * [postMessage * demo](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/post_messages) */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async onMessage(contentScriptId: string, callback: any) { this.plugin.onContentScriptMessage(contentScriptId, callback); } diff --git a/packages/lib/services/plugins/api/JoplinData.ts b/packages/lib/services/plugins/api/JoplinData.ts index 909296e5b..ed3149637 100644 --- a/packages/lib/services/plugins/api/JoplinData.ts +++ b/packages/lib/services/plugins/api/JoplinData.ts @@ -46,6 +46,7 @@ import { Path } from './types'; */ export default class JoplinData { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private api_: any = new Api(); private pathSegmentRegex_: RegExp; private plugin: Plugin; @@ -54,6 +55,7 @@ export default class JoplinData { this.plugin = plugin; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private serializeApiBody(body: any) { if (typeof body !== 'string') { return JSON.stringify(body); } return body; @@ -75,18 +77,22 @@ export default class JoplinData { return path.join('/'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async get(path: Path, query: any = null) { return this.api_.route('GET', this.pathToString(path), query); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async post(path: Path, query: any = null, body: any = null, files: any[] = null) { return this.api_.route('POST', this.pathToString(path), query, this.serializeApiBody(body), files); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async put(path: Path, query: any = null, body: any = null, files: any[] = null) { return this.api_.route('PUT', this.pathToString(path), query, this.serializeApiBody(body), files); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async delete(path: Path, query: any = null) { return this.api_.route('DELETE', this.pathToString(path), query); } diff --git a/packages/lib/services/plugins/api/JoplinImaging.ts b/packages/lib/services/plugins/api/JoplinImaging.ts index c8318af7d..6764eadac 100644 --- a/packages/lib/services/plugins/api/JoplinImaging.ts +++ b/packages/lib/services/plugins/api/JoplinImaging.ts @@ -36,7 +36,9 @@ export interface PdfInfo { export interface Implementation { nativeImage: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied createFromPath: (path: string)=> Promise; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied createFromPdf: (path: string, options: CreateFromPdfOptions)=> Promise; }; getPdfInfo: (path: string)=> Promise; @@ -52,6 +54,7 @@ export type Handle = string; interface Image { handle: Handle; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied data: any; } @@ -95,6 +98,7 @@ export default class JoplinImaging { return image; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private cacheImage(data: any) { const handle = this.createImageHandle(); this.images_.push({ @@ -199,6 +203,7 @@ export default class JoplinImaging { * Creates a new Joplin resource from the image data. The image will be * first converted to a JPEG. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async toJpgResource(handle: Handle, resourceProps: any, quality = 80) { const tempFilePath = this.tempFilePath('jpg'); await this.toJpgFile(handle, tempFilePath, quality); @@ -211,6 +216,7 @@ export default class JoplinImaging { * Creates a new Joplin resource from the image data. The image will be * first converted to a PNG. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async toPngResource(handle: Handle, resourceProps: any) { const tempFilePath = this.tempFilePath('png'); await this.toPngFile(handle, tempFilePath); diff --git a/packages/lib/services/plugins/api/JoplinInterop.ts b/packages/lib/services/plugins/api/JoplinInterop.ts index 5d33cd19f..0464d6aab 100644 --- a/packages/lib/services/plugins/api/JoplinInterop.ts +++ b/packages/lib/services/plugins/api/JoplinInterop.ts @@ -26,6 +26,7 @@ export default class JoplinInterop { public async registerExportModule(module: ExportModule) { const internalModule = makeExportModule({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ...module as any, type: ModuleType.Exporter, fileExtensions: module.fileExtensions ? module.fileExtensions : [], diff --git a/packages/lib/services/plugins/api/JoplinPlugins.ts b/packages/lib/services/plugins/api/JoplinPlugins.ts index 56aa9cc1d..a1c1e6734 100644 --- a/packages/lib/services/plugins/api/JoplinPlugins.ts +++ b/packages/lib/services/plugins/api/JoplinPlugins.ts @@ -38,7 +38,7 @@ export default class JoplinPlugins { // We don't use `await` when calling onStart because the plugin might be awaiting // in that call too (for example, when opening a dialog on startup) so we don't // want to get stuck here. - // 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/no-explicit-any -- Old code before rule was applied, Old code before rule was applied void script.onStart({}).catch((error: any) => { // For some reason, error thrown from the executed script do not have the type "Error" // but are instead plain object. So recreate the Error object here so that it can @@ -84,6 +84,7 @@ export default class JoplinPlugins { /** * @deprecated Use joplin.require() */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public require(_path: string): any { // Just a stub. Implementation has to be done within plugin process, in plugin_index.js } diff --git a/packages/lib/services/plugins/api/JoplinSettings.ts b/packages/lib/services/plugins/api/JoplinSettings.ts index 00a65d9b2..8cb41d316 100644 --- a/packages/lib/services/plugins/api/JoplinSettings.ts +++ b/packages/lib/services/plugins/api/JoplinSettings.ts @@ -148,6 +148,7 @@ export default class JoplinSettings { /** * Gets a setting value (only applies to setting you registered from your plugin) */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async value(key: string): Promise { return Setting.value(getPluginNamespacedSettingKey(this.plugin_.id, key)); } @@ -155,6 +156,7 @@ export default class JoplinSettings { /** * Sets a setting value (only applies to setting you registered from your plugin) */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async setValue(key: string, value: any) { return Setting.setValue(getPluginNamespacedSettingKey(this.plugin_.id, key), value); } @@ -166,6 +168,7 @@ export default class JoplinSettings { * * https://github.com/laurent22/joplin/blob/dev/packages/lib/models/Setting.ts#L142 */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async globalValue(key: string): Promise { return Setting.value(key); } diff --git a/packages/lib/services/plugins/api/JoplinViews.ts b/packages/lib/services/plugins/api/JoplinViews.ts index bb99164c4..4f0729a0d 100644 --- a/packages/lib/services/plugins/api/JoplinViews.ts +++ b/packages/lib/services/plugins/api/JoplinViews.ts @@ -16,6 +16,7 @@ import JoplinViewsNoteList from './JoplinViewsNoteList'; */ export default class JoplinViews { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private store: any; private plugin: Plugin; @@ -25,8 +26,10 @@ export default class JoplinViews { private toolbarButtons_: JoplinViewsToolbarButtons = null; private dialogs_: JoplinViewsDialogs = null; private noteList_: JoplinViewsNoteList = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private implementation_: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(implementation: any, plugin: Plugin, store: any) { this.store = store; this.plugin = plugin; diff --git a/packages/lib/services/plugins/api/JoplinViewsDialogs.ts b/packages/lib/services/plugins/api/JoplinViewsDialogs.ts index e8d7a2ab7..371cd9560 100644 --- a/packages/lib/services/plugins/api/JoplinViewsDialogs.ts +++ b/packages/lib/services/plugins/api/JoplinViewsDialogs.ts @@ -38,10 +38,12 @@ import { JoplinViewsDialogs as JoplinViewsDialogsImplementation } from '../BaseP */ export default class JoplinViewsDialogs { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private store: any; private plugin: Plugin; private implementation_: JoplinViewsDialogsImplementation; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(implementation: any, plugin: Plugin, store: any) { this.store = store; this.plugin = plugin; @@ -81,6 +83,7 @@ export default class JoplinViewsDialogs { * * desktop */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async showOpenDialog(options: any): Promise { return this.implementation_.showOpenDialog(options); } diff --git a/packages/lib/services/plugins/api/JoplinViewsMenuItems.ts b/packages/lib/services/plugins/api/JoplinViewsMenuItems.ts index b663d911b..6bc5f0e6f 100644 --- a/packages/lib/services/plugins/api/JoplinViewsMenuItems.ts +++ b/packages/lib/services/plugins/api/JoplinViewsMenuItems.ts @@ -15,9 +15,11 @@ import createViewHandle from '../utils/createViewHandle'; */ export default class JoplinViewsMenuItems { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private store: any; private plugin: Plugin; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(plugin: Plugin, store: any) { this.store = store; this.plugin = plugin; @@ -29,8 +31,11 @@ export default class JoplinViewsMenuItems { public async create(id: string, commandName: string, location: MenuItemLocation = MenuItemLocation.Tools, options: CreateMenuItemOptions = null) { if (typeof location !== 'string') { this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.menuItem.create("my-unique-id", ...)`', true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied options = location as any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied location = commandName as any || MenuItemLocation.Tools; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied commandName = id as any; id = `${this.plugin.viewCount}`; } diff --git a/packages/lib/services/plugins/api/JoplinViewsMenus.ts b/packages/lib/services/plugins/api/JoplinViewsMenus.ts index 702fb8ab2..4eb91a25b 100644 --- a/packages/lib/services/plugins/api/JoplinViewsMenus.ts +++ b/packages/lib/services/plugins/api/JoplinViewsMenus.ts @@ -15,9 +15,11 @@ import createViewHandle from '../utils/createViewHandle'; */ export default class JoplinViewsMenus { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private store: any; private plugin: Plugin; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(plugin: Plugin, store: any) { this.store = store; this.plugin = plugin; @@ -42,8 +44,11 @@ export default class JoplinViewsMenus { public async create(id: string, label: string, menuItems: MenuItem[], location: MenuItemLocation = MenuItemLocation.Tools) { if (!Array.isArray(menuItems)) { this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.menus.create("my-unique-id", ...)`', true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied location = menuItems as any || MenuItemLocation.Tools; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied menuItems = label as any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied label = id as any; id = `${this.plugin.viewCount}`; } diff --git a/packages/lib/services/plugins/api/JoplinViewsPanels.ts b/packages/lib/services/plugins/api/JoplinViewsPanels.ts index 58252105b..839d9ebaf 100644 --- a/packages/lib/services/plugins/api/JoplinViewsPanels.ts +++ b/packages/lib/services/plugins/api/JoplinViewsPanels.ts @@ -21,9 +21,11 @@ import { ViewHandle } from './types'; */ export default class JoplinViewsPanels { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private store: any; private plugin: Plugin; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(plugin: Plugin, store: any) { this.store = store; this.plugin = plugin; @@ -102,6 +104,7 @@ export default class JoplinViewsPanels { * * It is particularly useful when the webview needs to react to events emitted by the plugin or the joplin api. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public postMessage(handle: ViewHandle, message: any): void { return this.controller(handle).postMessage(message); } diff --git a/packages/lib/services/plugins/api/JoplinViewsToolbarButtons.ts b/packages/lib/services/plugins/api/JoplinViewsToolbarButtons.ts index 828d22a75..fad92d266 100644 --- a/packages/lib/services/plugins/api/JoplinViewsToolbarButtons.ts +++ b/packages/lib/services/plugins/api/JoplinViewsToolbarButtons.ts @@ -12,9 +12,11 @@ import createViewHandle from '../utils/createViewHandle'; */ export default class JoplinViewsToolbarButtons { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private store: any; private plugin: Plugin; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(plugin: Plugin, store: any) { this.store = store; this.plugin = plugin; @@ -26,7 +28,9 @@ export default class JoplinViewsToolbarButtons { public async create(id: string, commandName: string, location: ToolbarButtonLocation) { if (arguments.length < 3) { this.plugin.deprecationNotice('1.5', 'Creating a view without an ID is deprecated. To fix it, change your call to `joplin.views.toolbarButtons.create("my-unique-id", ...)`', true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied location = commandName as any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied commandName = id as any; id = `${this.plugin.viewCount}`; } diff --git a/packages/lib/services/plugins/api/JoplinWindow.ts b/packages/lib/services/plugins/api/JoplinWindow.ts index 5e413e307..1908f871e 100644 --- a/packages/lib/services/plugins/api/JoplinWindow.ts +++ b/packages/lib/services/plugins/api/JoplinWindow.ts @@ -10,9 +10,11 @@ export interface Implementation { export default class JoplinWindow { private plugin_: Plugin; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private store_: any; private implementation_: Implementation; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(implementation: Implementation, plugin: Plugin, store: any) { this.implementation_ = implementation; this.plugin_ = plugin; diff --git a/packages/lib/services/plugins/api/JoplinWorkspace.ts b/packages/lib/services/plugins/api/JoplinWorkspace.ts index ae878abbb..9d1709aa6 100644 --- a/packages/lib/services/plugins/api/JoplinWorkspace.ts +++ b/packages/lib/services/plugins/api/JoplinWorkspace.ts @@ -59,8 +59,10 @@ type ResourceChangeHandler = (event: ResourceChangeEvent)=> void; export default class JoplinWorkspace { // TODO: unregister events when plugin is closed or disabled + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private store: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(store: any) { this.store = store; } @@ -94,6 +96,7 @@ export default class JoplinWorkspace { * Called when the content of the current note changes. */ public async onNoteChange(handler: ItemChangeHandler): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const wrapperHandler = (event: any) => { if (event.itemType !== ModelType.Note) return; if (!this.store.getState().selectedNoteIds.includes(event.itemId)) return; @@ -151,6 +154,7 @@ export default class JoplinWorkspace { /** * Gets the currently selected note. Will be `null` if no note is selected. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async selectedNote(): Promise { const noteIds = this.store.getState().selectedNoteIds; if (noteIds.length !== 1) { return null; } diff --git a/packages/lib/services/plugins/api/noteListType.ts b/packages/lib/services/plugins/api/noteListType.ts index d2f524c47..a2657020e 100644 --- a/packages/lib/services/plugins/api/noteListType.ts +++ b/packages/lib/services/plugins/api/noteListType.ts @@ -11,10 +11,12 @@ export enum ItemFlow { LeftToRight = 'leftToRight', } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type RenderNoteView = Record; export interface OnChangeEvent { elementId: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; noteId: string; } @@ -23,6 +25,7 @@ export interface OnClickEvent { elementId: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type OnRenderNoteHandler = (props: any)=> Promise; export type OnChangeHandler = (event: OnChangeEvent)=> Promise; export type OnClickHandler = (event: OnClickEvent)=> Promise; diff --git a/packages/lib/services/plugins/api/types.ts b/packages/lib/services/plugins/api/types.ts index 57f2188e9..193c2cba9 100644 --- a/packages/lib/services/plugins/api/types.ts +++ b/packages/lib/services/plugins/api/types.ts @@ -26,6 +26,7 @@ export interface Command { /** * Code to be ran when the command is executed. It may return a result. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execute(...args: any[]): Promise; /** @@ -115,11 +116,13 @@ export interface ExportModule { /** * Called when an item needs to be processed. An "item" can be any Joplin object, such as a note, a folder, a notebook, etc. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProcessItem(context: ExportContext, itemType: number, item: any): Promise; /** * Called when a resource file needs to be exported. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onProcessResource(context: ExportContext, resource: any, filePath: string): Promise; /** @@ -183,11 +186,13 @@ export interface ExportContext { /** * You can attach your own custom data using this property - it will then be passed to each event handler, allowing you to keep state from one event to the next. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied userData?: any; } export interface ImportContext { sourcePath: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied options: any; warnings: string[]; } @@ -197,6 +202,7 @@ export interface ImportContext { // ================================================================= export interface Script { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onStart?(event: any): Promise; } @@ -302,6 +308,7 @@ export interface MenuItem { * Arguments that should be passed to the command. They will be as rest * parameters. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied commandArgs?: any[]; /** @@ -355,11 +362,13 @@ export type ViewHandle = string; export interface EditorCommand { name: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value?: any; } export interface DialogResult { id: ButtonId; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied formData?: any; } @@ -408,6 +417,7 @@ export enum SettingStorage { // Redefine a simplified interface to mask internal details // and to remove function calls as they would have to be async. export interface SettingItem { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; type: SettingItemType; @@ -444,6 +454,7 @@ export interface SettingItem { * This property is required when `isEnum` is `true`. In which case, it * should contain a map of value => label. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied options?: Record; /** @@ -501,6 +512,7 @@ export type Path = string[]; // Content Script types // ================================================================= +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type PostMessageHandler = (message: any)=> Promise; /** @@ -524,30 +536,38 @@ export interface ContentScriptContext { } export interface ContentScriptModuleLoadedEvent { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied userData?: any; } export interface ContentScriptModule { onLoaded?: (event: ContentScriptModuleLoadedEvent)=> void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied plugin: ()=> any; assets?: ()=> void; } export interface MarkdownItContentScriptModule extends Omit { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied plugin: (markdownIt: any, options: any)=> any; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type EditorCommandCallback = (...args: any[])=> any; export interface CodeMirrorControl { /** Points to a CodeMirror 6 EditorView instance. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied editor: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied cm6: any; /** `extension` should be a [CodeMirror 6 extension](https://codemirror.net/docs/ref/#state.Extension). */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied addExtension(extension: any|any[]): void; supportsCommand(name: string): boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied execCommand(name: string, ...args: any[]): any; registerCommand(name: string, callback: EditorCommandCallback): void; @@ -561,11 +581,13 @@ export interface CodeMirrorControl { * * Using `autocompletion({ override: [ ... ]})` causes errors when done by multiple plugins. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied completionSource(completionSource: any): any; /** * Creates an extension that enables or disables [`languageData`-based autocompletion](https://codemirror.net/docs/ref/#autocomplete.autocompletion^config.override). */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied enableLanguageDataAutocomplete: { of: (enabled: boolean)=> any }; }; } diff --git a/packages/lib/services/plugins/reducer.ts b/packages/lib/services/plugins/reducer.ts index 845826c05..72ca6a9f8 100644 --- a/packages/lib/services/plugins/reducer.ts +++ b/packages/lib/services/plugins/reducer.ts @@ -88,7 +88,9 @@ export const utils = { return output; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied viewsByType: function(plugins: PluginStates, type: string): any[] { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any[] = []; for (const pluginId in plugins) { @@ -137,6 +139,7 @@ export const utils = { }, }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const reducer = (draftRoot: Draft, action: any) => { if (action.type.indexOf('PLUGIN_') !== 0) return; @@ -162,6 +165,7 @@ const reducer = (draftRoot: Draft, action: any) => { case 'PLUGIN_VIEW_PROP_SET': if (action.name !== 'html') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (draft.plugins[action.pluginId].views[action.id] as any)[action.name] = action.value; } else { draft.pluginHtmlContents[action.pluginId] ??= {}; @@ -171,6 +175,7 @@ const reducer = (draftRoot: Draft, action: any) => { case 'PLUGIN_VIEW_PROP_PUSH': + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (draft.plugins[action.pluginId].views[action.id] as any)[action.name].push(action.value); break; diff --git a/packages/lib/services/plugins/utils/executeSandboxCall.ts b/packages/lib/services/plugins/utils/executeSandboxCall.ts index a28dd7d33..f87aa53c7 100644 --- a/packages/lib/services/plugins/utils/executeSandboxCall.ts +++ b/packages/lib/services/plugins/utils/executeSandboxCall.ts @@ -1,7 +1,9 @@ import Global from '../api/Global'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type EventHandler = (callbackId: string, args: any[])=> void; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function createEventHandlers(arg: any, eventHandler: EventHandler) { if (Array.isArray(arg)) { for (let i = 0; i < arg.length; i++) { @@ -10,6 +12,7 @@ function createEventHandlers(arg: any, eventHandler: EventHandler) { return arg; } else if (typeof arg === 'string' && arg.indexOf('___plugin_event_') === 0) { const callbackId = arg; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return async (...args: any[]) => { const result = await eventHandler(callbackId, args); return result; @@ -25,10 +28,13 @@ function createEventHandlers(arg: any, eventHandler: EventHandler) { return arg; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default async function executeSandboxCall(pluginId: string, sandbox: Global, path: string, args: any[], eventHandler: EventHandler) { const pathFragments = path.split('.'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let parent: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let fn: any = sandbox; if (!fn) throw new Error(`No sandbox for plugin ${pluginId}`); // Sanity check as normally cannot happen diff --git a/packages/lib/services/plugins/utils/loadContentScripts.ts b/packages/lib/services/plugins/utils/loadContentScripts.ts index 836be9f63..3c3d5ef37 100644 --- a/packages/lib/services/plugins/utils/loadContentScripts.ts +++ b/packages/lib/services/plugins/utils/loadContentScripts.ts @@ -9,12 +9,14 @@ const logger = Logger.create('loadContentScripts'); export interface ExtraContentScript { id: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied module: any; assetPath: string; pluginId: string; } function postMessageHandler(pluginId: string, scriptType: ContentScriptType, contentScriptId: string): PostMessageHandler { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (message: any) => { if (scriptType === ContentScriptType.MarkdownItPlugin) { logger.error('context.postMessage is not available to renderer content scripts'); @@ -56,6 +58,7 @@ function loadContentScripts(plugins: PluginStates, scriptType: ContentScriptType const loadedModule = module.default(context) as ContentScriptModule; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!loadedModule.plugin && !(loadedModule as any).codeMirrorResources && !(loadedModule as any).codeMirrorOptions) throw new Error(`Content script must export a "plugin" key or a list of CodeMirror assets or define a CodeMirror option: Plugin: ${pluginId}: Script: ${contentScript.id}`); output.push({ diff --git a/packages/lib/services/plugins/utils/manifestFromObject.ts b/packages/lib/services/plugins/utils/manifestFromObject.ts index b68fa6f6d..8d3aec843 100644 --- a/packages/lib/services/plugins/utils/manifestFromObject.ts +++ b/packages/lib/services/plugins/utils/manifestFromObject.ts @@ -2,6 +2,7 @@ import { PluginManifest, PluginPermission, Image, Icons } from './types'; import validatePluginId from './validatePluginId'; import validatePluginPlatforms from './validatePluginPlatforms'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function manifestFromObject(o: any): PluginManifest { const getString = (name: string, required = true, defaultValue = ''): string => { diff --git a/packages/lib/services/plugins/utils/mapEventHandlersToIds.ts b/packages/lib/services/plugins/utils/mapEventHandlersToIds.ts index 165dba15c..6981f81d7 100644 --- a/packages/lib/services/plugins/utils/mapEventHandlersToIds.ts +++ b/packages/lib/services/plugins/utils/mapEventHandlersToIds.ts @@ -5,6 +5,7 @@ export interface EventHandlers { [key: string]: Function; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function mapEventHandlersToIds(arg: any, eventHandlers: EventHandlers) { if (Array.isArray(arg)) { for (let i = 0; i < arg.length; i++) { diff --git a/packages/lib/services/plugins/utils/validatePluginPlatforms.test.ts b/packages/lib/services/plugins/utils/validatePluginPlatforms.test.ts index 65ec5962f..d9066d162 100644 --- a/packages/lib/services/plugins/utils/validatePluginPlatforms.test.ts +++ b/packages/lib/services/plugins/utils/validatePluginPlatforms.test.ts @@ -5,6 +5,7 @@ describe('validatePluginPlatforms', () => { [['mobile', 'desktop'], true], ['not-an-array', false], [[3, 4, 5], false], + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ])('should throw when given an invalid list of supported plugin platforms (case %#)', (platforms: any, shouldSupport) => { const callback = () => validatePluginPlatforms(platforms); if (shouldSupport) { diff --git a/packages/lib/services/profileConfig/index.ts b/packages/lib/services/profileConfig/index.ts index 5e9fc04a2..33d172a8d 100644 --- a/packages/lib/services/profileConfig/index.ts +++ b/packages/lib/services/profileConfig/index.ts @@ -4,6 +4,7 @@ import { CurrentProfileVersion, defaultProfile, defaultProfileConfig, DefaultPro import { customAlphabet } from 'nanoid/non-secure'; import { _ } from '../../locale'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const migrateProfileConfig = (profileConfig: any, toVersion: number): ProfileConfig => { let version = 2; diff --git a/packages/lib/services/profileConfig/mergeGlobalAndLocalSettings.ts b/packages/lib/services/profileConfig/mergeGlobalAndLocalSettings.ts index e1f9a4d01..3879b4aa7 100644 --- a/packages/lib/services/profileConfig/mergeGlobalAndLocalSettings.ts +++ b/packages/lib/services/profileConfig/mergeGlobalAndLocalSettings.ts @@ -3,7 +3,9 @@ import Setting from '../../models/Setting'; const logger = Logger.create('mergeGlobalAndLocalSettings'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default (rootSettings: Record, subProfileSettings: Record) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: Record = { ...subProfileSettings }; for (const k of Object.keys(output)) { diff --git a/packages/lib/services/rest/Api.test.ts b/packages/lib/services/rest/Api.test.ts index c94d99149..5bff2d510 100644 --- a/packages/lib/services/rest/Api.test.ts +++ b/packages/lib/services/rest/Api.test.ts @@ -170,6 +170,7 @@ describe('services/rest/Api', () => { })); it('should allow setting note properties', (async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let response: any = null; const f = await Folder.save({ title: 'mon carnet' }); @@ -576,6 +577,7 @@ describe('services/rest/Api', () => { expect(response3.items.length).toBe(2); // Also check that it only returns the required fields + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied response3.items.sort((a: any, b: any) => { return a.id < b.id ? -1 : +1; }); diff --git a/packages/lib/services/rest/Api.ts b/packages/lib/services/rest/Api.ts index 2757b8bef..8e008d69f 100644 --- a/packages/lib/services/rest/Api.ts +++ b/packages/lib/services/rest/Api.ts @@ -57,11 +57,16 @@ export interface Request { method: RequestMethod; path: string; query: RequestQuery; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied body: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied bodyJson_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied bodyJson: any; files: RequestFile[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied params: any[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied action?: any; } @@ -83,6 +88,7 @@ export interface RequestContext { token: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type RouteFunction = (request: Request, id: string, link: string, context: RequestContext)=> Promise; interface ResourceNameToRoute { @@ -94,13 +100,15 @@ 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; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private knownNounces_: any = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied 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 + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied public constructor(token: string | Function = null, dispatch: Function = null, actionApi: any = null) { this.token_ = token; this.actionApi_ = actionApi; @@ -127,6 +135,7 @@ export default class Api { return typeof this.token_ === 'function' ? this.token_() : this.token_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private dispatch(action: any) { if (action.type === 'API_AUTH_TOKEN_SET') { this.authToken_ = { @@ -171,6 +180,7 @@ export default class Api { } // Response can be any valid JSON object, so a string, and array or an object (key/value pairs). + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async route(method: RequestMethod, path: string, query: RequestQuery = null, body: any = null, files: RequestFile[] = null): Promise { if (!files) files = []; if (!query) query = {}; @@ -263,6 +273,7 @@ export default class Api { if (request.query.token !== this.token) throw new ErrorForbidden('Invalid "token" parameter'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async execServiceActionFromRequest_(externalApi: any, request: Request) { const action = externalApi[request.action]; if (!action) throw new ErrorNotFound(`Invalid action: ${request.action}`); diff --git a/packages/lib/services/rest/ApiResponse.ts b/packages/lib/services/rest/ApiResponse.ts index b0b943075..f806cdc99 100644 --- a/packages/lib/services/rest/ApiResponse.ts +++ b/packages/lib/services/rest/ApiResponse.ts @@ -1,6 +1,7 @@ export default class ApiResponse { public type: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public body: any; public contentType: string; public attachmentFilename: string; diff --git a/packages/lib/services/rest/routes/auth.ts b/packages/lib/services/rest/routes/auth.ts index 2508c199f..22a7beb49 100644 --- a/packages/lib/services/rest/routes/auth.ts +++ b/packages/lib/services/rest/routes/auth.ts @@ -20,6 +20,7 @@ export default async function(request: Request, id: string = null, _link: string if (id === 'check') { if ('auth_token' in request.query) { if (context.authToken && request.query.auth_token === context.authToken.value) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { status: context.authToken.status, }; diff --git a/packages/lib/services/rest/routes/notes.ts b/packages/lib/services/rest/routes/notes.ts index 4393c7502..667c149b4 100644 --- a/packages/lib/services/rest/routes/notes.ts +++ b/packages/lib/services/rest/routes/notes.ts @@ -32,6 +32,7 @@ import { DownloadController } from '../../../downloadController'; const logger = Logger.create('routes/notes'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let htmlToMdParser_: any = null; function htmlToMdParser() { @@ -41,6 +42,7 @@ function htmlToMdParser() { } type RequestNote = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied id?: any; parent_id?: string; title: string; @@ -59,8 +61,10 @@ type RequestNote = { body_html: string; base_url?: string; convert_to: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied anchor_names?: any[]; image_sizes?: object; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied stylesheets: any; }; @@ -82,6 +86,7 @@ interface ResourceFromPath extends DownloadedMediaFile { async function requestNoteToNote(requestNote: RequestNote): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { title: requestNote.title ? requestNote.title : '', body: requestNote.body ? requestNote.body : '', @@ -166,6 +171,7 @@ async function requestNoteToNote(requestNote: RequestNote): Promise return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function buildNoteStyleSheet(stylesheets: any[]) { if (!stylesheets) return []; @@ -192,6 +198,7 @@ async function buildNoteStyleSheet(stylesheets: any[]) { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function tryToGuessExtFromMimeType(response: any, mediaPath: string) { const mimeType = mimeTypeFromHeaders(response.headers); if (!mimeType) return mediaPath; @@ -336,7 +343,9 @@ async function removeTempFiles(urls: ResourceFromPath[]) { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function replaceUrlsByResources(markupLanguage: number, md: string, urls: ResourceFromPath[], imageSizes: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const imageSizesIndexes: any = {}; if (markupLanguage === MarkupToHtml.MARKUP_LANGUAGE_HTML) { @@ -356,7 +365,7 @@ function replaceUrlsByResources(markupLanguage: number, md: string, urls: Resour // // /(!?\[.*?\]\()([^\s\)]+)(.*?\))/g // - // eslint-disable-next-line no-useless-escape + // eslint-disable-next-line no-useless-escape, @typescript-eslint/no-explicit-any -- Old code before rule was applied return md.replace(/(!?\[.*?\]\()([^\s\)]+)(.*?\))/g, (_match: any, before: string, url: string, after: string) => { let type = 'link'; if (before.startsWith('[embedded_pdf]')) { @@ -404,12 +413,14 @@ export function extractMediaUrls(markupLanguage: number, text: string): string[] } // Note must have been saved first +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function attachImageFromDataUrl(note: any, imageDataUrl: string, cropRect: any) { const tempDir = Setting.value('tempDir'); const mime = mimeUtils.fromDataUrl(imageDataUrl); let ext = mimeUtils.toFileExtension(mime) || ''; if (ext) ext = `.${ext}`; const tempFilePath = `${tempDir}/${md5(`${Math.random()}_${Date.now()}`)}${ext}`; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const imageConvOptions: any = {}; if (cropRect) imageConvOptions.cropRect = cropRect; await shim.imageFromDataUrl(imageDataUrl, tempFilePath, imageConvOptions); @@ -419,6 +430,7 @@ async function attachImageFromDataUrl(note: any, imageDataUrl: string, cropRect: export const extractNoteFromHTML = async ( requestNote: RequestNote, requestId: number, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied imageSizes: any, fetchOptions?: FetchOptions, allowedProtocols?: string[], diff --git a/packages/lib/services/rest/routes/search.ts b/packages/lib/services/rest/routes/search.ts index 2641cf0da..fae4fe07a 100644 --- a/packages/lib/services/rest/routes/search.ts +++ b/packages/lib/services/rest/routes/search.ts @@ -20,6 +20,7 @@ export default async function(request: Request) { if (modelType !== BaseItem.TYPE_NOTE) { const ModelClass = BaseItem.getClassByItemType(modelType); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = {}; const fields = requestFields(request, modelType); if (fields.length) options.fields = fields; diff --git a/packages/lib/services/rest/utils/collectionToPaginatedResults.ts b/packages/lib/services/rest/utils/collectionToPaginatedResults.ts index 0afd5b999..333cf94e9 100644 --- a/packages/lib/services/rest/utils/collectionToPaginatedResults.ts +++ b/packages/lib/services/rest/utils/collectionToPaginatedResults.ts @@ -10,6 +10,7 @@ import requestFields from './requestFields'; // // It's however convenient for smaller lists as it reduces the need for // building complex SQL queries. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function(itemType: ModelType, items: any[], request: Request): ModelFeedPage { const fields = requestFields(request, itemType); const pagination = requestPaginationOptions(request); @@ -20,8 +21,10 @@ export default function(itemType: ModelType, items: any[], request: Request): Mo const sortBy = pagination.order[0].by; const sortDir = pagination.order[0].dir; const caseInsensitive = pagination.order[0].caseInsensitive; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const sortedItems = items.slice().map((item: any) => { if (!fields.length) return item; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const newItem: any = {}; for (const k of Object.keys(item)) { if (!fields.includes(k)) continue; @@ -30,6 +33,7 @@ export default function(itemType: ModelType, items: any[], request: Request): Mo return newItem; }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied sortedItems.sort((a: any, b: any) => { let v1 = a && (sortBy in a) ? a[sortBy] : ''; let v2 = b && (sortBy in b) ? b[sortBy] : ''; diff --git a/packages/lib/services/rest/utils/defaultAction.ts b/packages/lib/services/rest/utils/defaultAction.ts index d9d93c667..fffe6ae2c 100644 --- a/packages/lib/services/rest/utils/defaultAction.ts +++ b/packages/lib/services/rest/utils/defaultAction.ts @@ -12,6 +12,7 @@ export default async function(modelType: number, request: Request, id: string = const ModelClass = BaseItem.getClassByItemType(modelType); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const getOneModel = async (options: any = null) => { const model = await ModelClass.load(id, options || {}); if (!model) throw new ErrorNotFound(); diff --git a/packages/lib/services/rest/utils/defaultLoadOptions.ts b/packages/lib/services/rest/utils/defaultLoadOptions.ts index 2961d9c89..3ccc639de 100644 --- a/packages/lib/services/rest/utils/defaultLoadOptions.ts +++ b/packages/lib/services/rest/utils/defaultLoadOptions.ts @@ -2,6 +2,7 @@ import { Request } from '../Api'; import requestFields from './requestFields'; export default function(request: Request, modelType: number) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = {}; const fields = requestFields(request, modelType); if (fields.length) options.fields = fields; diff --git a/packages/lib/services/rest/utils/defaultSaveOptions.ts b/packages/lib/services/rest/utils/defaultSaveOptions.ts index cb532c799..3003a8c64 100644 --- a/packages/lib/services/rest/utils/defaultSaveOptions.ts +++ b/packages/lib/services/rest/utils/defaultSaveOptions.ts @@ -1,4 +1,5 @@ export default function(requestMethod: string, modelId: string = null) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = { userSideValidation: true }; if (requestMethod === 'POST' && modelId) options.isNew = true; return options; diff --git a/packages/lib/services/search/SearchEngine.test.ts b/packages/lib/services/search/SearchEngine.test.ts index 011a330ad..3bad73880 100644 --- a/packages/lib/services/search/SearchEngine.test.ts +++ b/packages/lib/services/search/SearchEngine.test.ts @@ -449,6 +449,7 @@ describe('services/SearchEngine', () => { })); it('should parse normal query strings', (async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const testCases: [string, any][] = [ ['abcd efgh', { _: ['abcd', 'efgh'] }], ['abcd efgh', { _: ['abcd', 'efgh'] }], @@ -465,8 +466,11 @@ describe('services/SearchEngine', () => { const expected = t[1]; const actual = await engine.parseQuery(input); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const _Values = actual.terms._ ? actual.terms._.map((v: any) => v.value) : undefined; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const titleValues = actual.terms.title ? actual.terms.title.map((v: any) => v.value) : undefined; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const bodyValues = actual.terms.body ? actual.terms.body.map((v: any) => v.value) : undefined; expect(JSON.stringify(_Values)).toBe(JSON.stringify(expected._)); diff --git a/packages/lib/services/search/SearchEngine.ts b/packages/lib/services/search/SearchEngine.ts index fca20562b..fd4c85ae5 100644 --- a/packages/lib/services/search/SearchEngine.ts +++ b/packages/lib/services/search/SearchEngine.ts @@ -57,6 +57,7 @@ export interface ProcessResultsRow { export interface ComplexTerm { type: 'regex' | 'text'; value: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied scriptType: any; valueRegex?: RegExp; } @@ -76,12 +77,14 @@ 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 + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied public dispatch: Function = (_o: any) => {}; private logger_ = new Logger(); private db_: JoplinDatabase = null; private isIndexing_ = false; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private syncCalls_: any[] = []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private scheduleSyncTablesIID_: any; public static instance() { @@ -98,6 +101,7 @@ export default class SearchEngine { return this.logger_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setDb(db: any) { this.db_ = db; } @@ -332,6 +336,7 @@ export default class SearchEngine { return row && row['total'] ? row['total'] : 0; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private fieldNamesFromOffsets_(offsets: any[]) { const notesNormalizedFieldNames = this.db().tableFieldNames('notes_normalized'); const occurrenceCount = Math.floor(offsets.length / 4); @@ -393,8 +398,10 @@ export default class SearchEngine { // l 12 const X = matchInfo.map(m => m.slice(1 + 1 + 1 + numColumns + numColumns)); // x + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const hitsThisRow = (array: any, c: number, p: number) => array[3 * (c + p * numColumns) + 0]; // const hitsAllRows = (array, c, p) => array[3 * (c + p*NUM_COLS) + 1]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const docsWithHits = (array: any, c: number, p: number) => array[3 * (c + p * numColumns) + 2]; const IDF = (n: number, N: number) => Math.max(Math.log(((N - n + 0.5) / (n + 0.5)) + 1), 0); @@ -440,25 +447,31 @@ export default class SearchEngine { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private processBasicSearchResults_(rows: any[], parsedQuery: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const valueRegexs = parsedQuery.keys.includes('_') ? parsedQuery.terms['_'].map((term: any) => term.valueRegex || term.value) : []; const isTitleSearch = parsedQuery.keys.includes('title'); const isOnlyTitle = parsedQuery.keys.length === 1 && isTitleSearch; for (let i = 0; i < rows.length; i++) { const row = rows[i]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const testTitle = (regex: any) => new RegExp(regex, 'ig').test(row.title); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const matchedFields: any = { title: isTitleSearch || valueRegexs.some(testTitle), body: !isOnlyTitle, }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied row.fields = Object.keys(matchedFields).filter((key: any) => matchedFields[key]); row.weight = 0; row.fuzziness = 0; } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private processResults_(rows: ProcessResultsRow[], parsedQuery: any, isBasicSearchResults = false) { if (isBasicSearchResults) { this.processBasicSearchResults_(rows, parsedQuery); @@ -466,6 +479,7 @@ export default class SearchEngine { this.calculateWeightBM25_(rows); for (let i = 0; i < rows.length; i++) { const row = rows[i]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const offsets = row.offsets.split(' ').map((o: any) => Number(o)); row.fields = this.fieldNamesFromOffsets_(offsets); } @@ -492,6 +506,7 @@ export default class SearchEngine { } // https://stackoverflow.com/a/13818704/561309 + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public queryTermToRegex(term: any) { while (term.length && term.indexOf('*') === 0) { term = term.substr(1); @@ -591,9 +606,11 @@ export default class SearchEngine { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public allParsedQueryTerms(parsedQuery: any) { if (!parsedQuery || !parsedQuery.termCount) return []; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let output: any[] = []; for (const col in parsedQuery.terms) { if (!parsedQuery.terms.hasOwnProperty(col)) continue; @@ -638,11 +655,14 @@ export default class SearchEngine { public async basicSearch(query: string) { query = query.replace(/\*/, ''); const parsedQuery = await this.parseQuery(query); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const searchOptions: any = {}; for (const key of parsedQuery.keys) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if ((parsedQuery.terms as any)[key].length === 0) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const term = (parsedQuery.terms as any)[key].map((x: Term) => x.value).join(' '); if (key === '_') searchOptions.anywherePattern = `*${term}*`; if (key === 'title') searchOptions.titlePattern = `*${term}*`; @@ -652,6 +672,7 @@ export default class SearchEngine { return Note.previews(null, searchOptions); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private determineSearchType_(query: string, preferredSearchType: any) { if (preferredSearchType === SearchEngine.SEARCH_TYPE_BASIC) return SearchEngine.SEARCH_TYPE_BASIC; if (preferredSearchType === SearchEngine.SEARCH_TYPE_NONLATIN_SCRIPT) return SearchEngine.SEARCH_TYPE_NONLATIN_SCRIPT; @@ -659,6 +680,7 @@ export default class SearchEngine { // If preferredSearchType is "fts" we auto-detect anyway // because it's not always supported. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let allTerms: any[] = []; try { allTerms = filterParser(query); @@ -737,6 +759,7 @@ export default class SearchEngine { if (searchType === SearchEngine.SEARCH_TYPE_BASIC) { searchString = this.normalizeText_(searchString); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied rows = (await this.basicSearch(searchString)) as any[]; this.processResults_(rows, parsedQuery, true); } else { diff --git a/packages/lib/services/search/SearchEngineUtils.test.ts b/packages/lib/services/search/SearchEngineUtils.test.ts index 6627cb996..4308b1c94 100644 --- a/packages/lib/services/search/SearchEngineUtils.test.ts +++ b/packages/lib/services/search/SearchEngineUtils.test.ts @@ -5,6 +5,7 @@ import Setting from '../../models/Setting.js'; const Note = require('../../models/Note').default; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let searchEngine: any = null; describe('SearchEngineUtils', () => { @@ -32,6 +33,7 @@ describe('SearchEngineUtils', () => { expect(rows.map(r=>r.id)).toContain(todo1.id); expect(rows.map(r=>r.id)).toContain(todo2.id); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = {}; options.fields = ['id', 'title']; @@ -57,6 +59,7 @@ describe('SearchEngineUtils', () => { expect(rows.map(r=>r.id)).toContain(note1.id); expect(rows.map(r=>r.id)).toContain(todo1.id); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = {}; options.fields = ['id', 'title']; const rows2 = (await SearchEngineUtils.notesForQuery('abcd', true, options, searchEngine)).notes; diff --git a/packages/lib/services/search/SearchEngineUtils.ts b/packages/lib/services/search/SearchEngineUtils.ts index 2aad219de..99cccdb76 100644 --- a/packages/lib/services/search/SearchEngineUtils.ts +++ b/packages/lib/services/search/SearchEngineUtils.ts @@ -55,6 +55,7 @@ export default class SearchEngineUtils { todoCompletedAutoAdded = true; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const previewOptions: any = { order: [], fields: fields, conditions: [`id IN ("${noteIds.join('","')}")`], ...options }; diff --git a/packages/lib/services/search/SearchFilter.test.ts b/packages/lib/services/search/SearchFilter.test.ts index 93e76c7f6..bcab9a266 100644 --- a/packages/lib/services/search/SearchFilter.test.ts +++ b/packages/lib/services/search/SearchFilter.test.ts @@ -11,6 +11,7 @@ import ResourceService from '../ResourceService'; import { NoteEntity } from '../database/types'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let engine: any = null; const ids = (array: NoteEntity[]) => array.map(a => a.id); diff --git a/packages/lib/services/share/ShareService.test.ts b/packages/lib/services/share/ShareService.test.ts index cb066fc2e..70fb6632f 100644 --- a/packages/lib/services/share/ShareService.test.ts +++ b/packages/lib/services/share/ShareService.test.ts @@ -26,12 +26,15 @@ interface TestShareFolderServiceOptions { const testImagePath = `${supportDir}/photo.jpg`; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const testReducer = (state: any = defaultState, action: any) => { return reducer(state, action); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function mockService(api: any) { const service = new ShareService(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const store = createStore(testReducer as any); service.initialize(store, encryptionService(), api); return service; @@ -39,7 +42,9 @@ function mockService(api: any) { const mockServiceForNoteSharing = () => { return mockService({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied exec: (method: string, path = '', _query: Record = null, _body: any = null, _headers: any = null, _options: any = null): Promise => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (method === 'GET' && path === 'api/shares') return { items: [] } as any; return null; }, @@ -130,6 +135,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({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied exec: async (method: string, path: string, query: Record, body: any) => { if (extraExecHandlers[`${method} ${path}`]) return extraExecHandlers[`${method} ${path}`](query, body); @@ -258,15 +264,18 @@ describe('ShareService', () => { let uploadedMasterKey: MasterKeyEntity = null; const service = testShareFolderService({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied 'POST api/shares': (_query: Record, body: any) => { return { id: 'share_1', master_key_id: body.master_key_id, }; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied 'GET api/users/toto%40example.com/public_key': async (_query: Record, _body: any) => { return recipientPpk; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied 'POST api/shares/share_1/users': async (_query: Record, body: any) => { uploadedEmail = body.email; uploadedMasterKey = JSON.parse(body.master_key); @@ -289,6 +298,7 @@ describe('ShareService', () => { const previousLogLevel = Logger.globalLogger.setLevel(LogLevel.Error); const service = testShareFolderService({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied 'GET api/shares': async (_query: Record, _body: any): Promise => { return { items: [], diff --git a/packages/lib/services/share/ShareService.ts b/packages/lib/services/share/ShareService.ts index 1436100a7..584f66b11 100644 --- a/packages/lib/services/share/ShareService.ts +++ b/packages/lib/services/share/ShareService.ts @@ -22,6 +22,7 @@ export interface ApiShare { master_key_id: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function formatShareInvitations(invitations: any[]): ShareInvitation[] { return invitations.map(inv => { return { @@ -35,6 +36,7 @@ export default class ShareService { private static instance_: ShareService; private api_: JoplinServerApi = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private store_: Store = null; private encryptionService_: EncryptionService = null; private initialized_ = false; @@ -45,6 +47,7 @@ export default class ShareService { return this.instance_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public initialize(store: Store, encryptionService: EncryptionService, api: JoplinServerApi = null) { this.initialized_ = true; this.store_ = store; @@ -57,6 +60,7 @@ export default class ShareService { return [9, 10].includes(Setting.value('sync.target')); // Joplin Server, Joplin Cloud targets } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private get store(): Store { return this.store_; } diff --git a/packages/lib/services/share/reducer.ts b/packages/lib/services/share/reducer.ts index b131895d8..342c76d5d 100644 --- a/packages/lib/services/share/reducer.ts +++ b/packages/lib/services/share/reducer.ts @@ -66,6 +66,7 @@ export const defaultState: State = { }; export const parseShareCache = (serialized: string): State => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let raw: any = {}; try { raw = JSON.parse(serialized); @@ -98,6 +99,7 @@ export function isRootSharedFolder(folder: FolderEntity): boolean { return !!folder.share_id && !folder.parent_id; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const reducer = (draftRoot: Draft, action: any) => { if (action.type.indexOf('SHARE_') !== 0) return; @@ -119,6 +121,7 @@ const reducer = (draftRoot: Draft, action: any) => { case 'SHARE_USER_UPDATE_ONE': { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const shareUser = (draft.shareUsers as any)[action.shareId].find((su: StateShareUser) => su.id === action.shareUser.id); if (!shareUser) throw new Error(`No such user: ${JSON.stringify(action)}`); diff --git a/packages/lib/services/spellChecker/SpellCheckerService.ts b/packages/lib/services/spellChecker/SpellCheckerService.ts index 1fa65bd1e..681dd0348 100644 --- a/packages/lib/services/spellChecker/SpellCheckerService.ts +++ b/packages/lib/services/spellChecker/SpellCheckerService.ts @@ -103,6 +103,7 @@ export default class SpellCheckerService { this.driver_.addWordToSpellCheckerDictionary(language, word); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public contextMenuItems(misspelledWord: string, dictionarySuggestions: string[]): any[] { if (!misspelledWord) return []; @@ -158,6 +159,7 @@ export default class SpellCheckerService { languageMenuItems.push(this.changeLanguageMenuItem(locale, enabled, selectedLanguages.includes(locale))); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied languageMenuItems.sort((a: any, b: any) => { return a.label < b.label ? -1 : +1; }); @@ -170,8 +172,10 @@ export default class SpellCheckerService { return this.changeLanguageMenuItem(language, true, selectedLanguages.includes(language)); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (latestLanguageItems.length) latestLanguageItems.splice(0, 0, { type: 'separator' } as any); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied latestLanguageItems.sort((a: any, b: any) => { return a.label < b.label ? -1 : +1; }); diff --git a/packages/lib/services/style/cssToTheme.ts b/packages/lib/services/style/cssToTheme.ts index e6249825e..3aeb48245 100644 --- a/packages/lib/services/style/cssToTheme.ts +++ b/packages/lib/services/style/cssToTheme.ts @@ -41,8 +41,10 @@ export default function cssToTheme(css: string, sourceFilePath: string): Theme { if (!rootRule || !rootRule.selectors.includes(':root')) throw new Error('`:root` rule not found'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const declarations: any[] = rootRule.declarations; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (const declaration of declarations) { if (declaration.type !== 'declaration') continue; // Skip comment lines diff --git a/packages/lib/services/style/loadCssToTheme.ts b/packages/lib/services/style/loadCssToTheme.ts index b195c5f3b..bb39eaaba 100644 --- a/packages/lib/services/style/loadCssToTheme.ts +++ b/packages/lib/services/style/loadCssToTheme.ts @@ -4,6 +4,7 @@ import shim from '../../shim'; import cssToTheme from './cssToTheme'; export default async function(cssBaseDir: string): Promise> { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const themeDirs = (await shim.fsDriver().readDirStats(cssBaseDir)).filter((f: any) => f.isDirectory()); const output: Record = {}; diff --git a/packages/lib/services/style/themeToCss.ts b/packages/lib/services/style/themeToCss.ts index 55415c9af..c498ccf5a 100644 --- a/packages/lib/services/style/themeToCss.ts +++ b/packages/lib/services/style/themeToCss.ts @@ -1,6 +1,7 @@ import { Theme } from '../../themes/type'; const { camelCaseToDash, formatCssSize } = require('../../string-utils'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const isColor = (v: any) => { return v && typeof v === 'object' && ('color' in v) && ('model' in v) && ('valpha' in v); }; @@ -12,6 +13,7 @@ export default function(theme: Theme) { const names = Object.keys(theme).sort(); for (const name of names) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const value = (theme as any)[name]; if (typeof value === 'object' && !isColor(value)) continue; diff --git a/packages/lib/services/synchronizer/ItemUploader.test.ts b/packages/lib/services/synchronizer/ItemUploader.test.ts index 5e8d8a954..7f4643880 100644 --- a/packages/lib/services/synchronizer/ItemUploader.test.ts +++ b/packages/lib/services/synchronizer/ItemUploader.test.ts @@ -8,24 +8,29 @@ import { ApiCallFunction } from './utils/types'; interface ApiCall { name: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied args: any[]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function clearArray(a: any[]) { a.splice(0, a.length); } function newFakeApi(): FileApi { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied 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 { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const apiCall = async (callName: string, ...args: any[]): Promise => { callRecorder.push({ name: callName, args }); if (callName === 'multiPut') { const [batch] = args; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { items: {} }; for (const item of batch) { if (itemBodyCallback) { @@ -148,6 +153,7 @@ describe('synchronizer/ItemUploader', () => { ]; // Simulates throwing an error on note 2 + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemBodyCallback = (item: any): any => { if (item.name === BaseItem.systemPath(notes[1])) { return { error: new Error('Could not save item'), item: null }; diff --git a/packages/lib/services/synchronizer/ItemUploader.ts b/packages/lib/services/synchronizer/ItemUploader.ts index 53ed1afed..f597aa818 100644 --- a/packages/lib/services/synchronizer/ItemUploader.ts +++ b/packages/lib/services/synchronizer/ItemUploader.ts @@ -16,6 +16,7 @@ export default class ItemUploader { private api_: FileApi; private apiCall_: ApiCallFunction; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private preUploadedItems_: Record = {}; private preUploadedItemUpdatedTimes_: Record = {}; private maxBatchSize_ = 1 * 1024 * 1024; // 1MB; diff --git a/packages/lib/services/synchronizer/LockHandler.ts b/packages/lib/services/synchronizer/LockHandler.ts index 0f2004826..2c0ee3854 100644 --- a/packages/lib/services/synchronizer/LockHandler.ts +++ b/packages/lib/services/synchronizer/LockHandler.ts @@ -118,6 +118,7 @@ function defaultAcquireLockOptions(): AcquireLockOptions { } interface RefreshTimer { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied id: any; inProgress: boolean; } @@ -178,6 +179,7 @@ export default class LockHandler { return `${Dirnames.Locks}/${this.lockFilename(lock)}`; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private lockFileToObject(file: any): Lock { return lockNameToObject(filename(file.path), file.updated_time); } diff --git a/packages/lib/services/synchronizer/MigrationHandler.ts b/packages/lib/services/synchronizer/MigrationHandler.ts index 6a2a47fa1..aa1b91cc6 100644 --- a/packages/lib/services/synchronizer/MigrationHandler.ts +++ b/packages/lib/services/synchronizer/MigrationHandler.ts @@ -112,6 +112,7 @@ export default class MigrationHandler extends BaseService { }); let autoLockError = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.lockHandler_.startAutoLockRefresh(exclusiveLock, (error: any) => { autoLockError = error; }); diff --git a/packages/lib/services/synchronizer/Synchronizer.conflicts.test.ts b/packages/lib/services/synchronizer/Synchronizer.conflicts.test.ts index 69e35b62c..fd58998dd 100644 --- a/packages/lib/services/synchronizer/Synchronizer.conflicts.test.ts +++ b/packages/lib/services/synchronizer/Synchronizer.conflicts.test.ts @@ -47,12 +47,14 @@ describe('Synchronizer.conflicts', () => { for (const n in conflictedNote) { if (!conflictedNote.hasOwnProperty(n)) continue; if (n === 'id' || n === 'is_conflict' || n === 'conflict_original_id') continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(conflictedNote[n]).toBe((note2conf as any)[n]); } const noteUpdatedFromRemote = await Note.load(note1.id); for (const n in noteUpdatedFromRemote) { if (!noteUpdatedFromRemote.hasOwnProperty(n)) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect((noteUpdatedFromRemote as any)[n]).toBe((note2 as any)[n]); } })); diff --git a/packages/lib/services/synchronizer/gui/useSyncTargetUpgrade.ts b/packages/lib/services/synchronizer/gui/useSyncTargetUpgrade.ts index 71d7b4b59..3cd60be9f 100644 --- a/packages/lib/services/synchronizer/gui/useSyncTargetUpgrade.ts +++ b/packages/lib/services/synchronizer/gui/useSyncTargetUpgrade.ts @@ -7,6 +7,7 @@ const { useEffect, useState } = shim.react(); export interface SyncTargetUpgradeResult { done: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied error: any; } diff --git a/packages/lib/services/synchronizer/migrations/1.ts b/packages/lib/services/synchronizer/migrations/1.ts index 12910548e..c88584ea3 100644 --- a/packages/lib/services/synchronizer/migrations/1.ts +++ b/packages/lib/services/synchronizer/migrations/1.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default async function(api: any) { await Promise.all([ api.mkdir('.resource'), diff --git a/packages/lib/services/synchronizer/migrations/2.ts b/packages/lib/services/synchronizer/migrations/2.ts index 61390c84d..e671d7ef0 100644 --- a/packages/lib/services/synchronizer/migrations/2.ts +++ b/packages/lib/services/synchronizer/migrations/2.ts @@ -1,5 +1,6 @@ import { Dirnames } from '../utils/types'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default async function(api: any) { await Promise.all([ api.put('.sync/version.txt', '2'), diff --git a/packages/lib/services/synchronizer/syncInfoUtils.ts b/packages/lib/services/synchronizer/syncInfoUtils.ts index c2d6dcfab..b37ccdf1c 100644 --- a/packages/lib/services/synchronizer/syncInfoUtils.ts +++ b/packages/lib/services/synchronizer/syncInfoUtils.ts @@ -51,6 +51,7 @@ export async function migrateLocalSyncInfo(db: JoplinDatabase) { const masterKeys = await db.selectAll('SELECT * FROM master_keys'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const masterKeyMap: Record = {}; for (const mk of masterKeys) masterKeyMap[mk.id] = mk; @@ -85,6 +86,7 @@ export async function fetchSyncInfo(api: FileApi): Promise { const syncTargetInfoText = await api.get('info.json'); // Returns version 0 if the sync target is empty + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let output: any = { version: 0 }; if (syncTargetInfoText) { @@ -229,6 +231,7 @@ export class SyncInfo { if (serialized) this.load(serialized); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public toObject(): any { return { version: this.version, @@ -265,6 +268,7 @@ export class SyncInfo { } public load(serialized: string) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const s: any = JSON.parse(serialized); this.version = 'version' in s ? s.version : 0; this.e2ee_ = 'e2ee' in s ? s.e2ee : { value: false, updatedTime: 0 }; @@ -283,8 +287,10 @@ export class SyncInfo { } public setWithTimestamp(fromSyncInfo: SyncInfo, propName: string) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!(propName in (this as any))) throw new Error(`Invalid prop name: ${propName}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (this as any)[propName] = (fromSyncInfo as any)[propName]; this.setKeyTimestamp(propName, fromSyncInfo.keyTimestamp(propName)); } @@ -348,12 +354,16 @@ export class SyncInfo { } public keyTimestamp(name: string): number { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!(`${name}_` in (this as any))) throw new Error(`Invalid name: ${name}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (this as any)[`${name}_`].updatedTime; } public setKeyTimestamp(name: string, timestamp: number) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!(`${name}_` in (this as any))) throw new Error(`Invalid name: ${name}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (this as any)[`${name}_`].updatedTime = timestamp; } diff --git a/packages/lib/services/synchronizer/synchronizer_LockHandler.test.ts b/packages/lib/services/synchronizer/synchronizer_LockHandler.test.ts index b5f97b08f..6e0b86261 100644 --- a/packages/lib/services/synchronizer/synchronizer_LockHandler.test.ts +++ b/packages/lib/services/synchronizer/synchronizer_LockHandler.test.ts @@ -97,7 +97,9 @@ describe('synchronizer_LockHandler', () => { }); const lock = await handler.acquireLock(LockType.Sync, LockClientType.Desktop, '111'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let autoLockError: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied handler.startAutoLockRefresh(lock, (error: any) => { autoLockError = error; }); diff --git a/packages/lib/services/synchronizer/synchronizer_MigrationHandler.test.ts b/packages/lib/services/synchronizer/synchronizer_MigrationHandler.test.ts index 329fb861f..fb2c1d5ec 100644 --- a/packages/lib/services/synchronizer/synchronizer_MigrationHandler.test.ts +++ b/packages/lib/services/synchronizer/synchronizer_MigrationHandler.test.ts @@ -40,9 +40,13 @@ interface MigrationTests { const migrationTests: MigrationTests = { 2: async function() { const items = (await fileApi().list('', { includeHidden: true })).items; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(items.filter((i: any) => i.path === '.resource' && i.isDir).length).toBe(1); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(items.filter((i: any) => i.path === 'locks' && i.isDir).length).toBe(1); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(items.filter((i: any) => i.path === 'temp' && i.isDir).length).toBe(1); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(items.filter((i: any) => i.path === 'info.json' && !i.isDir).length).toBe(1); const versionForOldClients = await fileApi().get('.sync/version.txt'); @@ -51,9 +55,13 @@ const migrationTests: MigrationTests = { 3: async function() { const items = (await fileApi().list('', { includeHidden: true })).items; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(items.filter((i: any) => i.path === '.resource' && i.isDir).length).toBe(1); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(items.filter((i: any) => i.path === 'locks' && i.isDir).length).toBe(1); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(items.filter((i: any) => i.path === 'temp' && i.isDir).length).toBe(1); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(items.filter((i: any) => i.path === 'info.json' && !i.isDir).length).toBe(1); const versionForOldClients = await fileApi().get('.sync/version.txt'); @@ -174,7 +182,9 @@ describe('MigrationHandler', () => { // Check that basic folders "locks" and "temp" are created for new sync targets. await migrationHandler().upgrade(1); const result = await fileApi().list(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(result.items.filter((i: any) => i.path === Dirnames.Locks).length).toBe(1); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(result.items.filter((i: any) => i.path === Dirnames.Temp).length).toBe(1); }), specTimeout); diff --git a/packages/lib/services/synchronizer/utils/handleConflictAction.ts b/packages/lib/services/synchronizer/utils/handleConflictAction.ts index b151456f5..6b1df7201 100644 --- a/packages/lib/services/synchronizer/utils/handleConflictAction.ts +++ b/packages/lib/services/synchronizer/utils/handleConflictAction.ts @@ -9,6 +9,7 @@ import { SyncAction, conflictActions } from './types'; const logger = Logger.create('handleConflictAction'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default async (action: SyncAction, ItemClass: typeof BaseItem, remoteExists: boolean, remoteContent: any, local: any, syncTargetId: number, itemIsReadOnly: boolean, dispatch: Dispatch) => { if (!conflictActions.includes(action)) return; diff --git a/packages/lib/services/synchronizer/utils/types.ts b/packages/lib/services/synchronizer/utils/types.ts index faa4ec8bf..c7b2aed74 100644 --- a/packages/lib/services/synchronizer/utils/types.ts +++ b/packages/lib/services/synchronizer/utils/types.ts @@ -18,8 +18,10 @@ export enum SyncAction { DeleteLocal = 'deleteLocal', } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type LogSyncOperationFunction = (action: SyncAction, local?: any, remote?: RemoteItem, message?: string, actionCount?: number)=> void; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type ApiCallFunction = (fnName: string, ...args: any[])=> Promise; export const conflictActions: SyncAction[] = [SyncAction.ItemConflict, SyncAction.NoteConflict, SyncAction.ResourceConflict]; diff --git a/packages/lib/shim-init-node.ts b/packages/lib/shim-init-node.ts index 509d3f0bf..431d3d3bb 100644 --- a/packages/lib/shim-init-node.ts +++ b/packages/lib/shim-init-node.ts @@ -24,6 +24,7 @@ const timers = require('timers'); const zlib = require('zlib'); const dgram = require('dgram'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const proxySettings: any = {}; type FetchBlobOptions = { @@ -31,6 +32,7 @@ type FetchBlobOptions = { method?: string; maxRedirects?: number; timeout?: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied headers?: any; downloadController?: DownloadController; }; @@ -94,6 +96,7 @@ const gunzipFile = function(source: string, destination: string) { }); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function setupProxySettings(options: any) { proxySettings.maxConcurrentConnections = options.maxConcurrentConnections; proxySettings.proxyTimeout = options.proxyTimeout; @@ -102,11 +105,16 @@ function setupProxySettings(options: any) { } interface ShimInitOptions { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied sharp: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied keytar: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied React: any; appVersion: ()=> string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied electronBridge: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied nodeSqlite: any; pdfJs: typeof pdfJsNamespace; } @@ -163,6 +171,7 @@ function shimInit(options: ShimInitOptions = null) { return Array.from(buffer); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied shim.detectAndSetLocale = function(Setting: any) { let locale = shim.isElectron() ? shim.electronBridge().getLocale() : process.env.LANG; if (!locale) locale = defaultLocale(); @@ -281,6 +290,7 @@ function shimInit(options: ShimInitOptions = null) { fit: 'inside', withoutEnlargement: true, }) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .toFile(targetPath, (error: any, info: any) => { if (error) { reject(error); @@ -363,6 +373,7 @@ function shimInit(options: ShimInitOptions = null) { const fileStat = await shim.fsDriver().stat(targetPath); resource.size = fileStat.size; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const saveOptions: any = { isNew: true }; if (options.userSideValidation) saveOptions.userSideValidation = true; @@ -413,6 +424,7 @@ function shimInit(options: ShimInitOptions = null) { return newBody.join('\n\n'); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied shim.attachFileToNote = async function(note, filePath, position: number = null, options: any = null) { if (!options) options = {}; if (note.markup_language) options.markupLanguage = note.markup_language; @@ -438,6 +450,7 @@ function shimInit(options: ShimInitOptions = null) { if (size.width > maxSize || size.height > maxSize) { console.warn(`Image is over ${maxSize}px - resizing it: ${filePath}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const options: any = {}; if (size.width > size.height) { options.width = maxSize; @@ -503,6 +516,7 @@ function shimInit(options: ShimInitOptions = null) { }, options); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied shim.fetchBlob = async function(url: any, options: FetchBlobOptions) { if (!options || !options.path) throw new Error('fetchBlob: target file path is missing'); if (!options.method) options.method = 'GET'; @@ -522,6 +536,7 @@ function shimInit(options: ShimInitOptions = null) { const filePath = options.path; const downloadController = options.downloadController; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function makeResponse(response: any) { return { ok: response.statusCode < 400, @@ -537,6 +552,7 @@ function shimInit(options: ShimInitOptions = null) { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const requestOptions: any = { protocol: url.protocol, host: url.hostname, @@ -553,8 +569,10 @@ function shimInit(options: ShimInitOptions = null) { const doFetchOperation = async () => { return new Promise((resolve, reject) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let file: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const cleanUpOnError = (error: any) => { // We ignore any unlink error as we only want to report on the main error void fs.unlink(filePath) @@ -577,10 +595,12 @@ function shimInit(options: ShimInitOptions = null) { // Note: relative paths aren't supported file = fs.createWriteStream(filePath); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied file.on('error', (error: any) => { cleanUpOnError(error); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const request = http.request(requestOptions, (response: any) => { if (downloadController) { @@ -622,6 +642,7 @@ function shimInit(options: ShimInitOptions = null) { request.destroy(new Error(`Request timed out. Timeout value: ${requestOptions.timeout}ms.`)); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied request.on('error', (error: any) => { cleanUpOnError(error); }); @@ -746,6 +767,7 @@ function shimInit(options: ShimInitOptions = null) { shim.requireDynamic = (path) => { if (path.indexOf('.') === 0) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const sites: any = callsites(); if (sites.length <= 1) throw new Error(`Cannot require file (1) ${path}`); const filename = sites[1].getFileName(); @@ -800,6 +822,7 @@ function shimInit(options: ShimInitOptions = null) { return document.createElement('canvas'); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const canvasToBuffer = async (canvas: any): Promise => { const quality = 0.8; if (isTesting) { diff --git a/packages/lib/shim.ts b/packages/lib/shim.ts index 5e2c35c07..6481c2bf9 100644 --- a/packages/lib/shim.ts +++ b/packages/lib/shim.ts @@ -38,15 +38,22 @@ let isTestingEnv_ = false; // // https://stackoverflow.com/a/42816077/561309 let react_: typeof React = null; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let nodeSqlite_: any = null; const shim = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied Geolocation: null as any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied electronBridge_: null as any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied fsDriver_: null as any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied httpAgent_: null as any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied proxyAgent: null as any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied electronBridge: (): any => { throw new Error('Not implemented: electronBridge'); }, @@ -131,11 +138,13 @@ const shim = { // https://github.com/cheton/is-electron isElectron: () => { // Renderer process + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (typeof window !== 'undefined' && typeof window.process === 'object' && (window.process as any).type === 'renderer') { return true; } // Main process + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!(process.versions as any).electron) { return true; } @@ -155,6 +164,7 @@ const shim = { // Node requests can go wrong is so many different ways and with so // many different error messages... This handler inspects the error // and decides whether the request can safely be repeated or not. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied fetchRequestCanBeRetried: (error: any) => { if (!error) return false; @@ -201,7 +211,7 @@ const shim = { return previous; }, - // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, 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 @@ -224,10 +234,12 @@ const shim = { } }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied fetch: (_url: string, _options: any = null): any => { throw new Error('Not implemented: fetch'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied fetchText: async (url: string, options: any = null): Promise => { const r = await shim.fetch(url, options || {}); if (!r.ok) throw new Error(`Could not fetch ${url}`); @@ -244,22 +256,28 @@ const shim = { throw new Error('Not implemented: fsDriver'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied FileApiDriverLocal: null as any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied readLocalFileBase64: (_path: string): any => { throw new Error('Not implemented: readLocalFileBase64'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied uploadBlob: (_url: string, _options: any): any => { throw new Error('Not implemented: uploadBlob'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied sjclModule: null as any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied randomBytes: async (_count: number): Promise => { throw new Error('Not implemented: randomBytes'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied stringByteLength: (_s: string): any => { throw new Error('Not implemented: stringByteLength'); }, @@ -267,10 +285,12 @@ const shim = { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied detectAndSetLocale: null as Function, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied attachFileToNote: async (_note: any, _filePath: string): Promise => { throw new Error('Not implemented: attachFileToNote'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied attachFileToNoteBody: async (_body: string, _filePath: string, _position: number, _options: any): Promise => { throw new Error('Not implemented: attachFileToNoteBody'); }, @@ -279,10 +299,12 @@ const shim = { throw new Error('Not implemented: imageToDataUrl'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied imageFromDataUrl: async (_imageDataUrl: string, _filePath: string, _options: any = null): Promise => { throw new Error('Not implemented: imageFromDataUrl'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied fetchBlob: function(_url: string, _options: any = null): any { throw new Error('Not implemented: fetchBlob'); }, @@ -300,24 +322,30 @@ const shim = { throw new Error('Not implemented: pdfInfo'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied Buffer: null as any, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied openUrl: (_url: string): any => { throw new Error('Not implemented: openUrl'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied httpAgent: (_url: string): any => { throw new Error('Not implemented: httpAgent'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied openOrCreateFile: (_path: string, _defaultContents: any): any => { throw new Error('Not implemented: openOrCreateFile'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied waitForFrame: (): any => { throw new Error('Not implemented: waitForFrame'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied appVersion: (): any => { throw new Error('Not implemented: appVersion'); }, @@ -332,6 +360,7 @@ const shim = { isTestingEnv_ = v; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pathRelativeToCwd: (_path: string): any => { throw new Error('Not implemented'); }, @@ -339,6 +368,7 @@ const shim = { // Returns the index of the button that was clicked. By default, // 0 -> OK // 1 -> Cancel + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied showMessageBox: (_message: string, _options: any = null): Promise => { throw new Error('Not implemented'); }, @@ -347,6 +377,7 @@ const shim = { return await shim.showMessageBox(message) === 0; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied writeImageToFile: (_image: any, _format: any, _filePath: string): void => { throw new Error('Not implemented'); }, @@ -370,24 +401,27 @@ 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 + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied setTimeout: (_fn: Function, _interval: number): any=> { throw new Error('Not implemented'); }, - // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied setInterval: (_fn: Function, _interval: number): any=> { throw new Error('Not implemented'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied clearTimeout: (_id: any): any => { throw new Error('Not implemented'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied clearInterval: (_id: any): any => { throw new Error('Not implemented'); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied setNodeSqlite: (nodeSqlite: any) => { nodeSqlite_ = nodeSqlite; }, @@ -397,6 +431,7 @@ const shim = { return nodeSqlite_; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied setReact: (react: any) => { react_ = react; }, @@ -406,6 +441,7 @@ const shim = { return react_; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied dgram: (): any => { throw new Error('Not implemented'); }, @@ -431,6 +467,7 @@ const shim = { return (shim.isWindows() || shim.isMac()) && !shim.isPortable(); }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied keytar: (): any => { throw new Error('Not implemented'); }, @@ -440,6 +477,7 @@ const shim = { // React Native. In React Native that code path will throw an error, but at // least it will build. // https://stackoverflow.com/questions/55581073 + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied requireDynamic: (_path: string): any => { throw new Error('Not implemented'); }, diff --git a/packages/lib/testing/syncTargetUtils.ts b/packages/lib/testing/syncTargetUtils.ts index 323fbd2a3..64b92e38b 100644 --- a/packages/lib/testing/syncTargetUtils.ts +++ b/packages/lib/testing/syncTargetUtils.ts @@ -40,7 +40,9 @@ export const testData = { }, }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function createTestData(data: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function recurseStruct(s: any, parentId = '') { for (const n in s) { if (n.toLowerCase().includes('folder')) { @@ -64,7 +66,9 @@ export async function createTestData(data: any) { await recurseStruct(data); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function checkTestData(data: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function recurseCheck(s: any) { for (const n in s) { const obj = s[n]; diff --git a/packages/lib/testing/test-utils-synchronizer.ts b/packages/lib/testing/test-utils-synchronizer.ts index 0839c1c0e..efe35e5c7 100644 --- a/packages/lib/testing/test-utils-synchronizer.ts +++ b/packages/lib/testing/test-utils-synchronizer.ts @@ -38,7 +38,7 @@ export async function remoteResources() { return remoteItemsByTypes([BaseModel.TYPE_RESOURCE]); } -// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, 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 6a1a3fc7f..248a09cfd 100644 --- a/packages/lib/testing/test-utils.ts +++ b/packages/lib/testing/test-utils.ts @@ -268,6 +268,7 @@ const settingFilename = (id: number): string => { return `settings-${id}.json`; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function switchClient(id: number, options: any = null) { options = { keychainEnabled: false, ...options }; @@ -335,6 +336,7 @@ async function clearDatabase(id: number = null) { await databases_[id].transactionExecBatch(queries); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function setupDatabase(id: number = null, options: any = null) { options = { keychainEnabled: false, ...options }; @@ -385,6 +387,7 @@ async function clearSettingFile(id: number) { await fs.remove(Setting.settingFilePath); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function createFolderTree(parentId: string, tree: any[], num = 0): Promise { let rootFolder: FolderEntity = null; @@ -445,6 +448,7 @@ const createNoteAndResource = async (options: CreateNoteAndResourceOptions = nul return { note, resource }; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function setupDatabaseAndSynchronizer(id: number, options: any = null) { if (id === null) id = currentClient_; @@ -503,6 +507,7 @@ function synchronizer(id: number = null) { // This is like calling synchronizer.start() but it handles the // complexity of passing around the sync context depending on // the client. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function synchronizerStart(id: number = null, extraOptions: any = null) { if (id === null) id = currentClient_; @@ -703,6 +708,7 @@ function fileApi() { return fileApis_[syncTargetId_]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function objectsEqual(o1: any, o2: any) { if (Object.getOwnPropertyNames(o1).length !== Object.getOwnPropertyNames(o2).length) return false; for (const n in o1) { @@ -723,7 +729,7 @@ async function checkThrowAsync(asyncFn: Function) { return hasThrown; } -// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied async function expectThrow(asyncFn: Function, errorCode: any = undefined, errorMessage: string = undefined) { let hasThrown = false; let thrownError = null; @@ -817,18 +823,22 @@ async function allSyncTargetItemsEncrypted() { return totalCount === encryptedCount; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function id(a: any) { return a.id; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function ids(a: any[]) { return a.map(n => n.id); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function sortedIds(a: any[]) { return ids(a).sort(); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function at(a: any[], indexes: any[]) { const out = []; for (let i = 0; i < indexes.length; i++) { @@ -847,6 +857,7 @@ async function createNTestFolders(n: number) { return folders; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function createNTestNotes(n: number, folder: any, tagIds: string[] = null, title = 'note') { const notes = []; for (let i = 0; i < n; i++) { @@ -932,6 +943,7 @@ export async function naughtyStrings() { class TestApp extends BaseApplication { private hasGui_: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private middlewareCalls_: any[]; private logger_: LoggerWrapper; @@ -948,6 +960,7 @@ class TestApp extends BaseApplication { return this.hasGui_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async start(argv: any[]) { this.logger_.info('Test app starting...'); @@ -969,6 +982,7 @@ class TestApp extends BaseApplication { this.logger_.info('Test app started...'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async generalMiddleware(store: any, next: any, action: any) { this.middlewareCalls_.push(true); try { diff --git a/packages/lib/theme.ts b/packages/lib/theme.ts index 43168d4b2..1dfd6598b 100644 --- a/packages/lib/theme.ts +++ b/packages/lib/theme.ts @@ -10,6 +10,7 @@ import Setting from './models/Setting'; const Color = require('color'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const themes: any = { [Setting.THEME_LIGHT]: theme_light, [Setting.THEME_DARK]: theme_dark, @@ -42,6 +43,7 @@ export function themeById(themeId: string) { // globalStyle should be used for properties that do not change across themes // i.e. should not be used for colors +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const globalStyle: any = { fontFamily: 'Roboto', // 'sans-serif', margin: 15, // No text and no interactive component should be within this margin @@ -111,9 +113,11 @@ globalStyle.buttonStyle = { borderRadius: 4, }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function addExtraStyles(style: any) { const zoomRatio = 1; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const fontSizes: any = { fontSize: Math.round(12 * zoomRatio), toolbarIconSize: 18, @@ -335,6 +339,7 @@ export function addExtraStyles(style: any) { return style; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const themeCache_: any = {}; export function themeStyle(themeId: number) { @@ -343,6 +348,7 @@ export function themeStyle(themeId: number) { const cacheKey = themeId; if (themeCache_[cacheKey]) return themeCache_[cacheKey]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let output: any = {}; // All theme are based on the light style, and just override the @@ -355,6 +361,7 @@ export function themeStyle(themeId: number) { return themeCache_[cacheKey]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const cachedStyles_: any = { themeId: null, styles: {}, @@ -363,7 +370,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 +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, 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 a97c676e3..6205713de 100644 --- a/packages/lib/time.ts +++ b/packages/lib/time.ts @@ -102,6 +102,7 @@ class Time { return moment(ms).format(format) as string; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public formatLocalToMs(localDateTime: any, format: string = null) { if (format === null) format = this.dateTimeFormat(); const m = moment(localDateTime, format); @@ -110,6 +111,7 @@ class Time { } // Mostly used as a utility function for the DateTime Electron component + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public anythingToDateTime(o: any, defaultValue: Date = null) { if (o && o.toDate) return o.toDate(); if (!o) return defaultValue; @@ -119,6 +121,7 @@ class Time { return m.isValid() ? m.toDate() : defaultValue; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public anythingToMs(o: any, defaultValue: number = null) { if (o && o.toDate) return o.toDate(); if (!o) return defaultValue; @@ -146,11 +149,13 @@ class Time { } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public goBackInTime(startDate: any, n: number, period: any) { // period is a string (eg. "day", "week", "month", "year" ), n is an integer return moment(startDate).startOf(period).subtract(n, period).format('x'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public goForwardInTime(startDate: any, n: number, period: any) { return moment(startDate).startOf(period).add(n, period).format('x'); } diff --git a/packages/lib/utils/focusHandler.ts b/packages/lib/utils/focusHandler.ts index 5234e81b8..be7ab5599 100644 --- a/packages/lib/utils/focusHandler.ts +++ b/packages/lib/utils/focusHandler.ts @@ -32,10 +32,12 @@ const toggleFocus = (source: string, element: FocusableElement, action: ToggleFo element[action](); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const focus = (source: string, element: any) => { toggleFocus(source, element, ToggleFocusAction.Focus); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const blur = (source: string, element: any) => { toggleFocus(source, element, ToggleFocusAction.Blur); }; diff --git a/packages/lib/utils/ipc/RemoteMessenger.test.ts b/packages/lib/utils/ipc/RemoteMessenger.test.ts index 5b558f71d..5c7f9e82e 100644 --- a/packages/lib/utils/ipc/RemoteMessenger.test.ts +++ b/packages/lib/utils/ipc/RemoteMessenger.test.ts @@ -89,6 +89,7 @@ describe('RemoteMessenger', () => { it('should preserve structure of transferred objects', async () => { const transferObjectApi = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied transfer: async (o: any) => o, }; type ApiType = typeof transferObjectApi; @@ -97,6 +98,7 @@ describe('RemoteMessenger', () => { const messenger2 = new TestMessenger('test', transferObjectApi); messenger1.connectTo(messenger2); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const testObjects: any[] = [ { foo: { bar: undefined, baz: null } }, { foo: { bar: [1, 2, 3], baz: 'test' } }, diff --git a/packages/lib/utils/ipc/RemoteMessenger.ts b/packages/lib/utils/ipc/RemoteMessenger.ts index 627af1403..6d9ae6c0d 100644 --- a/packages/lib/utils/ipc/RemoteMessenger.ts +++ b/packages/lib/utils/ipc/RemoteMessenger.ts @@ -77,7 +77,9 @@ type OnAllMethodsRespondedToListener = ()=> void; // TODO: Remove after upgrading nodejs/browser types sufficiently // (FinalizationRegistry is supported in modern browsers). declare class FinalizationRegistry { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(onDrop: any); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public register(v: any, id: string): void; } @@ -122,6 +124,7 @@ export default abstract class RemoteMessenger { return new Proxy(baseObject, { // Map all properties to functions that invoke remote // methods. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied get: (_target, property: string): any => { if (property === '___is_joplin_wrapper___') { return true; @@ -211,6 +214,7 @@ export default abstract class RemoteMessenger { }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private canRemoteAccessProperty(parentObject: any, methodName: string) { // TODO: There may be a better way to do this -- this currently assumes that // **only** the following property names should be avoided. @@ -233,6 +237,7 @@ export default abstract class RemoteMessenger { return this.invokeRemoteMethod(['__callbacks', callbackId], callbackArgs); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private trackCallbackFinalization = (callbackId: string, callback: any) => { this.callbackTracker?.register(callback, callbackId); }; @@ -241,6 +246,7 @@ export default abstract class RemoteMessenger { private async invokeLocalMethod(message: InvokeMethodMessage) { try { const methodFromPath = (path: string[]) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const parentObjectStack: any[] = []; // We also use invokeLocalMethod to call callbacks that were previously @@ -253,7 +259,9 @@ export default abstract class RemoteMessenger { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let parentObject: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let currentObject: any = this.localInterface; for (let i = 0; i < path.length; i++) { const propertyName = path[i]; diff --git a/packages/lib/utils/ipc/types.ts b/packages/lib/utils/ipc/types.ts index ff6f1776c..4434f3123 100644 --- a/packages/lib/utils/ipc/types.ts +++ b/packages/lib/utils/ipc/types.ts @@ -18,5 +18,6 @@ export type CallbackIds = null|string|CallbackIds[]|Readonly<{ // there's no clear way to enforce this in TypeScript (most methods lead to // a "missing index signature" error). export type ReturnsPromises = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied [functionName in keyof Type]: (...args: any[])=> Promise; }; diff --git a/packages/lib/utils/ipc/utils/mergeCallbacksAndSerializable.test.ts b/packages/lib/utils/ipc/utils/mergeCallbacksAndSerializable.test.ts index 1103bf3b8..ab3309c3e 100644 --- a/packages/lib/utils/ipc/utils/mergeCallbacksAndSerializable.test.ts +++ b/packages/lib/utils/ipc/utils/mergeCallbacksAndSerializable.test.ts @@ -13,6 +13,7 @@ describe('mergeCallbacksAndSerializable', () => { 'test[2]', ], }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const data: any = { foo: { fn1: undefined, @@ -27,6 +28,7 @@ describe('mergeCallbacksAndSerializable', () => { }; const callMethodWithId = jest.fn(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const merged: any = mergeCallbacksAndSerializable(data, callbacks, callMethodWithId, ()=>{}); // Should have created functions diff --git a/packages/lib/utils/ipc/utils/mergeCallbacksAndSerializable.ts b/packages/lib/utils/ipc/utils/mergeCallbacksAndSerializable.ts index bfdad4e79..fb9f9cdf1 100644 --- a/packages/lib/utils/ipc/utils/mergeCallbacksAndSerializable.ts +++ b/packages/lib/utils/ipc/utils/mergeCallbacksAndSerializable.ts @@ -3,6 +3,7 @@ import { CallbackIds, SerializableData, SerializableDataAndCallbacks } from '../ type CallMethodWithIdCallback = (id: string, args: SerializableDataAndCallbacks[])=> Promise; // Intended to be used to track callbacks for garbage collection +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type OnAfterCallbackCreated = (callbackId: string, callbackRef: ()=> any)=> void; // Below, we use TypeScript syntax to specify the return type of mergeCallbacksAndSerializable diff --git a/packages/lib/utils/ipc/utils/separateCallbacksFromSerializable.test.ts b/packages/lib/utils/ipc/utils/separateCallbacksFromSerializable.test.ts index 04a7d594d..7ebb71b2f 100644 --- a/packages/lib/utils/ipc/utils/separateCallbacksFromSerializable.test.ts +++ b/packages/lib/utils/ipc/utils/separateCallbacksFromSerializable.test.ts @@ -33,6 +33,7 @@ describe('separateCallbacksFromSerializable', () => { ]); expect(Array.isArray(separated.callbacks)).toBe(true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const callbackArray = separated.callbacks as any[]; // Should have assigned IDs to the two functions diff --git a/packages/lib/utils/joplinCloud.ts b/packages/lib/utils/joplinCloud.ts index 391294886..c6e96e0f8 100644 --- a/packages/lib/utils/joplinCloud.ts +++ b/packages/lib/utils/joplinCloud.ts @@ -274,6 +274,7 @@ export const getFeaturesByPlan = (planName: PlanName, featureOn: boolean): PlanF export const getFeatureLabel = (planName: PlanName, featureId: FeatureId): string => { const feature = features()[featureId]; const k = `${planName}Info`; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if ((feature as any)[k]) return (feature as any)[k]; return feature.title; }; @@ -308,6 +309,7 @@ export const createFeatureTableMd = () => { const getCellInfo = (planName: PlanName, feature: PlanFeature) => { if (!feature[planName]) return '-'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const infoShort: string = (feature as any)[`${planName}InfoShort`]; if (infoShort) return infoShort; return '✔️'; diff --git a/packages/pdf-viewer/Page.tsx b/packages/pdf-viewer/Page.tsx index 6395dceea..29860b897 100644 --- a/packages/pdf-viewer/Page.tsx +++ b/packages/pdf-viewer/Page.tsx @@ -121,6 +121,7 @@ export default function Page(props: PageProps) { if (props.onClick) props.onClick(props.pageNo); }, [props.onClick, props.pageNo]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let style: any = {}; if (props.scaledSize) { style = { diff --git a/packages/pdf-viewer/PdfDocument.ts b/packages/pdf-viewer/PdfDocument.ts index a1f4cca6f..1b7eb04ae 100644 --- a/packages/pdf-viewer/PdfDocument.ts +++ b/packages/pdf-viewer/PdfDocument.ts @@ -5,8 +5,10 @@ import { Mutex, MutexInterface, withTimeout } from 'async-mutex'; export default class PdfDocument { public url: string | Uint8Array; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private doc: any = null; public pageCount: number = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private pages: any = {}; private rendererMutex: MutexInterface = null; private pageSize: { @@ -24,6 +26,7 @@ export default class PdfDocument { this.url = url; const loadingTask = pdfjsLib.getDocument(url); try { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const pdfDocument: any = await loadingTask.promise; this.doc = pdfDocument; this.pageCount = pdfDocument.numPages; diff --git a/packages/pdf-viewer/messageService.ts b/packages/pdf-viewer/messageService.ts index dd19726bb..0e9453dac 100644 --- a/packages/pdf-viewer/messageService.ts +++ b/packages/pdf-viewer/messageService.ts @@ -3,6 +3,7 @@ export default class MessageService { public constructor(type: string) { this.viewerType = type; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private sendMessage = (name: string, data?: any) => { if (this.viewerType === 'full') { const message = { diff --git a/packages/plugin-repo-cli/commands/updateRelease.ts b/packages/plugin-repo-cli/commands/updateRelease.ts index 6f7f1b31a..70e79a6cb 100644 --- a/packages/plugin-repo-cli/commands/updateRelease.ts +++ b/packages/plugin-repo-cli/commands/updateRelease.ts @@ -97,6 +97,7 @@ async function uploadAsset(oauthToken: string, uploadUrl: string, pluginInfo: Pl path: pluginInfo.path, }, ], + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied }, (error: Error, assets: any) => { if (error) { reject(error); @@ -108,6 +109,7 @@ async function uploadAsset(oauthToken: string, uploadUrl: string, pluginInfo: Pl } async function createStats(statFilePath: string, release: Release) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: Record = await pathExists(statFilePath) ? JSON.parse(await readFile(statFilePath, 'utf8')) : {}; if (release.assets) { @@ -125,6 +127,7 @@ async function createStats(statFilePath: string, release: Release) { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function saveStats(statFilePath: string, stats: any) { await writeFile(statFilePath, JSON.stringify(stats, null, '\t')); } diff --git a/packages/plugin-repo-cli/index.ts b/packages/plugin-repo-cli/index.ts index a05ce4868..cdeb93ad8 100644 --- a/packages/plugin-repo-cli/index.ts +++ b/packages/plugin-repo-cli/index.ts @@ -17,6 +17,7 @@ import { applyManifestOverrides, getObsoleteManifests, getSupersededPackages, re import { execCommand } from '@joplin/utils'; import validateUntrustedManifest from './lib/validateUntrustedManifest'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function pluginInfoFromSearchResults(results: any[]): NpmPackage[] { const output: NpmPackage[] = []; @@ -45,6 +46,7 @@ async function checkPluginRepository(dirPath: string, dryRun: boolean) { chdir(previousDir); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function extractPluginFilesFromPackage(existingManifests: any, workDir: string, packageName: string, destDir: string): Promise { const previousDir = chdir(workDir); @@ -55,7 +57,9 @@ async function extractPluginFilesFromPackage(existingManifests: any, workDir: st if (!(await fs.pathExists(pluginDir))) throw new Error(`Could not find publish directory at ${pluginDir}`); const files = await fs.readdir(pluginDir); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const manifestFilePath = path.resolve(pluginDir, files.find((f: any) => path.extname(f) === '.json')); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const pluginFilePath = path.resolve(pluginDir, files.find((f: any) => path.extname(f) === '.jpl')); if (!(await fs.pathExists(manifestFilePath))) throw new Error(`Could not find manifest file at ${manifestFilePath}`); @@ -89,6 +93,7 @@ enum ProcessingActionType { Update = 2, } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function commitMessage(actionType: ProcessingActionType, manifest: any, previousManifest: any, npmPackage: NpmPackage, error: any): string { const output: string[] = []; @@ -113,10 +118,12 @@ function pluginManifestsPath(repoDir: string): string { return path.resolve(repoDir, 'manifests.json'); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function readManifests(repoDir: string): Promise { return readJsonFile(pluginManifestsPath(repoDir), {}); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function writeManifests(repoDir: string, manifests: any) { await fs.writeFile(pluginManifestsPath(repoDir), JSON.stringify(manifests, null, '\t'), 'utf8'); } @@ -157,9 +164,13 @@ async function processNpmPackage(npmPackage: NpmPackage, repoDir: string, dryRun await execCommand('npm init --yes --loglevel silent', { quiet: true }); let actionType: ProcessingActionType = ProcessingActionType.Update; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let manifests: any = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let manifest: any = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let error: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let previousManifest: any = null; try { @@ -285,6 +296,7 @@ async function main() { let selectedCommand = ''; let selectedCommandArgs = ''; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function setSelectedCommand(name: string, args: any) { selectedCommand = name; selectedCommandArgs = args; @@ -294,15 +306,19 @@ async function main() { .scriptName(scriptName) .usage('$0 [args]') + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .command('build [dry-run]', 'Build the plugin repository', (yargs: any) => { yargs.positional('plugin-repo-dir', { type: 'string', describe: 'Directory where the plugin repository is located', }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied }, (args: any) => setSelectedCommand('build', args)) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .command('version', 'Gives version info', () => {}, (args: any) => setSelectedCommand('version', args)) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied .command('update-release ', 'Update GitHub release', () => {}, (args: any) => setSelectedCommand('updateRelease', args)) .help() diff --git a/packages/plugin-repo-cli/lib/checkIfPluginCanBeAdded.ts b/packages/plugin-repo-cli/lib/checkIfPluginCanBeAdded.ts index a0ec69105..c338dd082 100644 --- a/packages/plugin-repo-cli/lib/checkIfPluginCanBeAdded.ts +++ b/packages/plugin-repo-cli/lib/checkIfPluginCanBeAdded.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function caseInsensitiveFindManifest(manifests: any, manifestId: string): any { for (const id of Object.keys(manifests)) { if (id.toLowerCase() === manifestId.toLowerCase()) return manifests[id]; @@ -5,6 +6,7 @@ function caseInsensitiveFindManifest(manifests: any, manifestId: string): any { return null; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function(existingManifests: any, manifest: any) { // If there's already a plugin with this ID published under a different // package name, we skip it. Otherwise it would allow anyone to overwrite diff --git a/packages/plugin-repo-cli/lib/errorsHaveChanged.test.ts b/packages/plugin-repo-cli/lib/errorsHaveChanged.test.ts index 168c8c9c4..e23b55b21 100644 --- a/packages/plugin-repo-cli/lib/errorsHaveChanged.test.ts +++ b/packages/plugin-repo-cli/lib/errorsHaveChanged.test.ts @@ -55,6 +55,7 @@ describe('errorsHaveChanged', () => { ]; for (const t of testCases) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const [oldErrors, newErrors, expected] = t as any; const result = errorsHaveChanged(oldErrors, newErrors); diff --git a/packages/plugin-repo-cli/lib/gitCompareUrl.ts b/packages/plugin-repo-cli/lib/gitCompareUrl.ts index 2017e988c..f3264253b 100644 --- a/packages/plugin-repo-cli/lib/gitCompareUrl.ts +++ b/packages/plugin-repo-cli/lib/gitCompareUrl.ts @@ -17,6 +17,7 @@ const formatRepoUrl = (url: string): string => { return url; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function(manifest: any, previousManifest: any = null): string { // "repository_url": "https://github.com/JackGruber/joplin-plugin-copytags", // "_publish_commit": "master:b52b01f6d3b709a811ac214253636a7c207c87dd", diff --git a/packages/plugin-repo-cli/lib/overrideUtils.test.ts b/packages/plugin-repo-cli/lib/overrideUtils.test.ts index 8ae2a4331..40357916b 100644 --- a/packages/plugin-repo-cli/lib/overrideUtils.test.ts +++ b/packages/plugin-repo-cli/lib/overrideUtils.test.ts @@ -3,6 +3,7 @@ import { applyManifestOverrides, getObsoleteManifests, getSupersededPackages, Ma describe('overrideUtils', () => { test('should get the obsolete manifests', () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const manifestOverrides: any = { 'ambrt.backlinksToNote': { 'manifest_version': 1, @@ -44,6 +45,7 @@ describe('overrideUtils', () => { }); test('should apply the overrides', () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const manifests: any = { 'io.github.jackgruber.copytags': { 'manifest_version': 1, diff --git a/packages/plugin-repo-cli/lib/overrideUtils.ts b/packages/plugin-repo-cli/lib/overrideUtils.ts index e7437c81e..b6be61826 100644 --- a/packages/plugin-repo-cli/lib/overrideUtils.ts +++ b/packages/plugin-repo-cli/lib/overrideUtils.ts @@ -9,8 +9,10 @@ export interface ManifestOverride { export type ManifestOverrides = Record; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function applyManifestOverrides(manifests: any, overrides: ManifestOverrides) { for (const [pluginId, override] of Object.entries(overrides)) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const manifest: any = manifests[pluginId]; if (!manifest) { @@ -32,6 +34,7 @@ export function applyManifestOverrides(manifests: any, overrides: ManifestOverri } export function getObsoleteManifests(overrides: ManifestOverrides) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; for (const [pluginId, override] of Object.entries(overrides)) { diff --git a/packages/plugin-repo-cli/lib/updateReadme.test.ts b/packages/plugin-repo-cli/lib/updateReadme.test.ts index 0cfcc7947..03c1bc71f 100644 --- a/packages/plugin-repo-cli/lib/updateReadme.test.ts +++ b/packages/plugin-repo-cli/lib/updateReadme.test.ts @@ -4,6 +4,7 @@ import updateReadme from './updateReadme'; describe('updateReadme', () => { test('should update the README file', async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const manifests: any = { 'io.github.jackgruber.copytags': { 'manifest_version': 1, diff --git a/packages/plugin-repo-cli/lib/updateReadme.ts b/packages/plugin-repo-cli/lib/updateReadme.ts index b63c31eec..8674d3717 100644 --- a/packages/plugin-repo-cli/lib/updateReadme.ts +++ b/packages/plugin-repo-cli/lib/updateReadme.ts @@ -1,6 +1,7 @@ import * as fs from 'fs-extra'; import markdownUtils, { MarkdownTableHeader, MarkdownTableRow } from '@joplin/lib/markdownUtils'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default async function(readmePath: string, manifests: any) { let rows: MarkdownTableRow[] = []; @@ -50,6 +51,7 @@ export default async function(readmePath: string, manifests: any) { }, ]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied rows.sort((a: any, b: any) => { return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : +1; }); diff --git a/packages/plugin-repo-cli/lib/utils.ts b/packages/plugin-repo-cli/lib/utils.ts index dbbf74021..845fd7e3f 100644 --- a/packages/plugin-repo-cli/lib/utils.ts +++ b/packages/plugin-repo-cli/lib/utils.ts @@ -1,5 +1,6 @@ import * as fs from 'fs-extra'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function readJsonFile(manifestPath: string, defaultValue: any = null): Promise { if (!(await fs.pathExists(manifestPath))) { if (defaultValue === null) throw new Error(`No such file: ${manifestPath}`); @@ -16,6 +17,7 @@ function stripOffPackageOrg(name: string): string { return n.join('/'); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function isJoplinPluginPackage(pack: any): boolean { if (!pack.keywords || !pack.keywords.includes('joplin-plugin')) return false; if (stripOffPackageOrg(pack.name).indexOf('joplin-plugin') !== 0) return false; diff --git a/packages/plugin-repo-cli/lib/validateUntrustedManifest.ts b/packages/plugin-repo-cli/lib/validateUntrustedManifest.ts index 696238963..8b7d170f1 100644 --- a/packages/plugin-repo-cli/lib/validateUntrustedManifest.ts +++ b/packages/plugin-repo-cli/lib/validateUntrustedManifest.ts @@ -6,6 +6,7 @@ import checkIfPluginCanBeAdded from './checkIfPluginCanBeAdded'; // Assumes that // 1. manifest._npm_package_name is correct, // 2. other fields were set by the plugin author and are thus untrusted. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const validateUntrustedManifest = (manifest: any, existingManifests: any) => { // At this point, we need to check the manifest ID as it's used in various // places including as directory name and object key in manifests.json, so diff --git a/packages/react-native-saf-x/src/index.ts b/packages/react-native-saf-x/src/index.ts index ccd75943c..a12b4ba56 100644 --- a/packages/react-native-saf-x/src/index.ts +++ b/packages/react-native-saf-x/src/index.ts @@ -22,6 +22,7 @@ if (Platform.OS === 'android') { ) ) as SafxInterface; } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied SafX = {} as any; } diff --git a/packages/renderer/HtmlToHtml.ts b/packages/renderer/HtmlToHtml.ts index 3736c61bc..abd4d99ed 100644 --- a/packages/renderer/HtmlToHtml.ts +++ b/packages/renderer/HtmlToHtml.ts @@ -63,6 +63,7 @@ export default class HtmlToHtml implements MarkupRenderer { return this.fsDriver_; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async allAssets(theme: any, noteStyleOptions: NoteStyleOptions = null) { let cssStrings: string[] = []; @@ -82,6 +83,7 @@ export default class HtmlToHtml implements MarkupRenderer { // Note: the "theme" variable is ignored and instead the light theme is // always used for HTML notes. // See: https://github.com/laurent22/joplin/issues/3698 + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async render(markup: string, theme: any, options: RenderOptions): Promise { options = { splitted: false, @@ -98,6 +100,7 @@ export default class HtmlToHtml implements MarkupRenderer { allowedFilePrefixes: options.allowedFilePrefixes, }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied html = htmlUtils.processImageTags(html, (data: any) => { if (!data.src) return null; @@ -117,6 +120,7 @@ export default class HtmlToHtml implements MarkupRenderer { } }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied html = htmlUtils.processAnchorTags(html, (data: any) => { if (!data.href) return null; diff --git a/packages/renderer/InMemoryCache.ts b/packages/renderer/InMemoryCache.ts index d210e39d8..268eaa7fa 100644 --- a/packages/renderer/InMemoryCache.ts +++ b/packages/renderer/InMemoryCache.ts @@ -10,6 +10,7 @@ // scale. interface Record { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; expiredTime: number; } @@ -55,6 +56,7 @@ export default class Cache { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public value(key: string, defaultValue: any = undefined): any { this.checkExpiredRecords(); if (key in this.records_) return this.records_[key].value; @@ -62,6 +64,7 @@ export default class Cache { return defaultValue; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public setValue(key: string, value: any, ttl = 0) { this.checkExpiredRecords(); diff --git a/packages/renderer/MarkupToHtml.ts b/packages/renderer/MarkupToHtml.ts index 6d4b3d5ee..cde8ce78b 100644 --- a/packages/renderer/MarkupToHtml.ts +++ b/packages/renderer/MarkupToHtml.ts @@ -17,8 +17,10 @@ export interface Options { isSafeMode?: boolean; ResourceModel?: OptionsResourceModel; customCss?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied extraRendererRules?: any[]; resourceBaseUrl?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginOptions?: any; // Not sure if needed tempDir?: string; // Not sure if needed fsDriver?: FsDriver; // Not sure if needed @@ -31,6 +33,7 @@ export default class MarkupToHtml implements MarkupToHtmlConverter { private renderers_: Record = {}; private options_: Options; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private rawMarkdownIt_: any; public constructor(options: Options = null) { @@ -54,10 +57,12 @@ export default class MarkupToHtml implements MarkupToHtmlConverter { throw new Error(`Invalid markup language: ${markupLanguage}`); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied this.renderers_[markupLanguage] = new RendererClass(this.options_ as any); return this.renderers_[markupLanguage]; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public stripMarkup(markupLanguage: MarkupLanguage, markup: string, options: any = null) { if (!markup) return ''; @@ -89,6 +94,7 @@ export default class MarkupToHtml implements MarkupToHtmlConverter { if (r.clearCache) r.clearCache(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async render(markupLanguage: MarkupLanguage, markup: string, theme: any, options: any): Promise { if (this.options_.isSafeMode) { const htmlentities = new AllHtmlEntities(); @@ -101,6 +107,7 @@ export default class MarkupToHtml implements MarkupToHtmlConverter { return this.renderer(markupLanguage).render(markup, theme, options); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async allAssets(markupLanguage: MarkupLanguage, theme: any, noteStyleOptions: NoteStyleOptions = null) { return this.renderer(markupLanguage).allAssets(theme, noteStyleOptions); } diff --git a/packages/renderer/MdToHtml.ts b/packages/renderer/MdToHtml.ts index 52a5cc3f3..3199a8be1 100644 --- a/packages/renderer/MdToHtml.ts +++ b/packages/renderer/MdToHtml.ts @@ -13,8 +13,11 @@ const htmlentities = new Entities().encode; const md5 = require('md5'); interface RendererRule { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied install(context: any, ruleOptions: any): any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied assets?(theme: any): any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied plugin?: any; assetPath?: string; assetPathIsAbsolute?: boolean; @@ -26,7 +29,9 @@ interface RendererRules { } interface RendererPlugin { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied module: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied options?: any; } @@ -80,6 +85,7 @@ const inMemoryCache = new InMemoryCache(20); export interface ExtraRendererRule { id: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied module: any; assetPath: string; pluginId: string; @@ -88,6 +94,7 @@ export interface ExtraRendererRule { export interface Options { resourceBaseUrl?: string; ResourceModel?: OptionsResourceModel; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginOptions?: any; tempDir?: string; fsDriver?: FsDriver; @@ -111,25 +118,32 @@ interface PluginAssets { export interface Link { href: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied resource: any; resourceReady: boolean; resourceFullPath: string; } interface PluginContext { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied css: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied pluginAssets: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied cache: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied userData: any; currentLinks: Link[]; } export interface RuleOptions { context: PluginContext; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied theme: any; postMessageSyntax: string; ResourceModel: OptionsResourceModel; resourceBaseUrl: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied resources: any; // resourceId: Resource // Used by checkboxes to specify how it should be rendered @@ -137,6 +151,7 @@ export interface RuleOptions { checkboxDisabled?: boolean; // Used by the keyword highlighting plugin (mobile only) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied highlightedKeywords?: any[]; // Use by resource-rendering logic to signify that it should be rendered @@ -181,16 +196,21 @@ export default class MdToHtml implements MarkupRenderer { private resourceBaseUrl_: string; private ResourceModel_: OptionsResourceModel; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private contextCache_: any; private fsDriver_: FsDriver; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private cachedOutputs_: any = {}; private lastCodeHighlightCacheKey_: string = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private cachedHighlightedCode_: any = {}; // Markdown-It plugin options (not Joplin plugin options) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private pluginOptions_: any = {}; private extraRendererRules_: RendererRules = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private allProcessedAssets_: any = {}; private customCss_ = ''; @@ -253,6 +273,7 @@ export default class MdToHtml implements MarkupRenderer { } // `module` is a file that has already been `required()` + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public loadExtraRendererRule(id: string, assetPath: string, module: any, pluginId: string) { if (this.extraRendererRules_[id]) throw new Error(`A renderer rule with this ID has already been loaded: ${id}`); @@ -326,11 +347,13 @@ export default class MdToHtml implements MarkupRenderer { // This return all the assets for all the plugins. Since it is called // on each render, the result is cached. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private allProcessedAssets(rules: RendererRules, theme: any, codeTheme: string) { const cacheKey: string = theme.cacheKey + codeTheme; if (this.allProcessedAssets_[cacheKey]) return this.allProcessedAssets_[cacheKey]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const assets: any = {}; for (const key in rules) { if (!this.pluginEnabled(key)) continue; @@ -353,7 +376,9 @@ export default class MdToHtml implements MarkupRenderer { } // This is similar to allProcessedAssets() but used only by the Rich Text editor + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async allAssets(theme: any, noteStyleOptions: NoteStyleOptions = null) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const assets: any = {}; for (const key in rules) { if (!this.pluginEnabled(key)) continue; @@ -371,6 +396,7 @@ export default class MdToHtml implements MarkupRenderer { return output.pluginAssets; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async outputAssetsToExternalAssets_(output: any) { for (const cssString of output.cssStrings) { const filePath = await this.fsDriver().cacheCssToFile(cssString); @@ -416,6 +442,7 @@ export default class MdToHtml implements MarkupRenderer { } // "theme" is the theme as returned by themeStyle() + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async render(body: string, theme: any = null, options: RenderOptions = null): Promise { options = { @@ -474,6 +501,7 @@ export default class MdToHtml implements MarkupRenderer { typographer: this.pluginEnabled('typographer'), linkify: this.pluginEnabled('linkify'), html: true, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied highlight: (str: string, lang: string, _attrs: any): any => { let outputCodeHtml = ''; @@ -549,6 +577,7 @@ export default class MdToHtml implements MarkupRenderer { const allRules = { ...rules, ...this.extraRendererRules_ }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const loadPlugin = (plugin: any, options: any) => { // Handle the case where we're bundling with webpack -- // some modules that are commonjs imports in nodejs diff --git a/packages/renderer/MdToHtml/linkReplacement.ts b/packages/renderer/MdToHtml/linkReplacement.ts index a8623a2f0..1b53e8418 100644 --- a/packages/renderer/MdToHtml/linkReplacement.ts +++ b/packages/renderer/MdToHtml/linkReplacement.ts @@ -8,6 +8,7 @@ const { getClassNameForMimeType } = require('font-awesome-filetypes'); export interface Options { title?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied resources?: any; ResourceModel?: OptionsResourceModel; linkRenderingType?: number; @@ -19,6 +20,7 @@ export interface Options { export interface LinkReplacementResult { html: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied resource: any; resourceReady: boolean; resourceFullPath: string; diff --git a/packages/renderer/MdToHtml/renderMedia.ts b/packages/renderer/MdToHtml/renderMedia.ts index a15caf6d1..1222819d3 100644 --- a/packages/renderer/MdToHtml/renderMedia.ts +++ b/packages/renderer/MdToHtml/renderMedia.ts @@ -11,6 +11,7 @@ export interface Options { useCustomPdfViewer: boolean; noteId: string; vendorDir: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied theme: any; } diff --git a/packages/renderer/MdToHtml/rules/checkbox.ts b/packages/renderer/MdToHtml/rules/checkbox.ts index b6c8d4466..f2165ccd8 100644 --- a/packages/renderer/MdToHtml/rules/checkbox.ts +++ b/packages/renderer/MdToHtml/rules/checkbox.ts @@ -2,6 +2,7 @@ import { RuleOptions } from '../../MdToHtml'; let checkboxIndex_ = -1; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function pluginAssets(theme: any) { return [ { @@ -53,6 +54,7 @@ function pluginAssets(theme: any) { ]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function createPrefixTokens(Token: any, id: string, checked: boolean, label: string, postMessageSyntax: string, sourceToken: any, disabled: boolean): any[] { let token = null; const tokens = []; @@ -106,6 +108,7 @@ function createPrefixTokens(Token: any, id: string, checked: boolean, label: str return tokens; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function createSuffixTokens(Token: any): any[] { return [ new Token('label_close', 'label', -1), @@ -113,9 +116,11 @@ function createSuffixTokens(Token: any): any[] { ]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function checkboxPlugin(markdownIt: any, options: RuleOptions) { const renderingType = options.checkboxRenderingType || 1; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.core.ruler.push('checkbox', (state: any) => { const tokens = state.tokens; const Token = state.Token; diff --git a/packages/renderer/MdToHtml/rules/code_inline.ts b/packages/renderer/MdToHtml/rules/code_inline.ts index 306001010..8acf5b98e 100644 --- a/packages/renderer/MdToHtml/rules/code_inline.ts +++ b/packages/renderer/MdToHtml/rules/code_inline.ts @@ -1,10 +1,13 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function plugin(markdownIt: any) { const defaultRender = markdownIt.renderer.rules.code_inline || + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function(tokens: any, idx: any, options: any, _env: any, self: any) { return self.renderToken(tokens, idx, options); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.renderer.rules.code_inline = (tokens: any[], idx: number, options: any, env: any, self: any) => { const token = tokens[idx]; let tokenClass = token.attrGet('class'); diff --git a/packages/renderer/MdToHtml/rules/fence.ts b/packages/renderer/MdToHtml/rules/fence.ts index 0105d3027..8f66cfa42 100644 --- a/packages/renderer/MdToHtml/rules/fence.ts +++ b/packages/renderer/MdToHtml/rules/fence.ts @@ -8,7 +8,9 @@ // So we modify the code below to allow highlight() to return an object that tells how to render // the code. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function plugin(markdownIt: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.renderer.rules.fence = function(tokens: any[], idx: number, options: any, _env: any, slf: any) { let token = tokens[idx], info = token.info ? markdownIt.utils.unescapeAll(token.info).trim() : '', diff --git a/packages/renderer/MdToHtml/rules/fountain.ts b/packages/renderer/MdToHtml/rules/fountain.ts index 123908db0..01c0b0718 100644 --- a/packages/renderer/MdToHtml/rules/fountain.ts +++ b/packages/renderer/MdToHtml/rules/fountain.ts @@ -103,6 +103,7 @@ const pluginAssets = function() { ]; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function renderFountainScript(markdownIt: any, content: string) { const result = fountain.parse(content); @@ -119,11 +120,14 @@ function renderFountainScript(markdownIt: any, content: string) { `; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function plugin(markdownIt: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const defaultRender = markdownIt.renderer.rules.fence || function(tokens: any[], idx: number, options: any, _env: any, self: any) { return self.renderToken(tokens, idx, options); }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.renderer.rules.fence = function(tokens: any[], idx: number, options: any, env: any, self: any) { const token = tokens[idx]; if (token.info !== 'fountain') return defaultRender(tokens, idx, options, env, self); diff --git a/packages/renderer/MdToHtml/rules/highlight_keywords.ts b/packages/renderer/MdToHtml/rules/highlight_keywords.ts index 1bcd28ff8..9f569f88d 100644 --- a/packages/renderer/MdToHtml/rules/highlight_keywords.ts +++ b/packages/renderer/MdToHtml/rules/highlight_keywords.ts @@ -5,6 +5,7 @@ import { RuleOptions } from '../../MdToHtml'; const stringUtils = require('../../stringUtils.js'); const md5 = require('md5'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function createHighlightedTokens(Token: any, splitted: string[]) { let token; const output = []; @@ -35,9 +36,11 @@ function createHighlightedTokens(Token: any, splitted: string[]) { } // function installRule(markdownIt, mdOptions, ruleOptions) { +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function plugin(markdownIt: any, ruleOptions: RuleOptions) { const divider = md5(Date.now().toString() + Math.random().toString()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.core.ruler.push('highlight_keywords', (state: any) => { const keywords = ruleOptions.highlightedKeywords; if (!keywords || !keywords.length) return; diff --git a/packages/renderer/MdToHtml/rules/html_image.ts b/packages/renderer/MdToHtml/rules/html_image.ts index 210bd8d95..5a6302ad1 100644 --- a/packages/renderer/MdToHtml/rules/html_image.ts +++ b/packages/renderer/MdToHtml/rules/html_image.ts @@ -9,17 +9,20 @@ function renderImageHtml(before: string, src: string, after: string, ruleOptions return `[Image: ${src}]`; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function plugin(markdownIt: any, ruleOptions: RuleOptions) { const Resource = ruleOptions.ResourceModel; const htmlBlockDefaultRender = markdownIt.renderer.rules.html_block || + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function(tokens: any[], idx: number, options: any, _env: any, self: any) { return self.renderToken(tokens, idx, options); }; const htmlInlineDefaultRender = markdownIt.renderer.rules.html_inline || + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function(tokens: any[], idx: number, options: any, _env: any, self: any) { return self.renderToken(tokens, idx, options); }; @@ -28,12 +31,14 @@ function plugin(markdownIt: any, ruleOptions: RuleOptions) { // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied const handleImageTags = function(defaultRender: Function) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return function(tokens: any[], idx: number, options: any, env: any, self: any) { const token = tokens[idx]; const content = token.content; if (!content.match(imageRegex)) return defaultRender(tokens, idx, options, env, self); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return content.replace(imageRegex, (_v: any, before: string, src: string, after: string) => { if (!Resource.isResourceUrl(src)) return ``; return renderImageHtml(before, src, after, ruleOptions); diff --git a/packages/renderer/MdToHtml/rules/image.ts b/packages/renderer/MdToHtml/rules/image.ts index 27c82669d..d584b806c 100644 --- a/packages/renderer/MdToHtml/rules/image.ts +++ b/packages/renderer/MdToHtml/rules/image.ts @@ -3,9 +3,11 @@ import { attributesHtml } from '../../htmlUtils'; import * as utils from '../../utils'; import createEventHandlingAttrs from '../createEventHandlingAttrs'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function plugin(markdownIt: any, ruleOptions: RuleOptions) { const defaultRender = markdownIt.renderer.rules.image; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.renderer.rules.image = (tokens: any[], idx: number, options: any, env: any, self: any) => { const Resource = ruleOptions.ResourceModel; diff --git a/packages/renderer/MdToHtml/rules/katex.ts b/packages/renderer/MdToHtml/rules/katex.ts index 648952dfa..13725c811 100644 --- a/packages/renderer/MdToHtml/rules/katex.ts +++ b/packages/renderer/MdToHtml/rules/katex.ts @@ -8,6 +8,7 @@ const mhchemModule = require('./katex_mhchem.js'); // to serialize them with json-stringify-safe const stringifySafe = require('json-stringify-safe'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function stringifyKatexOptions(options: any) { if (!options) return ''; @@ -50,12 +51,14 @@ function stringifyKatexOptions(options: any) { // is created by \begin{align}...\end{align} environments, and doesn't have a "tokens" property. if (options.macros) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const toSerialize: any = {}; for (const k of Object.keys(options.macros)) { const macro = options.macros[k]; if (typeof macro === 'string') { toSerialize[k] = `${macro}_string`; } else { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const macroText: string[] = macro.tokens.map((t: any) => t.text); toSerialize[k] = `${macroText.join('')}_${macro.numArgs}`; } @@ -100,6 +103,7 @@ function katexStyle() { // Test if potential opening or closing delimiter // Assumes that there is a "$" at state.src[pos] +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function isValidDelim(state: any, pos: number) { const max = state.posMax; @@ -124,6 +128,7 @@ function isValidDelim(state: any, pos: number) { }; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function math_inline(state: any, silent: boolean) { let match, token, res, pos; @@ -199,6 +204,7 @@ function math_inline(state: any, silent: boolean) { return true; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function math_block(state: any, start: number, end: number, silent: boolean) { let firstLine, lastLine, @@ -279,8 +285,10 @@ function math_block(state: any, start: number, end: number, silent: boolean) { return true; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const cache_: any = {}; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function renderToStringWithCache(latex: string, katexOptions: any) { const cacheKey = md5(escape(latex) + escape(stringifyKatexOptions(katexOptions))); if (cacheKey in cache_) { @@ -297,18 +305,21 @@ function renderToStringWithCache(latex: string, katexOptions: any) { } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function renderKatexError(latex: string, error: any): string { console.error('Katex error for:', latex, error); return `
${error.message}
`; } export default { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied plugin: function(markdownIt: any, options: RuleOptions) { // Keep macros that persist across Katex blocks to allow defining a macro // in one block and re-using it later in other blocks. // https://github.com/laurent22/joplin/issues/1105 if (!options.context.userData.__katex) options.context.userData.__katex = { macros: {} }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const katexOptions: any = {}; katexOptions.macros = options.context.userData.__katex.macros; katexOptions.trust = true; @@ -325,6 +336,7 @@ export default { return `${markdownIt.utils.escapeHtml(latex)}${outputHtml}`; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const inlineRenderer = function(tokens: any[], idx: number) { return katexInline(tokens[idx].content); }; @@ -341,6 +353,7 @@ export default { return `
${markdownIt.utils.escapeHtml(latex)}
${outputHtml}
`; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const blockRenderer = function(tokens: any[], idx: number) { return `${katexBlock(tokens[idx].content)}\n`; }; diff --git a/packages/renderer/MdToHtml/rules/link_close.ts b/packages/renderer/MdToHtml/rules/link_close.ts index ab214ad55..0ca17e4cd 100644 --- a/packages/renderer/MdToHtml/rules/link_close.ts +++ b/packages/renderer/MdToHtml/rules/link_close.ts @@ -9,13 +9,16 @@ export interface LinkIndexes { [key: string]: number; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function plugin(markdownIt: any, ruleOptions: RuleOptions) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const defaultRender = markdownIt.renderer.rules.link_close || function(tokens: any, idx: any, options: any, _env: any, self: any) { return self.renderToken(tokens, idx, options); }; const linkIndexes: LinkIndexes = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.renderer.rules.link_close = function(tokens: any[], idx: number, options: any, env: any, self: any) { const defaultOutput = defaultRender(tokens, idx, options, env, self); const link = ruleOptions.context.currentLinks.pop(); diff --git a/packages/renderer/MdToHtml/rules/link_open.ts b/packages/renderer/MdToHtml/rules/link_open.ts index b13c24328..4d4a9ee17 100644 --- a/packages/renderer/MdToHtml/rules/link_open.ts +++ b/packages/renderer/MdToHtml/rules/link_open.ts @@ -4,7 +4,9 @@ import * as utils from '../../utils'; const urlUtils = require('../../urlUtils.js'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function plugin(markdownIt: any, ruleOptions: RuleOptions) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.renderer.rules.link_open = function(tokens: any[], idx: number) { const token = tokens[idx]; const href = utils.getAttr(token.attrs, 'href'); diff --git a/packages/renderer/MdToHtml/rules/mermaid.ts b/packages/renderer/MdToHtml/rules/mermaid.ts index 4a42def0e..047c2d90c 100644 --- a/packages/renderer/MdToHtml/rules/mermaid.ts +++ b/packages/renderer/MdToHtml/rules/mermaid.ts @@ -2,6 +2,7 @@ import { RuleOptions } from '../../MdToHtml'; export default { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied assets: function(theme: any) { return [ { name: 'mermaid.min.js' }, @@ -38,14 +39,16 @@ export default { ]; }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied plugin: function(markdownIt: any, ruleOptions: RuleOptions) { - // eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied + // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, 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) : ''; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied 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); diff --git a/packages/renderer/MdToHtml/rules/sanitize_html.ts b/packages/renderer/MdToHtml/rules/sanitize_html.ts index fd3d01044..d1c74cf37 100644 --- a/packages/renderer/MdToHtml/rules/sanitize_html.ts +++ b/packages/renderer/MdToHtml/rules/sanitize_html.ts @@ -4,10 +4,13 @@ import htmlUtils from '../../htmlUtils'; const md5 = require('md5'); export default { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied plugin: function(markdownIt: any, ruleOptions: RuleOptions) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.core.ruler.push('sanitize_html', (state: any) => { const tokens = state.tokens; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const walkHtmlTokens = (tokens: any[]) => { if (!tokens || !tokens.length) return; diff --git a/packages/renderer/MdToHtml/rules/source_map.ts b/packages/renderer/MdToHtml/rules/source_map.ts index f82f0e029..fd3532040 100644 --- a/packages/renderer/MdToHtml/rules/source_map.ts +++ b/packages/renderer/MdToHtml/rules/source_map.ts @@ -1,4 +1,5 @@ export default { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied plugin: (markdownIt: any, params: any) => { if (!params.mapsToLine) return; @@ -19,6 +20,7 @@ export default { for (const [key, allowedLevel] of Object.entries(allowedLevels)) { const precedentRule = markdownIt.renderer.rules[key]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.renderer.rules[key] = (tokens: any[], idx: number, options: any, env: any, self: any) => { if (!!tokens[idx].map && tokens[idx].level <= allowedLevel) { const line = tokens[idx].map[0]; diff --git a/packages/renderer/MdToHtml/rules/tableHorizontallyScrollable.ts b/packages/renderer/MdToHtml/rules/tableHorizontallyScrollable.ts index 76ad02c1f..4ef328614 100644 --- a/packages/renderer/MdToHtml/rules/tableHorizontallyScrollable.ts +++ b/packages/renderer/MdToHtml/rules/tableHorizontallyScrollable.ts @@ -4,11 +4,13 @@ export default { // Make table horizontally scrollable by give table a div parent, so the width of the table is limited to the screen width. // see https://github.com/laurent22/joplin/pull/10161 plugin: (markdownIt: MarkdownIt) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.renderer.rules.table_open = function(tokens: MarkdownIt.Token[], idx: number, options: MarkdownIt.Options, _env: any, renderer: any) { const current = renderer.renderToken(tokens, idx, options); // joplin-table-wrapper css is set in packages/renderer/noteStyle.ts return `
\n${current}`; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.renderer.rules.table_close = function(tokens: MarkdownIt.Token[], idx: number, options: MarkdownIt.Options, _env: any, renderer: any) { const current = renderer.renderToken(tokens, idx, options); return `${current}
\n`; diff --git a/packages/renderer/MdToHtml/setupLinkify.ts b/packages/renderer/MdToHtml/setupLinkify.ts index c03f1db0c..e6901365b 100644 --- a/packages/renderer/MdToHtml/setupLinkify.ts +++ b/packages/renderer/MdToHtml/setupLinkify.ts @@ -1,7 +1,9 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function(markdownIt: any) { // Add `file:` protocol in linkify to allow text in the format of "file://..." to translate into // file-URL links in html view markdownIt.linkify.add('file:', { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied validate: function(text: string, pos: number, self: any) { const tail = text.slice(pos); if (!self.re.file) { diff --git a/packages/renderer/headerAnchor.ts b/packages/renderer/headerAnchor.ts index 0a0282f34..f023149c7 100644 --- a/packages/renderer/headerAnchor.ts +++ b/packages/renderer/headerAnchor.ts @@ -1,4 +1,6 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function(markdownIt: any) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.core.ruler.push('anchorHeader', (state: any): boolean => { const tokens = state.tokens; const Token = state.Token; diff --git a/packages/renderer/noteStyle.ts b/packages/renderer/noteStyle.ts index 27c6b1d8c..a702ac50e 100644 --- a/packages/renderer/noteStyle.ts +++ b/packages/renderer/noteStyle.ts @@ -1,5 +1,6 @@ // TODO: copied from string-utils +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function formatCssSize(v: any): string { if (typeof v === 'string') { if (v.includes('px') || v.includes('em') || v.includes('%')) return v; @@ -48,6 +49,7 @@ export const whiteBackgroundNoteStyle = () => { `; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default function(theme: any, options: Options = null) { options = { contentMaxWidth: 0, diff --git a/packages/renderer/types.ts b/packages/renderer/types.ts index 34b9f4b05..9282b5121 100644 --- a/packages/renderer/types.ts +++ b/packages/renderer/types.ts @@ -1,6 +1,7 @@ import { MarkupLanguage } from './MarkupToHtml'; import { Options as NoteStyleOptions } from './noteStyle'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type ItemIdToUrlHandler = (resource: any)=> string; interface ResourceEntity { @@ -13,6 +14,7 @@ interface ResourceEntity { export interface FsDriver { writeFile: (path: string, content: string, encoding: string)=> Promise; exists: (path: string)=> Promise; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied cacheCssToFile: (cssStrings: string[])=> Promise; } @@ -26,8 +28,10 @@ export interface RenderOptions { externalAssetsOnly?: boolean; highlightedKeywords?: string[]; codeTheme?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied theme?: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied plugins?: Record; audioPlayerEnabled?: boolean; videoPlayerEnabled?: boolean; @@ -42,6 +46,7 @@ export interface RenderOptions { vendorDir?: string; itemIdToUrl?: ItemIdToUrlHandler; allowedFilePrefixes?: string[]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied settingValue?: (pluginId: string, key: string)=> any; resources?: Record; @@ -70,8 +75,10 @@ export interface RenderResult { } export interface MarkupRenderer { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied render(markup: string, theme: any, options: RenderOptions): Promise; clearCache(): void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied allAssets(theme: any, noteStyleOptions: NoteStyleOptions|null): Promise; } @@ -80,9 +87,11 @@ interface StripMarkupOptions { } export interface MarkupToHtmlConverter { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied render(markupLanguage: MarkupLanguage, markup: string, theme: any, options: any): Promise; clearCache(markupLanguage: MarkupLanguage): void; stripMarkup(markupLanguage: MarkupLanguage, markup: string, options: StripMarkupOptions): string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied allAssets(markupLanguage: MarkupLanguage, theme: any, noteStyleOptions: NoteStyleOptions|null): Promise; } diff --git a/packages/renderer/utils.ts b/packages/renderer/utils.ts index 378dc8bc0..9ad01a162 100644 --- a/packages/renderer/utils.ts +++ b/packages/renderer/utils.ts @@ -97,6 +97,7 @@ export const resourceStatusName = function(index: number) { throw new Error(`Unknown index: ${index}`); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const resourceStatus = function(ResourceModel: OptionsResourceModel, resourceInfo: any) { if (!ResourceModel) return 'ready'; @@ -122,6 +123,7 @@ export const resourceStatus = function(ResourceModel: OptionsResourceModel, reso return status; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const imageReplacement = function(ResourceModel: OptionsResourceModel, src: string, resources: any, resourceBaseUrl: string, itemIdToUrl: ItemIdToUrlHandler = null) { if (!ResourceModel || !resources) return null; diff --git a/packages/server/src/app.ts b/packages/server/src/app.ts index 85a8449c3..77499bdd9 100644 --- a/packages/server/src/app.ts +++ b/packages/server/src/app.ts @@ -40,6 +40,7 @@ const cors = require('@koa/cors'); const { shimInit } = require('@joplin/lib/shim-init-node.js'); shimInit({ nodeSqlite }); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const defaultEnvVariables: Record = { dev: { // To test with the Postgres database, uncomment DB_CLIENT below and @@ -66,9 +67,11 @@ function appLogger(): LoggerWrapper { return appLogger_; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function markPasswords(o: Record): Record { if (!o) return o; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: Record = {}; for (const k of Object.keys(o)) { @@ -82,6 +85,7 @@ function markPasswords(o: Record): Record { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function getEnvFilePath(env: Env, argv: any): Promise { if (argv.envFile) return argv.envFile; @@ -95,6 +99,7 @@ async function getEnvFilePath(env: Env, argv: any): Promise { async function main() { const { selectedCommand, argv: yargsArgv } = await setupCommands(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const argv: Argv = yargsArgv as any; const env: Env = argv.env as Env || Env.Prod; @@ -253,6 +258,7 @@ async function main() { if (selectedCommand) { const commandArgv = { ...argv, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied _: (argv as any)._.slice(), }; commandArgv._.splice(0, 1); @@ -345,6 +351,7 @@ async function main() { if (runCommandAndExitApp) process.exit(0); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied main().catch((error: any) => { console.error(error); process.exit(1); diff --git a/packages/server/src/commands/BaseCommand.ts b/packages/server/src/commands/BaseCommand.ts index dc4c03a16..980d444d5 100644 --- a/packages/server/src/commands/BaseCommand.ts +++ b/packages/server/src/commands/BaseCommand.ts @@ -31,6 +31,7 @@ export default abstract class BaseCommand { return {}; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public abstract run(argv: any, context: RunContext): Promise; } diff --git a/packages/server/src/config.ts b/packages/server/src/config.ts index 2a83e1edc..714e44eb6 100644 --- a/packages/server/src/config.ts +++ b/packages/server/src/config.ts @@ -143,6 +143,7 @@ function ldapConfigFromEnv(env: EnvVariables): LdapConfig[] { let config_: Config = null; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function initConfig(envType: Env, env: EnvVariables, overrides: any = null) { runningInDocker_ = !!env.RUNNING_IN_DOCKER; diff --git a/packages/server/src/db.test.ts b/packages/server/src/db.test.ts index 2dfdf1dba..7d01e2098 100644 --- a/packages/server/src/db.test.ts +++ b/packages/server/src/db.test.ts @@ -2,7 +2,9 @@ import { afterAllTests, beforeAllDb, beforeEachDb, db } from './utils/testing/te import sqlts from '@rmp135/sql-ts'; import { DbConnection, migrateDown, migrateLatest, migrateUp, needsMigration, nextMigration } from './db'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function dbSchemaSnapshot(db: DbConnection): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return sqlts.toTypeScript({}, db as any); } diff --git a/packages/server/src/db.ts b/packages/server/src/db.ts index 50ba12a0c..828e3ecdc 100644 --- a/packages/server/src/db.ts +++ b/packages/server/src/db.ts @@ -12,6 +12,7 @@ import { compareVersions } from 'compare-versions'; // // In our case, all bigInteger are timestamps, which JavaScript can handle // fine as numbers. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied require('pg').types.setTypeParser(20, (val: any) => { return parseInt(val, 10); }); @@ -63,7 +64,9 @@ export interface KnexDatabaseConfig { export interface ConnectionCheckResult { isCreated: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied error: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied latestMigration: any; connection: DbConnection; } @@ -144,6 +147,7 @@ export const setCollateC = async (db: DbConnection, tableName: string, columnNam await db.raw(`ALTER TABLE ${tableName} ALTER COLUMN ${columnName} SET DATA TYPE character varying(32) COLLATE "C"`); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function makeSlowQueryHandler(duration: number, connection: any, sql: string, bindings: any[]) { return setTimeout(() => { try { @@ -156,10 +160,12 @@ function makeSlowQueryHandler(duration: number, connection: any, sql: string, bi export function setupSlowQueryLog(connection: DbConnection, slowQueryLogMinDuration: number) { interface QueryInfo { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied timeoutId: any; startTime: number; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const queryInfos: Record = {}; // These queries do not return a response, so "query-response" is not @@ -196,7 +202,9 @@ export function setupSlowQueryLog(connection: DbConnection, slowQueryLogMinDurat }); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const filterBindings = (bindings: any[]): Record => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: Record = {}; for (let i = 0; i < bindings.length; i++) { @@ -214,6 +222,7 @@ interface KnexQueryErrorResponse { } interface KnexQueryErrorData { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied bindings: any[]; queryContext: QueryContext; } @@ -279,6 +288,7 @@ export async function migrateUnlock(db: DbConnection) { } export async function migrateList(db: DbConnection, asString = true) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const migrations: any = await db.migrate.list({ directory: migrationDir, }); @@ -301,12 +311,14 @@ export async function migrateList(db: DbConnection, asString = true) { // ] // ] + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const getMigrationName = (migrationInfo: any) => { if (migrationInfo && migrationInfo.name) return migrationInfo.name; if (migrationInfo && migrationInfo.file) return migrationInfo.file; return migrationInfo; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const formatName = (migrationInfo: any) => { const s = getMigrationName(migrationInfo).split('.'); s.pop(); @@ -388,6 +400,7 @@ export async function truncateTables(db: DbConnection, includedTables: string[] } } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function isNoSuchTableError(error: any): boolean { if (error) { // Postgres error: 42P01: undefined_table @@ -400,6 +413,7 @@ function isNoSuchTableError(error: any): boolean { return false; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function isUniqueConstraintError(error: any): boolean { if (error) { // Postgres error: 23505: unique_violation diff --git a/packages/server/src/env.ts b/packages/server/src/env.ts index e37861890..dd50ea192 100644 --- a/packages/server/src/env.ts +++ b/packages/server/src/env.ts @@ -214,6 +214,7 @@ const parseBoolean = (s: string): boolean => { throw new Error(`Invalid boolean value: "${s}" (Must be one of "true", "false", "0, "1")`); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function parseEnv(rawEnv: Record, defaultOverrides: any = null): EnvVariables { const output: EnvVariables = { ...defaultEnvValues, @@ -229,10 +230,13 @@ export function parseEnv(rawEnv: Record, defaultOverrides: any = if (typeof value === 'number') { const v = Number(rawEnvValue); if (isNaN(v)) throw new Error(`Invalid number value "${rawEnvValue}"`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (output as any)[key] = v; } else if (typeof value === 'boolean') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (output as any)[key] = parseBoolean(rawEnvValue); } else if (typeof value === 'string') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (output as any)[key] = `${rawEnvValue}`; } else { throw new Error(`Invalid env default value type: ${typeof value}`); diff --git a/packages/server/src/middleware/routeHandler.ts b/packages/server/src/middleware/routeHandler.ts index 0b38e58f5..146d44bb0 100644 --- a/packages/server/src/middleware/routeHandler.ts +++ b/packages/server/src/middleware/routeHandler.ts @@ -76,6 +76,7 @@ export default async function(ctx: AppContext) { ctx.response.body = await ctx.joplin.services.mustache.renderView(view); } else { // JSON ctx.response.set('Content-Type', 'application/json'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const r: any = { error: error.message }; if (ctx.joplin.env === Env.Dev && error.stack) r.stack = error.stack; if (error.code) r.code = error.code; diff --git a/packages/server/src/models/BackupItemModel.ts b/packages/server/src/models/BackupItemModel.ts index 73f52ade9..d0c3bf417 100644 --- a/packages/server/src/models/BackupItemModel.ts +++ b/packages/server/src/models/BackupItemModel.ts @@ -15,6 +15,7 @@ export default class BackupItemModel extends BaseModel { return false; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async add(type: BackupItemType, key: string, content: any, userId = ''): Promise { const item: BackupItem = { user_id: userId, diff --git a/packages/server/src/models/BaseModel.ts b/packages/server/src/models/BaseModel.ts index ae6eb2832..01dde86ef 100644 --- a/packages/server/src/models/BaseModel.ts +++ b/packages/server/src/models/BaseModel.ts @@ -24,7 +24,9 @@ export enum UuidType { export interface SaveOptions { isNew?: boolean; skipValidation?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied validationRules?: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied previousItem?: any; queryContext?: QueryContext; } @@ -38,6 +40,7 @@ export interface AllPaginatedOptions extends LoadOptions { } export interface DeleteOptions { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied validationRules?: any; allowNoOp?: boolean; deletedItemUserIds?: Record; @@ -45,6 +48,7 @@ export interface DeleteOptions { export interface ValidateOptions { isNew?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied rules?: any; } @@ -238,6 +242,7 @@ export default abstract class BaseModel { } public async all(options: LoadOptions = {}): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const rows: any[] = await this.db(this.tableName).select(this.selectFields(options)); return rows as T[]; } @@ -280,6 +285,7 @@ export default abstract class BaseModel { public fromApiInput(object: T): T { const blackList = ['updated_time', 'created_time', 'owner_id']; const whiteList = Object.keys(databaseSchema[this.tableName]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { ...object }; for (const f in object) { @@ -310,6 +316,7 @@ export default abstract class BaseModel { protected async isNew(object: T, options: SaveOptions): Promise { if (options.isNew === false) return false; if (options.isNew === true) return true; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if ('id' in (object as any) && !(object as WithUuid).id) throw new Error('ID cannot be undefined or null'); return !(object as WithUuid).id; } diff --git a/packages/server/src/models/ChangeModel.test.ts b/packages/server/src/models/ChangeModel.test.ts index 9c37241a6..7fb4c667f 100644 --- a/packages/server/src/models/ChangeModel.test.ts +++ b/packages/server/src/models/ChangeModel.test.ts @@ -130,6 +130,7 @@ describe('ChangeModel', () => { const changeCount = 10; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const itemsToCreate: any[] = []; for (let i = 0; i < changeCount / 2; i++) { itemsToCreate.push({ diff --git a/packages/server/src/models/ChangeModel.ts b/packages/server/src/models/ChangeModel.ts index ff23cb016..a56dd1208 100644 --- a/packages/server/src/models/ChangeModel.ts +++ b/packages/server/src/models/ChangeModel.ts @@ -16,6 +16,7 @@ export const defaultChangeTtl = 180 * Day; export interface DeltaChange extends Change { jop_updated_time?: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied jopItem?: any; } @@ -42,6 +43,7 @@ export function defaultDeltaPagination(): ChangePagination { }; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function requestDeltaPagination(query: any): ChangePagination { if (!query) return defaultDeltaPagination(); @@ -160,6 +162,7 @@ export default class ChangeModel extends BaseModel { if (!doCountQuery) subParams2.push(limit); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let query: Knex.Raw = null; const finalParams = subParams1.concat(subParams2); diff --git a/packages/server/src/models/ItemModel.ts b/packages/server/src/models/ItemModel.ts index a0d72ba04..54e67d2c1 100644 --- a/packages/server/src/models/ItemModel.ts +++ b/packages/server/src/models/ItemModel.ts @@ -46,6 +46,7 @@ export interface SaveFromRawContentItem { export interface SaveFromRawContentResultItem { item: Item; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied error: any; } @@ -144,6 +145,7 @@ export default class ItemModel extends BaseModel { const output: Item = {}; const propNames = ['id', 'name', 'updated_time', 'created_time']; for (const k of Object.keys(object)) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (propNames.includes(k)) (output as any)[k] = (object as any)[k]; } return output; @@ -544,6 +546,7 @@ export default class ItemModel extends BaseModel { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public itemToJoplinItem(itemRow: Item): any { if (itemRow.jop_type <= 0) throw new Error(`Not a Joplin item: ${itemRow.id}`); if (!itemRow.content) throw new Error('Item content is missing'); @@ -559,6 +562,7 @@ export default class ItemModel extends BaseModel { return item; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async loadAsJoplinItem(id: Uuid): Promise { const raw = await this.loadWithContent(id); return this.itemToJoplinItem(raw); @@ -579,6 +583,7 @@ export default class ItemModel extends BaseModel { error: Error; resourceIds?: string[]; isNote?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied joplinItem?: any; } @@ -600,6 +605,7 @@ export default class ItemModel extends BaseModel { name: rawItem.name, }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let joplinItem: any = null; let resourceIds: string[] = []; @@ -827,10 +833,12 @@ export default class ItemModel extends BaseModel { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async allForDebug(): Promise { const items = await this.all({ fields: ['*'] }); return items.map(i => { if (!i.content) return i; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied i.content = i.content.toString() as any; return i; }); diff --git a/packages/server/src/models/KeyValueModel.ts b/packages/server/src/models/KeyValueModel.ts index 92472b059..2011f9514 100644 --- a/packages/server/src/models/KeyValueModel.ts +++ b/packages/server/src/models/KeyValueModel.ts @@ -57,7 +57,9 @@ export default class KeyValueModel extends BaseModel { public async value(key: string, defaultValue: Value = null): Promise { const row: KeyValue = await this.db(this.tableName).where('key', '=', key).first(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!row) return defaultValue as any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return this.unserializeValue(row.type, row.value) as any; } @@ -66,6 +68,7 @@ export default class KeyValueModel extends BaseModel { // While inside a transaction SQlite should lock the whole database // file, which should allow atomic read then write. await this.withTransaction(async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const value: any = await this.value(key); const newValue = await handler(value); await this.setValue(key, newValue); @@ -104,6 +107,7 @@ export default class KeyValueModel extends BaseModel { await this.db(this.tableName).where('key', '=', key).delete(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async delete(_id: string | string[] | number | number[], _options: any = {}): Promise { throw new Error('Call ::deleteValue()'); } diff --git a/packages/server/src/models/LockModel.test.ts b/packages/server/src/models/LockModel.test.ts index c399f7790..f8365bc55 100644 --- a/packages/server/src/models/LockModel.test.ts +++ b/packages/server/src/models/LockModel.test.ts @@ -62,7 +62,9 @@ describe('LockModel', () => { test('should validate locks', async () => { const { user: user1 } = await createUserAndSession(1); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await expectHttpError(async () => models().lock().acquireLock(user1.id, 'wrongtype' as any, LockClientType.Desktop, '1111'), ErrorUnprocessableEntity.httpCode); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied await expectHttpError(async () => models().lock().acquireLock(user1.id, LockType.Exclusive, 'wrongclienttype' as any, '1111'), ErrorUnprocessableEntity.httpCode); await expectHttpError(async () => models().lock().acquireLock(user1.id, LockType.Exclusive, LockClientType.Desktop, 'veryverylongclientidveryverylongclientidveryverylongclientidveryverylongclientid'), ErrorUnprocessableEntity.httpCode); }); diff --git a/packages/server/src/models/ShareModel.ts b/packages/server/src/models/ShareModel.ts index cdc590480..5615a0d11 100644 --- a/packages/server/src/models/ShareModel.ts +++ b/packages/server/src/models/ShareModel.ts @@ -101,6 +101,7 @@ export default class ShareModel extends BaseModel { return !!r; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public shareUrl(shareOwnerId: Uuid, id: Uuid, query: any = null): string { return setQueryParameters(`${this.personalizedUserContentBaseUrl(shareOwnerId)}/shares/${id}`, query); } @@ -464,6 +465,7 @@ export default class ShareModel extends BaseModel { this.db('items') .select('id') .where('jop_share_id', '=', shareId), + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ).groupBy('user_id') as any; } diff --git a/packages/server/src/models/UserDeletionModel.ts b/packages/server/src/models/UserDeletionModel.ts index 748bbfb76..0828f7a4b 100644 --- a/packages/server/src/models/UserDeletionModel.ts +++ b/packages/server/src/models/UserDeletionModel.ts @@ -87,6 +87,7 @@ export default class UserDeletionModel extends BaseModel { if (item.start_time !== now) throw new Error('Job was already started'); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async end(deletionId: number, success: boolean, error: any) { const now = Date.now(); diff --git a/packages/server/src/models/UserItemModel.ts b/packages/server/src/models/UserItemModel.ts index f5789fad6..4d417b9f3 100644 --- a/packages/server/src/models/UserItemModel.ts +++ b/packages/server/src/models/UserItemModel.ts @@ -174,6 +174,7 @@ export default class UserItemModel extends BaseModel { } else if (options.byUserItem) { userItems = [options.byUserItem]; } else if (options.byUserItemIds) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied userItems = await this.loadByIds(options.byUserItemIds as any); } else { throw new Error('Invalid options'); diff --git a/packages/server/src/models/UserModel.test.ts b/packages/server/src/models/UserModel.test.ts index 62458a76c..7b1f93df2 100644 --- a/packages/server/src/models/UserModel.test.ts +++ b/packages/server/src/models/UserModel.test.ts @@ -308,6 +308,7 @@ describe('UserModel', () => { const { user: user3 } = await createUserAndSession(3); const { user: user4 } = await createUserAndSession(4); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const syncInfo1: any = { 'version': 3, 'e2ee': { @@ -326,9 +327,11 @@ describe('UserModel', () => { }, }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const syncInfo2: any = JSON.parse(JSON.stringify(syncInfo1)); syncInfo2.ppk.value.publicKey = 'PUBLIC_KEY_2'; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const syncInfo3: any = JSON.parse(JSON.stringify(syncInfo1)); delete syncInfo3.ppk; diff --git a/packages/server/src/models/UserModel.ts b/packages/server/src/models/UserModel.ts index 27b44901d..5798de397 100644 --- a/packages/server/src/models/UserModel.ts +++ b/packages/server/src/models/UserModel.ts @@ -202,6 +202,7 @@ export default class UserModel extends BaseModel { ]; for (const key of Object.keys(resource)) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!user.is_admin && !canBeChangedByNonAdmin.includes(key) && (resource as any)[key] !== (previousResource as any)[key]) { throw new ErrorForbidden(`non-admin user cannot change "${key}"`); } @@ -218,6 +219,7 @@ export default class UserModel extends BaseModel { } } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async checkMaxItemSizeLimit(user: User, buffer: Buffer, item: Item, joplinItem: any) { // If the item is encrypted, we apply a multiplier because encrypted // items can be much larger (seems to be up to twice the size but for @@ -633,6 +635,7 @@ export default class UserModel extends BaseModel { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async syncInfo(userId: Uuid): Promise { const item = await this.models().item().loadByName(userId, 'info.json'); diff --git a/packages/server/src/models/items/storage/StorageDriverS3.test.ts b/packages/server/src/models/items/storage/StorageDriverS3.test.ts index 5bb8ef50e..40e800dfc 100644 --- a/packages/server/src/models/items/storage/StorageDriverS3.test.ts +++ b/packages/server/src/models/items/storage/StorageDriverS3.test.ts @@ -9,6 +9,7 @@ import { shouldDeleteContent, shouldNotCreateItemIfContentNotSaved, shouldNotUpd let s3config_: StorageDriverConfig; const s = readCredentialFileSync('server-s3-test-units.json', ''); if (s) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const parse: any = JSON.parse(s); if ('enabled' in parse && parse.enabled === false) { // disable S3 tests diff --git a/packages/server/src/models/items/storage/StorageDriverS3.ts b/packages/server/src/models/items/storage/StorageDriverS3.ts index 65e2c74ab..5243a022e 100644 --- a/packages/server/src/models/items/storage/StorageDriverS3.ts +++ b/packages/server/src/models/items/storage/StorageDriverS3.ts @@ -3,6 +3,7 @@ import { CustomError, CustomErrorCode } from '../../../utils/errors'; import { StorageDriverConfig, StorageDriverType } from '../../../utils/types'; import StorageDriverBase from './StorageDriverBase'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function stream2buffer(stream: any): Promise { return new Promise((resolve, reject) => { const buffer: Uint8Array[] = []; @@ -18,6 +19,7 @@ function stream2buffer(stream: any): Promise { resolve(Buffer.concat(buffer)); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied stream.on('error', (error: any) => { if (hasError) return; hasError = true; diff --git a/packages/server/src/models/items/storage/testUtils.ts b/packages/server/src/models/items/storage/testUtils.ts index a5ea13ca7..1108f3b91 100644 --- a/packages/server/src/models/items/storage/testUtils.ts +++ b/packages/server/src/models/items/storage/testUtils.ts @@ -283,6 +283,7 @@ export function shouldThrowNotFoundIfNotExist(driverConfig: StorageDriverConfig) test('should throw not found if item does not exist', async () => { const driver = await loadStorageDriver(driverConfig, db()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let error: any = null; try { await driver.read('doesntexist', { models: models() }); diff --git a/packages/server/src/models/utils/pagination.test.ts b/packages/server/src/models/utils/pagination.test.ts index aae0c5a3b..0510be346 100644 --- a/packages/server/src/models/utils/pagination.test.ts +++ b/packages/server/src/models/utils/pagination.test.ts @@ -6,6 +6,7 @@ describe('pagination', () => { test('should create options from request query parameters', async () => { const d = defaultPagination(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const testCases: any = [ [ null, @@ -57,6 +58,7 @@ describe('pagination', () => { ]; for (const t of testCases) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const input: any = t[0]; const expected: Pagination = t[1]; const actual: Pagination = requestPagination(input); diff --git a/packages/server/src/models/utils/pagination.ts b/packages/server/src/models/utils/pagination.ts index bf56775ee..2d3f4e04a 100644 --- a/packages/server/src/models/utils/pagination.ts +++ b/packages/server/src/models/utils/pagination.ts @@ -55,6 +55,7 @@ function dbOffset(pagination: Pagination): number { return pagination.limit * (pagination.page - 1); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function requestPaginationOrder(query: any, defaultOrderField: string = null, defaultOrderDir: PaginationOrderDir = null): PaginationOrder[] { if (defaultOrderField === null) defaultOrderField = defaultOrderField_; if (defaultOrderDir === null) defaultOrderDir = defaultOrderDir_; @@ -92,6 +93,7 @@ function processCursor(pagination: Pagination): Pagination { return pagination as Pagination; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function requestPagination(query: any): Pagination { if (!query) return defaultPagination(); @@ -141,6 +143,7 @@ export interface PageLink { url?: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function filterPaginationQueryParams(query: any): PaginationQueryParams { if (!query) return {}; @@ -214,6 +217,7 @@ export function createPaginationLinks(page: number, pageCount: number, urlTempla // } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function paginateDbQuery(query: Knex.QueryBuilder, pagination: Pagination, mainTable = ''): Promise> { pagination = { ...defaultPagination(), @@ -222,6 +226,7 @@ export async function paginateDbQuery(query: Knex.QueryBuilder, pagination: Pagi pagination = processCursor(pagination); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const orderSql: any[] = pagination.order.map(o => { return { column: (mainTable ? `${mainTable}.` : '') + o.by, diff --git a/packages/server/src/routes/admin/users.test.ts b/packages/server/src/routes/admin/users.test.ts index e65cab67e..2ff581e59 100644 --- a/packages/server/src/routes/admin/users.test.ts +++ b/packages/server/src/routes/admin/users.test.ts @@ -5,6 +5,7 @@ import { beforeAllDb, afterAllTests, beforeEachDb, koaAppContext, createUserAndS import { uuidgen } from '@joplin/lib/uuid'; import { ErrorForbidden } from '../../utils/errors'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function postUser(sessionId: string, email: string, password: string = null, props: any = null): Promise { password = password === null ? uuidgen() : password; @@ -28,6 +29,7 @@ async function postUser(sessionId: string, email: string, password: string = nul return context.response.body; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function patchUser(sessionId: string, user: any, url = ''): Promise { const context = await koaAppContext({ sessionId: sessionId, diff --git a/packages/server/src/routes/admin/users.ts b/packages/server/src/routes/admin/users.ts index e904cf9ee..ab845b867 100644 --- a/packages/server/src/routes/admin/users.ts +++ b/packages/server/src/routes/admin/users.ts @@ -41,6 +41,7 @@ export function checkRepeatPassword(fields: CheckRepeatPasswordInput, required: return ''; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function boolOrDefaultToValue(fields: any, fieldName: string): number | null { if (fields[fieldName] === '') return null; const output = Number(fields[fieldName]); @@ -48,6 +49,7 @@ function boolOrDefaultToValue(fields: any, fieldName: string): number | null { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function intOrDefaultToValue(fields: any, fieldName: string): number | null { if (fields[fieldName] === '') return null; const output = Number(fields[fieldName]); @@ -55,6 +57,7 @@ function intOrDefaultToValue(fields: any, fieldName: string): number | null { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function makeUser(isNew: boolean, fields: any): User { const user: User = {}; @@ -207,6 +210,7 @@ router.get('admin/users', async (_path: SubPath, ctx: AppContext) => { return view; }); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied router.get('admin/users/:id', async (path: SubPath, ctx: AppContext, user: User = null, error: any = null) => { const owner = ctx.joplin.owner; const isMe = userIsMe(path); @@ -283,6 +287,7 @@ router.get('admin/users/:id', async (path: SubPath, ctx: AppContext, user: User if (config().accountTypesEnabled) { view.content.showAccountTypes = true; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied view.content.accountTypes = accountTypeOptions().map((o: any) => { o.selected = user.account_type === o.value; return o; diff --git a/packages/server/src/routes/api/batch.ts b/packages/server/src/routes/api/batch.ts index ad9590bb4..6c50ab143 100644 --- a/packages/server/src/routes/api/batch.ts +++ b/packages/server/src/routes/api/batch.ts @@ -15,6 +15,7 @@ interface SubRequest { method: HttpMethod; url: string; headers: Record; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied body: any; } @@ -22,7 +23,9 @@ type SubRequests = Record; interface SubRequestResponse { status: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied body: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied header: Record; } diff --git a/packages/server/src/routes/api/batch_items.ts b/packages/server/src/routes/api/batch_items.ts index f8f7d3a7c..a0c445e35 100644 --- a/packages/server/src/routes/api/batch_items.ts +++ b/packages/server/src/routes/api/batch_items.ts @@ -8,7 +8,9 @@ import { PaginatedResults } from '../../models/utils/pagination'; const router = new Router(RouteType.Api); router.put('api/batch_items', async (path: SubPath, ctx: AppContext) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: PaginatedResults = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied items: await putItemContents(path, ctx, true) as any, has_more: false, }; diff --git a/packages/server/src/routes/api/items.test.ts b/packages/server/src/routes/api/items.test.ts index f40383e83..8deb043e3 100644 --- a/packages/server/src/routes/api/items.test.ts +++ b/packages/server/src/routes/api/items.test.ts @@ -83,6 +83,7 @@ describe('api/items', () => { test('should delete an item', async () => { const { user, session } = await createUserAndSession(1, true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const tree: any = { '000000000000000000000000000000F1': { '00000000000000000000000000000001': null, @@ -154,6 +155,7 @@ describe('api/items', () => { test('should batch upload items', async () => { const { session: session1 } = await createUserAndSession(1, false); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const result: PaginatedResults = await putApi(session1.id, 'batch_items', { items: [ { @@ -177,6 +179,7 @@ describe('api/items', () => { const note1 = makeNoteSerializedBody({ id: '00000000000000000000000000000001' }); await models().user().save({ id: user1.id, max_item_size: note1.length }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const result: PaginatedResults = await putApi(session1.id, 'batch_items', { items: [ { @@ -190,6 +193,7 @@ describe('api/items', () => { ], }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const items: SaveFromRawContentResult = result.items as any; expect(Object.keys(items).length).toBe(2); diff --git a/packages/server/src/routes/api/items.ts b/packages/server/src/routes/api/items.ts index f92606c3a..5c81cb28e 100644 --- a/packages/server/src/routes/api/items.ts +++ b/packages/server/src/routes/api/items.ts @@ -28,6 +28,7 @@ export async function putItemContents(path: SubPath, ctx: AppContext, isBatch: b if (isBatch) { let totalSize = 0; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied items = bodyFields.items.map((item: any) => { totalSize += item.name.length + (item.body ? item.body.length : 0); return { diff --git a/packages/server/src/routes/api/ping.test.ts b/packages/server/src/routes/api/ping.test.ts index 33de396d9..dbf8ab6d5 100644 --- a/packages/server/src/routes/api/ping.test.ts +++ b/packages/server/src/routes/api/ping.test.ts @@ -24,6 +24,7 @@ describe('api_ping', () => { await routeHandler(context); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const body = context.response.body as any; expect(context.response.status).toBe(200); diff --git a/packages/server/src/routes/api/sessions.test.ts b/packages/server/src/routes/api/sessions.test.ts index 6ea490ed7..1958616cf 100644 --- a/packages/server/src/routes/api/sessions.test.ts +++ b/packages/server/src/routes/api/sessions.test.ts @@ -44,8 +44,10 @@ describe('api/sessions', () => { const context = await postSession(user.email, password); expect(context.response.status).toBe(200); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(!!(context.response.body as any).id).toBe(true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const session: Session = await models().session().load((context.response.body as any).id); expect(session.user_id).toBe(user.id); }); @@ -127,8 +129,10 @@ describe('api/sessions', () => { expect(ldapLogin).toHaveBeenCalled(); expect(context.response.status).toBe(200); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(!!(context.response.body as any).id).toBe(true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const session: Session = await models().session().load((context.response.body as any).id); expect(session.user_id).toBe(user.id); @@ -155,8 +159,10 @@ describe('api/sessions', () => { expect(ldapLogin).toHaveBeenCalled(); expect(context.response.status).toBe(200); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect(!!(context.response.body as any).id).toBe(true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const session: Session = await models().session().load((context.response.body as any).id); expect(session.user_id).toBe(user.id); diff --git a/packages/server/src/routes/api/share_users.test.ts b/packages/server/src/routes/api/share_users.test.ts index 3a954b5b8..124673430 100644 --- a/packages/server/src/routes/api/share_users.test.ts +++ b/packages/server/src/routes/api/share_users.test.ts @@ -32,6 +32,7 @@ describe('share_users', () => { const { share: share1 } = await shareWithUserAndAccept(session1.id, session2.id, user2, ShareType.Folder, folderItem1); const { share: share2 } = await shareWithUserAndAccept(session1.id, session2.id, user2, ShareType.Folder, folderItem2); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const shareUsers = await getApi>(session2.id, 'share_users'); expect(shareUsers.items.length).toBe(2); expect(shareUsers.items.find(su => su.share.id === share1.id)).toBeTruthy(); diff --git a/packages/server/src/routes/api/share_users.ts b/packages/server/src/routes/api/share_users.ts index b0549ee74..84c2346c2 100644 --- a/packages/server/src/routes/api/share_users.ts +++ b/packages/server/src/routes/api/share_users.ts @@ -15,6 +15,7 @@ router.patch('api/share_users/:id', async (path: SubPath, ctx: AppContext) => { await shareUserModel.checkIfAllowed(ctx.joplin.owner, AclAction.Update, shareUser); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const body = await bodyFields(ctx.req); if ('status' in body) { @@ -35,6 +36,7 @@ router.del('api/share_users/:id', async (path: SubPath, ctx: AppContext) => { router.get('api/share_users', async (_path: SubPath, ctx: AppContext) => { const shareUsers = await ctx.joplin.models.shareUser().byUserId(ctx.joplin.owner.id); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const items: any[] = []; for (const su of shareUsers) { const share = await ctx.joplin.models.share().load(su.share_id); diff --git a/packages/server/src/routes/api/shares.test.ts b/packages/server/src/routes/api/shares.test.ts index 4713dc76a..f0d5bd584 100644 --- a/packages/server/src/routes/api/shares.test.ts +++ b/packages/server/src/routes/api/shares.test.ts @@ -23,6 +23,7 @@ describe('shares', () => { const { user: user2, session: session2 } = await createUserAndSession(2); const { user: user3 } = await createUserAndSession(3); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const tree: any = { '000000000000000000000000000000F1': { '00000000000000000000000000000001': null, @@ -49,6 +50,7 @@ describe('shares', () => { }); { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const shares = await getApi>(session1.id, 'shares'); expect(shares.items.length).toBe(2); @@ -60,6 +62,7 @@ describe('shares', () => { expect(share2).toBeTruthy(); expect(share2.type).toBe(ShareType.Note); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const shareUsers = await getApi>(session1.id, `shares/${share1.id}/users`); expect(shareUsers.items.length).toBe(2); diff --git a/packages/server/src/routes/api/users.test.ts b/packages/server/src/routes/api/users.test.ts index 49bdf0f9d..26ab01289 100644 --- a/packages/server/src/routes/api/users.test.ts +++ b/packages/server/src/routes/api/users.test.ts @@ -74,6 +74,7 @@ describe('api_users', () => { await createUserAndSession(2); await createUserAndSession(3); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const results: any = await getApi(adminSession.id, 'users'); expect(results.items.length).toBe(3); }); diff --git a/packages/server/src/routes/api/users.ts b/packages/server/src/routes/api/users.ts index 37c082d8e..acc4467bb 100644 --- a/packages/server/src/routes/api/users.ts +++ b/packages/server/src/routes/api/users.ts @@ -17,6 +17,7 @@ async function fetchUser(path: SubPath, ctx: AppContext): Promise { } async function postedUserFromContext(ctx: AppContext): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return ctx.joplin.models.user().fromApiInput(await bodyFields(ctx.req)); } diff --git a/packages/server/src/routes/index/home.test.ts b/packages/server/src/routes/index/home.test.ts index d5cfff812..f769fd7b2 100644 --- a/packages/server/src/routes/index/home.test.ts +++ b/packages/server/src/routes/index/home.test.ts @@ -28,6 +28,7 @@ describe('index/home', () => { await routeHandler(context); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect((context.response.body as any).indexOf(user.email) >= 0).toBe(true); }); diff --git a/packages/server/src/routes/index/items.test.ts b/packages/server/src/routes/index/items.test.ts index 2191a96fc..e7b9d173c 100644 --- a/packages/server/src/routes/index/items.test.ts +++ b/packages/server/src/routes/index/items.test.ts @@ -18,6 +18,7 @@ describe('index_items', () => { test('should list the user items', async () => { const { user: user1, session: session1 } = await createUserAndSession(1, true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const items: any = {}; for (let i = 1; i <= 150; i++) { items[(`${i}`).padStart(32, '0')] = {}; diff --git a/packages/server/src/routes/index/login.ts b/packages/server/src/routes/index/login.ts index 7c1a99dba..f46280ac9 100644 --- a/packages/server/src/routes/index/login.ts +++ b/packages/server/src/routes/index/login.ts @@ -10,6 +10,7 @@ import limiterLoginBruteForce from '../../utils/request/limiterLoginBruteForce'; import { cookieSet } from '../../utils/cookies'; import { homeUrl } from '../../utils/urlUtils'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function makeView(error: any = null): View { const view = defaultView('login', 'Login'); view.content = { diff --git a/packages/server/src/routes/index/shares.link.test.ts b/packages/server/src/routes/index/shares.link.test.ts index 2d3ab213b..0c025ff7a 100644 --- a/packages/server/src/routes/index/shares.link.test.ts +++ b/packages/server/src/routes/index/shares.link.test.ts @@ -27,6 +27,7 @@ type_: 4`, }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function getShareContent(shareId: string, query: any = {}): Promise { const context = await koaAppContext({ request: { @@ -37,6 +38,7 @@ async function getShareContent(shareId: string, query: any = {}): Promise { if (!stripeConfig().webhookSecret) throw new Error('webhookSecret is required'); @@ -41,6 +42,7 @@ interface CreateCheckoutSessionFields { email: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type StripeRouteHandler = (stripe: Stripe, path: SubPath, ctx: AppContext)=> Promise; interface PostHandlers { @@ -537,7 +539,9 @@ const getHandlers: Record = { }; router.post('stripe/:id', async (path: SubPath, ctx: AppContext) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied if (!(postHandlers as any)[path.id]) throw new ErrorNotFound(`No such action: ${path.id}`); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return (postHandlers as any)[path.id](initStripe(), path, ctx); }); diff --git a/packages/server/src/routes/index/users.test.ts b/packages/server/src/routes/index/users.test.ts index a54438e9b..0988470ed 100644 --- a/packages/server/src/routes/index/users.test.ts +++ b/packages/server/src/routes/index/users.test.ts @@ -7,6 +7,7 @@ import { execRequest, execRequestC } from '../../utils/testing/apiUtils'; import { beforeAllDb, afterAllTests, beforeEachDb, koaAppContext, createUserAndSession, models, parseHtml, checkContextError, expectHttpError, expectThrow } from '../../utils/testing/testUtils'; import { uuidgen } from '@joplin/lib/uuid'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function postUser(sessionId: string, email: string, password: string = null, props: any = null): Promise { password = password === null ? uuidgen() : password; @@ -30,6 +31,7 @@ async function postUser(sessionId: string, email: string, password: string = nul return context.response.body; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function patchUser(sessionId: string, user: any, url = ''): Promise { const context = await koaAppContext({ sessionId: sessionId, @@ -115,6 +117,7 @@ describe('index/users', () => { const doc = parseHtml(userHtml); // + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied expect((doc.querySelector('input[name=email]') as any).value).toBe('user1@localhost'); }); diff --git a/packages/server/src/routes/index/users.ts b/packages/server/src/routes/index/users.ts index 481e6520c..278018b46 100644 --- a/packages/server/src/routes/index/users.ts +++ b/packages/server/src/routes/index/users.ts @@ -36,6 +36,7 @@ export function checkRepeatPassword(fields: CheckRepeatPasswordInput, required: return ''; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function makeUser(userId: Uuid, fields: any): User { const user: User = {}; @@ -52,6 +53,7 @@ function makeUser(userId: Uuid, fields: any): User { const router = new Router(RouteType.Web); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied router.get('users/:id', async (path: SubPath, ctx: AppContext, formUser: User = null, error: any = null) => { const owner = ctx.joplin.owner; if (path.id !== 'me' && path.id !== owner.id) throw new ErrorForbidden(); @@ -111,6 +113,7 @@ router.get('users/:id', async (path: SubPath, ctx: AppContext, formUser: User = if (config().accountTypesEnabled) { view.content.showAccountTypes = true; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied view.content.accountTypes = accountTypeOptions().map((o: any) => { o.selected = user.account_type === o.value; return o; diff --git a/packages/server/src/services/EmailService.ts b/packages/server/src/services/EmailService.ts index 6f805c390..08fb2848c 100644 --- a/packages/server/src/services/EmailService.ts +++ b/packages/server/src/services/EmailService.ts @@ -13,6 +13,7 @@ const logger = Logger.create('EmailService'); export default class EmailService extends BaseService { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private transport_: any; private async transport(): Promise { diff --git a/packages/server/src/services/MustacheService.ts b/packages/server/src/services/MustacheService.ts index e60ccc4b9..108beae65 100644 --- a/packages/server/src/services/MustacheService.ts +++ b/packages/server/src/services/MustacheService.ts @@ -13,6 +13,7 @@ import { adminDashboardUrl, adminEmailsUrl, adminTasksUrl, adminUserDeletionsUrl import { MenuItem, setSelectedMenu } from '../utils/views/menu'; export interface RenderOptions { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied partials?: any; cssFiles?: string[]; jsFiles?: string[]; @@ -25,6 +26,7 @@ export interface View { path: string; layout?: string; navbar?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied content?: any; partials?: string[]; cssFiles?: string[]; @@ -59,6 +61,7 @@ interface GlobalParams { appShortName?: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function isView(o: any): boolean { if (typeof o !== 'object' || !o) return false; return 'path' in o && 'name' in o; @@ -281,6 +284,7 @@ export default class MustacheService { const contentHtml = await this.renderFileContent(filePath, view, globalParams); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const layoutView: any = { global: globalParams, pageName: this.formatPageName(view.name), diff --git a/packages/server/src/services/UserDeletionService.ts b/packages/server/src/services/UserDeletionService.ts index 747cec8f7..efc089f00 100644 --- a/packages/server/src/services/UserDeletionService.ts +++ b/packages/server/src/services/UserDeletionService.ts @@ -104,6 +104,7 @@ export default class UserDeletionService extends BaseService { return; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let error: any = null; let success = true; diff --git a/packages/server/src/services/database/types.ts b/packages/server/src/services/database/types.ts index 0b7bbc3e0..01a2b60d7 100644 --- a/packages/server/src/services/database/types.ts +++ b/packages/server/src/services/database/types.ts @@ -148,6 +148,7 @@ export interface File { id?: Uuid; owner_id?: Uuid; name?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied content?: any; mime_type?: string; size?: number; diff --git a/packages/server/src/tools/debugTools.ts b/packages/server/src/tools/debugTools.ts index 5f8a73317..c38ab95be 100644 --- a/packages/server/src/tools/debugTools.ts +++ b/packages/server/src/tools/debugTools.ts @@ -11,6 +11,7 @@ export interface CreateTestUsersOptions { fromNum?: number; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function handleDebugCommands(argv: any, db: DbConnection, config: Config): Promise { if (argv.debugCreateTestUsers) { await createTestUsers(db, config); diff --git a/packages/server/src/tools/generateTypes.ts b/packages/server/src/tools/generateTypes.ts index b786f7c1c..ecf3e5d77 100644 --- a/packages/server/src/tools/generateTypes.ts +++ b/packages/server/src/tools/generateTypes.ts @@ -21,6 +21,7 @@ const config: Config = { ], 'interfaceNameFormat': '${table}', 'singularTableNames': true, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied 'tableNameCasing': 'pascal' as any, 'filename': './db', 'columnSortOrder': 'source', diff --git a/packages/server/src/utils/array.ts b/packages/server/src/utils/array.ts index 3643a6e41..93bd3bbc7 100644 --- a/packages/server/src/utils/array.ts +++ b/packages/server/src/utils/array.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function unique(array: any[]): any[] { return array.filter((elem, index, self) => { return index === self.indexOf(elem); @@ -9,6 +10,7 @@ export const randomElement = (array: T[]): T => { return array[Math.floor(Math.random() * array.length)]; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const removeElement = (array: any[], element: any) => { const index = array.indexOf(element); if (index < 0) return; diff --git a/packages/server/src/utils/cache.ts b/packages/server/src/utils/cache.ts index 471256129..45349d980 100644 --- a/packages/server/src/utils/cache.ts +++ b/packages/server/src/utils/cache.ts @@ -1,4 +1,5 @@ interface CacheEntry { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied object: any; timestamp: number; } @@ -11,6 +12,7 @@ class Cache { private cache: CacheEntries = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async setAny(key: string, o: any): Promise { this.cache[key] = { object: JSON.stringify(o), @@ -18,11 +20,13 @@ class Cache { }; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public async setObject(key: string, object: any): Promise { if (!object) return; return this.setAny(key, object); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private async getAny(key: string): Promise { if (!this.cache[key]) return null; try { diff --git a/packages/server/src/utils/errors.ts b/packages/server/src/utils/errors.ts index 9f41e32e4..b47539aa9 100644 --- a/packages/server/src/utils/errors.ts +++ b/packages/server/src/utils/errors.ts @@ -10,6 +10,7 @@ export enum ErrorCode { } export interface ErrorOptions { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied details?: any; code?: ErrorCode; } @@ -21,6 +22,7 @@ export class ApiError extends Error { public httpCode: number; public code: ErrorCode; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public details: any; public constructor(message: string, httpCode: number = null, code: ErrorCode | ErrorOptions = undefined) { @@ -156,6 +158,7 @@ interface PlainObjectError { stack?: string; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function errorToPlainObject(error: any): PlainObjectError { if (typeof error === 'string') return { message: error }; diff --git a/packages/server/src/utils/joplinUtils.ts b/packages/server/src/utils/joplinUtils.ts index 846625009..9b649d1d2 100644 --- a/packages/server/src/utils/joplinUtils.ts +++ b/packages/server/src/utils/joplinUtils.ts @@ -31,6 +31,7 @@ const { substrWithEllipsis } = require('@joplin/lib/string-utils'); const logger = Logger.create('JoplinUtils'); export interface FileViewerResponse { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied body: any; mime: string; size: number; @@ -38,11 +39,14 @@ export interface FileViewerResponse { } interface ResourceInfo { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied localState: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied item: any; } interface LinkedItemInfo { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied item: any; file: File; } @@ -93,10 +97,12 @@ export function isJoplinItemName(name: string): boolean { return !!name.match(/^[0-9a-zA-Z]{32}\.md$/); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function unserializeJoplinItem(body: string): Promise { return BaseItem.unserialize(body); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function serializeJoplinItem(item: any): Promise { const ModelClass = BaseItem.itemClass(item); return ModelClass.serialize(item); @@ -119,6 +125,7 @@ export async function localFileFromUrl(url: string): Promise { } async function getResourceInfos(linkedItemInfos: LinkedItemInfos): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: Record = {}; for (const itemId of Object.keys(linkedItemInfos)) { @@ -159,6 +166,7 @@ async function renderResource(userId: string, resourceId: string, item: Item, co // sufficient to download the resource. However, if we want a more user // friendly download, we need to know the resource original name and mime // type. So below, we try to get that information. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let jopItem: any = null; try { @@ -181,6 +189,7 @@ async function renderNote(share: Share, note: NoteEntity, resourceInfos: Resourc ResourceModel: Resource as OptionsResourceModel, }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const renderOptions: any = { resources: resourceInfos, @@ -296,6 +305,7 @@ interface RenderItemQuery { export async function renderItem(userId: Uuid, item: Item, share: Share, query: RenderItemQuery): Promise { interface FileToRender { item: Item; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied content: any; jopItemId: string; } @@ -306,6 +316,7 @@ export async function renderItem(userId: Uuid, item: Item, share: Share, query: let linkedItemInfos: LinkedItemInfos = {}; let resourceInfos: ResourceInfos = {}; let fileToRender: FileToRender; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let itemToRender: any = null; if (query.resource_id) { @@ -352,6 +363,7 @@ export async function renderItem(userId: Uuid, item: Item, share: Share, query: fileToRender = { item: item, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied content: null as any, jopItemId: rootNote.id, }; diff --git a/packages/server/src/utils/koaIf.ts b/packages/server/src/utils/koaIf.ts index b1a5ef653..05ee8f5ed 100644 --- a/packages/server/src/utils/koaIf.ts +++ b/packages/server/src/utils/koaIf.ts @@ -1,6 +1,6 @@ import { Context } from 'koa'; -// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, 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) => { diff --git a/packages/server/src/utils/prettycron.ts b/packages/server/src/utils/prettycron.ts index ae856cacb..aaa7cd630 100644 --- a/packages/server/src/utils/prettycron.ts +++ b/packages/server/src/utils/prettycron.ts @@ -74,6 +74,7 @@ const later = require('later'); // For an array of numbers, e.g. a list of hours in a schedule, // return a string listing out all of the values (complete with // "and" plus ordinal text on the last item). + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const numberList = function(numbers: any[]) { if (numbers.length < 2) { return ordinal.toOrdinal(numbers[0]); @@ -83,6 +84,7 @@ const later = require('later'); return `${numbers.join(', ')} and ${ordinal.toOrdinal(last_val)}`; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const stepSize = function(numbers: any[]) { if (!numbers || numbers.length <= 1) return 0; @@ -95,15 +97,19 @@ const later = require('later'); }) ? expectedStep : 0; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const isEveryOther = function(stepsize: number, numbers: any[]) { return numbers.length === 30 && stepsize === 2; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const isTwicePerHour = function(stepsize: number, numbers: any[]) { return numbers.length === 2 && stepsize === 30; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const isOnTheHour = function(numbers: any[]) { return numbers.length === 1 && numbers[0] === 0; }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const isStepValue = function(stepsize: number, numbers: any[]) { // Value with slash (https://en.wikipedia.org/wiki/Cron#Non-Standard_Characters) return numbers.length > 2 && stepsize > 0; @@ -111,6 +117,7 @@ const later = require('later'); // For an array of numbers of seconds, return a string // listing all the values unless they represent a frequency divisible by 60: // /2, /3, /4, /5, /6, /10, /12, /15, /20 and /30 + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const getMinutesTextParts = function(numbers: any[]) { const stepsize = stepSize(numbers); if (!numbers) { @@ -134,6 +141,7 @@ const later = require('later'); // For an array of numbers of seconds, return a string // listing all the values unless they represent a frequency divisible by 60: // /2, /3, /4, /5, /6, /10, /12, /15, /20 and /30 + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const getSecondsTextParts = function(numbers: any[]) { const stepsize = stepSize(numbers); if (!numbers) { @@ -150,6 +158,7 @@ const later = require('later'); // Parse a number into day of week, or a month name; // used in dateList below. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const numberToDateName = function(value: any, type: any) { if (type === 'dow') { return dayjs().day(value - 1).format('ddd'); @@ -160,6 +169,7 @@ const later = require('later'); // From an array of numbers corresponding to dates (given in type: either // days of the week, or months), return a string listing all the values. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const dateList = function(numbers: any[], type: any) { if (numbers.length < 2) { return numberToDateName(`${numbers[0]}`, type); @@ -185,6 +195,7 @@ const later = require('later'); // return (x < 10) ? '0' + x : x; // }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const removeFromSchedule = function(schedule: any, member: any, length: any) { if (schedule[member] && schedule[member].length === length) { delete schedule[member]; @@ -195,6 +206,7 @@ const later = require('later'); // Given a schedule from later.js (i.e. after parsing the cronspec), // generate a friendly sentence description. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const scheduleToSentence = function(schedule: any, useSeconds: boolean) { let textParts = []; @@ -336,6 +348,7 @@ const later = require('later'); // ---------------- // Given a cronspec, return the human-readable string. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const toString = function(cronspec: any, sixth: boolean) { const schedule = later.parse.cron(cronspec, sixth); return scheduleToSentence(schedule['schedules'][0], sixth); @@ -343,6 +356,7 @@ const later = require('later'); // Given a cronspec, return the next date for when it will next run. // (This is just a wrapper for later.js) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const getNextDate = function(cronspec: any, sixth: boolean) { later.date.localTime(); const schedule = later.parse.cron(cronspec, sixth); @@ -351,6 +365,7 @@ const later = require('later'); // Given a cronspec, return a friendly string for when it will next run. // (This is just a wrapper for later.js and moment.js) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const getNext = function(cronspec: any, sixth: boolean) { return dayjs(getNextDate(cronspec, sixth)).calendar(); }; @@ -358,6 +373,7 @@ const later = require('later'); // Given a cronspec and numDates, return a list of formatted dates // of the next set of runs. // (This is just a wrapper for later.js and moment.js) + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const getNextDates = function(cronspec: any, numDates: any, sixth: boolean) { const schedule = later.parse.cron(cronspec, sixth); const nextDates = later.schedule(schedule).next(numDates); @@ -374,6 +390,7 @@ const later = require('later'); // attach ourselves to window in the browser, and to exports in Node, // so our functions can always be called as prettyCron.toString() + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const global_obj = (typeof exports !== 'undefined' && exports !== null) ? exports : (window as any).prettyCron = {}; global_obj.toString = toString; diff --git a/packages/server/src/utils/requestUtils.ts b/packages/server/src/utils/requestUtils.ts index b04516186..9ac4cae39 100644 --- a/packages/server/src/utils/requestUtils.ts +++ b/packages/server/src/utils/requestUtils.ts @@ -5,10 +5,12 @@ import * as formidable from 'formidable'; import { Fields, Files } from 'formidable'; import { IncomingMessage } from 'http'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type BodyFields = Record; interface FormParseResult { fields: BodyFields; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied files: any; } @@ -21,6 +23,7 @@ interface FormParseRequest extends IncomingMessage { __isMocked: boolean; __parsed: ParsedBody; files: Files; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied body: any; } @@ -35,6 +38,7 @@ interface FormParseRequest extends IncomingMessage { // As of 2024-01-18, this may no longer be necessary since we reverted to Formidable v2, but keeping // it anyway just in case. const convertFieldsToKeyValue = (fields: Files | Fields) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const convertedFields: Record = {}; for (const [k, v] of Object.entries(fields)) { if (Array.isArray(v)) { @@ -49,12 +53,14 @@ const convertFieldsToKeyValue = (fields: Files | Fields) => { // Input should be Koa ctx.req, which corresponds to the native Node request export async function formParse(request: IncomingMessage): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const req: FormParseRequest = request as any; // It's not clear how to get mocked requests to be parsed successfully by // formidable so we use this small hack. If it's mocked, we are running test // units and the request body is already an object and can be returned. if (req.__isMocked) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = {}; if (req.files) output.files = req.files; output.fields = req.body || {}; @@ -73,6 +79,7 @@ export async function formParse(request: IncomingMessage): Promise { if (error) { error.message = `Could not parse form: ${error.message}`; @@ -94,11 +101,13 @@ export async function formParse(request: IncomingMessage): Promise(req: any/* , filter:string[] = null*/): Promise { const form = await formParse(req); return form.fields as T; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const bodyFiles = async (req: any/* , filter:string[] = null*/): Promise => { const form = await formParse(req); return form.files as T; @@ -108,6 +117,7 @@ export function ownerRequired(ctx: AppContext) { if (!ctx.joplin.owner) throw new ErrorForbidden(); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function headerSessionId(headers: any): string { return headers['x-api-auth'] ? headers['x-api-auth'] : ''; } diff --git a/packages/server/src/utils/routeUtils.test.ts b/packages/server/src/utils/routeUtils.test.ts index 2a9a8c11e..e126a8bb0 100644 --- a/packages/server/src/utils/routeUtils.test.ts +++ b/packages/server/src/utils/routeUtils.test.ts @@ -6,6 +6,7 @@ import { expectThrow } from './testing/testUtils'; describe('routeUtils', () => { it('should parse a route path', async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const testCases: any[] = [ ['123456/content', '123456', 'content', ItemAddressingType.Id], ['123456', '123456', '', ItemAddressingType.Id], @@ -28,6 +29,7 @@ describe('routeUtils', () => { }); it('should find a matching route', async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const testCases: any[] = [ ['/admin/organizations', { route: 1, @@ -66,6 +68,7 @@ describe('routeUtils', () => { }], ]; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const routes: Record = { 'admin/organizations': 1, 'api/users': 2, @@ -83,6 +86,7 @@ describe('routeUtils', () => { }); it('should split an item path', async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const testCases: any[] = [ ['root:/Documents/MyFile.md:', ['root', 'Documents', 'MyFile.md']], ['documents:/CV.doc:', ['documents', 'CV.doc']], diff --git a/packages/server/src/utils/routeUtils.ts b/packages/server/src/utils/routeUtils.ts index 2652e597d..a4b0c801f 100644 --- a/packages/server/src/utils/routeUtils.ts +++ b/packages/server/src/utils/routeUtils.ts @@ -28,6 +28,7 @@ export enum RouteResponseFormat { Json = 'json', } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export type RouteHandler = (path: SubPath, ctx: AppContext, ...args: any[])=> Promise; export interface Routers { @@ -55,8 +56,10 @@ export enum ResponseType { export class Response { public type: ResponseType; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public response: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(type: ResponseType, response: any) { this.type = type; this.response = response; @@ -197,6 +200,7 @@ function disabledAccountCheck(route: MatchedRoute, user: User) { } interface ExecRequestResult { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied response: any; path: SubPath; } @@ -295,6 +299,7 @@ export function findMatchingRoute(path: string, routes: Routers): MatchedRoute { throw new Error('Unreachable'); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function respondWithItemContent(koaResponse: any, item: Item, content: Buffer): Response { koaResponse.body = item.jop_type > 0 ? content.toString() : content; koaResponse.set('Content-Type', item.mime_type); diff --git a/packages/server/src/utils/strings.ts b/packages/server/src/utils/strings.ts index 026599db9..708ef0194 100644 --- a/packages/server/src/utils/strings.ts +++ b/packages/server/src/utils/strings.ts @@ -2,6 +2,7 @@ import { User } from '../services/database/types'; import { getMaxItemSize, getMaxTotalItemSize, totalSizePercent } from '../models/utils/user'; import { formatBytes } from './bytes'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function yesOrNo(value: any): string { return value ? 'yes' : 'no'; } diff --git a/packages/server/src/utils/testing/apiUtils.ts b/packages/server/src/utils/testing/apiUtils.ts index 8b8ea086a..0ecf7f333 100644 --- a/packages/server/src/utils/testing/apiUtils.ts +++ b/packages/server/src/utils/testing/apiUtils.ts @@ -4,21 +4,26 @@ import { AppContextTestOptions, checkContextError, koaAppContext } from './testU interface ExecRequestOptions { filePath?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied query?: Record; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function putApiC(sessionId: string, path: string, body: Record = null, options: ExecRequestOptions = null): Promise { return execApiC(sessionId, 'PUT', path, body, options); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function putApi(sessionId: string, path: string, body: Record = null, options: ExecRequestOptions = null): Promise { return execApi(sessionId, 'PUT', path, body, options); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function patchApiC(sessionId: string, path: string, body: Record = null, options: ExecRequestOptions = null): Promise { return execApiC(sessionId, 'PATCH', path, body, options); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function patchApi(sessionId: string, path: string, body: Record = null, options: ExecRequestOptions = null): Promise { return execApi(sessionId, 'PATCH', path, body, options); } @@ -39,14 +44,17 @@ export async function deleteApi(sessionId: string, path: string, options: Exe return execApi(sessionId, 'DELETE', path, null, options); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function postApiC(sessionId: string, path: string, body: Record = null, options: ExecRequestOptions = null): Promise { return execApiC(sessionId, 'POST', path, body, options); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function postApi(sessionId: string, path: string, body: Record = null, options: ExecRequestOptions = null): Promise { return execApi(sessionId, 'POST', path, body, options); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function execRequestC(sessionId: string, method: string, path: string, body: Record = null, options: ExecRequestOptions = null): Promise { options = options || {}; @@ -68,16 +76,19 @@ export async function execRequestC(sessionId: string, method: string, path: stri return context; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function execRequest(sessionId: string, method: string, url: string, body: Record = null, options: ExecRequestOptions = null): Promise { const context = await execRequestC(sessionId, method, url, body, options); await checkContextError(context); return context.response.body as T; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function execApiC(sessionId: string, method: string, path: string, body: Record = null, options: ExecRequestOptions = null): Promise { return execRequestC(sessionId, method, `api/${path}`, body, options); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function execApi(sessionId: string, method: string, url: string, body: Record = null, options: ExecRequestOptions = null): Promise { const context = await execApiC(sessionId, method, url, body, options); await checkContextError(context); diff --git a/packages/server/src/utils/testing/fileApiUtils.ts b/packages/server/src/utils/testing/fileApiUtils.ts index 5770d1772..09f40dd47 100644 --- a/packages/server/src/utils/testing/fileApiUtils.ts +++ b/packages/server/src/utils/testing/fileApiUtils.ts @@ -194,8 +194,10 @@ export async function getDeltaContext(sessionId: string, path: string, paginatio return context; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function getDelta(sessionId: string, path: string, pagination: Pagination): Promise> { const context = await getDeltaContext(sessionId, path, pagination); checkContextError(context); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied return context.response.body as PaginatedResults; } diff --git a/packages/server/src/utils/testing/koa/FakeRequest.ts b/packages/server/src/utils/testing/koa/FakeRequest.ts index 62b15a57c..f9387a5e2 100644 --- a/packages/server/src/utils/testing/koa/FakeRequest.ts +++ b/packages/server/src/utils/testing/koa/FakeRequest.ts @@ -1,7 +1,9 @@ export default class FakeRequest { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private req_: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public constructor(nodeRequest: any) { this.req_ = nodeRequest; } diff --git a/packages/server/src/utils/testing/koa/FakeResponse.ts b/packages/server/src/utils/testing/koa/FakeResponse.ts index 511f5e90a..433c5b14b 100644 --- a/packages/server/src/utils/testing/koa/FakeResponse.ts +++ b/packages/server/src/utils/testing/koa/FakeResponse.ts @@ -1,13 +1,17 @@ export default class FakeResponse { public status = 200; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public body: any = null; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied private headers_: any = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public set(name: string, value: any) { this.headers_[name] = value; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public get(name: string): any { return this.headers_[name]; } diff --git a/packages/server/src/utils/testing/shareApiUtils.ts b/packages/server/src/utils/testing/shareApiUtils.ts index cf19d528c..67efafe64 100644 --- a/packages/server/src/utils/testing/shareApiUtils.ts +++ b/packages/server/src/utils/testing/shareApiUtils.ts @@ -22,10 +22,13 @@ export async function createFolderShare(sessionId: string, folderId: string): Pr } // For backward compatibility with old tests that used a different tree format. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function convertTree(tree: any): any[] { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any[] = []; for (const jopId in tree) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const children: any = tree[jopId]; const isFolder = children !== null; @@ -44,6 +47,7 @@ function convertTree(tree: any): any[] { return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function createItemTree3(sessionId: Uuid, userId: Uuid, parentFolderId: string, shareId: Uuid, tree: any[]): Promise { const user = await models().user().load(userId); @@ -81,6 +85,7 @@ export async function inviteUserToShare(share: Share, sharerSessionId: string, r return shareUser; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function shareFolderWithUser(sharerSessionId: string, shareeSessionId: string, sharedFolderId: string, itemTree: any, acceptShare = true): Promise { itemTree = Array.isArray(itemTree) ? itemTree : convertTree(itemTree); diff --git a/packages/server/src/utils/testing/testRouters.ts b/packages/server/src/utils/testing/testRouters.ts index 38029550c..d244c43f4 100644 --- a/packages/server/src/utils/testing/testRouters.ts +++ b/packages/server/src/utils/testing/testRouters.ts @@ -10,6 +10,7 @@ const execCommand = function(command: string, returnStdErr = false): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied exec(command, (error: any, stdout: any, stderr: any) => { if (error) { if (error.signal === 'SIGTERM') { @@ -36,6 +37,7 @@ async function sleep(seconds: number) { }); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function curl(method: string, path: string, query: object = null, body: any = null, headers: any = null, formFields: string[] = null, options: any = {}): Promise { const curlCmd: string[] = ['curl']; @@ -92,8 +94,10 @@ function extractCurlResponse(rawResult: string) { const spawn = require('child_process').spawn; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let serverProcess: any = null; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function checkAndPrintResult(prefix: string, result: any) { if (typeof result === 'object' && result && result.error) throw new Error(`${prefix}: ${JSON.stringify(result)}`); console.info(prefix, result); @@ -139,6 +143,7 @@ async function main() { }); try { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let response: any = null; console.info('Waiting for server to be ready...'); diff --git a/packages/server/src/utils/testing/testUtils.ts b/packages/server/src/utils/testing/testUtils.ts index 51ed23a6e..f325b7ad8 100644 --- a/packages/server/src/utils/testing/testUtils.ts +++ b/packages/server/src/utils/testing/testUtils.ts @@ -140,6 +140,7 @@ export async function beforeEachDb() { export interface AppContextTestOptions { // owner?: User; sessionId?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied request?: any; } @@ -204,10 +205,12 @@ export async function koaAppContext(options: AppContextTestOptions = null): Prom const appLogger = Logger.create('AppTest'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const baseAppContext = await setupAppContext({} as any, Env.Dev, db_, () => appLogger); // Set type to "any" because the Koa context has many properties and we // don't need to mock all of them. + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const appContext: any = { baseAppContext, joplin: { @@ -289,10 +292,12 @@ export const createUser = async function(index = 1, isAdmin = false): Promise { const itemModel = models().item(); for (const jopId in tree) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const children: any = tree[jopId]; const isFolder = children !== null; @@ -323,6 +328,7 @@ export async function createItemTree(userId: Uuid, parentFolderId: string, tree: // } // } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function createItemTree3(userId: Uuid, parentFolderId: string, shareId: Uuid, tree: any[]): Promise { const itemModel = models().item(); const user = await models().user().load(userId); @@ -451,7 +457,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 +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied export async function checkThrowAsync(asyncFn: Function): Promise { try { await asyncFn(); @@ -461,7 +467,7 @@ export async function checkThrowAsync(asyncFn: Function): Promise { return null; } -// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied +// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any -- Old code before rule was applied, Old code before rule was applied export async function expectThrow(asyncFn: Function, errorCode: any = undefined): Promise { let hasThrown = false; let thrownError = null; diff --git a/packages/server/src/utils/urlUtils.ts b/packages/server/src/utils/urlUtils.ts index 873eff22b..48d37f1bf 100644 --- a/packages/server/src/utils/urlUtils.ts +++ b/packages/server/src/utils/urlUtils.ts @@ -2,6 +2,7 @@ import { URL } from 'url'; import config from '../config'; import { Uuid } from '../services/database/types'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function setQueryParameters(url: string, query: any): string { if (!query) return url; diff --git a/packages/server/src/utils/views/select.ts b/packages/server/src/utils/views/select.ts index 27a8541c8..5c4c79fd1 100644 --- a/packages/server/src/utils/views/select.ts +++ b/packages/server/src/utils/views/select.ts @@ -1,16 +1,20 @@ interface Option { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied value: any; label: string; selected: boolean; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied type LabelFn = (key: string, value: any)=> string; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function yesNoDefaultLabel(_key: string, value: any): string { if (value === '') return 'Default'; return value ? 'Yes' : 'No'; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function objectToSelectOptions(object: any, selectedValue: any, labelFn: LabelFn): Option[] { const output: Option[] = []; for (const [key, value] of Object.entries(object)) { @@ -23,10 +27,12 @@ export function objectToSelectOptions(object: any, selectedValue: any, labelFn: return output; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function selectOption(label: string, value: any, selected: boolean): Option { return { label, value, selected }; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function yesNoDefaultOptions(object: any, key: string): Option[] { return [ selectOption('Default', '', object[key] === null), @@ -35,6 +41,7 @@ export function yesNoDefaultOptions(object: any, key: string): Option[] { ]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function yesNoOptions(object: any, key: string): Option[] { return [ selectOption('Yes', '1', object[key] === 1), diff --git a/packages/server/src/utils/views/table.ts b/packages/server/src/utils/views/table.ts index 4348e7ad6..724a2a3c2 100644 --- a/packages/server/src/utils/views/table.ts +++ b/packages/server/src/utils/views/table.ts @@ -71,6 +71,7 @@ export interface Table { headers: Header[]; rows: Row[]; baseUrl?: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied requestQuery?: any; pageCount?: number; pagination?: Pagination; @@ -82,6 +83,7 @@ export interface TableView { paginationLinks: PageLink[]; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function makeTablePagination(query: any, defaultOrderField: string, defaultOrderDir: PaginationOrderDir): Pagination { const limit = Number(query.limit) || pageMaxSize; const order: PaginationOrder[] = requestPaginationOrder(query, defaultOrderField, defaultOrderDir); diff --git a/packages/tools/build-release-stats.ts b/packages/tools/build-release-stats.ts index 2deb69221..3e96810ee 100644 --- a/packages/tools/build-release-stats.ts +++ b/packages/tools/build-release-stats.ts @@ -248,6 +248,7 @@ async function main() { { name: 'mac_count', label: 'macOS' }, { name: 'linux_count', label: 'Linux' }, { name: 'total_count', label: 'Total' }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied ], rows as any[]), ]; diff --git a/packages/tools/generate-database-types.ts b/packages/tools/generate-database-types.ts index 5b115df20..dca0ba761 100644 --- a/packages/tools/generate-database-types.ts +++ b/packages/tools/generate-database-types.ts @@ -5,6 +5,7 @@ import { remove } from 'fs-extra'; const sqlts = require('@rmp135/sql-ts').default; const fs = require('fs-extra'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function createRuntimeObject(table: any) { const colStrings = []; for (const col of table.columns) { @@ -21,6 +22,7 @@ const stringToSingular = (word: string) => { return word; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const generateListRenderDependencyType = (tables: any[]) => { const output: string[] = []; @@ -63,6 +65,7 @@ async function main() { const definitions = await sqlts.toObject(sqlTsConfig); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied definitions.tables = definitions.tables.map((t: any) => { t.columns.push({ nullable: false, @@ -77,7 +80,9 @@ async function main() { return t; }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied definitions.tables = definitions.tables.map((table: any) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied table.columns = table.columns.map((column: any) => { return { ...column, diff --git a/packages/tools/generate-images.ts b/packages/tools/generate-images.ts index eac5bc0b3..ea457bb12 100644 --- a/packages/tools/generate-images.ts +++ b/packages/tools/generate-images.ts @@ -582,6 +582,7 @@ const saveResults = async (filePath: string, results: Results) => { }; const makeOperationKey = async (source: Source, sourcePath: string, operation: Operation): Promise => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any[] = []; output.push(source.id); output.push(await md5File(sourcePath)); diff --git a/packages/tools/licenseChecker.ts b/packages/tools/licenseChecker.ts index 7f4bb16b5..d9e4ce155 100644 --- a/packages/tools/licenseChecker.ts +++ b/packages/tools/licenseChecker.ts @@ -30,6 +30,7 @@ const createCsvLine = (items: string[]) => { } }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const enforceString = (line: any): string => { if (Array.isArray(line)) return line.join(', '); return line ? (`${line}`) : ''; diff --git a/packages/tools/postPreReleasesToForum.ts b/packages/tools/postPreReleasesToForum.ts index 63aac28fb..428b69783 100644 --- a/packages/tools/postPreReleasesToForum.ts +++ b/packages/tools/postPreReleasesToForum.ts @@ -7,6 +7,7 @@ import dayjs = require('dayjs'); import { getRootDir } from '@joplin/utils'; interface State { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied processedReleases: Record; } diff --git a/packages/tools/release-clipper.ts b/packages/tools/release-clipper.ts index 031d96962..8d52879ff 100644 --- a/packages/tools/release-clipper.ts +++ b/packages/tools/release-clipper.ts @@ -151,6 +151,7 @@ async function main() { console.info(await execCommand('npm run build')); type PlatformDistOptions = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied removeManifestKeys(manifest: Record): Record; outputPath?: string; }; diff --git a/packages/tools/setupNewRelease.ts b/packages/tools/setupNewRelease.ts index 024303f90..2d6949650 100644 --- a/packages/tools/setupNewRelease.ts +++ b/packages/tools/setupNewRelease.ts @@ -108,6 +108,7 @@ function iosVersionHack(majorMinorVersion: string) { } async function main() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const argv: any = yargs.parserConfiguration({ 'parse-numbers': false, 'parse-positional-numbers': false, diff --git a/packages/tools/tool-utils.ts b/packages/tools/tool-utils.ts index ce259e550..09e137768 100644 --- a/packages/tools/tool-utils.ts +++ b/packages/tools/tool-utils.ts @@ -104,6 +104,7 @@ async function loadGitHubUsernameCache() { return {}; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function saveGitHubUsernameCache(cache: any) { const path = `${__dirname}/github_username_cache.json`; await writeFile(path, JSON.stringify(cache)); @@ -112,12 +113,14 @@ async function saveGitHubUsernameCache(cache: any) { // Returns the project root dir export const rootDir: string = require('path').dirname(require('path').dirname(__dirname)); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function execCommand(command: string, options: any = null): Promise { options = options || {}; const exec = require('child_process').exec; return new Promise((resolve, reject) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied exec(command, options, (error: any, stdout: any, stderr: any) => { if (error) { if (error.signal === 'SIGTERM') { @@ -153,10 +156,12 @@ export function execCommandWithPipes(executable: string, args: string[]) { return new Promise((resolve, reject) => { const child = spawn(executable, args, { stdio: 'inherit' }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied child.on('error', (error: any) => { reject(error); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied child.on('close', (code: any) => { if (code !== 0) { reject(`Ended with code ${code}`); @@ -173,6 +178,7 @@ export function toSystemSlashes(path: string) { return path.replace(/\\/g, '/'); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function setPackagePrivateField(filePath: string, value: any) { const text = await readFile(filePath, 'utf8'); const obj = JSON.parse(text); @@ -189,6 +195,7 @@ export async function downloadFile(url: string, targetPath: string) { return new Promise((resolve, reject) => { const file = createWriteStream(targetPath); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied https.get(url, (response: any) => { if (response.statusCode !== 200) reject(new Error(`HTTP error ${response.statusCode}`)); response.pipe(file); @@ -196,6 +203,7 @@ export async function downloadFile(url: string, targetPath: string) { // file.close(); resolve(null); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied }).on('error', (error: any) => { reject(error); }); @@ -210,11 +218,13 @@ export function fileSha256(filePath: string) { const shasum = crypto.createHash(algo); const s = fs.ReadStream(filePath); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied s.on('data', (d: any) => { shasum.update(d); }); s.on('end', () => { const d = shasum.digest('hex'); resolve(d); }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied s.on('error', (error: any) => { reject(error); }); @@ -232,6 +242,7 @@ export async function unlinkForce(filePath: string) { export function fileExists(filePath: string) { return new Promise((resolve, reject) => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied stat(filePath, (error: any) => { if (!error) { resolve(true); @@ -344,6 +355,7 @@ export function githubOauthToken() { // As of July 2023 /latest seems to be working again, so switching back to this // method, but let's keep the old method just in case they break the API again. export async function gitHubLatestRelease(repoName: string): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const response: any = await fetch(`https://api.github.com/repos/laurent22/${repoName}/releases/latest`, { headers: { 'Content-Type': 'application/json', @@ -360,6 +372,7 @@ export async function gitHubLatestRelease_KeepInCaseMicrosoftBreaksTheApiAgain(r let pageNum = 1; while (true) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const response: any = await fetch(`https://api.github.com/repos/laurent22/${repoName}/releases?page=${pageNum}`, { headers: { 'Content-Type': 'application/json', @@ -397,6 +410,7 @@ export const gitHubLatestReleases = async (page: number, perPage: number) => { return releases; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export async function githubRelease(project: string, tagName: string, options: any = null): Promise { options = { isDraft: false, isPreRelease: false, ...options }; diff --git a/packages/tools/update-readme-contributors.ts b/packages/tools/update-readme-contributors.ts index 806b7d276..8a1ddd44a 100644 --- a/packages/tools/update-readme-contributors.ts +++ b/packages/tools/update-readme-contributors.ts @@ -19,6 +19,7 @@ async function gitHubContributors(page: number): Promise { url: `https://api.github.com/repos/laurent22/joplin/contributors${page ? `?page=${page}` : ''}`, json: true, headers: { 'User-Agent': 'Joplin Readme Updater' }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied }, (error: any, response: any, data: any) => { if (error) { reject(error); diff --git a/packages/tools/update-readme-download.ts b/packages/tools/update-readme-download.ts index 1d8f818c0..c1b1a0dec 100644 --- a/packages/tools/update-readme-download.ts +++ b/packages/tools/update-readme-download.ts @@ -66,6 +66,7 @@ function setReadmeContent(content: string) { return fs.writeFileSync(destMarkdownPath, content); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied async function main(argv: any) { const waitForVersion = argv.length === 3 ? argv[2] : null; diff --git a/packages/tools/utils/discourse.ts b/packages/tools/utils/discourse.ts index ef3660ee1..dbc88e0e8 100644 --- a/packages/tools/utils/discourse.ts +++ b/packages/tools/utils/discourse.ts @@ -79,7 +79,9 @@ export const execApi = async (method: HttpMethod, path: string, body: Record => { return execApi(HttpMethod.POST, 'posts', topic); }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const createPost = async (topicId: number, post: any): Promise => { return execApi(HttpMethod.POST, 'posts', { topic_id: topicId, @@ -132,6 +137,7 @@ export const createPost = async (topicId: number, post: any): Promise => { await execApi(HttpMethod.PUT, `posts/${postId}.json`, content); }; diff --git a/packages/tools/utils/translation.ts b/packages/tools/utils/translation.ts index 1a649da03..1b74182b8 100644 --- a/packages/tools/utils/translation.ts +++ b/packages/tools/utils/translation.ts @@ -56,6 +56,7 @@ export const parsePoFile = async (filePath: string) => { // to a map, with the English text on the left and the // translation on the right. If a particular translation is missing, no entry // will be returned. The caller should display the English text in this case. +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const parseTranslations = (gettextTranslations: any) => { const output: Translations = {}; diff --git a/packages/tools/website/build.ts b/packages/tools/website/build.ts index 09e4e7d5b..bb3596f77 100644 --- a/packages/tools/website/build.ts +++ b/packages/tools/website/build.ts @@ -90,6 +90,7 @@ const jsBasePath = `${websiteAssetDir}/js`; const jsBaseUrl = `${baseUrl}/js`; async function getAssetUrls(): Promise { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const scriptsToImport: any[] = [ // { // id: 'tippy', diff --git a/packages/tools/website/processDocs.ts b/packages/tools/website/processDocs.ts index cec901737..8cc41c579 100644 --- a/packages/tools/website/processDocs.ts +++ b/packages/tools/website/processDocs.ts @@ -36,6 +36,7 @@ interface Context { inHeader?: boolean; listStack?: List[]; listStarting?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied currentLinkAttrs?: any; inFence?: boolean; processedFiles?: string[]; @@ -77,6 +78,7 @@ const parseHtml = (html: string) => { const parser = new htmlparser2.Parser({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onopentag: (name: string, attrs: Record) => { tagStack.push({ name }); @@ -128,6 +130,7 @@ const paragraphBreak = '///PARAGRAPH_BREAK///'; const blockQuoteStart = '///BLOCK_QUOTE_START///'; const blockQuoteEnd = '///BLOCK_QUOTE_END///'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const processToken = (token: any, output: string[], context: Context): void => { if (!context.listStack) context.listStack = []; diff --git a/packages/tools/website/updateNews.ts b/packages/tools/website/updateNews.ts index efaa70abc..b6c3dc0ef 100644 --- a/packages/tools/website/updateNews.ts +++ b/packages/tools/website/updateNews.ts @@ -67,6 +67,7 @@ const getPostContent = async (post: Post): Promise => { const generateRssFeed = async (posts: Post[]) => { let pubDate = null; let postCount = 0; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const feedItems: any[] = []; for (const post of posts.reverse()) { const content = await getPostContent(post); diff --git a/packages/tools/website/utils/applyTranslations.ts b/packages/tools/website/utils/applyTranslations.ts index cdca6430c..bb5a39bad 100644 --- a/packages/tools/website/utils/applyTranslations.ts +++ b/packages/tools/website/utils/applyTranslations.ts @@ -95,6 +95,7 @@ export default (html: string, _languageCode: string, translations: Translations) const parser = new htmlparser2.Parser({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied onopentag: (name: string, attrs: any) => { if (name === 'script') state.inScript = true; diff --git a/packages/tools/website/utils/convertLinksToLocale.test.ts b/packages/tools/website/utils/convertLinksToLocale.test.ts index 3f97dfa20..1d631ef00 100644 --- a/packages/tools/website/utils/convertLinksToLocale.test.ts +++ b/packages/tools/website/utils/convertLinksToLocale.test.ts @@ -3,6 +3,7 @@ import convertLinksToLocale from './convertLinksToLocale'; describe('convertLinksToLocale', () => { it('should convert links', async () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const tests: [string, any, string][] = [ [ 'test [link](/help/link)', diff --git a/packages/tools/website/utils/frontMatter.test.ts b/packages/tools/website/utils/frontMatter.test.ts index 02fc7772f..39017bfb0 100644 --- a/packages/tools/website/utils/frontMatter.test.ts +++ b/packages/tools/website/utils/frontMatter.test.ts @@ -1,6 +1,7 @@ import { compileWithFrontMatter, stripOffFrontMatter } from './frontMatter'; const moment = require('moment'); +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const testCases: any[][] = [ // ============================================================= diff --git a/packages/tools/website/utils/frontMatter.ts b/packages/tools/website/utils/frontMatter.ts index b2f164734..d4a797035 100644 --- a/packages/tools/website/utils/frontMatter.ts +++ b/packages/tools/website/utils/frontMatter.ts @@ -59,6 +59,7 @@ export const stripOffFrontMatter = (md: string): MarkdownAndFrontMatter => { if (state !== 'doc') throw new Error('Front matter block was not closed with "---"'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const header: Record = yaml.load(headerLines.join('\n'), { schema: yaml.FAILSAFE_SCHEMA }); if (header.created) header.created = moment(header.created).toDate(); @@ -73,6 +74,7 @@ export const stripOffFrontMatter = (md: string): MarkdownAndFrontMatter => { // source_url: https://www.patreon.com/posts/any-ideas-for-53317699 // --- +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const formatFrontMatterValue = (key: string, value: any) => { if (['created', 'updated'].includes(key)) { return moment((value as Date)).toISOString(); @@ -87,6 +89,7 @@ export const compileWithFrontMatter = (md: MarkdownAndFrontMatter): string => { if (Object.keys(md.header).length) { const header = { ...md.header }; for (const [key, value] of Object.entries(header)) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (header as any)[key] = formatFrontMatterValue(key, value); } const headerString = yaml.dump(header, { noCompatMode: true, schema: yaml.FAILSAFE_SCHEMA, lineWidth: 100000 }); diff --git a/packages/tools/website/utils/render.ts b/packages/tools/website/utils/render.ts index 0254fcd3a..86a203e05 100644 --- a/packages/tools/website/utils/render.ts +++ b/packages/tools/website/utils/render.ts @@ -30,6 +30,7 @@ export function getMarkdownIt() { html: true, }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied markdownIt.core.ruler.push('tableClass', (state: any) => { const tokens = state.tokens; for (let i = 0; i < tokens.length; i++) { diff --git a/packages/utils/Logger.ts b/packages/utils/Logger.ts index 2e32dde5a..bbf4ec287 100644 --- a/packages/utils/Logger.ts +++ b/packages/utils/Logger.ts @@ -22,7 +22,9 @@ type FormatFunction = (level: LogLevel, targetPrefix?: string)=> string; interface TargetOptions { level?: LogLevel; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied database?: any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied console?: any; prefix?: string; path?: string; @@ -112,7 +114,9 @@ class Logger { // statement comes from. console.warn('Logger: Trying to access globalLogger, but it has not been initialized. Make sure that initializeGlobalLogger() has been called before logging. Will use the console as fallback.'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const output: any = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied log: (level: LogLevel, prefix: string, ...object: any[]) => { // eslint-disable-next-line no-console console.info(`[UNINITIALIZED GLOBAL LOGGER] ${this.levelIdToString(level)}: ${prefix}:`, object); @@ -127,9 +131,13 @@ class Logger { public static create(prefix: string): LoggerWrapper { return { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied debug: (...object: any[]) => this.globalLogger.log(LogLevel.Debug, prefix, ...object), + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied info: (...object: any[]) => this.globalLogger.log(LogLevel.Info, prefix, ...object), + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied warn: (...object: any[]) => this.globalLogger.log(LogLevel.Warn, prefix, ...object), + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied error: (...object: any[]) => this.globalLogger.log(LogLevel.Error, prefix, ...object), }; } @@ -152,17 +160,20 @@ class Logger { const target = { type: type }; for (const n in options) { if (!options.hasOwnProperty(n)) continue; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (target as any)[n] = (options as any)[n]; } this.targets_.push(target); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public objectToString(object: any) { let output = ''; if (typeof object === 'object') { if (object instanceof Error) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied object = object as any; output = object.toString(); if (object.code) output += `\nCode: ${object.code}`; @@ -179,6 +190,7 @@ class Logger { return output; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public objectsToString(...object: any[]) { const output = []; if (object.length === 1) { @@ -240,6 +252,7 @@ class Logger { return this.level(); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public log(level: LogLevel, prefix: string | null, ...object: any[]) { if (!this.targets_.length || !this.enabled) return; @@ -255,6 +268,7 @@ class Logger { if (level === LogLevel.Warn) fn = 'warn'; if (level === LogLevel.Info) fn = 'info'; const consoleObj = target.console ? target.console : console; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied let items: any[] = []; if (target.format) { @@ -294,7 +308,7 @@ class Logger { writeToFileMutex_.acquire().then((r: Function) => { release = r; return Logger.fsDriver().appendFile(target.path as string, `${line.join(': ')}\n`, 'utf8'); - // 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/no-explicit-any -- Old code before rule was applied, Old code before rule was applied }).catch((error: any) => { console.error('Cannot write to log file:', error); // eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied @@ -335,15 +349,19 @@ class Logger { return; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public error(...object: any[]) { return this.log(LogLevel.Error, null, ...object); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public warn(...object: any[]) { return this.log(LogLevel.Warn, null, ...object); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public info(...object: any[]) { return this.log(LogLevel.Info, null, ...object); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied public debug(...object: any[]) { return this.log(LogLevel.Debug, null, ...object); } diff --git a/packages/utils/dom.ts b/packages/utils/dom.ts index e7e11d95e..446ca3907 100644 --- a/packages/utils/dom.ts +++ b/packages/utils/dom.ts @@ -1,5 +1,6 @@ /* eslint-disable import/prefer-default-export */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const findParentElementByClassName = (element: any, parentClassName: string) => { while (element) { if (element.classList.contains(parentClassName)) return element; diff --git a/packages/utils/env.ts b/packages/utils/env.ts index 55cecedf2..84954e42e 100644 --- a/packages/utils/env.ts +++ b/packages/utils/env.ts @@ -68,6 +68,7 @@ export const parseEnvFile = (env_file: string, options: Options = {}) => { } catch (error) { if (options.raise) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied (error as any).message = `Environment file could not be read: ${env_file}: ${(error as any).message}`; throw error; } else { @@ -96,6 +97,7 @@ export const parseEnvFile = (env_file: string, options: Options = {}) => { } else { lineVariables.push(line); + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied const key_value = line.match(/^([^=]+)\s*=\s*(.*)$/) as any; const env_key = key_value[1]; diff --git a/packages/utils/execCommand.ts b/packages/utils/execCommand.ts index b1aa0893f..a46fa8eac 100644 --- a/packages/utils/execCommand.ts +++ b/packages/utils/execCommand.ts @@ -8,6 +8,7 @@ interface ExecCommandOptions { showStdout?: boolean; showStderr?: boolean; quiet?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied env?: Record; } diff --git a/packages/utils/html.ts b/packages/utils/html.ts index 57699be19..7608dd5ff 100644 --- a/packages/utils/html.ts +++ b/packages/utils/html.ts @@ -30,6 +30,7 @@ const entitiesInstance = new Entities(); export const htmlentities = entitiesInstance.encode; export const htmlentitiesDecode = entitiesInstance.decode; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const attributesHtml = (attr: Record) => { const output = []; diff --git a/packages/utils/net.ts b/packages/utils/net.ts index ab1c66f20..fc5dd2514 100644 --- a/packages/utils/net.ts +++ b/packages/utils/net.ts @@ -3,6 +3,7 @@ import { msleep } from './time'; import fetch from 'node-fetch'; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const fetchWithRetry = async (url: string, opts: any = null) => { if (!opts) opts = {}; let retry = opts && opts.retry || 3; diff --git a/packages/utils/object.ts b/packages/utils/object.ts index a63a37196..b3b0445a4 100644 --- a/packages/utils/object.ts +++ b/packages/utils/object.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export const objectValueFromPath = (o: any, path: string) => { const elements = path.split('.'); let result = { ...o }; @@ -8,6 +9,7 @@ export const objectValueFromPath = (o: any, path: string) => { return result; }; +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export function checkObjectHasProperties(object: any, properties: string[]) { for (const prop of properties) { if (!(prop in object)) throw new Error(`Missing property "${prop}": ${JSON.stringify(object)}`); diff --git a/packages/utils/splitCommandString.ts b/packages/utils/splitCommandString.ts index cdaab6cd4..26d0a7f5b 100644 --- a/packages/utils/splitCommandString.ts +++ b/packages/utils/splitCommandString.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied export default (command: string, options: any = null) => { options = options || {}; if (!('handleEscape' in options)) {