1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Tools: Implement @typescript-eslint/no-explicit-any rule

This commit is contained in:
Laurent Cozic 2024-04-05 12:16:49 +01:00
parent 42900bcc66
commit 2e2a2b3193
654 changed files with 2971 additions and 170 deletions

View File

@ -112,6 +112,8 @@ module.exports = {
},
],
'@typescript-eslint/no-explicit-any': ['error'],
// -------------------------------
// Formatting
// -------------------------------

View File

@ -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;

View File

@ -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<string, any> = {};
// 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<string, any> = {};
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<any> {
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();

View File

@ -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);

View File

@ -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 = [
{

View File

@ -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'];

View File

@ -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'];

View File

@ -27,6 +27,7 @@ class Command extends BaseCommand {
return new Promise<void>((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<Record<string, any>>((acc, key) => {
const value = Setting.value(key);
if (!verbose && !value) return acc;

View File

@ -13,6 +13,7 @@ class Command extends BaseCommand {
return _('Duplicates the notes matching <note> 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']) {

View File

@ -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);
}

View File

@ -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 });

View File

@ -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;

View File

@ -24,6 +24,7 @@ class Command extends BaseCommand {
return [['--format <format>', _('Destination format: %s', formats.join(', '))], ['--note <note>', _('Exports only the given note.')], ['--notebook <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);
}

View File

@ -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'];

View File

@ -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();

View File

@ -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);

View File

@ -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) {

View File

@ -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;

View File

@ -14,6 +14,7 @@ class Command extends BaseCommand {
return _('Moves the given <item> 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'];

View File

@ -14,6 +14,7 @@ class Command extends BaseCommand {
return _('Renames the given <item> (note or notebook) to <name>.');
}
// 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'];

View File

@ -12,6 +12,7 @@ class Command extends BaseCommand {
return _('Restore the items matching <pattern> 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'];

View File

@ -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;

View File

@ -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;

View File

@ -22,6 +22,7 @@ class Command extends BaseCommand {
return _('Sets the property <name> of the given <note> 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_,

View File

@ -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<string, any> = {
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<string, any> = {};
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;

View File

@ -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(' '));

View File

@ -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 <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') {

View File

@ -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']));

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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';

View File

@ -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);

View File

@ -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') {

View File

@ -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();

View File

@ -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);

View File

@ -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');
}));

View File

@ -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<string, any> = {
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);

View File

@ -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 });
};

View File

@ -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<string, any>;
}

View File

@ -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);

View File

@ -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<any>((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}`));

View File

@ -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<string, any>;
}
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;
}

View File

@ -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<any> {
// If running inside a package, the command line, instead of being "node.exe <path> <flags>" is "joplin.exe <flags>" 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(),

View File

@ -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,

View File

@ -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');

View File

@ -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,

View File

@ -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,

View File

@ -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');

View File

@ -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') : '';

View File

@ -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;

View File

@ -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) {

View File

@ -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<any, any> {
// 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<any, any> {
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<any, any> {
);
}
// 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<any, any> {
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<string, any> = {
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<any, any> {
);
}
// 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<any, any> {
return description ? <div style={this.descriptionStyle(themeId)}>{description}</div> : 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<any, any> {
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<any, any> {
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<any, any> {
<select
value={value}
style={selectStyle}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
onChange={(event: any) => {
updateSettingValue(key, event.target.value);
}}
@ -449,6 +464,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
</div>
);
} else if (md.type === Setting.TYPE_STRING) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
const inputStyle: any = { ...textInputBaseStyle, width: '50%',
minWidth: '20em' };
const inputType = md.secure === true ? 'password' : 'text';
@ -476,6 +492,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
return cmdString;
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
const onPathChange = (event: any) => {
if (md.subType === 'file_path_and_args') {
const cmd = splitCmd(this.state.settings[key]);
@ -486,6 +503,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
}
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
const onArgsChange = (event: any) => {
const cmd = splitCmd(this.state.settings[key]);
cmd[1] = event.target.value;
@ -522,6 +540,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
<input
type={inputType}
style={inputStyle}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
onChange={(event: any) => {
onArgsChange(event);
}}
@ -547,6 +566,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
<input
type={inputType}
style={{ ...inputStyle, marginBottom: 0, marginRight: 5 }}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
onChange={(event: any) => {
onPathChange(event);
}}
@ -567,6 +587,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
</div>
);
} 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<any, any> {
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<any, any> {
);
}
} 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<any, any> {
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<any, any> {
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<any, any> {
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 ? (
<div style={{ ...theme.textStyle, padding: 10, paddingLeft: 24, backgroundColor: theme.warningBackgroundColor, color: theme.color }}>
{this.restartMessage()}
@ -751,6 +777,7 @@ class ConfigScreenComponent extends React.Component<any, any> {
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
const mapStateToProps = (state: any) => {
return {
themeId: state.settings.theme,

View File

@ -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 (

View File

@ -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;
}

View File

@ -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};

View File

@ -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<any>`
${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)<any>`
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

View File

@ -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;

View File

@ -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[];

View File

@ -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.

View File

@ -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<any>`
display: flex;
justify-content: ${props => props.justifyContent ? props.justifyContent : 'center'};

View File

@ -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<any, any> {
// 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<any, any> {
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
const mapStateToProps = (state: any) => {
return {
themeId: state.settings.theme,

View File

@ -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]);

View File

@ -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);
}, []);

View File

@ -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,
});

View File

@ -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<string, string>;
@ -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 ? <h2>{_('Encryption keys')}</h2> : <a onClick={() => toggleShowDisabledMasterKeys() } style={{ ...theme.urlStyle, display: 'inline-block', marginBottom: 10 }} href="#">{showTable ? _('Hide disabled keys') : _('Show disabled keys')}</a>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
const infoComp: any = null; // isEnabledMasterKeys ? <p>{'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.'}</p> : null;
const tableComp = !showTable ? null : (
<table>

View File

@ -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<Props, State> {
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 };

View File

@ -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: {

View File

@ -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<Props> {
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 (

View File

@ -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

View File

@ -83,6 +83,7 @@ class ImportScreenComponent extends React.Component<Props, State> {
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<Props, State> {
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)

View File

@ -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<Props, State> {
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<Props, State> {
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);
}

View File

@ -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: {

View File

@ -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<Props, State> {
// 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<Props, State> {
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<Props, State> {
}
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<Props, State> {
}
}
// 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<Props, State> {
}
}
// 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<Props, State> {
// 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 <span>{message}</span>;
@ -557,6 +571,7 @@ class MainScreenComponent extends React.Component<Props, State> {
);
}
// 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<Props, State> {
}
}
// 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<Props, State> {
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<Props, State> {
// const viewsToRemove:string[] = [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
const components: any = {
sideBar: () => {
return <Sidebar key={key} />;
@ -854,6 +872,7 @@ class MainScreenComponent extends React.Component<Props, State> {
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<Props, State> {
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}

View File

@ -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) => {

View File

@ -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;

View File

@ -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) => {

View File

@ -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 },

View File

@ -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 () => {

View File

@ -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++) {

View File

@ -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) => {

View File

@ -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) => {

View File

@ -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) => {

View File

@ -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));

View File

@ -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) => {

View File

@ -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) => {

View File

@ -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) => {

View File

@ -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({

View File

@ -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) => {

View File

@ -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) => {

View File

@ -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() });
},

View File

@ -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.

View File

@ -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 () => {

View File

@ -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);
}, []);

View File

@ -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<any[]>([]);
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);

View File

@ -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() });

View File

@ -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;
}

View File

@ -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<number>(0);

View File

@ -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(() => {

View File

@ -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[];
}

Some files were not shown because too many files have changed in this diff Show More