@uppy: upgrade biome and more improvements (#6244)

- This PR upgrades `biome` from `2.0.5` -> `2.1.2` and adds two new
rules
-
[noUnusedImports](https://biomejs.dev/linter/rules/no-unused-private-class-members)
( we already had suppressions for this rule in code, but the rule itself
was never enabled in the config )
-
[noUnusedPrivateClassMembers](https://biomejs.dev/linter/rules/no-unused-private-class-members/)
- remove stale suppressions. 
- remove stale code.

---------

Co-authored-by: Mikael Finstad <finstaden@gmail.com>
This commit is contained in:
Prakash 2026-05-21 09:58:03 +05:30 committed by GitHub
parent 9143d41bc2
commit 5519b84409
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
111 changed files with 432 additions and 449 deletions

View file

@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.0.5/schema.json",
"$schema": "https://biomejs.dev/schemas/2.4.15/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
@ -14,10 +14,11 @@
"bin/**",
"e2e/**",
"private/**",
"!packages/**/{dist,lib}/**",
"!packages/**/{dist,lib}",
"!node_modules",
"!.svelte-kit",
"!packages/@uppy/components/src/input.css"
"!packages/@uppy/components/src/input.css",
"!examples/angular/**/*.html"
]
},
"formatter": {
@ -25,20 +26,11 @@
"indentStyle": "space",
"formatWithErrors": true
},
"html": {
"experimentalFullSupportEnabled": true
},
"linter": {
"enabled": true,
"includes": [
"packages/**",
"examples/**",
"scripts/**",
"private/**",
"!packages/**/{dist,lib}/**",
"!node_modules",
"!.svelte-kit",
"!packages/@uppy/components/src/input.css",
"!**/*.vue",
"!**/*.svelte"
],
"rules": {
"recommended": true,
"suspicious": {
@ -48,37 +40,26 @@
"useExhaustiveDependencies": "error",
"useHookAtTopLevel": "error",
"noUnusedFunctionParameters": "off",
"noUnusedImports": "error",
"noUnusedPrivateClassMembers": "error",
"noUnusedVariables": {
"level": "error",
"options": {
"ignoreRestSiblings": true
}
}
},
"noNestedComponentDefinitions": "error",
"noReactPropAssignments": "error"
},
"style": {
"noNonNullAssertion": "off"
},
"a11y": {
"noSvgWithoutTitle": "off"
},
"nursery": {
"noNestedComponentDefinitions": "error",
"noReactPropAssign": "error"
"noSvgWithoutTitle": "off",
"useSemanticElements": "off"
}
}
},
"overrides": [
{
"includes": ["packages/@uppy/companion/**"],
"linter": {
"rules": {
"complexity": {
"useLiteralKeys": "off"
}
}
}
}
],
"javascript": {
"formatter": {
"quoteStyle": "single",
@ -92,5 +73,36 @@
"organizeImports": "on"
}
}
},
"overrides": [
{
"includes": ["packages/@uppy/companion/**"],
"linter": {
"rules": {
"complexity": {
"useLiteralKeys": "off"
}
}
}
},
{
"includes": ["**/*.vue", "**/*.svelte", "packages/@uppy/vue/**/*.ts"],
"linter": {
"rules": {
"correctness": {
"useHookAtTopLevel": "off",
"useExhaustiveDependencies": "off"
}
}
}
},
{
"includes": ["examples/nextjs/**/*.css"],
"css": {
"parser": {
"tailwindDirectives": true
}
}
}
]
}

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Uppy AWS upload example</title>
@ -24,7 +24,8 @@
</footer>
<noscript>You need JavaScript to run this example.</noscript>
<script type="module">
import { Uppy, Dashboard, AwsS3 } from './uppy.min.mjs'
import { AwsS3, Dashboard, Uppy } from './uppy.min.mjs'
function onUploadComplete(result) {
console.log(
'Upload complete! Weve uploaded these files:',
@ -34,7 +35,7 @@
function onUploadSuccess(file, data) {
console.log(
'Upload success! Weve uploaded this file:',
file.meta['name'],
file.meta.name,
)
}
{

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Uppy AWS upload example</title>
@ -16,7 +16,8 @@
</footer>
<noscript>You need JavaScript to run this example.</noscript>
<script type="module">
import { Uppy, Dashboard, AwsS3 } from './uppy.min.mjs'
import { AwsS3, Dashboard, Uppy } from './uppy.min.mjs'
/**
* This generator transforms a deep object into URL-encodable pairs
* to work with `URLSearchParams` on the client and `body-parser` on the server.
@ -258,7 +259,7 @@
uppy.on('upload-success', (file, data) => {
console.log(
'Upload success! Weve uploaded this file:',
file.meta['name'],
file.meta.name,
)
})
}

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

View file

@ -11,14 +11,14 @@
</head>
<body>
<noscript>You need JavaScript enabled for this example to work.</noscript>
<button id="uppyModalOpener">Open Modal</button>
<button type="button" id="uppyModalOpener">Open Modal</button>
<script type="module">
import {
Uppy,
Dashboard,
Webcam,
Tus,
Uppy,
Webcam,
} from 'https://releases.transloadit.com/uppy/v4.18.0/uppy.min.mjs'
const uppy = new Uppy({ debug: true, autoProceed: false })

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

View file

@ -10,14 +10,14 @@
/>
</head>
<body>
<button id="uppyModalOpener">Open Modal</button>
<button type="button" id="uppyModalOpener">Open Modal</button>
<noscript>This web page requires JavaScript to work properly.</noscript>
<script type="module">
import {
Uppy,
Dashboard,
GoogleDrive,
Tus,
Uppy,
} from 'https://releases.transloadit.com/uppy/v4.18.0/uppy.min.mjs'
const uppy = new Uppy({ debug: true, autoProceed: false })

View file

@ -1,4 +1,4 @@
/** biome-ignore-all lint/nursery/useUniqueElementIds: it's fine */
/** biome-ignore-all lint/correctness/useUniqueElementIds: it's fine */
import Uppy, { type UppyFile } from '@uppy/core'
import UppyImageEditor from '@uppy/image-editor'
import {

View file

@ -20,7 +20,7 @@ const { getButtonProps, getInputProps: getFileInputProps } = useFileInput()
>
<div class="flex items-center justify-center gap-4">
<input {...getFileInputProps()} class="hidden" />
<button
<button type="button"
{...getButtonProps()}
class="hover:bg-gray-100 transition-colors p-2 rounded-md flex flex-col items-center gap-2 text-sm"
>
@ -30,7 +30,7 @@ const { getButtonProps, getInputProps: getFileInputProps } = useFileInput()
Device
</button>
<button
<button type="button"
onclick={() => openModal('webcam')}
class="hover:bg-gray-100 transition-colors p-2 rounded-md flex flex-col items-center gap-2 text-sm"
>
@ -40,7 +40,7 @@ const { getButtonProps, getInputProps: getFileInputProps } = useFileInput()
Webcam
</button>
<button
<button type="button"
onclick={() => openModal('screen-capture')}
class="hover:bg-gray-100 transition-colors p-2 rounded-md flex flex-col items-center gap-2 text-sm"
>
@ -50,7 +50,7 @@ const { getButtonProps, getInputProps: getFileInputProps } = useFileInput()
Screen Capture
</button>
<button
<button type="button"
onclick={() => openModal('dropbox')}
class="hover:bg-gray-100 transition-colors p-2 rounded-md flex flex-col items-center gap-2 text-sm"
>

View file

@ -24,6 +24,7 @@ const editor = useImageEditor({ file })
</div>
<div class="mb-4">
<!-- biome-ignore lint/a11y/useAltText: alt is provided via editor.getImageProps() spread -->
<img
class="w-full max-h-[400px] rounded-lg border-2"
{...editor.getImageProps()}
@ -41,31 +42,31 @@ const editor = useImageEditor({ file })
</div>
<div class="flex gap-2 flex-wrap mb-4">
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
{...editor.getRotateButtonProps(-90)}
>
↶ -90°
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
{...editor.getRotateButtonProps(90)}
>
↷ +90°
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
{...editor.getFlipHorizontalButtonProps()}
>
⇆ Flip
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
{...editor.getZoomButtonProps(0.1)}
>
+ Zoom
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
{...editor.getZoomButtonProps(-0.1)}
>
@ -74,25 +75,25 @@ const editor = useImageEditor({ file })
</div>
<div class="flex gap-2 flex-wrap mb-4">
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
{...editor.getCropSquareButtonProps()}
>
1:1
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
{...editor.getCropLandscapeButtonProps()}
>
16:9
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
{...editor.getCropPortraitButtonProps()}
>
9:16
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
{...editor.getResetButtonProps()}
>
@ -101,13 +102,13 @@ const editor = useImageEditor({ file })
</div>
<div class="flex gap-4 justify-end">
<button
<button type="button"
class="bg-gray-500 text-white px-4 py-2 rounded-md"
{...editor.getCancelButtonProps({ onClick: close })}
>
Cancel
</button>
<button
<button type="button"
class="bg-green-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-green-300"
{...editor.getSaveButtonProps({ onClick: close })}
>

View file

@ -42,36 +42,37 @@ const {
<p>{mediaError.message ? `Camera error: ${mediaError.message}` : 'An unknown camera error occurred.'}</p>
</div>
{/if}
<!-- biome-ignore lint/a11y/useMediaCaption: live camera preview does not require captions -->
<video
class="border-2 w-full rounded-lg data-[uppy-mirrored=true]:scale-x-[-1]"
{...videoProps}
></video>
<div class="flex gap-4 flex-wrap mt-4">
<button
<button type="button"
class="bg-blue-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-blue-300"
{...primaryActionButtonProps}
>
{primaryActionButtonLabel}
</button>
<button
<button type="button"
class="bg-blue-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-blue-300"
{...recordButtonProps}
>
Record
</button>
<button
<button type="button"
class="bg-red-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-red-300"
{...stopRecordingButtonProps}
>
Stop
</button>
<button
<button type="button"
class="bg-green-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-green-300"
{...submitButtonProps}
>
Submit
</button>
<button
<button type="button"
class="bg-gray-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-gray-300"
{...discardButtonProps}
>

View file

@ -18,6 +18,7 @@ const dtf = new Intl.DateTimeFormat('en-US', {
timeStyle: 'short',
})
// biome-ignore lint/correctness/noUnusedVariables: used as a Svelte action via use:setFolderCheckboxIndeterminate
function setFolderCheckboxIndeterminate(
node: HTMLInputElement,
item: PartialTreeFolderNode,

View file

@ -14,9 +14,9 @@ let hideUploadButton = false
</script>
<main class="p-5 max-w-xl mx-auto">
<button onclick={() => (disabled = !disabled)}>Toggle dashboard</button>
<button type="button" onclick={() => (disabled = !disabled)}>Toggle dashboard</button>
<Dashboard props={{disabled: disabled}} uppy={uppy} />
<button onclick={() => (hideUploadButton = !hideUploadButton)}>Toggle statusbar</button>
<button type="button" onclick={() => (hideUploadButton = !hideUploadButton)}>Toggle statusbar</button>
<div id="statusbar-container">
<StatusBar props={{ hideUploadButton }} uppy={uppy} />
</div>

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@ -140,7 +140,7 @@
This API is a one-shot upload UI using a modal overlay. Call the
function and receive a listen to an event with upload results ✌️
</p>
<button onclick="openModal()">Open</button>
<button type="button" onclick="openModal()">Open</button>
<h2>uppy.upload()</h2>
<p>An &lt;input type=file&gt; backed by <code>uppy.upload()</code>:</p>

View file

@ -36,7 +36,7 @@ function Footer() {
}
function FormFields(fields) {
// biome-ignore lint/nursery/noNestedComponentDefinitions: not a react component
// biome-ignore lint/correctness/noNestedComponentDefinitions: not a react component
function Field([name, value]) {
if (name === 'transloadit') return ''
let isValueJSON = false
@ -76,7 +76,7 @@ function FormFields(fields) {
}
function UploadsList(uploads) {
// biome-ignore lint/nursery/noNestedComponentDefinitions: not a react component
// biome-ignore lint/correctness/noNestedComponentDefinitions: not a react component
function Upload(upload) {
return `<li>${e(upload.name)}</li>`
}
@ -89,12 +89,12 @@ function UploadsList(uploads) {
}
function ResultsList(results) {
// biome-ignore lint/nursery/noNestedComponentDefinitions: not a react component
// biome-ignore lint/correctness/noNestedComponentDefinitions: not a react component
function Result(result) {
return `<li>${e(result.name)} <a href="${result.ssl_url}" target="_blank">View</a></li>`
}
// biome-ignore lint/nursery/noNestedComponentDefinitions: not a react component
// biome-ignore lint/correctness/noNestedComponentDefinitions: not a react component
function ResultsSection(stepName) {
return `
<h2>${e(stepName)}</h2>

View file

@ -7,7 +7,7 @@
>
<div class="flex items-center justify-center gap-4">
<input v-bind="getFileInputProps()" class="hidden" />
<button
<button type="button"
v-bind="getButtonProps()"
class="hover:bg-gray-100 transition-colors p-2 rounded-md flex flex-col items-center gap-2 text-sm"
>
@ -17,7 +17,7 @@
Device
</button>
<button
<button type="button"
@click="() => props.openModal('webcam')"
class="hover:bg-gray-100 transition-colors p-2 rounded-md flex flex-col items-center gap-2 text-sm"
>
@ -27,7 +27,7 @@
Webcam
</button>
<button
<button type="button"
@click="() => props.openModal('screen-capture')"
class="hover:bg-gray-100 transition-colors p-2 rounded-md flex flex-col items-center gap-2 text-sm"
>
@ -37,7 +37,7 @@
Screen Capture
</button>
<button
<button type="button"
@click="() => props.openModal('dropbox')"
class="hover:bg-gray-100 transition-colors p-2 rounded-md flex flex-col items-center gap-2 text-sm"
>

View file

@ -12,6 +12,7 @@
</div>
<div class="mb-4">
<!-- biome-ignore lint/a11y/useAltText: alt is provided via editor.getImageProps() spread -->
<img
class="w-full max-h-[400px] rounded-lg border-2"
v-bind="editor.getImageProps()"
@ -29,31 +30,31 @@
</div>
<div class="flex gap-2 flex-wrap mb-4">
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
v-bind="editor.getRotateButtonProps(-90)"
>
-90°
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
v-bind="editor.getRotateButtonProps(90)"
>
+90°
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
v-bind="editor.getFlipHorizontalButtonProps()"
>
Flip
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
v-bind="editor.getZoomButtonProps(0.1)"
>
+ Zoom
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
v-bind="editor.getZoomButtonProps(-0.1)"
>
@ -62,25 +63,25 @@
</div>
<div class="flex gap-2 flex-wrap mb-4">
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
v-bind="editor.getCropSquareButtonProps()"
>
1:1
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
v-bind="editor.getCropLandscapeButtonProps()"
>
16:9
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
v-bind="editor.getCropPortraitButtonProps()"
>
9:16
</button>
<button
<button type="button"
class="bg-gray-200 px-3 py-1 rounded disabled:opacity-50"
v-bind="editor.getResetButtonProps()"
>
@ -89,13 +90,13 @@
</div>
<div class="flex gap-4 justify-end">
<button
<button type="button"
class="bg-gray-500 text-white px-4 py-2 rounded-md"
v-bind="editor.getCancelButtonProps({ onClick: close })"
>
Cancel
</button>
<button
<button type="button"
class="bg-green-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-green-300"
v-bind="editor.getSaveButtonProps({ onClick: close })"
>

View file

@ -24,31 +24,31 @@
<track kind="captions" />
</video>
<div class="flex gap-4 flex-wrap mt-4">
<button
<button type="button"
class="bg-blue-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-blue-300"
v-bind="primaryActionButtonProps"
>
{{ primaryActionButtonLabel }}
</button>
<button
<button type="button"
class="bg-blue-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-blue-300"
v-bind="recordButtonProps"
>
Record
</button>
<button
<button type="button"
class="bg-red-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-red-300"
v-bind="stopRecordingButtonProps"
>
Stop
</button>
<button
<button type="button"
class="bg-green-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-green-300"
v-bind="submitButtonProps"
>
Submit
</button>
<button
<button type="button"
class="bg-gray-500 text-white px-4 py-2 rounded-md disabled:opacity-50 disabled:bg-gray-300"
v-bind="discardButtonProps"
>

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

View file

@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

View file

@ -29,7 +29,7 @@
"release": "changeset publish"
},
"devDependencies": {
"@biomejs/biome": "2.0.5",
"@biomejs/biome": "2.4.15",
"@changesets/changelog-github": "^0.5.1",
"@changesets/cli": "patch:@changesets/cli@npm%3A2.29.5#~/.yarn/patches/@changesets-cli-npm-2.29.5-68d8030bf3.patch",
"npm-run-all": "^4.1.5",

View file

@ -284,7 +284,9 @@ export default class Audio<M extends Meta, B extends Body> extends UIPlugin<
#stop = async () => {
if (this.#stream) {
const audioTracks = this.#stream.getAudioTracks()
audioTracks.forEach((track) => track.stop())
audioTracks.forEach((track) => {
track.stop()
})
}
if (this.#recorder) {

View file

@ -263,9 +263,9 @@ export class HTTPCommunicationQueue<M extends Meta, B extends Body> {
const data = chunk.getData()
if (method.toUpperCase() === 'POST') {
const formData = new FormData()
Object.entries(fields!).forEach(([key, value]) =>
formData.set(key, value),
)
Object.entries(fields!).forEach(([key, value]) => {
formData.set(key, value)
})
formData.set('file', data)
body = formData
} else {

View file

@ -256,6 +256,7 @@ class MultipartUploader<M extends Meta, B extends Body> {
else this.pause()
}
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: accessed via Symbol in tests
private [Symbol.for('uppy test: getChunkState')]() {
return this.#chunkState
}

View file

@ -110,5 +110,7 @@ try {
await Promise.all(companions)
} finally {
loadBalancer?.close()
companions.forEach((companion) => companion.kill())
companions.forEach((companion) => {
companion.kill()
})
}

View file

@ -806,9 +806,9 @@ export default class Uploader {
if (this.options.useFormData) {
const formData = new FormData()
Object.entries(this.metadata).forEach(([key, value]) =>
formData.append(key, value),
)
Object.entries(this.metadata).forEach(([key, value]) => {
formData.append(key, value)
})
// see https://github.com/octet-stream/form-data/blob/73a5a24e635938026538673f94cbae1249a3f5cc/readme.md?plain=1#L232
formData.set(this.fieldname, {

View file

@ -76,7 +76,7 @@ const getNextPagePath = (
currentQuery: Record<string, string>,
currentPath: string | undefined,
): string | null => {
if (!data.paging || !data.paging.cursors) {
if (!data.paging?.cursors) {
return null
}

View file

@ -1,7 +1,7 @@
import type { S3Client } from '@aws-sdk/client-s3'
import type { CompanionRuntimeOptions } from './companion-options.js'
import type Provider from '../server/provider/Provider.js'
import { CredentialsFetchResponse } from '../schemas/companion.js'
import type Provider from '../server/provider/Provider.js'
import type { CompanionRuntimeOptions } from './companion-options.js'
export type BuildUrl = (
subPath: string,

View file

@ -1,5 +1,5 @@
declare module 'express-interceptor' {
import type { Request, Response, RequestHandler } from 'express'
import type { Request, RequestHandler, Response } from 'express'
type InterceptorConfig = {
isInterceptable: () => boolean

View file

@ -41,7 +41,7 @@ describe('providers requests with remote oauth keys', () => {
// mocking request module used to fetch custom oauth credentials
nock('http://localhost:2111')
.post('/zoom-keys')
// @ts-ignore
// @ts-expect-error
.reply((uri, { provider, parameters }) => {
if (provider !== 'zoom' || parameters !== 'ZOOM-CREDENTIALS-PARAMS')
return [400]

View file

@ -489,9 +489,9 @@ describe('provider file gets downloaded from', () => {
})
describe('connect to provider', () => {
test.each(providerNames)(
'connect to %s via grant.js endpoint',
async (providerName: string) => {
test.each(
providerNames,
)('connect to %s via grant.js endpoint', async (providerName: string) => {
const oauthProvider = oauthProviders[providerName]
if (oauthProvider == null) return
@ -504,8 +504,7 @@ describe('connect to provider', () => {
'Location',
`http://localhost:3020/connect/${oauthProvider}?state=${OAUTH_STATE}`,
)
},
)
})
})
describe('logout of provider', () => {

View file

@ -82,9 +82,9 @@ describe('url get', () => {
.then((res) => expect(res.body.token).toBeTruthy())
})
test.each(invalids)(
'downloads are not instantiated for invalid urls',
async (urlCase) => {
test.each(
invalids,
)('downloads are not instantiated for invalid urls', async (urlCase) => {
nockUrl()
return request(await getMockServer())
@ -97,6 +97,5 @@ describe('url get', () => {
})
.expect(400)
.then((res) => expect(res.body.error).toBe('Invalid request body'))
},
)
})
})

View file

@ -2,7 +2,6 @@ import prettierBytes from '@transloadit/prettier-bytes'
import type { DefinePluginOpts, PluginOpts } from '@uppy/core'
import { BasePlugin, type Uppy } from '@uppy/core'
import type { Body, LocalUppyFile, Meta, UppyFile } from '@uppy/utils'
// @ts-ignore
import { getFileNameAndExtension, RateLimitedQueue } from '@uppy/utils'
import CompressorJS from 'compressorjs'
import locale from './locale.js'

View file

@ -1,6 +1,6 @@
import prettierBytes from '@transloadit/prettier-bytes'
import type { Body, I18n, Meta, UppyFile } from '@uppy/utils'
// @ts-ignore untyped
// @ts-expect-error untyped
import match from 'mime-match'
import type { NonNullableUppyOptions, State } from './Uppy.js'
@ -206,4 +206,4 @@ class Restricter<M extends Meta, B extends Body> {
}
}
export { Restricter, defaultOptions, RestrictionError }
export { defaultOptions, Restricter, RestrictionError }

View file

@ -173,26 +173,26 @@ describe('src/Core', () => {
core.use(AcquirerPlugin1)
core.use(AcquirerPlugin2)
core.iteratePlugins((plugin) => {
// @ts-ignore
// @ts-expect-error
plugin.run('hello')
})
expect(
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: getPlugins')]('acquirer')[0].mocks.run.mock
.calls.length,
).toEqual(1)
expect(
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: getPlugins')]('acquirer')[0].mocks.run.mock
.calls[0],
).toEqual(['hello'])
expect(
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: getPlugins')]('acquirer')[1].mocks.run.mock
.calls.length,
).toEqual(1)
expect(
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: getPlugins')]('acquirer')[1].mocks.run.mock
.calls[0],
).toEqual(['hello'])
@ -203,7 +203,7 @@ describe('src/Core', () => {
core.use(AcquirerPlugin1)
core.use(AcquirerPlugin2)
expect(
// @ts-ignore
// @ts-expect-error
Object.keys(core[Symbol.for('uppy test: getPlugins')]('acquirer'))
.length,
).toEqual(2)
@ -211,14 +211,14 @@ describe('src/Core', () => {
const plugin = core.getPlugin('TestSelector1')
core.removePlugin(plugin!)
expect(
// @ts-ignore
// @ts-expect-error
Object.keys(core[Symbol.for('uppy test: getPlugins')]('acquirer'))
.length,
).toEqual(1)
// @ts-ignore
// @ts-expect-error
expect(plugin.mocks.uninstall.mock.calls.length).toEqual(1)
expect(
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: getPlugins')]('acquirer')[0].mocks.run.mock
.calls.length,
).toEqual(0)
@ -232,22 +232,22 @@ describe('src/Core', () => {
core.use(AcquirerPlugin2)
core.updateAll({ foo: 'bar' })
expect(
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: getPlugins')]('acquirer')[0].mocks.update
.mock.calls.length,
).toEqual(1)
expect(
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: getPlugins')]('acquirer')[0].mocks.update
.mock.calls[0],
).toEqual([{ foo: 'bar' }])
expect(
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: getPlugins')]('acquirer')[1].mocks.update
.mock.calls.length,
).toEqual(1)
expect(
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: getPlugins')]('acquirer')[1].mocks.update
.mock.calls[0],
).toEqual([{ foo: 'bar' }])
@ -285,12 +285,12 @@ describe('src/Core', () => {
expect(core.getState()).toEqual(newState)
expect(
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: getPlugins')]('acquirer')[0].mocks.update
.mock.calls[1],
).toEqual([newState])
expect(
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: getPlugins')]('acquirer')[1].mocks.update
.mock.calls[1],
).toEqual([newState])
@ -405,7 +405,7 @@ describe('src/Core', () => {
})
const fileIDs = Object.keys(core.getState().files)
// @ts-ignore
// @ts-expect-error
const id = core[Symbol.for('uppy test: createUpload')](fileIDs)
expect(core.getState().currentUploads[id]).toBeDefined()
@ -443,7 +443,7 @@ describe('src/Core', () => {
})
const fileIDs = Object.keys(core.getState().files)
// @ts-ignore
// @ts-expect-error
const id = core[Symbol.for('uppy test: createUpload')](fileIDs)
expect(core.getState().currentUploads[id]).toBeDefined()
@ -481,7 +481,7 @@ describe('src/Core', () => {
})
const fileIDs = Object.keys(core.getState().files)
// @ts-ignore
// @ts-expect-error
const id = core[Symbol.for('uppy test: createUpload')](fileIDs)
expect(core.getState().currentUploads[id]).toBeDefined()
@ -522,7 +522,7 @@ describe('src/Core', () => {
})
const fileIDs = Object.keys(core.getState().files)
// @ts-ignore
// @ts-expect-error
const id = core[Symbol.for('uppy test: createUpload')](fileIDs)
expect(core.getState().currentUploads[id]).toBeDefined()
@ -543,7 +543,7 @@ describe('src/Core', () => {
const coreCancelEventMock = vi.fn()
const coreStateUpdateEventMock = vi.fn()
// @ts-ignore
// @ts-expect-error
const plugin = core[Symbol.for('uppy test: getPlugins')]('acquirer')[0]
core.on('cancel-all', coreCancelEventMock)
@ -939,7 +939,7 @@ describe('src/Core', () => {
source: 'vi',
name: 'foo.webm',
type: 'video/webm; codecs="vp8, opus"',
// @ts-ignore
// @ts-expect-error
data: new File([sampleImage], {
type: 'video/webm; codecs="vp8, opus"',
}),
@ -1106,7 +1106,7 @@ describe('src/Core', () => {
it('does not dedupe different files', async () => {
const core = new Core()
const data = new Blob([sampleImage], { type: 'image/jpeg' })
// @ts-ignore
// @ts-expect-error
data.lastModified = 1562770350937
core.addFile({
@ -1165,7 +1165,6 @@ describe('src/Core', () => {
fileIDs.forEach((fileID) => {
const file = core.getFile(fileID)
if (file.name != null && /bar/.test(file.name)) {
// @ts-ignore
core.emit(
'upload-error',
file,
@ -1199,9 +1198,8 @@ describe('src/Core', () => {
it('should only upload files that are not already assigned to another upload id', () => {
const core = new Core()
// @ts-ignore
// @ts-expect-error
core.store.state.currentUploads = {
// @ts-ignore
upload1: {
fileIDs: [
'uppy-file1/jpg-1e-image/jpeg',
@ -1209,7 +1207,6 @@ describe('src/Core', () => {
'uppy-file3/jpg-1e-image/jpeg',
],
},
// @ts-ignore
upload2: {
fileIDs: [
'uppy-file4/jpg-1e-image/jpeg',
@ -1224,21 +1221,21 @@ describe('src/Core', () => {
source: 'vi',
name: 'foo.jpg',
type: 'image/jpeg',
// @ts-ignore
// @ts-expect-error
data: new Uint8Array(),
})
core.addFile({
source: 'vi',
name: 'bar.jpg',
type: 'image/jpeg',
// @ts-ignore
// @ts-expect-error
data: new Uint8Array(),
})
core.addFile({
source: 'file3',
name: 'file3.jpg',
type: 'image/jpeg',
// @ts-ignore
// @ts-expect-error
data: new Uint8Array(),
})
@ -1344,7 +1341,6 @@ describe('src/Core', () => {
fileIDs.forEach((fileID) => {
const file = core.getFile(fileID)
if (!hasError) {
// @ts-ignore
core.emit('upload-error', file, new Error('foo'))
hasError = true
}
@ -1548,7 +1544,7 @@ describe('src/Core', () => {
core.setFileMeta(fileId, { caption: 'Test caption' })
// Trigger the dashboard:file-edit-complete event to update validation state
// @ts-ignore
// @ts-expect-error
core.emit('dashboard:file-edit-complete', core.getFile(fileId))
const updatedFile = core.getFile(fileId)
@ -1609,7 +1605,7 @@ describe('src/Core', () => {
// Fix metadata for first file only
core.setFileMeta(fileId1, { caption: 'Fixed caption' })
// @ts-ignore
// @ts-expect-error
core.emit('dashboard:file-edit-complete', core.getFile(fileId1))
// Add an error to file1 so it can be retried
@ -1676,7 +1672,7 @@ describe('src/Core', () => {
source: 'vi',
name: 'empty.dat',
type: 'application/octet-stream',
// @ts-ignore
// @ts-expect-error
data: new File([new Uint8Array(1000)], {
type: 'application/octet-stream',
}),
@ -1768,7 +1764,7 @@ describe('src/Core', () => {
source: 'vi',
name: 'foo1.png',
type: 'image/png',
// @ts-ignore
// @ts-expect-error
data: new File([sampleImage], { type: 'image/png' }),
})
throw new Error('should have thrown')
@ -1786,7 +1782,7 @@ describe('src/Core', () => {
source: 'vi',
name: 'foo1.png',
type: 'image/png',
// @ts-ignore
// @ts-expect-error
data: new File([sampleImage], { type: 'image/png' }),
})
throw new Error('should have thrown')
@ -1813,7 +1809,7 @@ describe('src/Core', () => {
source: 'vi',
name: 'foo1.png',
type: 'image/png',
// @ts-ignore
// @ts-expect-error
data: new File([sampleImage], { type: 'image/png' }),
})
}).not.toThrow()
@ -1835,7 +1831,7 @@ describe('src/Core', () => {
any
>({
store: DeepFrozenStore(),
// @ts-ignore
// @ts-expect-error
meta: { foo2: 'bar2' },
})
core.setMeta({ foo: 'bar', bur: 'mur' })
@ -1879,7 +1875,7 @@ describe('src/Core', () => {
name: 'foo.jpg',
type: 'image/jpeg',
meta: {
// @ts-ignore
// @ts-expect-error
resize: 5000,
},
data: testImage,
@ -1910,7 +1906,7 @@ describe('src/Core', () => {
core.emit('upload-start', [core.getFile(fileId)])
// @ts-ignore
// @ts-expect-error
core.emit('upload-progress', file, {
bytesUploaded: 12345,
bytesTotal: 17175,
@ -1923,7 +1919,7 @@ describe('src/Core', () => {
uploadStarted: expect.any(Number),
})
// @ts-ignore
// @ts-expect-error
core.emit('upload-progress', file, {
bytesUploaded: 17175,
bytesTotal: 17175,
@ -1951,13 +1947,13 @@ describe('src/Core', () => {
core.addUploader(async ([id]) => {
core.emit('upload-start', [core.getFile(id)])
await progressPromise
// @ts-ignore deprecated
// @ts-expect-error deprecated
core.emit('upload-progress', core.getFile(id), {
bytesTotal: 3456,
bytesUploaded: 1234,
})
await finishPromise
// @ts-ignore deprecated
// @ts-expect-error deprecated
core.emit('upload-success', core.getFile(id), { uploadURL: 'lol' })
})
@ -1965,11 +1961,11 @@ describe('src/Core', () => {
source: 'dropbox',
name: 'foo.jpg',
type: 'image/jpeg',
// @ts-ignore
// @ts-expect-error
data: {},
})
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: updateTotalProgress')]()
const uploadStartedPromise = new Promise((resolve) =>
@ -1985,7 +1981,7 @@ describe('src/Core', () => {
bytesTotal: null,
})
// @ts-ignore
// @ts-expect-error
proceedUpload()
// wait for progress event
await progressPromise
@ -1999,7 +1995,7 @@ describe('src/Core', () => {
expect(core.getState().totalProgress).toBe(36)
// @ts-ignore
// @ts-expect-error
finishUpload()
// wait for success event
await finishPromise
@ -2021,7 +2017,7 @@ describe('src/Core', () => {
core.once('file-added', (file) => {
core.emit('upload-start', [file])
// @ts-ignore
// @ts-expect-error
core.emit('upload-progress', file, {
bytesTotal: 3456,
bytesUploaded: 1234,
@ -2031,16 +2027,15 @@ describe('src/Core', () => {
source: 'dropbox',
name: 'foo.jpg',
type: 'image/jpeg',
// @ts-ignore
// @ts-expect-error
data: {},
})
core.once('file-added', (file) => {
core.emit('upload-start', [file])
core.emit('upload-progress', file, {
// @ts-ignore
bytesTotal: null,
// @ts-ignore
// @ts-expect-error
bytesUploaded: null,
})
})
@ -2048,11 +2043,11 @@ describe('src/Core', () => {
source: 'dropbox',
name: 'bar.jpg',
type: 'image/jpeg',
// @ts-ignore
// @ts-expect-error
data: {},
})
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: updateTotalProgress')]()
// foo.jpg at 35%, bar.jpg has unknown size and will not be counted
@ -2082,27 +2077,27 @@ describe('src/Core', () => {
const [file1, file2] = core.getFiles()
core.setFileState(file1.id, {
// @ts-ignore suddenly dates??
// @ts-expect-error suddenly dates??
progress: { ...file1.progress, uploadStarted: new Date() },
})
core.setFileState(file2.id, {
// @ts-ignore suddenly dates??
// @ts-expect-error suddenly dates??
progress: { ...file2.progress, uploadStarted: new Date() },
})
// @ts-ignore test does not care about missing properties
// @ts-expect-error test does not care about missing properties
core.emit('upload-progress', core.getFile(file1.id), {
bytesUploaded: 12345,
bytesTotal: 17175,
})
// @ts-ignore test does not care about missing properties
// @ts-expect-error test does not care about missing properties
core.emit('upload-progress', core.getFile(file2.id), {
bytesUploaded: 10201,
bytesTotal: 17175,
})
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: updateTotalProgress')]()
expect(core.getState().totalProgress).toEqual(66)
@ -2126,27 +2121,27 @@ describe('src/Core', () => {
const [file1, file2] = core.getFiles()
core.setFileState(file1.id, {
// @ts-ignore suddenly dates??
// @ts-expect-error suddenly dates??
progress: { ...file1.progress, uploadStarted: new Date() },
})
core.setFileState(file2.id, {
// @ts-ignore suddenly dates??
// @ts-expect-error suddenly dates??
progress: { ...file2.progress, uploadStarted: new Date() },
})
// @ts-ignore test does not care about missing properties
// @ts-expect-error test does not care about missing properties
core.emit('upload-progress', core.getFile(file1.id), {
bytesUploaded: 12345,
bytesTotal: 17175,
})
// @ts-ignore test does not care about missing properties
// @ts-expect-error test does not care about missing properties
core.emit('upload-progress', core.getFile(file2.id), {
bytesUploaded: 10201,
bytesTotal: 17175,
})
// @ts-ignore
// @ts-expect-error
core[Symbol.for('uppy test: updateTotalProgress')]()
expect(core.getState().totalProgress).toEqual(66)
@ -2199,7 +2194,7 @@ describe('src/Core', () => {
},
},
}
// @ts-ignore
// @ts-expect-error
core.setState(newState)
expect(() => {
core.clear()
@ -2486,14 +2481,13 @@ describe('src/Core', () => {
const core = new Core()
core.setState({
files: {
// @ts-ignore
// @ts-expect-error
fileId: {
id: 'fileId',
name: 'filename',
},
},
})
// @ts-ignore test does not care about missing properties
core.emit(
'upload-error',
core.getFile('fileId'),
@ -2510,9 +2504,9 @@ describe('src/Core', () => {
it('should reset the error state when receiving the upload event', () => {
const core = new Core()
// @ts-ignore test does not care about missing properties
// @ts-expect-error test does not care about missing properties
core.emit('error', { foo: 'bar' })
// @ts-ignore test does not care about missing properties
// @ts-expect-error test does not care about missing properties
core.emit('upload')
expect(core.getState().error).toEqual(null)
})
@ -2529,7 +2523,7 @@ describe('src/Core', () => {
}
afterEach(() => {
// @ts-ignore readonly but whatever
// @ts-expect-error readonly but whatever
globalThis.window.navigator.onLine = RealNavigatorOnline
})
@ -2538,11 +2532,8 @@ describe('src/Core', () => {
const offlineEventMock = vi.fn()
const backOnlineEventMock = vi.fn()
const core = new Core()
// @ts-ignore untyped
core.on('is-offline', offlineEventMock)
// @ts-ignore untyped
core.on('is-online', onlineEventMock)
// @ts-ignore untyped
core.on('back-online', backOnlineEventMock)
mockNavigatorOnline(true)
@ -2689,7 +2680,7 @@ describe('src/Core', () => {
data: testImage,
})
// @ts-ignore accessing private method
// @ts-expect-error accessing private method
core[Symbol.for('uppy test: createUpload')](
Object.keys(core.getState().files),
)
@ -2754,11 +2745,11 @@ describe('src/Core', () => {
// logger.debug should have been called 1 time above,
// but we call log in Cores constructor to output VERSION, hence +1 here
// @ts-ignore
// @ts-expect-error
expect(core.opts.logger.debug.mock.calls.length).toBe(2)
// @ts-ignore
// @ts-expect-error
expect(core.opts.logger.error.mock.calls.length).toBe(2)
// @ts-ignore
// @ts-expect-error
expect(core.opts.logger.warn.mock.calls.length).toBe(1)
})
@ -2781,13 +2772,13 @@ describe('src/Core', () => {
// logger.debug should have been called 1 time above,
// but we call log in Cores constructor to output VERSION, hence +1 here
// @ts-ignore
// @ts-expect-error
expect(core.opts.logger.debug.mock.calls.length).toBe(2)
// @ts-ignore
// @ts-expect-error
expect(core.opts.logger.error.mock.calls.length).toBe(2)
// logger.warn should have been called 1 time above,
// but we warn in Core when using both logger and debug: true, hence +1 here
// @ts-ignore
// @ts-expect-error
expect(core.opts.logger.warn.mock.calls.length).toBe(2)
})
@ -2805,14 +2796,14 @@ describe('src/Core', () => {
// console.debug debug should have been called 2 times above,
// ibut we call log n Core constructor to output VERSION, hence +1 here
// @ts-ignore
// @ts-expect-error
expect(console.debug.mock.calls.length).toBe(3)
// @ts-ignore
// @ts-expect-error
expect(console.error.mock.calls.length).toBe(1)
// @ts-ignore
// @ts-expect-error
console.debug.mockClear()
// @ts-ignore
// @ts-expect-error
console.error.mockClear()
const core2 = new Core({
@ -2825,9 +2816,9 @@ describe('src/Core', () => {
// console.debug debug should have been called 2 times here,
// but we call log in Core constructor to output VERSION, hence +1 here
// @ts-ignore
// @ts-expect-error
expect(console.debug.mock.calls.length).toBe(3)
// @ts-ignore
// @ts-expect-error
expect(console.error.mock.calls.length).toBe(1)
})
@ -2841,9 +2832,9 @@ describe('src/Core', () => {
core.log('beep boop')
core.log('beep beep', 'error')
// @ts-ignore
// @ts-expect-error
expect(console.debug.mock.calls.length).toBe(0)
// @ts-ignore
// @ts-expect-error
expect(console.error.mock.calls.length).toBe(1)
})
})

View file

@ -25,7 +25,7 @@ import {
Translator,
} from '@uppy/utils'
import throttle from 'lodash/throttle.js'
// @ts-ignore untyped
// @ts-expect-error untyped
import ee from 'namespace-emitter'
import { nanoid } from 'nanoid/non-secure'
import type { h } from 'preact'
@ -511,7 +511,7 @@ export class Uppy<
// Exposing uppy object on window for debugging and testing
if (this.opts.debug && typeof window !== 'undefined') {
// @ts-ignore Mutating the global object for debug purposes
// @ts-expect-error Mutating the global object for debug purposes
window[this.opts.id] = this
}
@ -1592,6 +1592,7 @@ export class Uppy<
{ leading: true, trailing: true },
)
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: accessed via Symbol in tests
private [Symbol.for('uppy test: updateTotalProgress')]() {
return this.#updateTotalProgress()
}
@ -1977,6 +1978,7 @@ export class Uppy<
return undefined
}
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: accessed via Symbol in tests
private [Symbol.for('uppy test: getPlugins')](
type: string,
): UnknownPlugin<M, B>[] {
@ -2181,6 +2183,7 @@ export class Uppy<
return uploadID
}
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: accessed via Symbol in tests
private [Symbol.for('uppy test: createUpload')](...args: any[]): string {
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/47595
return this.#createUpload(...args)

View file

@ -20,4 +20,4 @@ const debugLogger = {
console.error(`[Uppy] [${getTimeStamp()}]`, ...args),
}
export { justErrorsLogger, debugLogger }
export { debugLogger, justErrorsLogger }

View file

@ -724,7 +724,7 @@ export default class Dashboard<M extends Meta, B extends Body> extends UIPlugin<
private handlePopState = (event: PopStateEvent) => {
// Close the modal if the history state no longer contains our modal name
if (this.isModalOpen() && (!event.state || !event.state[this.modalName])) {
if (this.isModalOpen() && !event.state?.[this.modalName]) {
this.closeModal({ manualClose: false })
}
@ -970,9 +970,9 @@ export default class Dashboard<M extends Meta, B extends Body> extends UIPlugin<
if (this.opts.trigger && !this.opts.inline) {
const showModalTrigger = findAllDOMElements(this.opts.trigger)
if (showModalTrigger) {
showModalTrigger.forEach((trigger) =>
trigger.addEventListener('click', this.openModal),
)
showModalTrigger.forEach((trigger) => {
trigger.addEventListener('click', this.openModal)
})
} else {
this.uppy.log(
'Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself',
@ -1010,9 +1010,9 @@ export default class Dashboard<M extends Meta, B extends Body> extends UIPlugin<
removeEvents = (): void => {
const showModalTrigger = findAllDOMElements(this.opts.trigger)
if (!this.opts.inline && showModalTrigger) {
showModalTrigger.forEach((trigger) =>
trigger.removeEventListener('click', this.openModal),
)
showModalTrigger.forEach((trigger) => {
trigger.removeEventListener('click', this.openModal)
})
}
this.stopListeningToResize()

View file

@ -274,6 +274,7 @@ class AddFiles extends Component<AddFilesProps> {
)
}
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: accessed via Symbol in tests
private [Symbol.for('uppy test: disable unused locale key warning')]() {
// Those are actually used in `renderDropPasteBrowseTagline` method.
this.props.i18nArray('dropPasteBoth')
@ -309,27 +310,6 @@ class AddFiles extends Component<AddFilesProps> {
)
}
private renderAcquirers = (acquirers: TargetWithRender[]) => {
// Group last two buttons, so we dont end up with
// just one button on a new line
const acquirersWithoutLastTwo = [...acquirers]
const lastTwoAcquirers = acquirersWithoutLastTwo.splice(
acquirers.length - 2,
acquirers.length,
)
return (
<>
{acquirersWithoutLastTwo.map((acquirer) =>
this.renderAcquirer(acquirer),
)}
<span role="presentation" style={{ 'white-space': 'nowrap' }}>
{lastTwoAcquirers.map((acquirer) => this.renderAcquirer(acquirer))}
</span>
</>
)
}
private renderSourcesList = (
acquirers: TargetWithRender[],
disableLocalFiles: boolean,

View file

@ -13,7 +13,6 @@ const AddFilesPanel = (props: $TSFixMe): $TSFixMe => {
<div className="uppy-DashboardContent-bar">
<div
className="uppy-DashboardContent-title"
// biome-ignore lint/a11y/useSemanticElements: ...
role="heading"
aria-level={1}
>

View file

@ -20,7 +20,6 @@ function EditorPanel(props: $TSFixMe) {
<div className="uppy-DashboardContent-bar">
<div
className="uppy-DashboardContent-title"
// biome-ignore lint/a11y/useSemanticElements: ...
role="heading"
aria-level={1}
>

View file

@ -115,7 +115,6 @@ export default function FileCard(props: $TSFixMe) {
<div className="uppy-DashboardContent-bar">
<div
className="uppy-DashboardContent-title"
// biome-ignore lint/a11y/useSemanticElements: ...
role="heading"
aria-level={1}
>

View file

@ -1,6 +1,5 @@
import type { Body, Meta, State, Uppy, UppyFile } from '@uppy/core'
import type { I18n } from '@uppy/utils'
// @ts-ignore untyped
import { VirtualList } from '@uppy/utils'
import { useMemo } from 'preact/hooks'
import type { DashboardState } from '../Dashboard.js'

View file

@ -27,7 +27,6 @@ function PickerPanelContent({
<div className="uppy-DashboardContent-bar">
<div
className="uppy-DashboardContent-title"
// biome-ignore lint/a11y/useSemanticElements: ...
role="heading"
aria-level={1}
>

View file

@ -456,7 +456,6 @@ function ProgressBarComplete(props: ProgressBarCompleteProps) {
return (
<div
className="uppy-StatusBar-content"
// biome-ignore lint/a11y/useSemanticElements: ...
role="status"
title={i18n('complete')}
>
@ -531,16 +530,17 @@ function ProgressBarError(props: ProgressBarErrorProps) {
</div>
)
}
export {
UploadBtn,
RetryBtn,
CancelBtn,
PauseResumeButton,
DoneBtn,
LoadingSpinner,
ProgressDetails,
ProgressBarProcessing,
ProgressBarError,
ProgressBarUploading,
PauseResumeButton,
ProgressBarComplete,
ProgressBarError,
ProgressBarProcessing,
ProgressBarUploading,
ProgressDetails,
RetryBtn,
UploadBtn,
}

View file

@ -1,8 +1,6 @@
import Core, { type UIPlugin } from '@uppy/core'
import GoogleDrivePlugin from '@uppy/google-drive'
// @ts-ignore untyped
import Url from '@uppy/url'
// @ts-ignore untyped
import WebcamPlugin from '@uppy/webcam'
import resizeObserverPolyfill from 'resize-observer-polyfill'
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
@ -12,7 +10,6 @@ type $TSFixMe = any
describe('Dashboard', () => {
beforeAll(() => {
// @ts-ignore we're touching globals for the test
globalThis.ResizeObserver =
(resizeObserverPolyfill as any).default || resizeObserverPolyfill
})

View file

@ -1,4 +1,3 @@
// @ts-ignore untyped
import { FOCUSABLE_ELEMENTS } from '@uppy/utils'
import debounce from 'lodash/debounce.js'
import getActiveOverlayEl from './getActiveOverlayEl.js'

View file

@ -1,4 +1,3 @@
// @ts-ignore untyped
import { FOCUSABLE_ELEMENTS, toArray } from '@uppy/utils'
import getActiveOverlayEl from './getActiveOverlayEl.js'

View file

@ -9,7 +9,7 @@ import type {
import { BasePlugin } from '@uppy/core'
import { findDOMElement, toArray } from '@uppy/utils'
// @ts-ignore untyped
// @ts-expect-error untyped
import getFormData from 'get-form-data'
import packageJson from '../package.json' with { type: 'json' }

View file

@ -15,7 +15,6 @@ import MetaDataStore from './MetaDataStore.js'
import ServiceWorkerStore from './ServiceWorkerStore.js'
declare module '@uppy/core' {
// biome-ignore lint/correctness/noUnusedVariables: must be defined
export interface UppyEventMap<M extends Meta, B extends Body> {
'restore:plugin-data-changed': (data: Record<string, unknown>) => void
}

View file

@ -136,9 +136,9 @@ ar_SA.strings = {
openFolderNamed: '%{name} افتح المجلد',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.ar_SA = ar_SA
}

View file

@ -164,9 +164,9 @@ bg_BG.strings = {
},
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.bg_BG = bg_BG
}

View file

@ -229,9 +229,9 @@ ca_ES.strings = {
unselectFileNamed: 'Desselecciona arxiu %{name}',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.ca_ES = ca_ES
}

View file

@ -274,9 +274,9 @@ cs_CZ.strings = {
zoomOut: 'Oddálit',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.cs_CZ = cs_CZ
}

View file

@ -141,9 +141,9 @@ da_DK.strings = {
},
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.da_DK = da_DK
}

View file

@ -210,9 +210,9 @@ de_DE.strings = {
zoomOut: 'Verkleinern',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.de_DE = de_DE
}

View file

@ -145,9 +145,9 @@ el_GR.strings = {
},
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.el_GR = el_GR
}

View file

@ -252,9 +252,9 @@ en_US.strings = {
zoomOut: 'Zoom out',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.en_US = en_US
}

View file

@ -232,9 +232,9 @@ es_ES.strings = {
unselectFileNamed: 'Deseleccionar archivo %{name}',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.es_ES = es_ES
}

View file

@ -198,9 +198,9 @@ es_MX.strings = {
zoomOut: 'Alejar',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.es_MX = es_MX
}

View file

@ -221,9 +221,9 @@ fa_IR.strings = {
zoomOut: 'کوچک‌نمایی',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.fa_IR = fa_IR
}

View file

@ -146,9 +146,9 @@ fi_FI.strings = {
recording: 'Tallennetaan',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.fi_FI = fi_FI
}

View file

@ -215,9 +215,9 @@ fr_FR.strings = {
},
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.fr_FR = fr_FR
}

View file

@ -143,9 +143,9 @@ gl_ES.strings = {
openFolderNamed: 'Cartafol aberto %{name}',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.gl_ES = gl_ES
}

View file

@ -139,9 +139,9 @@ he_IL.strings = {
},
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.he_IL = he_IL
}

View file

@ -189,9 +189,9 @@ hi_IN.strings = {
zoomOut: 'ज़ूम आउट',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.hi_IN = hi_IN
}

View file

@ -143,9 +143,9 @@ hr_HR.strings = {
openFolderNamed: 'Otvori mapu %{name}',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.hr_HR = hr_HR
}

View file

@ -105,9 +105,9 @@ hu_HU.strings = {
openFolderNamed: 'Nyitott mappa %{name}',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.hu_HU = hu_HU
}

View file

@ -140,9 +140,9 @@ id_ID.strings = {
},
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.id_ID = id_ID
}

View file

@ -145,9 +145,9 @@ is_IS.strings = {
},
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.is_IS = is_IS
}

View file

@ -140,9 +140,9 @@ it_IT.strings = {
openFolderNamed: 'Cartella aperta %{name}',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.it_IT = it_IT
}

View file

@ -148,9 +148,9 @@ ja_JP.strings = {
openFolderNamed: '開いたフォルダ %{name}',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.ja_JP = ja_JP
}

View file

@ -108,9 +108,9 @@ ko_KR.strings = {
youHaveToAtLeastSelectX: '최소 %{smart_count}개의 파일을 선택해야 합니다',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.ko_KR = ko_KR
}

View file

@ -232,9 +232,9 @@ ms_MY.strings = {
zoomOut: 'Zum keluar',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.ms_MY = ms_MY
}

View file

@ -175,9 +175,9 @@ nb_NO.strings = {
zoomOut: 'Zoom ut',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.nb_NO = nb_NO
}

View file

@ -247,9 +247,9 @@ nl_NL.strings = {
zoomOut: 'Zoom uit',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.nl_NL = nl_NL
}

View file

@ -243,9 +243,9 @@ pl_PL.strings = {
zoomOut: 'Pomniejsz',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.pl_PL = pl_PL
}

View file

@ -248,9 +248,9 @@ pt_BR.strings = {
zoomOut: 'Diminuir o zoom',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.pt_BR = pt_BR
}

View file

@ -140,9 +140,9 @@ pt_PT.strings = {
openFolderNamed: 'Pasta aberta %{name}',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.pt_PT = pt_PT
}

View file

@ -154,9 +154,9 @@ ro_RO.strings = {
},
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.ro_RO = ro_RO
}

View file

@ -253,9 +253,9 @@ ru_RU.strings = {
zoomOut: 'Отдалить',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.ru_RU = ru_RU
}

View file

@ -177,9 +177,9 @@ sk_SK.strings = {
zoomOut: 'Oddialiť',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.sk_SK = sk_SK
}

View file

@ -143,9 +143,9 @@ sr_RS_Cyrillic.strings = {
openFolderNamed: 'Отвори фолдер %{name}',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.sr_RS_Cyrillic = sr_RS_Cyrillic
}

View file

@ -143,9 +143,9 @@ sr_RS_Latin.strings = {
openFolderNamed: 'Otvori folder %{name}',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.sr_RS_Latin = sr_RS_Latin
}

View file

@ -244,9 +244,9 @@ sv_SE.strings = {
zoomOut: 'Zooma ut',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.sv_SE = sv_SE
}

View file

@ -166,9 +166,9 @@ th_TH.strings = {
zoomOut: 'ซูมออก',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.th_TH = th_TH
}

View file

@ -141,9 +141,9 @@ tr_TR.strings = {
openFolderNamed: 'Açık dosya %{name}',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.tr_TR = tr_TR
}

View file

@ -238,9 +238,9 @@ uk_UA.strings = {
zoomOut: 'Зменшити',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.uk_UA = uk_UA
}

View file

@ -221,9 +221,9 @@ uz_UZ.strings = {
zoomOut: 'Kichraytirish',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.uz_UZ = uz_UZ
}

View file

@ -224,9 +224,9 @@ vi_VN.strings = {
zoomOut: 'Thu nhỏ',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.vi_VN = vi_VN
}

View file

@ -178,9 +178,9 @@ zh_CN.strings = {
zoomOut: '缩小',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.zh_CN = zh_CN
}

View file

@ -176,9 +176,9 @@ zh_TW.strings = {
zoomOut: '縮小',
}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.zh_TW = zh_TW
}

View file

@ -12,9 +12,9 @@ const en_US: Locale<0 | 1> = {
en_US.strings = {}
// @ts-ignore untyped
// @ts-expect-error untyped
if (typeof Uppy !== 'undefined') {
// @ts-ignore untyped
// @ts-expect-error untyped
globalThis.Uppy.locales.en_US = en_US
}

View file

@ -456,7 +456,6 @@ function ProgressBarComplete(props: ProgressBarCompleteProps) {
return (
<div
className="uppy-StatusBar-content"
// biome-ignore lint/a11y/useSemanticElements: ...
role="status"
title={i18n('complete')}
>
@ -531,16 +530,17 @@ function ProgressBarError(props: ProgressBarErrorProps) {
</div>
)
}
export {
UploadBtn,
RetryBtn,
CancelBtn,
PauseResumeButton,
DoneBtn,
LoadingSpinner,
ProgressDetails,
ProgressBarProcessing,
ProgressBarError,
ProgressBarUploading,
PauseResumeButton,
ProgressBarComplete,
ProgressBarError,
ProgressBarProcessing,
ProgressBarUploading,
ProgressDetails,
RetryBtn,
UploadBtn,
}

View file

@ -2,7 +2,7 @@ import type { DefinePluginOpts, UIPluginOptions, Uppy } from '@uppy/core'
import { UIPlugin } from '@uppy/core'
import type { Body, LocalUppyFile, Meta, UppyFile } from '@uppy/utils'
import { dataURItoBlob, isObjectURL, isPreviewSupported } from '@uppy/utils'
// @ts-ignore untyped
// @ts-expect-error untyped
import { rotation } from 'exifr/dist/mini.esm.mjs'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'

View file

@ -1,4 +1,3 @@
// @ts-ignore untyped
import type { RateLimitedQueue, WrapPromiseFunctionType } from '@uppy/utils'
import {
fetchWithNetworkError,
@ -299,9 +298,7 @@ class TransloaditAssembly extends Emitter {
const prevResults = prevResultsMap[stepName] ?? []
nextResults
.filter(
(n) => !prevResults || !prevResults.some((p) => p.id === n.id),
)
.filter((n) => !prevResults?.some((p) => p.id === n.id))
.forEach((result) => {
this.emit('result', stepName, result)
})

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