1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +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

@ -1,7 +1,9 @@
import Global from '../api/Global';
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
type EventHandler = (callbackId: string, args: any[])=> void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
function createEventHandlers(arg: any, eventHandler: EventHandler) {
if (Array.isArray(arg)) {
for (let i = 0; i < arg.length; i++) {
@ -10,6 +12,7 @@ function createEventHandlers(arg: any, eventHandler: EventHandler) {
return arg;
} else if (typeof arg === 'string' && arg.indexOf('___plugin_event_') === 0) {
const callbackId = arg;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
return async (...args: any[]) => {
const result = await eventHandler(callbackId, args);
return result;
@ -25,10 +28,13 @@ function createEventHandlers(arg: any, eventHandler: EventHandler) {
return arg;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
export default async function executeSandboxCall(pluginId: string, sandbox: Global, path: string, args: any[], eventHandler: EventHandler) {
const pathFragments = path.split('.');
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
let parent: any = null;
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
let fn: any = sandbox;
if (!fn) throw new Error(`No sandbox for plugin ${pluginId}`); // Sanity check as normally cannot happen