From 301aae87c34540f704870cea725ec25cf9d6bd82 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 5 Jan 2024 22:26:58 +0100 Subject: [PATCH 1/3] meta: use `explicit-module-boundary-types` instead of `explicit-function-return-type` --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4d4fc571ec..a91ba927a4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -471,7 +471,7 @@ module.exports = { files: ['packages/@uppy/*/src/**/*.ts', 'packages/@uppy/*/src/**/*.tsx'], excludedFiles: ['packages/@uppy/**/*.test.ts', 'packages/@uppy/core/src/mocks/*.ts'], rules: { - '@typescript-eslint/explicit-function-return-type': 'error', + '@typescript-eslint/explicit-module-boundary-types': 'error', }, }, { From 5e26a1f2081acd1837abff6bd38ed0f7d0d82ddd Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 5 Jan 2024 22:46:14 +0100 Subject: [PATCH 2/3] fixup! meta: use `explicit-module-boundary-types` instead of `explicit-function-return-type` --- packages/@uppy/core/src/BasePlugin.ts | 4 ++-- packages/@uppy/core/src/UIPlugin.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/@uppy/core/src/BasePlugin.ts b/packages/@uppy/core/src/BasePlugin.ts index 0e2391f2bc..c4a221536a 100644 --- a/packages/@uppy/core/src/BasePlugin.ts +++ b/packages/@uppy/core/src/BasePlugin.ts @@ -13,7 +13,7 @@ import Translator from '@uppy/utils/lib/Translator' import type { I18n, Locale } from '@uppy/utils/lib/Translator' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' -import type { Uppy } from '.' +import type { State, Uppy } from './Uppy' export type PluginOpts = { locale?: Locale @@ -103,7 +103,7 @@ export default class BasePlugin< uninstall(): void {} // eslint-disable-next-line @typescript-eslint/no-unused-vars - update(state: any): void {} + update(state: State): void {} // Called after every state update, after everything's mounted. Debounced. afterUpdate(): void {} diff --git a/packages/@uppy/core/src/UIPlugin.ts b/packages/@uppy/core/src/UIPlugin.ts index 163148cecb..3045af9c2d 100644 --- a/packages/@uppy/core/src/UIPlugin.ts +++ b/packages/@uppy/core/src/UIPlugin.ts @@ -7,6 +7,7 @@ import getTextDirection from '@uppy/utils/lib/getTextDirection' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' import BasePlugin from './BasePlugin.ts' import type { PluginOpts } from './BasePlugin.ts' +import type { State } from './Uppy.ts' /** * Defer a frequent call to the microtask queue. @@ -48,7 +49,7 @@ class UIPlugin< M extends Meta, B extends Body, > extends BasePlugin { - #updateUI: (state: any) => void + #updateUI: (state: State) => void isTargetDOMEl: boolean @@ -175,7 +176,7 @@ class UIPlugin< ) } - update(state: any): void { + update(state: State): void { if (this.el != null) { this.#updateUI?.(state) } From 65e0b37ddaebd9ecd0c546f4e78b3421cd035fe8 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 5 Jan 2024 22:50:43 +0100 Subject: [PATCH 3/3] fixup! meta: use `explicit-module-boundary-types` instead of `explicit-function-return-type` --- packages/@uppy/core/src/BasePlugin.ts | 2 +- packages/@uppy/core/src/UIPlugin.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/@uppy/core/src/BasePlugin.ts b/packages/@uppy/core/src/BasePlugin.ts index c4a221536a..bbb33cc315 100644 --- a/packages/@uppy/core/src/BasePlugin.ts +++ b/packages/@uppy/core/src/BasePlugin.ts @@ -103,7 +103,7 @@ export default class BasePlugin< uninstall(): void {} // eslint-disable-next-line @typescript-eslint/no-unused-vars - update(state: State): void {} + update(state: Partial>): void {} // Called after every state update, after everything's mounted. Debounced. afterUpdate(): void {} diff --git a/packages/@uppy/core/src/UIPlugin.ts b/packages/@uppy/core/src/UIPlugin.ts index 3045af9c2d..e84388a721 100644 --- a/packages/@uppy/core/src/UIPlugin.ts +++ b/packages/@uppy/core/src/UIPlugin.ts @@ -49,7 +49,7 @@ class UIPlugin< M extends Meta, B extends Body, > extends BasePlugin { - #updateUI: (state: State) => void + #updateUI: (state: Partial>) => void isTargetDOMEl: boolean @@ -176,7 +176,7 @@ class UIPlugin< ) } - update(state: State): void { + update(state: Partial>): void { if (this.el != null) { this.#updateUI?.(state) }