Skip to content

The swiss army knife of lossless video/audio editing

Fix 5 simple TODO lint disable comments

Claude6e2af02a68b7
diff --git a/script/featureMedia.ts b/script/featureMedia.ts
index 132aff8c..23770d2b 100644
--- a/script/featureMedia.ts
+++ b/script/featureMedia.ts
@@ -48,8 +48,7 @@ const outDir = 'dist/feature-media';
await mkdir(outDir, { recursive: true });
await mkdir(clips, { recursive: true });
-// eslint-disable-next-line unicorn-js/prefer-then-catch -- TODO fix (new rule in @mifi/lint-config)
-const exists = async (path: string) => access(path).then(() => true, () => false);
+const exists = async (path: string) => access(path).then(() => true).catch(() => false);
// Writes to a temp file first, so an interrupted download isn't used next time
async function writeVia(path: string, write: (partPath: string) => Promise<unknown>) {
@@ -125,8 +124,7 @@ const rawVideo = join(configDir, 'raw.mkv');
try {
// Wait for the HTTP API
for (let i = 0; ; i += 1) {
- // eslint-disable-next-line unicorn-js/prefer-then-catch -- TODO fix (new rule in @mifi/lint-config)
- if (await fetch(`http://127.0.0.1:${port}/`).then(() => true, () => false)) break;
+ if (await fetch(`http://127.0.0.1:${port}/`).then(() => true).catch(() => false)) break;
assert.ok(i < 60 && app.exitCode == null, `LosslessCut did not start, see ${appLog}`);
await timers.setTimeout(500);
}
diff --git a/src/main/util.test.ts b/src/main/util.test.ts
index bfc53f02..503bdef9 100644
--- a/src/main/util.test.ts
+++ b/src/main/util.test.ts
@@ -30,8 +30,7 @@ describe('parseCliKeyboardActionArgs', () => {
});
test('throws on invalid JSON5', () => {
- // eslint-disable-next-line vitest/require-to-throw-message -- TODO fix (new rule in @mifi/lint-config)
- expect(() => parseCliKeyboardActionArgs('goToTimecodeDirect', ['{time:'], cwd)).toThrow();
+ expect(() => parseCliKeyboardActionArgs('goToTimecodeDirect', ['{time:'], cwd)).toThrow(/JSON5/);
});
});
diff --git a/src/renderer/src/components/ExportConfirm.tsx b/src/renderer/src/components/ExportConfirm.tsx
index b0b3b983..148388e6 100644
--- a/src/renderer/src/components/ExportConfirm.tsx
+++ b/src/renderer/src/components/ExportConfirm.tsx
@@ -231,8 +231,7 @@ function ExportConfirm({
generic.push({ text: t('You are in simple mode, meaning some functionality has been simplified or hidden.') });
}
- // eslint-disable-next-line unicorn-js/prefer-includes-over-repeated-comparisons -- TODO fix (new rule in @mifi/lint-config)
- if ((effectiveExportMode === 'separate' || effectiveExportMode === 'merge' || effectiveExportMode === 'merge+separate') && !areWeCutting) {
+ if (['separate', 'merge', 'merge+separate'].includes(effectiveExportMode) && !areWeCutting) {
generic.push({ text: t('Exporting whole file without cutting, because there are no segments to export.') });
}
diff --git a/src/renderer/src/components/FileNameTemplateEditor.tsx b/src/renderer/src/components/FileNameTemplateEditor.tsx
index 842e569a..4bbc5dc1 100644
--- a/src/renderer/src/components/FileNameTemplateEditor.tsx
+++ b/src/renderer/src/components/FileNameTemplateEditor.tsx
@@ -265,8 +265,7 @@ function FileNameTemplateEditor(opts: {
{hasTextNumericPaddedValue && (
<div style={{ marginBottom: '.3em' }}>
<Select value={outputFileNameMinZeroPadding} onChange={(e) => setOutputFileNameMinZeroPadding(parseInt(e.target.value, 10))} style={{ marginRight: '.5em', fontSize: '1em' }}>
- {/* eslint-disable-next-line unicorn-js/prefer-array-from-map -- TODO fix (new rule in @mifi/lint-config) */}
- {Array.from({ length: 10 }).map((_v, i) => i + 1).map((v) => <option key={v} value={v}>{v}</option>)}
+ {Array.from({ length: 10 }, (_v, i) => i + 1).map((v) => <option key={v} value={v}>{v}</option>)}
</Select>
{t('Minimum numeric padded length')}
</div>