Skip to content

The swiss army knife of lossless video/audio editing

Remove 47 disable comments that no longer suppress anything

Claudee2107be3ec15
diff --git a/script/featureMedia.ts b/script/featureMedia.ts
index 5376c7b3..132aff8c 100644
--- a/script/featureMedia.ts
+++ b/script/featureMedia.ts
@@ -213,7 +213,6 @@ try {
.filter(({ start, end }) => end > start);
const zooms: Zoom[] = zoomEvents.map(({ time, rect }) => ({ time: time - socialStart, rect }));
for (const format of ['landscape', 'vertical'] as const) {
- // eslint-disable-next-line no-await-in-loop
await renderSocialVideo({ ffmpeg, rawVideo, videoStart: socialStart, duration, captions, zooms, description: scenario.description, music, windowWidth: width, windowHeight: height, format, tmpDir: configDir, outPath: join(outDir, `${scenarioName}-${format}.mp4`) });
}
console.log('Wrote', videoPath, 'the social media versions and screenshots in', outDir);
diff --git a/script/featureMedia/socialVideo.ts b/script/featureMedia/socialVideo.ts
index 80ff12ea..6c482597 100644
--- a/script/featureMedia/socialVideo.ts
+++ b/script/featureMedia/socialVideo.ts
@@ -139,7 +139,6 @@ export async function renderSocialVideo({ ffmpeg, rawVideo, videoStart, duration
let last = 'v0';
for (const [i, { start, end, text }] of captions.entries()) {
const path = join(tmpDir, `${format}-caption-${i}.png`);
- // eslint-disable-next-line no-await-in-loop
const { width: captionWidth, height: captionHeight } = await renderCaption(text, captionSize, width - 120, path);
const length = end - start;
const input = 3 + i;
diff --git a/script/storeRelease.ts b/script/storeRelease.ts
index 15594ed2..1ea3f8cf 100644
--- a/script/storeRelease.ts
+++ b/script/storeRelease.ts
@@ -137,7 +137,6 @@ async function masPrivacyPolicy() {
log(`${locale} privacy policy URL is already up to date`);
} else {
plan(`set the ${locale} privacy policy URL to ${privacyPolicyUrl} (currently: ${JSON.stringify(current ?? null)})`);
- // eslint-disable-next-line no-await-in-loop
if (write) await asc('PATCH', `/v1/appInfoLocalizations/${localization.id}`, { type: 'appInfoLocalizations', id: localization.id, attributes: { privacyPolicyUrl } });
}
}
@@ -176,9 +175,7 @@ async function mas(version: string) {
assert.ok(build == null || build.attributes['processingState'] === 'PROCESSING', `Build ${version} is ${build?.attributes['processingState']}`);
assert.ok(i < 60, `Build ${version} didn't finish processing in time`);
log('Waiting for the build to be uploaded/processed…');
- // eslint-disable-next-line no-await-in-loop
await sleep(60_000);
- // eslint-disable-next-line no-await-in-loop
build = await findMasBuild(version);
}
}
@@ -319,7 +316,6 @@ async function msstore(version: string) {
fileName: `LosslessCut-win-${arch}.appx`,
}));
for (const { url } of packages) {
- // eslint-disable-next-line no-await-in-loop
const response = await fetch(url, { method: 'HEAD' });
assert.ok(response.ok, `${url}: HTTP ${response.status}`);
log(`${url} (${(Number(response.headers.get('content-length')) / 1e6).toFixed(0)} MB)`);
@@ -333,10 +329,8 @@ async function msstore(version: string) {
try {
for (const { url, fileName } of packages) {
log(`Downloading ${fileName}…`);
- // eslint-disable-next-line no-await-in-loop
const response = await fetch(url);
assert.ok(response.ok, `${url}: HTTP ${response.status}`);
- // eslint-disable-next-line no-await-in-loop
await writeFile(join(dir, fileName), Buffer.from(await response.arrayBuffer()));
}
const zipPath = join(dir, 'upload.zip');
@@ -369,9 +363,7 @@ async function msstore(version: string) {
let status: { status: string, statusDetails: unknown };
for (let i = 0; ; i += 1) {
assert.ok(i < 60, 'Commit didn\'t finish in time, check the submission in Partner Center');
- // eslint-disable-next-line no-await-in-loop
await sleep(10_000);
- // eslint-disable-next-line no-await-in-loop
status = await ms('GET', `/submissions/${submission.id}/status`);
log(status.status);
if (!['PendingCommit', 'CommitStarted'].includes(status.status)) break;
diff --git a/script/xcrunWrapper.ts b/script/xcrunWrapper.ts
index 9ed08d06..8d70752a 100644
--- a/script/xcrunWrapper.ts
+++ b/script/xcrunWrapper.ts
@@ -99,11 +99,9 @@ const maxRetries = 3;
async function run() {
for (let i = 0; i < maxRetries; i += 1) {
- // eslint-disable-next-line no-await-in-loop
const wantRetry = await runAttempt();
if (!wantRetry) return; // success
console.log('Retrying soon');
- // eslint-disable-next-line no-await-in-loop
await new Promise((resolve) => { setTimeout(resolve, 1000); });
}
diff --git a/src/common/ffprobe.ts b/src/common/ffprobe.ts
index e415e80b..80979a75 100644
--- a/src/common/ffprobe.ts
+++ b/src/common/ffprobe.ts
@@ -251,7 +251,6 @@ export interface FFprobeStreamDisposition {
/**
The "tags" field on an FFprobe response stream object
*/
-// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type FFprobeStreamTags = {
/**
The track's language (usually represented using a 3 letter language code, e.g.: "eng")
diff --git a/src/main/compatPlayer.ts b/src/main/compatPlayer.ts
index 858c64dd..8cf83b5c 100644
--- a/src/main/compatPlayer.ts
+++ b/src/main/compatPlayer.ts
@@ -59,7 +59,6 @@ export function createMediaSourceStream(params: Parameters<typeof createMediaSou
return;
}
- // eslint-disable-next-line no-shadow
let cleanup: () => void;
const onClose = () => {
diff --git a/src/main/configStore.ts b/src/main/configStore.ts
index b52b45ef..1dd527fc 100644
--- a/src/main/configStore.ts
+++ b/src/main/configStore.ts
@@ -225,7 +225,6 @@ async function tryCreateStore({ customStoragePath }: { customStoragePath: string
});
return;
} catch (err) {
- // eslint-disable-next-line no-await-in-loop
await new Promise((resolve) => { setTimeout(resolve, 2000); });
logger.error('Failed to create config store, retrying', err);
}
diff --git a/src/main/ffmpeg.ts b/src/main/ffmpeg.ts
index 763789fe..1ffe5b98 100644
--- a/src/main/ffmpeg.ts
+++ b/src/main/ffmpeg.ts
@@ -328,7 +328,6 @@ export async function detectSceneChanges({ filePath, streamId, minChange, onProg
let lastTime: number | undefined;
rl.on('line', (line) => {
- // eslint-disable-next-line unicorn/better-regex
const match = /^frame:\d+\s+pts:\d+\s+pts_time:([\d.]+)/.exec(line);
if (!match) return;
const time = parseFloat(match[1]!);
diff --git a/src/main/index.ts b/src/main/index.ts
index c158003a..ad1f2de5 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -279,7 +279,6 @@ function parseCliArgs(rawArgv = process.argv) {
const argv = parseCliArgs();
const lossyModeSchema = z.object({ videoEncoder: z.union([z.literal('libx264'), z.literal('libx265'), z.literal('libsvtav1')]) });
-// eslint-disable-next-line prefer-destructuring
const lossyMode = argv['lossyMode'] ? lossyModeSchema.parse(JSON5.parse(argv['lossyMode'])) : undefined;
export type LossyMode = z.infer<typeof lossyModeSchema>;
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index 2037039d..5baf24ab 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -552,7 +552,6 @@ function App() {
const toggleWaveformMode = useCallback(() => {
if (forceBigWaveform) return;
- // eslint-disable-next-line unicorn-js/prefer-switch
if (waveformModePreference === 'waveform') {
setWaveformMode('big-waveform');
} else if (waveformModePreference === 'big-waveform') {
@@ -849,7 +848,6 @@ function App() {
}, []);
const commonSettings = useMemo(() => {
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
const { keyBindings: _keyBindings, ...rest } = allUserSettings.settings;
return { ...rest, ffmpegVersion: ffmpegInfo?.program_version.version };
}, [allUserSettings.settings, ffmpegInfo?.program_version.version]);
@@ -1357,11 +1355,9 @@ function App() {
setProgress(totalProgress / segments.length);
};
- // eslint-disable-next-line eslint-js/no-restricted-syntax
for (const [index, segment] of segments.entries()) {
const { start, end } = segment;
invariant(filePath != null);
- // eslint-disable-next-line no-await-in-loop
lastOutPath = await captureFramesRange({ customOutDir, filePath, fps: detectedFps, fromTime: start, toTime: end, estimatedMaxNumFiles: captureFramesResponse.estimatedMaxNumFiles, captureFormat, quality: captureFrameQuality, filter: captureFramesResponse.filter, outputTimestamps: captureFrameFileNameFormat === 'timestamp', onProgress: (segmentProgress) => handleSegmentProgress(index, segmentProgress) });
}
if (!hideAllNotifications && lastOutPath != null) {
diff --git a/src/renderer/src/MediaSourcePlayer.tsx b/src/renderer/src/MediaSourcePlayer.tsx
index f2672a1f..211b75a5 100644
--- a/src/renderer/src/MediaSourcePlayer.tsx
+++ b/src/renderer/src/MediaSourcePlayer.tsx
@@ -276,7 +276,6 @@ async function startPlayback({ path, slaveVideo, masterVideo, videoStreamIndex,
slaveVideo.currentTime = masterVideo.currentTime;
setStandardPlaybackRate();
} else if (playbackDiff != null && playbackDiff > 0.3) {
- // eslint-disable-next-line no-param-reassign
if (setPlaybackRate(1.5)) {
console.warn(`Playback behind by ${playbackDiff}s, speeding up playback`);
}
diff --git a/src/renderer/src/SegmentList.tsx b/src/renderer/src/SegmentList.tsx
index c2bcac47..315f7c0c 100644
--- a/src/renderer/src/SegmentList.tsx
+++ b/src/renderer/src/SegmentList.tsx
@@ -508,7 +508,6 @@ function SegmentList({
const onTagReset = useCallback((tag: string) => setEditingSegmentTags((tags) => {
invariant(tags != null);
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
const { [tag]: _deleted, ...rest } = tags;
return rest;
}), [setEditingSegmentTags]);
diff --git a/src/renderer/src/Timeline.tsx b/src/renderer/src/Timeline.tsx
index 81a21d03..7f99410a 100644
--- a/src/renderer/src/Timeline.tsx
+++ b/src/renderer/src/Timeline.tsx
@@ -368,7 +368,7 @@ function Timeline({
}, [onGenerateOverviewWaveformClick]);
return (
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/mouse-events-have-key-events
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div
className="no-user-select"
style={{ position: 'relative', borderTop: '1px solid var(--gray-7)', borderBottom: '1px solid var(--gray-7)' }}
diff --git a/src/renderer/src/components/Checkbox.tsx b/src/renderer/src/components/Checkbox.tsx
index db6af221..d1a4732a 100644
--- a/src/renderer/src/components/Checkbox.tsx
+++ b/src/renderer/src/components/Checkbox.tsx
@@ -16,7 +16,6 @@ export default function Checkbox({ label, disabled, style, ...props }: CheckboxP
</Indicator>
</Root>
- {/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
<label className={classes['Label']} htmlFor={id} style={{ opacity: disabled ? 0.5 : undefined }}>
{label}
</label>
diff --git a/src/renderer/src/components/util.tsx b/src/renderer/src/components/util.tsx
index 106e2709..d64b6b2e 100644
--- a/src/renderer/src/components/util.tsx
+++ b/src/renderer/src/components/util.tsx
@@ -2,7 +2,6 @@ import React from 'react';
export function withClass<P extends { className?: string | undefined }>(Component: React.ForwardRefExoticComponent<P>, cls: string) {
- // eslint-disable-next-line react/display-name,@typescript-eslint/no-explicit-any
return React.forwardRef<React.ForwardRefExoticComponent<P>, P>((props, ref) => {
const { className, ...rest } = props ?? {};
// @ts-expect-error dunno how to type this
diff --git a/src/renderer/src/dialogs/index.tsx b/src/renderer/src/dialogs/index.tsx
index 453a545c..e992ff03 100644
--- a/src/renderer/src/dialogs/index.tsx
+++ b/src/renderer/src/dialogs/index.tsx
@@ -264,7 +264,6 @@ export async function askForSegmentDuration({ totalDuration, inputPlaceholder, p
// https://github.com/mifi/lossless-cut/issues/1153
async function askForSegmentsRandomDurationRange() {
function parse(str: string) {
- // eslint-disable-next-line unicorn/better-regex
const match = /^duration([\d.]+)to([\d.]+),gap([-\d.]+)to([-\d.]+)$/i.exec(str.replaceAll(/\s/g, ''));
if (!match) return undefined;
const values = match.slice(1);
@@ -571,11 +570,9 @@ export async function promptDownloadMediaUrl(outPath: string) {
export async function deleteFiles({ paths, deleteIfTrashFails, signal }: { paths: string[], deleteIfTrashFails?: boolean | undefined, signal: AbortSignal }) {
const failedToTrashFiles: string[] = [];
- // eslint-disable-next-line eslint-js/no-restricted-syntax
for (const path of paths) {
try {
if (testFailFsOperation) throw new Error('test trash failure');
- // eslint-disable-next-line no-await-in-loop
await trashFile(path);
signal.throwIfAborted();
} catch (err) {
diff --git a/src/renderer/src/edlFormats.ts b/src/renderer/src/edlFormats.ts
index 67273902..7eb67e5c 100644
--- a/src/renderer/src/edlFormats.ts
+++ b/src/renderer/src/edlFormats.ts
@@ -397,7 +397,6 @@ export function parseDvAnalyzerSummaryTxt(txt: string) {
let headerFound = false;
const times: { time: number, name: string, tags: Record<string, string> }[] = [];
- // eslint-disable-next-line eslint-js/no-restricted-syntax
for (const line of lines) {
if (headerFound) {
const match = /^(\d{2}):(\d{2}):(\d{2}).(\d{3})\s+(\S+)\s+-\s+(\S+)\s+(\S+\s+\S+)\s+-\s+(\S+\s+\S+)/.exec(line);
@@ -443,7 +442,6 @@ export function parseSrt(text: string) {
lines = [];
};
- // eslint-disable-next-line eslint-js/no-restricted-syntax
for (const lineRaw of text.trim().split(/\r?\n/)) {
const line = lineRaw.trim();
if (line === '') {
diff --git a/src/renderer/src/edlStore.ts b/src/renderer/src/edlStore.ts
index 51643c92..88aca031 100644
--- a/src/renderer/src/edlStore.ts
+++ b/src/renderer/src/edlStore.ts
@@ -104,7 +104,6 @@ export async function loadLlcProject(path: string) {
return llcProjectV2Schema.parse(json);
} catch (err) {
if (err instanceof ZodError) {
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
const { cutSegments, version: _ignored, ...restProject } = llcProjectV1Schema.parse(json);
console.log('Converting v1 project to v2');
return {
diff --git a/src/renderer/src/hooks/useDirectoryAccess.ts b/src/renderer/src/hooks/useDirectoryAccess.ts
index 79837d11..df55be33 100644
--- a/src/renderer/src/hooks/useDirectoryAccess.ts
+++ b/src/renderer/src/hooks/useDirectoryAccess.ts
@@ -49,7 +49,6 @@ export default function useDirectoryAccess({ setCustomOutDir }: { setCustomOutDi
// We are now MAS, so we need to try to encourage the user to allow access to the dir
// If the user keeps choosing the wrong dir, we will keep asking
// Normally Apple grants access to the dir of the file that was selected in a file open dialog or drag-droppen, but maybe the user opened a file from the batch list, for example.
- // eslint-disable-next-line no-await-in-loop
const userSelectedDir = await askForInputDir(inputFileDir);
// allow user to cancel:
diff --git a/src/renderer/src/hooks/useHtml5ify.tsx b/src/renderer/src/hooks/useHtml5ify.tsx
index d63159ae..17d59b6d 100644
--- a/src/renderer/src/hooks/useHtml5ify.tsx
+++ b/src/renderer/src/hooks/useHtml5ify.tsx
@@ -108,7 +108,6 @@ export default function useHtml5ify({ filePath, hasVideo, hasAudio, workingRef,
checked={option === value}
onChange={onOptionChange}
/>
- {/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
<label htmlFor={id} style={{ marginLeft: '.5em' }}>{label}</label>
</div>
);
diff --git a/src/renderer/src/hooks/useNativeMenu.ts b/src/renderer/src/hooks/useNativeMenu.ts
index 44a2dd06..22881c1f 100644
--- a/src/renderer/src/hooks/useNativeMenu.ts
+++ b/src/renderer/src/hooks/useNativeMenu.ts
@@ -3,7 +3,6 @@ import { useCallback, useMemo } from 'react';
// TODO pull out?
const { getCurrentWindow, Menu } = window.require('@electron/remote');
-// eslint-disable-next-line prefer-destructuring
// https://github.com/transflow/use-electron-context-menu
// https://www.electronjs.org/docs/latest/api/menu-item
diff --git a/src/renderer/src/hooks/useSegments.tsx b/src/renderer/src/hooks/useSegments.tsx
index b2365b64..74401fa3 100644
--- a/src/renderer/src/hooks/useSegments.tsx
+++ b/src/renderer/src/hooks/useSegments.tsx
@@ -106,7 +106,6 @@ function useSegments({ filePath, workingRef, setWorking, setProgress, videoStrea
})), []);
const clearSegColorCounter = useCallback(() => {
- // eslint-disable-next-line no-param-reassign
setSegColorCounter(0);
}, [setSegColorCounter]);
@@ -119,7 +118,6 @@ function useSegments({ filePath, workingRef, setWorking, setProgress, videoStrea
}
// delete "initial" after modifying segments
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
const map = (newSegments: StateSegment[]) => newSegments.flatMap(({ start, end, initial: _ignored, ...rest }) => {
const startClamped = clampValue(start) ?? 0;
const endClamped = clampValue(end);
@@ -390,7 +388,6 @@ function useSegments({ filePath, workingRef, setWorking, setProgress, videoStrea
// also exclude initial segment (will cause problems later on)
const sortedSegments = sortSegments(filterNonMarkers(cutSegments).filter((seg) => !seg.initial));
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
return invertSegments(sortedSegments, true, true, fileDuration).map(({ segId, end, name: _ignored, ...rest }) => {
// in order to please TS:
invariant(segId != null && end != null);
@@ -428,7 +425,6 @@ function useSegments({ filePath, workingRef, setWorking, setProgress, videoStrea
errorToast(i18n.t('Make sure you have no overlapping segments.'));
return;
}
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
const newInverseCutSegments = inverseSegmentsAndMarkers.map(({ name: _ignored, ...segment }) => createIndexedSegment({ segment, incrementCount: true }));
safeSetCutSegments((existing) => ([...existing, ...newInverseCutSegments]));
}, [createIndexedSegment, fileDuration, selectedSegments, safeSetCutSegments]);
diff --git a/src/renderer/src/hooks/useTimecode.tsx b/src/renderer/src/hooks/useTimecode.tsx
index f962acbd..360c6024 100644
--- a/src/renderer/src/hooks/useTimecode.tsx
+++ b/src/renderer/src/hooks/useTimecode.tsx
@@ -90,7 +90,6 @@ export default ({ detectedFps, timecodeFormat, showGenericDialog }: {
}, [onOpenChange, t, value]);
return (
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
<Dialog.Content aria-describedby={undefined} style={{ width: '80vw' }}>
<Dialog.Title>{title}</Dialog.Title>
diff --git a/src/renderer/src/i18n.ts b/src/renderer/src/i18n.ts
index b1711207..a4d26d90 100644
--- a/src/renderer/src/i18n.ts
+++ b/src/renderer/src/i18n.ts
@@ -31,5 +31,4 @@ i18n
},
});
-// eslint-disable-next-line unicorn/prefer-export-from
export default i18n;
diff --git a/src/renderer/src/segments.ts b/src/renderer/src/segments.ts
index 812fd459..51dbd8d2 100644
--- a/src/renderer/src/segments.ts
+++ b/src/renderer/src/segments.ts
@@ -156,7 +156,6 @@ export function hasAnySegmentOverlap(sortedSegments: { start: number, end: numbe
return overlappingGroups.length > 0;
}
-// eslint-disable-next-line @stylistic/space-before-function-paren
export function invertSegments(
sortedSegmentsIn: ({ start: number, end?: number | undefined, segId?: string | undefined, name?: string | undefined })[],
includeFirstSegment: boolean,
@@ -210,7 +209,6 @@ export function invertSegments(
// because chapters need to be contiguous in formats like MP4, we insert "gap" segments in-between, so that end times will be correct
export function convertSegmentsToChaptersWithGaps(sortedSegments: (DefiniteSegmentBase & { name?: string | undefined })[]) {
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
const invertedSegmentsWithoutName = invertSegments(sortedSegments, true, false).map(({ end, name: _ignored, ...seg }) => {
invariant(end != null); // to please typescript
return { ...seg, end };
diff --git a/src/renderer/src/util.ts b/src/renderer/src/util.ts
index b578d933..d9966910 100644
--- a/src/renderer/src/util.ts
+++ b/src/renderer/src/util.ts
@@ -182,7 +182,6 @@ export function filenamify(name: string) {
return name.replaceAll(/[^\p{L}\p{N} ._-]/gu, '_');
}
-// eslint-disable-next-line @stylistic/space-before-function-paren
export function withBlur<T extends { target?: object | { blur?: () => unknown } }>(cb: (a: T) => void) {
return (e: T) => {
cb(e);
@@ -340,7 +339,6 @@ export function shuffleArray<T>(arrayIn: T[]) {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
export function escapeRegExp(str: string) {
- // eslint-disable-next-line unicorn/better-regex
return str.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`); // $& means the whole matched string
}
diff --git a/src/renderer/src/util/duration.ts b/src/renderer/src/util/duration.ts
index 198eed77..cd71aa05 100644
--- a/src/renderer/src/util/duration.ts
+++ b/src/renderer/src/util/duration.ts
@@ -55,7 +55,6 @@ export const isExactTimecodeMatch = (str: string, parseTimecode: ParseTimecode,
// See also parseYoutube
export function parseDuration(str: string, fps?: number) {
- // eslint-disable-next-line unicorn/better-regex
const match = durationRegex.exec(str.replaceAll(/\s/g, ''));
if (!match) return undefined;
diff --git a/src/renderer/src/worker/evalWorker.ts b/src/renderer/src/worker/evalWorker.ts
index c16f045e..6ac7f8de 100644
--- a/src/renderer/src/worker/evalWorker.ts
+++ b/src/renderer/src/worker/evalWorker.ts
@@ -128,7 +128,6 @@ myGlobal.fetch = undefined;
// eslint-disable-next-line @stylistic/wrap-iife, func-names, unicorn-js/prefer-block-statement-over-iife -- TODO fix (new rule in @mifi/lint-config)
(function () {
onmessage = (event: MessageEvent<RequestMessageData>) => {
- // eslint-disable-next-line strict, lines-around-directive
'use strict';
const { code, id, context: contextStr } = event.data;