Skip to content

armgit / VERT

Public Imported from GitHub
0

The next-generation file converter. Open source, fully local* and free forever.

fix: svelte eslint fixes

JovannMC8fe98e4acd54
diff --git a/src/lib/components/functional/ConversionPanel.svelte b/src/lib/components/functional/ConversionPanel.svelte
index 757c138..9874052 100644
--- a/src/lib/components/functional/ConversionPanel.svelte
+++ b/src/lib/components/functional/ConversionPanel.svelte
@@ -128,7 +128,7 @@
f.result = null;
})}
{categories}
- dropdownSize={"large"}
+ dropdownSize="large"
/>
{:else}
<Dropdown options={[m["convert.panel.na"]()]} disabled />
diff --git a/src/lib/components/functional/Dropdown.svelte b/src/lib/components/functional/Dropdown.svelte
index 9fa3481..3a6249a 100644
--- a/src/lib/components/functional/Dropdown.svelte
+++ b/src/lib/components/functional/Dropdown.svelte
@@ -163,7 +163,7 @@
)}
</p>
{/key}
- {#each options as option}
+ {#each options as option (getValue(option))}
<p
class={clsx(
"col-start-1 row-start-1 pointer-events-none",
@@ -192,7 +192,7 @@
}}
class="shadow-xl bg-panel-alt shadow-black/25 overflow-hidden z-[9999] bg-background rounded-xl max-h-[23.5vh] overflow-y-auto"
>
- {#each options as option}
+ {#each options as option (getValue(option))}
<button
data-selected={getValue(option) === selected}
class={clsx(
diff --git a/src/lib/components/functional/FormatDropdown.svelte b/src/lib/components/functional/FormatDropdown.svelte
index d072533..62478e8 100644
--- a/src/lib/components/functional/FormatDropdown.svelte
+++ b/src/lib/components/functional/FormatDropdown.svelte
@@ -504,7 +504,7 @@
</p>
{/key}
{#if currentCategory}
- {#each categories[currentCategory].formats as option}
+ {#each categories[currentCategory].formats as option (option)}
<p
class="col-start-1 row-start-1 invisible pointer-events-none truncate max-w-[2.5rem]"
>
@@ -588,7 +588,7 @@
{/if}
<!-- available categories -->
<div class="flex items-center justify-between">
- {#each filteredData.categories as category}
+ {#each filteredData.categories as category (category)}
<button
class="flex-grow text-lg hover:text-muted/20 border-b-2 pb-2 capitalize
{currentCategory === category
diff --git a/src/lib/components/functional/popups/Dialog.svelte b/src/lib/components/functional/popups/Dialog.svelte
index c9e64ba..505ac53 100644
--- a/src/lib/components/functional/popups/Dialog.svelte
+++ b/src/lib/components/functional/popups/Dialog.svelte
@@ -72,7 +72,7 @@
{/if}
</div>
<div class="flex flex-row items-center justify-between gap-4 w-full">
- {#each buttons as { text, action }, i}
+ {#each buttons as { text, action }, i (`${i}-${text}`)}
<button
class="w-full justify-center hover:scale-105 active:scale-100 duration-200 flex items-center gap-2 p-2 rounded-md {i ===
1
diff --git a/src/lib/components/functional/popups/Modal.svelte b/src/lib/components/functional/popups/Modal.svelte
index c44f96e..25bdaad 100644
--- a/src/lib/components/functional/popups/Modal.svelte
+++ b/src/lib/components/functional/popups/Modal.svelte
@@ -124,7 +124,7 @@
</div>
<div class="flex flex-row items-center gap-2 w-full">
- {#each buttons as { text, action, primary }, i}
+ {#each buttons as { text, action, primary }, i (`${i}-${text}`)}
<button
class="hover:scale-105 active:scale-100 duration-200 flex items-center gap-2 p-2 rounded-md {primary ||
i === 1
diff --git a/src/lib/components/functional/popups/SettingsModal.svelte b/src/lib/components/functional/popups/SettingsModal.svelte
index dac8224..3b9b2cf 100644
--- a/src/lib/components/functional/popups/SettingsModal.svelte
+++ b/src/lib/components/functional/popups/SettingsModal.svelte
@@ -270,7 +270,7 @@
<Dropdown
options={fileOptions}
selected={selectedFileId}
- style={"inline"}
+ style="inline"
onselect={(value) => {
selectedFileId = value;
settings = {};
@@ -279,7 +279,7 @@
</div>
<div class="flex items-center justify-between">
- {#each Object.keys(settingTabs) as tab}
+ {#each Object.keys(settingTabs) as tab (tab)}
<button
class={clsx(
"flex-grow text-lg hover:text-muted/20 border-b-2 pb-2 capitalize",
@@ -302,7 +302,7 @@
>
{#if activeTab === "Converter"}
<div class="flex flex-col gap-2">
- {#each availableConverters as converter}
+ {#each availableConverters as converter (converter.name)}
<button
class={clsx(
"w-full p-3 text-left rounded-xl border-2 border-button",
diff --git a/src/lib/components/visual/effects/ProgressiveBlur.svelte b/src/lib/components/visual/effects/ProgressiveBlur.svelte
index f16cc42..09a9db5 100644
--- a/src/lib/components/visual/effects/ProgressiveBlur.svelte
+++ b/src/lib/components/visual/effects/ProgressiveBlur.svelte
@@ -42,7 +42,7 @@
</script>
<div class="w-full h-full relative">
- {#each blurSteps as { blurIntensity, mask }, index}
+ {#each blurSteps as { blurIntensity, mask }, index (index)}
<div
class="absolute w-full h-full"
style="
diff --git a/src/lib/converters/ffmpeg/ffmpeg.svelte.ts b/src/lib/converters/ffmpeg/ffmpeg.svelte.ts
index 21d4c48..6da775d 100644
--- a/src/lib/converters/ffmpeg/ffmpeg.svelte.ts
+++ b/src/lib/converters/ffmpeg/ffmpeg.svelte.ts
@@ -3,6 +3,7 @@ import { Converter, FormatInfo } from "../converter.svelte";
import { FFmpeg } from "@ffmpeg/ffmpeg";
import { browser } from "$app/env";
import { error, log } from "#lib/util/logger.svelte";
+import { SvelteMap } from "svelte/reactivity";
import { m } from "#lib/paraglide/messages";
import { Settings } from "#lib/sections/settings/index.svelte";
import { ToastManager } from "#lib/util/toast.svelte";
@@ -23,7 +24,7 @@ export class FFmpegConverter extends Converter {
public name = "ffmpeg";
public ready = $state(false);
- private activeConversions = new Map<string, FFmpeg>();
+ private activeConversions = new SvelteMap<string, FFmpeg>();
// non supported audio to video formats
private cantConvert: string[] = ["ogx"];
diff --git a/src/lib/converters/magick/magick.svelte.ts b/src/lib/converters/magick/magick.svelte.ts
index 5f7605a..123df52 100644
--- a/src/lib/converters/magick/magick.svelte.ts
+++ b/src/lib/converters/magick/magick.svelte.ts
@@ -10,6 +10,7 @@ import {
formatsWithoutTransparency,
} from "./magick-settings";
import { Settings } from "#lib/sections/settings/index.svelte";
+import { SvelteMap } from "svelte/reactivity";
import magickWasm from "@imagemagick/magick-wasm/magick.wasm?url";
import { ToastManager } from "#lib/util/toast.svelte";
import type {
@@ -23,7 +24,7 @@ export class MagickConverter extends Converter {
public ready = $state(false);
public wasm: ArrayBuffer = null!;
- private activeConversions = new Map<string, Worker>();
+ private activeConversions = new SvelteMap<string, Worker>();
public supportedFormats = [
// manually tested formats
diff --git a/src/lib/converters/mediabunny/mediabunny.svelte.ts b/src/lib/converters/mediabunny/mediabunny.svelte.ts
index df3c954..71e3689 100644
--- a/src/lib/converters/mediabunny/mediabunny.svelte.ts
+++ b/src/lib/converters/mediabunny/mediabunny.svelte.ts
@@ -24,6 +24,7 @@ import { registerDtsDecoder, registerDtsEncoder } from "@mediabunny/dts";
import { registerMp3Encoder } from "@mediabunny/mp3-encoder";
import { registerFlacEncoder } from "@mediabunny/flac-encoder";
import { registerProresDecoder } from "@mediabunny/prores";
+import { SvelteMap } from "svelte/reactivity";
import { Converter, FormatInfo, type WorkerStatus } from "../converter.svelte";
import { error, log } from "#lib/util/logger.svelte";
import { m } from "#lib/paraglide/messages";
@@ -135,7 +136,7 @@ export class MediabunnyConverter extends Converter {
public status: WorkerStatus = $state("ready");
public reportsProgress: boolean = true;
- private activeConversions = new Map<string, Conversion>();
+ private activeConversions = new SvelteMap<string, Conversion>();
private formats: string[] = [
"mp4",
diff --git a/src/lib/converters/pandoc/pandoc.svelte.ts b/src/lib/converters/pandoc/pandoc.svelte.ts
index 1d05dc6..485f333 100644
--- a/src/lib/converters/pandoc/pandoc.svelte.ts
+++ b/src/lib/converters/pandoc/pandoc.svelte.ts
@@ -4,6 +4,7 @@ import { browser } from "$app/env";
import PandocWorker from "#lib/workers/pandoc?worker&url";
import { error, log } from "#lib/util/logger.svelte";
import { ToastManager } from "#lib/util/toast.svelte";
+import { SvelteMap } from "svelte/reactivity";
import { m } from "#lib/paraglide/messages";
export class PandocConverter extends Converter {
@@ -11,7 +12,7 @@ export class PandocConverter extends Converter {
public ready = $state(false);
public wasm: ArrayBuffer = null!;
- private activeConversions = new Map<string, Worker>();
+ private activeConversions = new SvelteMap<string, Worker>();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private log: (...msg: any[]) => void = () => {};
diff --git a/src/lib/converters/vertd/vertd.svelte.ts b/src/lib/converters/vertd/vertd.svelte.ts
index c689c39..d634a52 100644
--- a/src/lib/converters/vertd/vertd.svelte.ts
+++ b/src/lib/converters/vertd/vertd.svelte.ts
@@ -2,6 +2,7 @@ import VertdErrorComponent from "#lib/components/functional/popups/VertdError.sv
import { error, log } from "#lib/util/logger.svelte";
import { m } from "#lib/paraglide/messages";
import { Settings } from "#lib/sections/settings/index.svelte";
+import { SvelteMap, SvelteSet } from "svelte/reactivity";
import {
VertdInstance,
getVertdCustomHeaders,
@@ -347,7 +348,7 @@ export class VertdConverter extends Converter {
public ready = $state(false);
public reportsProgress = true;
- private activeConversions = new Map<
+ private activeConversions = new SvelteMap<
string,
{
ws: WebSocket;
@@ -356,11 +357,11 @@ export class VertdConverter extends Converter {
}
>();
- private activeUploads = new Map<string, UploadTask>();
+ private activeUploads = new SvelteMap<string, UploadTask>();
- private activeDownloads = new Map<string, DownloadTask>();
+ private activeDownloads = new SvelteMap<string, DownloadTask>();
- private cancelledConversions = new Set<string>();
+ private cancelledConversions = new SvelteSet<string>();
public supportedFormats = [
...videoFormats
@@ -393,11 +394,13 @@ export class VertdConverter extends Converter {
// ensure it's a map
// this might fix the "e.get" isn't a function error, but i can't reproduce it
if (!(blockedHashes instanceof Map) || blockedHashes === null) {
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
blockedHashes = new Map(Object.entries(blockedHashes || {}));
Settings.instance.settings.vertdBlockedHashes = blockedHashes;
Settings.instance.save();
}
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
const now = new Date();
const dates = blockedHashes.get(hash) || [];
const filteredDates = dates.filter(
@@ -421,11 +424,13 @@ export class VertdConverter extends Converter {
// same as above (blocked())
if (!(blockedHashes instanceof Map) || blockedHashes === null) {
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
blockedHashes = new Map(Object.entries(blockedHashes || {}));
Settings.instance.settings.vertdBlockedHashes = blockedHashes;
Settings.instance.save();
}
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
const now = new Date();
const dates = blockedHashes.get(hash) || [];
dates.push(now);
diff --git a/src/lib/sections/about/Credits.svelte b/src/lib/sections/about/Credits.svelte
index a617b22..cf670ba 100644
--- a/src/lib/sections/about/Credits.svelte
+++ b/src/lib/sections/about/Credits.svelte
@@ -70,7 +70,7 @@
<!-- Main contributors -->
<div class="flex flex-col gap-4">
<div class="flex flex-col flex-wrap gap-2">
- {#each mainContribs as contrib}
+ {#each mainContribs as contrib (contrib.github)}
{@const { name, github, avatar, role } = contrib}
{@render contributor(name, github, avatar, role)}
{/each}
@@ -88,7 +88,7 @@
{m["about.credits.notable_description"]()}
</p>
<div class="flex flex-col gap-2">
- {#each notableContribs as contrib}
+ {#each notableContribs as contrib (contrib.github)}
{@const { name, github, avatar, role } = contrib}
{@render contributor(name, github, avatar, role, true)}
{/each}
@@ -130,7 +130,7 @@
{#if ghContribs && ghContribs.length > 0}
<div class="flex flex-row flex-wrap gap-2">
- {#each ghContribs as contrib}
+ {#each ghContribs as contrib (contrib.github)}
{@const { name, github, avatar } = contrib}
{@render contributor(name, github, avatar)}
{/each}
diff --git a/src/lib/sections/about/Donate.svelte b/src/lib/sections/about/Donate.svelte
index 0268afb..64464ab 100644
--- a/src/lib/sections/about/Donate.svelte
+++ b/src/lib/sections/about/Donate.svelte
@@ -239,7 +239,7 @@
</button>
</div>
<div class="grid grid-cols-4 gap-3 w-full">
- {#each presetAmounts as preset, i}
+ {#each presetAmounts as preset, i (preset)}
<button
onclick={() => amountClick(preset)}
class={clsx(
diff --git a/src/lib/sections/settings/Appearance.svelte b/src/lib/sections/settings/Appearance.svelte
index ca8beea..c786f6b 100644
--- a/src/lib/sections/settings/Appearance.svelte
+++ b/src/lib/sections/settings/Appearance.svelte
@@ -189,7 +189,7 @@
<div class="flex flex-col gap-3 w-full">
<Dropdown
options={languageOptions}
- style={"settings"}
+ style="settings"
selected={getLanguageDisplayName(currentLocale)}
onselect={handleLanguageChange}
/>
diff --git a/src/lib/sections/settings/Conversion.svelte b/src/lib/sections/settings/Conversion.svelte
index dd78fcb..18b07f0 100644
--- a/src/lib/sections/settings/Conversion.svelte
+++ b/src/lib/sections/settings/Conversion.svelte
@@ -44,7 +44,7 @@
<FancyTextInput
placeholder="VERT_%name%"
bind:value={settings.filenameFormat}
- extension={".ext"}
+ extension=".ext"
type="text"
/>
</div>
@@ -141,7 +141,7 @@
</p>
<FormatDropdown
categories={{ image: categories.image }}
- from={".png"}
+ from=".png"
bind:selected={
settings.defaultFormat.image
}
@@ -156,7 +156,7 @@
</p>
<FormatDropdown
categories={{ audio: categories.audio }}
- from={".mp3"}
+ from=".mp3"
bind:selected={
settings.defaultFormat.audio
}
@@ -171,7 +171,7 @@
</p>
<FormatDropdown
categories={{ video: categories.video }}
- from={".mp4"}
+ from=".mp4"
bind:selected={
settings.defaultFormat.video
}
@@ -186,7 +186,7 @@
</p>
<FormatDropdown
categories={{ doc: categories.doc }}
- from={".docx"}
+ from=".docx"
bind:selected={
settings.defaultFormat.document
}
@@ -271,8 +271,8 @@
type="number"
min={1}
max={100}
- placeholder={"100"}
- extension={"%"}
+ placeholder="100"
+ extension="%"
/>
</div>
</div>
diff --git a/src/lib/sections/settings/Vertd.svelte b/src/lib/sections/settings/Vertd.svelte
index 4482e05..058e9d8 100644
--- a/src/lib/sections/settings/Vertd.svelte
+++ b/src/lib/sections/settings/Vertd.svelte
@@ -157,7 +157,7 @@
]();
}
})()}
- style={"settings"}
+ style="settings"
/>
{#if VertdInstance.instance.innerData().type === "custom"}
<FancyInput
@@ -201,7 +201,7 @@
"settings.vertd.conversion_speed.speeds.ultra_fast"
](),
]}
- style={"settings"}
+ style="settings"
selected={(() => {
switch (settings.vertdSpeed) {
case "verySlow":
diff --git a/src/lib/sections/settings/index.svelte.ts b/src/lib/sections/settings/index.svelte.ts
index 5f0e590..f237187 100644
--- a/src/lib/sections/settings/index.svelte.ts
+++ b/src/lib/sections/settings/index.svelte.ts
@@ -1,4 +1,5 @@
import { PUB_VERTD_URL } from "$app/env/public";
+import { SvelteMap } from "svelte/reactivity";
import type { ConversionSpeed } from "#lib/converters/vertd/vertd.svelte";
import { readSettings } from "#lib/util/settings";
import { VertdInstance } from "./vertdSettings.svelte";
@@ -45,7 +46,7 @@ export class Settings {
plausible: true,
vertdURL: PUB_VERTD_URL,
vertdSpeed: "slow",
- vertdBlockedHashes: new Map<string, Date[]>(),
+ vertdBlockedHashes: new SvelteMap<string, Date[]>(),
vertdCustomHeaders: "",
magickQuality: 90,
});
@@ -61,7 +62,7 @@ export class Settings {
const persisted = readSettings<ISettings>();
if (!Object.keys(persisted).length) return;
const settings = persisted as ISettings;
- const vertdBlockedHashes = new Map<string, Date[]>(
+ const vertdBlockedHashes = new SvelteMap<string, Date[]>(
Object.entries(
settings.vertdBlockedHashes ||
this.settings.vertdBlockedHashes,
diff --git a/src/lib/sections/settings/vertdSettings.svelte.ts b/src/lib/sections/settings/vertdSettings.svelte.ts
index c8fbf34..d0eba5f 100644
--- a/src/lib/sections/settings/vertdSettings.svelte.ts
+++ b/src/lib/sections/settings/vertdSettings.svelte.ts
@@ -41,6 +41,7 @@ export const normalizeVertdUrl = (value: string): string => {
const trimmed = value.trim();
if (!trimmed) throw new Error("No vertd server URL configured");
try {
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
const url = new URL(
/^[a-z][a-z\d+.-]*:\/\//i.test(trimmed)
? trimmed
diff --git a/src/lib/store/index.svelte.ts b/src/lib/store/index.svelte.ts
index 2a036ab..a190c5a 100644
--- a/src/lib/store/index.svelte.ts
+++ b/src/lib/store/index.svelte.ts
@@ -222,6 +222,7 @@ class Files {
log(["files"], `extracted ${totalEntries} files from zip`);
// check if all files in zip use the same converter and are compatible
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
const convertersUsed = new Set<string>();
let incompatibleFiles = false;
const archiveFiles: VertFile[] = [];
diff --git a/src/lib/types/file.svelte.ts b/src/lib/types/file.svelte.ts
index d872ea9..3cac2d0 100644
--- a/src/lib/types/file.svelte.ts
+++ b/src/lib/types/file.svelte.ts
@@ -17,6 +17,7 @@ import { error, log } from "#lib/util/logger.svelte";
import { readSettings } from "#lib/util/settings";
import { formatFilename } from "#lib/util/file";
import { conversionConcurrency } from "#lib/util/consts";
+import { SvelteSet } from "svelte/reactivity";
import { fileTypeFromBuffer } from "file-type";
const LARGE_FILE = 2 * 1024 * 1024 * 1024; // 2GB
@@ -123,7 +124,7 @@ export class VertFile {
public archiveFormats?: string[];
private fallbackToastId: number | null = null;
private slowConversionToastId: number | null = null;
- private attemptedConverters = new Set<string>();
+ private attemptedConverters = new SvelteSet<string>();
private retryingFallback = false;
private postDownload: (() => Promise<void>) | null = null;
private disposal: Promise<void> | null = null;
@@ -591,6 +592,7 @@ export class VertFile {
const convertedFiles: File[] = [];
const convertedResults: VertFile[] = [];
const failedFiles: string[] = [];
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
const progressFiles = new Map<number, VertFile>();
const progressInterval = setInterval(() => {
for (const [index, file] of progressFiles)
@@ -913,6 +915,7 @@ export class VertFile {
public hash(): Promise<string> {
const stream = this.file.stream();
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
const hashes = new Set<string>();
const reader = stream.getReader();
return new Promise<string>((resolve, reject) => {
diff --git a/src/lib/util/debug.svelte.ts b/src/lib/util/debug.svelte.ts
index 488ea7f..0a6142a 100644
--- a/src/lib/util/debug.svelte.ts
+++ b/src/lib/util/debug.svelte.ts
@@ -199,6 +199,7 @@ export async function getStorageInfo(): Promise<StorageInfo> {
}
export function formatFileStamp(): string {
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
return new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
}
@@ -216,6 +217,7 @@ export function downloadText(filename: string, content: string): void {
export function buildReport(systemInfo: SystemInfo): string {
return [
`${VERT_NAME} debug report`,
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
`Generated: ${new Date().toISOString()}`,
`Environment: ${PUB_ENV}`,
`Commit: ${commitHash}`,
diff --git a/src/lib/util/logger.svelte.ts b/src/lib/util/logger.svelte.ts
index 90d5625..721313d 100644
--- a/src/lib/util/logger.svelte.ts
+++ b/src/lib/util/logger.svelte.ts
@@ -18,6 +18,7 @@ export const logs = $state<{ entries: LogEntry[] }>({ entries: [] });
let internalWrite = false;
let consoleInstalled = false;
+// eslint-disable-next-line svelte/prefer-svelte-reactivity
const originalConsole = new Map<string, (...args: any[]) => void>();
const pad = (value: number, length = 2) => String(value).padStart(length, "0");
@@ -61,6 +62,7 @@ export const addLog = (
) => {
if (!browser) return;
const prefixes = Array.isArray(prefix) ? prefix : [prefix];
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
const now = new Date();
logs.entries.push({
id: logs.entries.length
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index d5fe95b..a276f76 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -34,6 +34,7 @@
let enablePlausible = $state(false);
let isAprilFools = $state(false);
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
let scrollPositions = new Map<string, number>();
beforeNavigate((nav) => {
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 858d401..8782087 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -183,7 +183,7 @@
<div class="flex gap-4 mt-8 md:flex-row flex-col">
{#if browser}
- {#each Object.entries(worker) as [key, s], i}
+ {#each Object.entries(worker) as [key, s], i (key)}
{@const Icon = s.icon}
<div class="file-category-card w-full flex flex-col gap-4">
<div class="file-category-card-inner">
@@ -271,7 +271,7 @@
<p
class="flex flex-wrap justify-center leading-tight px-2"
>
- {#each s.formats.split(", ") as format, index}
+ {#each s.formats.split(", ") as format, index (format)}
{@const isPartial =
format.endsWith("*")}
{@const formatName = isPartial
@@ -307,7 +307,7 @@
{#if showBlur[i]}
<div
class="absolute left-0 bottom-0 w-full h-10 pointer-events-none"
- style={`background: linear-gradient(to top, var(--bg-panel), transparent 65%);`}
+ style="background: linear-gradient(to top, var(--bg-panel), transparent 65%);"
></div>
{/if}
</div>