From 0cb965e7205c49ac9888c4ba86e443cfdc1c35ff Mon Sep 17 00:00:00 2001 From: Merlijn Vos Date: Thu, 4 Jan 2024 10:36:19 +0100 Subject: [PATCH 1/3] @uppy/provider-views: add referrerpolicy to images (#4853) --- packages/@uppy/provider-views/src/Item/components/ItemIcon.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@uppy/provider-views/src/Item/components/ItemIcon.jsx b/packages/@uppy/provider-views/src/Item/components/ItemIcon.jsx index 8a4f9c9d77..d4c3cc352d 100644 --- a/packages/@uppy/provider-views/src/Item/components/ItemIcon.jsx +++ b/packages/@uppy/provider-views/src/Item/components/ItemIcon.jsx @@ -38,7 +38,7 @@ export default (props) => { return default: { const { alt } = props - return {alt} + return {alt} } } } From 7694ead67e80b994ee39275ad70d6f6e75f0557a Mon Sep 17 00:00:00 2001 From: Merlijn Vos Date: Thu, 4 Jan 2024 10:44:35 +0100 Subject: [PATCH 2/3] @uppy/form: use requestSubmit (#4852) --- packages/@uppy/form/src/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/@uppy/form/src/index.js b/packages/@uppy/form/src/index.js index b019ab08ca..c3b73f43c2 100644 --- a/packages/@uppy/form/src/index.js +++ b/packages/@uppy/form/src/index.js @@ -12,6 +12,9 @@ import packageJson from '../package.json' export default class Form extends BasePlugin { static VERSION = packageJson.version + /** @type {HTMLFormElement} */ + form // TODO: make this private (or at least, mark it as readonly) + constructor (uppy, opts) { super(uppy, opts) this.type = 'acquirer' @@ -50,7 +53,7 @@ export default class Form extends BasePlugin { } if (this.opts.submitOnSuccess) { - this.form.submit() + this.form.requestSubmit() } } From 984bdc135d91019e9a2454342ae9333296a17962 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 8 Jan 2024 13:57:02 +0100 Subject: [PATCH 3/3] meta: use `explicit-module-boundary-types` lint rule (#4858) * meta: use `explicit-module-boundary-types` instead of `explicit-function-return-type` It seems to better align with what we are after: stability of public API types. We likely don't need explicit types for all functions, and it's a bit tedious to have when converting an existing plugin. --- .eslintrc.js | 2 +- packages/@uppy/core/src/BasePlugin.ts | 4 ++-- packages/@uppy/core/src/UIPlugin.ts | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) 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', }, }, { diff --git a/packages/@uppy/core/src/BasePlugin.ts b/packages/@uppy/core/src/BasePlugin.ts index 0e2391f2bc..bbb33cc315 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: 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 163148cecb..e84388a721 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: Partial>) => void isTargetDOMEl: boolean @@ -175,7 +176,7 @@ class UIPlugin< ) } - update(state: any): void { + update(state: Partial>): void { if (this.el != null) { this.#updateUI?.(state) }