The swiss army knife of lossless video/audio editing
Adapt to the stage 2 rules of @mifi/lint-config
Claude5c90864e4948
diff --git a/.oxlintrc.json b/.oxlintrc.jsonindex 31789758..a6d89094 100644--- a/.oxlintrc.json+++ b/.oxlintrc.json@@ -25,6 +25,47 @@"jsx-a11y/control-has-associated-label": "off","react-js/no-unused-prop-types": "off","eslint-js/func-call-spacing": "off",+ // TODO stage 2 rules from @mifi/lint-config with many findings here (count in parentheses), turned off until fixed+ "unicorn-js/consistent-boolean-name": "off", // (95)+ "unicorn/prefer-number-coercion": "off", // (95)+ "unicorn-js/prefer-minimal-ternary": "off", // (19)+ "unicorn-js/prefer-simple-condition-first": "off", // (17)+ "unicorn-js/no-asterisk-prefix-in-documentation-comments": "off", // (152)+ "unicorn-js/prefer-combined-guards": "off", // (19)+ "unicorn-js/prefer-early-return": "off", // (26)+ "unicorn-js/no-negated-array-predicate": "off", // (7)+ "unicorn-js/single-line-block-comment-style": "off", // (37)+ "unicorn/max-nested-calls": "off", // (22)+ "unicorn-js/no-declarations-before-early-exit": "off", // (15)+ "unicorn/consistent-assert": "off", // (56)+ "unicorn-js/no-top-level-assignment-in-function": "off", // (25)+ "unicorn-js/prefer-continue": "off", // (6)+ "unicorn-js/prefer-split-limit": "off", // (7)+ "unicorn-js/no-unnecessary-array-flat-map": "off", // (20)+ "unicorn-js/consistent-conditional-object-spread": "off", // (6)+ "unicorn-js/prefer-await": "off", // (14)+ "unicorn-js/no-computed-property-existence-check": "off", // (15)+ "unicorn-js/no-useless-concat": "off", // (11)+ "typescript/prefer-nullish-coalescing": "off", // (33)+ "typescript/strict-boolean-expressions": "off", // (275)+ "typescript/no-unsafe-assignment": "off", // (69)+ "typescript/no-confusing-void-expression": "off", // (396)+ "typescript/no-unnecessary-condition": "off", // (97)+ "typescript/no-unsafe-member-access": "off", // (54)+ "typescript/no-unsafe-return": "off", // (11)+ "typescript/restrict-template-expressions": "off", // (18)+ "typescript/no-unsafe-argument": "off", // (33)+ "typescript/unbound-method": "off", // (8)+ "typescript/no-duplicate-type-constituents": "off", // (11)+ "typescript/no-floating-promises": "off", // (116)+ "typescript/no-unnecessary-type-assertion": "off", // (7)+ "typescript/no-unnecessary-type-conversion": "off", // (9)+ "typescript/prefer-optional-chain": "off", // (17)+ "typescript/no-redundant-type-constituents": "off", // (8)+ "typescript/prefer-regexp-exec": "off", // (20)+ "typescript/require-await": "off", // (19)+ "typescript/no-misused-promises": "off", // (121)+ "typescript/no-unnecessary-boolean-literal-compare": "off", // (7)// TODO remove the type assertions (58), then use the shared config's assertionStyle: never"@typescript-eslint/consistent-type-assertions": ["error",diff --git a/script/featureMedia.ts b/script/featureMedia.tsindex 59505080..53fd4303 100644--- a/script/featureMedia.ts+++ b/script/featureMedia.ts@@ -17,6 +17,7 @@ import musicTracks, { defaultMusic } from './featureMedia/music.ts';import scenarios from './featureMedia/scenarios.ts';import { renderSocialVideo, type Caption, type Rect, type Zoom } from './featureMedia/socialVideo.ts';+// eslint-disable-next-line unicorn-js/no-unreadable-object-destructuring -- TODO fix (new rule in @mifi/lint-config)const { values: { clips = 'dist/feature-media-clips', music: musicArg = defaultMusic, scale: scaleArg = '1' }, positionals: [scenarioName] } = parseArgs({ allowPositionals: true, options: { clips: { type: 'string' }, music: { type: 'string' }, scale: { type: 'string' } } });const scenario = scenarioName != null ? scenarios[scenarioName] : undefined;assert(scenario != null, `Usage: node script/featureMedia.ts <scenario> [--clips dir] [--music track from music.ts, audio file or none] [--scale 2]. Scenarios: ${Object.keys(scenarios).join(', ')}`);@@ -27,6 +28,7 @@ assert(process.platform === 'linux' && display != null, 'Run under Xvfb on Linuxconst width = 1024;const height = 640;const scale = Number(scaleArg);+// eslint-disable-next-line unicorn-js/prefer-number-is-safe-integer -- TODO fix (new rule in @mifi/lint-config)assert(Number.isInteger(scale) && scale > 0, `--scale must be a whole number, got ${scaleArg}`);const screenWidth = width * scale;const screenHeight = height * scale;@@ -45,6 +47,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);// Writes to a temp file first, so an interrupted download isn't used next time@@ -122,6 +125,7 @@ const rawVideo = join(configDir, 'raw.mkv');try {// Wait for the HTTP APIfor (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;assert(i < 60 && app.exitCode == null, `LosslessCut did not start, see ${appLog}`);await timers.setTimeout(500);diff --git a/script/generateIcon.ts b/script/generateIcon.tsindex 5a0d5861..f8b2f52e 100644--- a/script/generateIcon.ts+++ b/script/generateIcon.ts@@ -10,6 +10,7 @@ const renderPng = (from: string, width: number, height: number) => sharp(from)}).toBuffer();+// eslint-disable-next-line unicorn-js/no-unnecessary-parameters -- TODO fix (new rule in @mifi/lint-config)const svg2png = async (from: string, to: string, width: number, height: number) => (writeFile(to, await renderPng(from, width, height)));diff --git a/script/generateVersions.ts b/script/generateVersions.tsindex 8bdc871c..562f4e99 100644--- a/script/generateVersions.ts+++ b/script/generateVersions.ts@@ -5,6 +5,7 @@ const versionsDir = new URL('../versions/', import.meta.url);const versions: { version: string, highlightsMd?: string | undefined }[] = [];+// eslint-disable-next-line unicorn-js/no-unreadable-for-of-expression -- TODO fix (new rule in @mifi/lint-config)for (const file of await readdir(versionsDir, { withFileTypes: true })) {if (file.isFile() && file.name.endsWith('.md')) {const version = file.name.replace(/.md$/, '');diff --git a/script/getCommits.ts b/script/getCommits.tsindex 7172e3c7..863ca3ba 100644--- a/script/getCommits.ts+++ b/script/getCommits.ts@@ -8,8 +8,8 @@ const tag = ps1.stdout.trim();assert(tag, 'Tag not found');// Use record separator (RS) and field separator (FS) to split commits and fields reliably-const RS = '\u001E';-const FS = '\u001F';+const RS = '\u{1E}';+const FS = '\u{1F}';const format = `%H${FS}%cI${FS}%an <%ae>${FS}%B${RS}`;const args = tag ? ['log', `${tag}..HEAD`, `--pretty=format:${format}`] : ['log', `--pretty=format:${format}`];diff --git a/script/releaseImage.ts b/script/releaseImage.tsindex 9c887532..34e711ff 100644--- a/script/releaseImage.ts+++ b/script/releaseImage.ts@@ -5,6 +5,7 @@ import { dirname } from 'node:path';import { parseArgs } from 'node:util';import sharp from 'sharp';+// eslint-disable-next-line unicorn-js/no-unreadable-object-destructuring -- TODO fix (new rule in @mifi/lint-config)const { values: { bg, position, caption, square, out }, positionals: [version, ...highlights] } = parseArgs({allowPositionals: true,options: { bg: { type: 'string' }, position: { type: 'string' }, caption: { type: 'string' }, square: { type: 'boolean' }, out: { type: 'string' } },diff --git a/script/releaseNotes.ts b/script/releaseNotes.tsindex 8d74d170..7ea9bfd6 100644--- a/script/releaseNotes.ts+++ b/script/releaseNotes.ts@@ -7,6 +7,7 @@ const from = process.argv[2] ?? (await execa('git', ['describe', '--tags', '--ab// Match anywhere in the message, not just git's trailer block (which is only the last paragraph)const { stdout } = await execa('git', ['log', '--reverse', '--format=%B', `${from}..HEAD`]);// without duplicates (e.g. the same line in several commits of a pull request)+// eslint-disable-next-line unicorn-js/prefer-iterator-to-array -- TODO fix (new rule in @mifi/lint-config)const notes = [...new Set([...stdout.matchAll(/^changelog\s*:\s*(.+)$/gim)].map(([, note]) => note!.trim()))];console.log(`Changes since ${from}:\n`);diff --git a/script/storeRelease.ts b/script/storeRelease.tsindex 1259ab22..7156182b 100644--- a/script/storeRelease.ts+++ b/script/storeRelease.ts@@ -399,6 +399,7 @@ async function msstoreRollout(percentArg: string) {const version = String(args['version']);assert(store === 'msstore-rollout' || /^\d+\.\d+\.\d+$/.test(version), `Invalid version ${version}`);+// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- TODO fix (new rule in @mifi/lint-config)switch (store) {case 'mas': { await mas(version); break; }case 'msstore': { await msstore(version); break; }diff --git a/src/main/aboutPanel.ts b/src/main/aboutPanel.tsindex d530e5ca..fb613013 100644--- a/src/main/aboutPanel.ts+++ b/src/main/aboutPanel.ts@@ -9,7 +9,6 @@ import isStoreBuild from './isStoreBuild.js';import { githubUrl, homepageUrl } from '../common/constants.js';-// eslint-disable-next-line import/prefer-default-exportexport function getAboutPanelOptions() {const appVersion = app.getVersion();diff --git a/src/main/compatPlayer.ts b/src/main/compatPlayer.tsindex 766d062e..858c64dd 100644--- a/src/main/compatPlayer.ts+++ b/src/main/compatPlayer.ts@@ -4,7 +4,6 @@ import logger from './logger.js';import { createMediaSourceProcess } from './ffmpeg.js';-// eslint-disable-next-line import/prefer-default-exportexport function createMediaSourceStream(params: Parameters<typeof createMediaSourceProcess>[0]) {const abortController = new AbortController();diff --git a/src/main/ffmpeg.ts b/src/main/ffmpeg.tsindex c509862c..3beb1066 100644--- a/src/main/ffmpeg.ts+++ b/src/main/ffmpeg.ts@@ -40,9 +40,9 @@ function escapeCliArg(arg: string) {// todo change String(arg) => arg when ts no-implicit-any is turned onif (isWindows) {// https://github.com/mifi/lossless-cut/issues/2151- return /[\s"&<>^|]/.test(arg) ? `"${String(arg).replaceAll('"', '""')}"` : arg;+ return /[\s"&<>^|]/.test(arg) ? `"${arg.replaceAll('"', '""')}"` : arg;}- return /[^\w-]/.test(arg) ? `'${String(arg).replaceAll("'", '\'"\'"\'')}'` : arg;+ return /[^\w-]/.test(arg) ? `'${arg.replaceAll("'", '\'"\'"\'')}'` : arg;}export type FfCommand = 'ffmpeg' | 'ffprobe';@@ -293,6 +293,7 @@ export function mapTimesToSegments(times: number[], includeLast: boolean) {if (start != null) {if (end != null) {segments.push({ start, end });+ // eslint-disable-next-line unicorn-js/no-duplicate-if-branches -- TODO fix (new rule in @mifi/lint-config)} else if (includeLast) {segments.push({ start, end }); // end undefined is allowed (means until end of video)}diff --git a/src/main/httpServerUtil.ts b/src/main/httpServerUtil.tsindex ea53fdbe..12ca23fd 100644--- a/src/main/httpServerUtil.ts+++ b/src/main/httpServerUtil.ts@@ -4,7 +4,6 @@// resolve to 127.0.0.1 so that their page becomes same-origin with us.// - Checking `Origin` prevents CSRF. Browsers always send `Origin` on cross origin requests (and on// all POSTs), while non-browser clients like curl never send it.-// eslint-disable-next-line import/prefer-default-exportexport function isRequestAllowed({ host, origin, port }: {host: string | undefined,origin: string | undefined,diff --git a/src/main/logger.ts b/src/main/logger.tsindex d489762b..0a551da7 100644--- a/src/main/logger.ts+++ b/src/main/logger.ts@@ -12,6 +12,7 @@ import type { TransformableInfo } from 'logform';// https://github.com/winstonjs/winston/issues/1427const combineMessageAndSplat = () => ({transform(info: TransformableInfo) {+ // eslint-disable-next-line unicorn-js/no-unreadable-object-destructuring -- TODO fix (new rule in @mifi/lint-config)const { [Symbol.for('splat')]: args = [], message } = info;// @ts-expect-error incorrect type// eslint-disable-next-line no-param-reassigndiff --git a/src/main/progress.ts b/src/main/progress.tsindex 4b2a968b..b2adc368 100644--- a/src/main/progress.ts+++ b/src/main/progress.ts@@ -1,4 +1,3 @@-// eslint-disable-next-line import/prefer-default-exportexport function parseFfmpegProgressLine({ line, customMatcher, duration: durationIn }: {line: string,customMatcher?: ((a: string) => void) | undefined,diff --git a/src/main/updateChecker.ts b/src/main/updateChecker.tsindex 22f42b15..3f338f00 100644--- a/src/main/updateChecker.ts+++ b/src/main/updateChecker.ts@@ -9,7 +9,6 @@ import logger from './logger.js';const { app } = electron;-// eslint-disable-next-line import/prefer-default-exportexport async function checkNewVersion() {try {// Redirects to GitHub's "latest release" API (see websiteUrls.ts), which returns the latest published full releasediff --git a/src/preload/index.ts b/src/preload/index.tsindex 4efdd5f2..0dcb6391 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -16,5 +16,6 @@ const apiProxy = new Proxy(// todo use contextBridge instead once we get rid of @electron/remote// @ts-expect-error we don't need to type this+// eslint-disable-next-line unicorn-js/no-global-object-property-assignment -- TODO fix (new rule in @mifi/lint-config)window.electron = apiProxy;// contextBridge.exposeInMainWorld('electron', apiProxy);diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsxindex 5e570523..2024639a 100644--- a/src/renderer/src/App.tsx+++ b/src/renderer/src/App.tsx@@ -1588,8 +1588,7 @@ function App() {// Open .llc AND media referenced withinif (isLlcProject) {console.log('Loading LLC project', path);- const project = await loadLlcProject(path);- const { mediaFileName } = project;+ const { mediaFileName } = await loadLlcProject(path);console.log({ mediaFileName });if (!mediaFileName) return;@@ -2093,9 +2092,9 @@ function App() {selectSegmentsAtCursor,increaseRotation,goToTimecode: () => goToTimecode(),- seekBackwards: () => seekRelAccelerated(-1 * keyboardNormalSeekSpeed),- seekBackwards2: () => seekRelAccelerated(-1 * keyboardSeekSpeed2),- seekBackwards3: () => seekRelAccelerated(-1 * keyboardSeekSpeed3),+ seekBackwards: () => seekRelAccelerated(-keyboardNormalSeekSpeed),+ seekBackwards2: () => seekRelAccelerated(-keyboardSeekSpeed2),+ seekBackwards3: () => seekRelAccelerated(-keyboardSeekSpeed3),seekForwards: () => seekRelAccelerated(keyboardNormalSeekSpeed),seekForwards2: () => seekRelAccelerated(keyboardSeekSpeed2),seekForwards3: () => seekRelAccelerated(keyboardSeekSpeed3),diff --git a/src/renderer/src/BottomBar.tsx b/src/renderer/src/BottomBar.tsxindex b4bf1920..e2c52d41 100644--- a/src/renderer/src/BottomBar.tsx+++ b/src/renderer/src/BottomBar.tsx@@ -33,6 +33,7 @@ import type { Frame } from './ffmpeg';import mainApi from './mainApi';+// eslint-disable-next-line unicorn-js/no-array-from-fill -- TODO fix (new rule in @mifi/lint-config)const zoomOptions = Array.from({ length: 13 }).fill(undefined).map((_unused, z) => 2 ** z);const leftRightWidth = 100;diff --git a/src/renderer/src/ErrorBoundary.tsx b/src/renderer/src/ErrorBoundary.tsxindex a7de2339..de7df5d6 100644--- a/src/renderer/src/ErrorBoundary.tsx+++ b/src/renderer/src/ErrorBoundary.tsx@@ -14,6 +14,7 @@ class ErrorBoundary extends Component<{ children: ReactNode }> {this.state = { error: undefined };}+ // eslint-disable-next-line unicorn-js/consistent-class-member-order -- TODO fix (new rule in @mifi/lint-config)static getDerivedStateFromError(error: unknown) {return { error };}diff --git a/src/renderer/src/StreamsSelector.tsx b/src/renderer/src/StreamsSelector.tsxindex 88534379..f7243201 100644--- a/src/renderer/src/StreamsSelector.tsx+++ b/src/renderer/src/StreamsSelector.tsx@@ -817,6 +817,7 @@ function StreamsSelector({if (fileParams != null) resetParamsDraft(fileParams, streamId);})), [setParamsByFile]);+ // eslint-disable-next-line unicorn-js/prefer-iterator-helpers, unicorn-js/prefer-iterator-to-array -- TODO fix (new rule in @mifi/lint-config)const haveEdits = useMemo(() => [...paramsByFile.values()].some((fileParams) => hasFileEdits(fileParams) || [...fileParams.paramsByStream.values()].some((streamParams) => hasStreamEdits(streamParams))), [paramsByFile]);const onResetAllClick = useCallback(async () => {diff --git a/src/renderer/src/animations.ts b/src/renderer/src/animations.tsindex 77a6ba71..f4d50155 100644--- a/src/renderer/src/animations.ts+++ b/src/renderer/src/animations.ts@@ -1,7 +1,6 @@import mitt from 'mitt';-// eslint-disable-next-line import/prefer-default-exportexport const mySpring = { type: 'spring' as const, damping: 50, stiffness: 700 };export const emitter = mitt<{diff --git a/src/renderer/src/components/ConcatDialog.tsx b/src/renderer/src/components/ConcatDialog.tsxindex a75971d7..c20e28b8 100644--- a/src/renderer/src/components/ConcatDialog.tsx+++ b/src/renderer/src/components/ConcatDialog.tsx@@ -37,18 +37,9 @@ function Alert({ text }: { text: string }) {);}+// eslint-disable-next-line unicorn-js/prefer-smaller-scope -- TODO fix (new rule in @mifi/lint-config)type ProblemValue = string | number | undefined;-type Problem = {- index: number,-} & ({- type: 'extraneous',-} | {- type: 'parameter_mismatch',- key: string,- values: [ProblemValue, ProblemValue],-});-function ConcatDialog({ isShown, onHide, paths, mergedFileTemplate: storedMergedFileTemplate, generateMergedFileNames, onConcat, alwaysConcatMultipleFiles, setAlwaysConcatMultipleFiles, fileFormat, setFileFormat, detectedFileFormat, setDetectedFileFormat, onOutputFormatUserChange }: {isShown: boolean,onHide: () => void,@@ -134,6 +125,15 @@ function ConcatDialog({ isShown, onHide, paths, mergedFileTemplate: storedMerged}, [allFilesMeta, paths]);const problemsByFile = useMemo(() => {+ type Problem = {+ index: number,+ } & ({+ type: 'extraneous',+ } | {+ type: 'parameter_mismatch',+ key: string,+ values: [ProblemValue, ProblemValue],+ });if (!matchingFilesMeta) return {};const allFilesMetaExceptFirstFile = matchingFilesMeta.slice(1);const [, firstFileMeta] = matchingFilesMeta[0]!;diff --git a/src/renderer/src/components/ExportConfirm.tsx b/src/renderer/src/components/ExportConfirm.tsxindex 550fe4c4..97670e35 100644--- a/src/renderer/src/components/ExportConfirm.tsx+++ b/src/renderer/src/components/ExportConfirm.tsx@@ -231,6 +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) {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.tsxindex 57406a2a..66735e51 100644--- a/src/renderer/src/components/FileNameTemplateEditor.tsx+++ b/src/renderer/src/components/FileNameTemplateEditor.tsx@@ -265,6 +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>)}</Select>{t('Minimum numeric padded length')}diff --git a/src/renderer/src/components/TagEditor.tsx b/src/renderer/src/components/TagEditor.tsxindex 2009c7d3..86f8b9c8 100644--- a/src/renderer/src/components/TagEditor.tsx+++ b/src/renderer/src/components/TagEditor.tsx@@ -186,6 +186,7 @@ function TagEditor({ existingTags = emptyObject, customTags = emptyObject, editi<><table style={{ marginBottom: '1em', width: '100%' }}><tbody>+ {/* eslint-disable-next-line unicorn-js/prefer-object-iterable-methods -- TODO fix (new rule in @mifi/lint-config) */}{Object.keys(effectiveTags).map((tag) => {const editingThis = tag === editingTag;const thisTagCustom = customTags[tag] != null;diff --git a/src/renderer/src/components/util.tsx b/src/renderer/src/components/util.tsxindex 2a296426..906f3916 100644--- a/src/renderer/src/components/util.tsx+++ b/src/renderer/src/components/util.tsx@@ -1,7 +1,6 @@import React from 'react';-// eslint-disable-next-line import/prefer-default-exportexport function withClass<P extends { className?: string | undefined }>(Component: React.ForwardRefExoticComponent<P>, cls: string) {// eslint-disable-next-line react/display-name,@typescript-eslint/no-explicit-anyreturn React.forwardRef<React.ForwardRefExoticComponent<P>, P>((props, ref) => {diff --git a/src/renderer/src/dialogs/extractFrames.tsx b/src/renderer/src/dialogs/extractFrames.tsxindex f167dfa2..cb813673 100644--- a/src/renderer/src/dialogs/extractFrames.tsx+++ b/src/renderer/src/dialogs/extractFrames.tsx@@ -3,7 +3,6 @@ import i18n from 'i18next';import getSwal from '../swal';-// eslint-disable-next-line import/prefer-default-exportexport async function askExtractFramesAsImages({ segmentsNumFrames, plural, fps }: { segmentsNumFrames: number, plural: boolean, fps: number }) {const { value: captureChoice } = await getSwal().Swal.fire<string>({text: i18n.t(plural ? 'Extract frames of the selected segments as images' : 'Extract frames of the current segment as images'),@@ -43,6 +42,7 @@ export async function askExtractFramesAsImages({ segmentsNumFrames, plural, fpsestimatedMaxNumFiles = Math.round(segmentsNumFrames / intervalFrames);}+ // eslint-disable-next-line unicorn-js/prefer-else-if -- TODO fix (new rule in @mifi/lint-config)if (captureChoice === 'selectNthSec' || captureChoice === 'selectNthFrame') {let nthFrame: number;if (captureChoice === 'selectNthFrame') {@@ -56,6 +56,7 @@ export async function askExtractFramesAsImages({ segmentsNumFrames, plural, fps});if (value == null) return undefined;const intervalFrames = parseInt(value, 10);+ // eslint-disable-next-line unicorn-js/prefer-hoisting-branch-code -- TODO fix (new rule in @mifi/lint-config)if (Number.isNaN(intervalFrames) || intervalFrames < 1) return undefined;nthFrame = intervalFrames;} else {@@ -76,6 +77,7 @@ export async function askExtractFramesAsImages({ segmentsNumFrames, plural, fpsfilter = `select=not(mod(n\\,${nthFrame}))`;estimatedMaxNumFiles = Math.round(segmentsNumFrames / nthFrame);}+ // eslint-disable-next-line unicorn-js/prefer-else-if -- TODO fix (new rule in @mifi/lint-config)if (captureChoice === 'selectScene') {const { value } = await getSwal().Swal.fire({text: i18n.t('Capture frames that differ the most from the previous frame'),diff --git a/src/renderer/src/edlFormats.test.ts b/src/renderer/src/edlFormats.test.tsindex 3c234c7c..d8991bf3 100644--- a/src/renderer/src/edlFormats.test.ts+++ b/src/renderer/src/edlFormats.test.ts@@ -113,6 +113,7 @@ it('formatYouTube 2', () => {});// https://kodi.wiki/view/Edit_decision_list+// eslint-disable-next-line unicorn-js/prefer-https -- TODO fix (new rule in @mifi/lint-config)// http://www.mplayerhq.hu/DOCS/HTML/en/edl.htmlit('parseMplayerEdl', async () => {// TODO support more durations (frames and timestamps):diff --git a/src/renderer/src/edlFormats.ts b/src/renderer/src/edlFormats.tsindex f7b344cf..7e964442 100644--- a/src/renderer/src/edlFormats.ts+++ b/src/renderer/src/edlFormats.ts@@ -266,6 +266,7 @@ const xmlList = <T>(value: XmlList<T>): T[] => (value == null ? [] : [value].fla// https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/FinalCutPro_XML/VersionsoftheInterchangeFormat/VersionsoftheInterchangeFormat.htmlexport function parseXmeml(xmlStr: string) {+ // eslint-disable-next-line unicorn-js/prefer-single-object-destructuring -- TODO fix (new rule in @mifi/lint-config)const xml = new XMLParser().parse(xmlStr);// TODO maybe support media.audio also?@@ -293,9 +294,7 @@ export function parseXmeml(xmlStr: string) {}export function parseFcpXml(xmlStr: string) {- const xml = new XMLParser({ ignoreAttributes: false }).parse(xmlStr);-- const { fcpxml } = xml;+ const { fcpxml } = new XMLParser({ ignoreAttributes: false }).parse(xmlStr);if (!fcpxml) throw new Error('Root element <fcpxml> not found in file');// e.g. "1001/30000s" or "10s"@@ -427,6 +426,7 @@ export function parseDvAnalyzerSummaryTxt(txt: string) {return edl;}+// eslint-disable-next-line unicorn-js/prefer-https -- TODO fix (new rule in @mifi/lint-config)// http://www.textfiles.com/uploads/kds-srt.txtexport function parseSrt(text: string) {const ret: { start: number, end: number, lines: string[], index: number | undefined }[] = [];diff --git a/src/renderer/src/edlStore.ts b/src/renderer/src/edlStore.tsindex f9ee8e82..0c1f25bb 100644--- a/src/renderer/src/edlStore.ts+++ b/src/renderer/src/edlStore.ts@@ -141,6 +141,7 @@ export async function readEdlFile({ type, path, fps }: {if (type === 'csv-frames') return loadCsv(path, getFrameValParser(fps));if (type === 'edl') return loadEdl(path, fps);}+ // eslint-disable-next-line unicorn-js/prefer-else-if -- TODO fix (new rule in @mifi/lint-config)if (type === 'cutlist') return loadCutlistSeconds(path);if (type === 'xmeml') return loadXmeml(path);if (type === 'fcpxml') return loadFcpXml(path);@@ -203,6 +204,7 @@ export async function exportEdlFile({ type, cutSegments, customOutDir, filePath,} else if (type === 'csv-human') {ext = 'csv';filters = [{ name: i18n.t('TXT files'), extensions: [ext, 'txt'] }];+ // eslint-disable-next-line unicorn-js/no-duplicate-if-branches -- TODO fix (new rule in @mifi/lint-config)} else if (type === 'csv-frames') {ext = 'csv';filters = [{ name: i18n.t('TXT files'), extensions: [ext, 'txt'] }];diff --git a/src/renderer/src/ffmpeg.ts b/src/renderer/src/ffmpeg.tsindex 29fbb2ee..0047261c 100644--- a/src/renderer/src/ffmpeg.ts+++ b/src/renderer/src/ffmpeg.ts@@ -143,6 +143,7 @@ export async function findKeyframeNearTime({ filePath, streamIndex, time, mode }// todo this is not in use// https://stackoverflow.com/questions/14005110/how-to-split-a-video-using-ffmpeg-so-that-each-chunk-starts-with-a-key-frame+// eslint-disable-next-line unicorn-js/prefer-https -- TODO fix (new rule in @mifi/lint-config)// http://kicherer.org/joomla/index.php/de/blog/42-avcut-frame-accurate-video-cutting-with-only-small-quality-lossexport function getSafeCutTime(frames: Frame[], cutTime: number, nextMode: boolean) {const sigma = 0.01;@@ -163,8 +164,9 @@ export function getSafeCutTime(frames: Frame[], cutTime: number, nextMode: boolereturn time;}+ // eslint-disable-next-line unicorn-js/no-unnecessary-parameters -- TODO fix (new rule in @mifi/lint-config)const findReverseIndex = <T>(arr: T[], cb: (value: T, i: number, obj: T[]) => unknown) => {- // eslint-disable-next-line unicorn/no-array-callback-reference+ // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn-js/prefer-array-last-methods -- TODO fix (new rule in @mifi/lint-config)const ret = arr.toReversed().findIndex(cb);if (ret === -1) return -1;return arr.length - 1 - ret;@@ -192,9 +194,11 @@ export function getSafeCutTime(frames: Frame[], cutTime: number, nextMode: boolereturn frames[index - 1]!.time;}+// eslint-disable-next-line unicorn-js/consistent-compound-words -- TODO fix (new rule in @mifi/lint-config)export function findNearestKeyFrameTime({ frames, time, direction }: { frames: Frame[], time: number, direction: number }) {const keyframes = frames.filter((f) => f.keyframe && (direction > 0 ? f.time >= time : f.time <= time));if (keyframes.length === 0) return undefined;+ // eslint-disable-next-line unicorn-js/consistent-compound-words -- TODO fix (new rule in @mifi/lint-config)const nearestKeyFrame = sortBy(keyframes, (keyframe) => (direction > 0 ? keyframe.time - time : time - keyframe.time))[0];if (!nearestKeyFrame) return undefined;return nearestKeyFrame.time;@@ -426,6 +430,7 @@ export async function renderThumbnails({ filePath, from, duration, onThumbnail,signal: AbortSignal,}) {const numThumbs = 10;+ // eslint-disable-next-line unicorn-js/no-array-from-fill -- TODO fix (new rule in @mifi/lint-config)const thumbTimes = Array.from({ length: numThumbs }).fill(undefined).map((_unused, i) => (from + ((duration * i) / numThumbs)));// console.log(thumbTimes);@@ -439,6 +444,7 @@ export async function extractWaveform({ filePath, outPath }: { filePath: string,const numSegs = 10;const duration = 60 * 60;const maxLen = 0.1;+ // eslint-disable-next-line unicorn-js/no-array-from-fill -- TODO fix (new rule in @mifi/lint-config)const segments = Array.from({ length: numSegs }).fill(undefined).map((_unused, i) => [i * (duration / numSegs), Math.min(duration / numSegs, maxLen)] as const);// https://superuser.com/questions/681885/how-can-i-remove-multiple-segments-from-a-video-using-ffmpeg@@ -522,6 +528,7 @@ function parseTimecode(str: string, frameRate?: number | undefined) {export function getTimecodeFromStreams(streams: FFprobeStream[]) {console.log('Trying to load timecode');let foundTimecode: number | undefined;+ // eslint-disable-next-line unicorn-js/no-unused-builtin-method-return -- TODO fix (new rule in @mifi/lint-config)streams.find((stream) => {try {if (stream.tags && stream.tags['timecode']) {diff --git a/src/renderer/src/hooks/normalizeWheel.ts b/src/renderer/src/hooks/normalizeWheel.tsindex 5b683867..036c4f6a 100644--- a/src/renderer/src/hooks/normalizeWheel.ts+++ b/src/renderer/src/hooks/normalizeWheel.ts@@ -101,7 +101,7 @@ const PAGE_HEIGHT = 800;** The 'wheel' event is more standard:*- * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents+ * https://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents** The basics is that it includes a unit, deltaMode (pixels, lines, pages), and* deltaX, deltaY and deltaZ. Some browsers provide other values to maintain@@ -119,6 +119,7 @@ const PAGE_HEIGHT = 800;* Firefox v4/Win7 | undefined | 3**/+// eslint-disable-next-line unicorn-js/prefer-smaller-scope -- TODO fix (new rule in @mifi/lint-config)type LegacyWheelEvent = WheelEvent & { axis?: number, HORIZONTAL_AXIS?: number };export default function normalizeWheel(/* object */ event: WheelEvent) /* object */ {diff --git a/src/renderer/src/hooks/useDirectoryAccess.ts b/src/renderer/src/hooks/useDirectoryAccess.tsindex a133d738..79837d11 100644--- a/src/renderer/src/hooks/useDirectoryAccess.ts+++ b/src/renderer/src/hooks/useDirectoryAccess.ts@@ -36,6 +36,7 @@ export default function useDirectoryAccess({ setCustomOutDir }: { setCustomOutDi// If we are MAS, we need to loop try to make the user confirm the dialog with the same path as the defaultPath.for (;;) {// First check if we already have access, if so, we are done+ // eslint-disable-next-line unicorn-js/prefer-while-loop-condition -- TODO fix (new rule in @mifi/lint-config)if (await checkDirWriteAccess(inputFileDir) && !simulateMasPermissionError) break;// If we are not MAS, but we don't have access, then we can't do anythingdiff --git a/src/renderer/src/hooks/useFfmpegOperations.ts b/src/renderer/src/hooks/useFfmpegOperations.tsindex 456be4e1..e3391473 100644--- a/src/renderer/src/hooks/useFfmpegOperations.ts+++ b/src/renderer/src/hooks/useFfmpegOperations.ts@@ -658,7 +658,7 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, treastreamIds: streamsToCopyFromMainFile.filter((stream) => stream.index === videoStream.index || stream.codec_type !== 'video').map((stream) => stream.index),}];- // eslint-disable-next-line no-shadow+ // eslint-disable-next-line no-shadow, unicorn-js/no-unnecessary-parameters -- TODO fix (new rule in @mifi/lint-config)async function cutEncodeSmartPartWrapper({ cutFrom, cutTo, outPath }: { cutFrom: number, cutTo: number, outPath: string }) {if (await shouldSkipExistingFile(outPath)) return;invariant(videoCodec != null);@@ -840,6 +840,7 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea// h264/aac_at: No licensing when using HW encoder (Video/Audio Toolbox on Mac)// https://github.com/mifi/lossless-cut/issues/372#issuecomment-810766512+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- TODO fix (new rule in @mifi/lint-config)switch (video) {case 'hq': {// eslint-disable-next-line unicorn/prefer-ternary@@ -878,6 +879,7 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea}}+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- TODO fix (new rule in @mifi/lint-config)switch (audio) {case 'hq': {// eslint-disable-next-line unicorn/prefer-ternarydiff --git a/src/renderer/src/hooks/useFrameCapture.ts b/src/renderer/src/hooks/useFrameCapture.tsindex fc4d9568..1c1f5403 100644--- a/src/renderer/src/hooks/useFrameCapture.ts+++ b/src/renderer/src/hooks/useFrameCapture.ts@@ -127,6 +127,7 @@ export default ({ appendFfmpegCommandLog, formatTimecode, treatInputFileModifiedconst timecode = formatTimecode({ seconds: time, fileNameFriendly: true });const outPath = getSuffixedOutPath({ customOutDir, filePath, nameSuffix: `${timecode}.${ext}` });+ // eslint-disable-next-line unicorn-js/no-unsafe-buffer-conversion -- TODO fix (new rule in @mifi/lint-config)await writeFile(outPath, new Uint8Array(dataUri.buffer));await transferTimestamps({ inPath: filePath, outPath, cutFrom: time, cutTo: time, duration: isDurationValid(fileDuration) ? fileDuration : undefined, treatInputFileModifiedTimeAsStart, treatOutputFileModifiedTimeAsStart });diff --git a/src/renderer/src/hooks/useKeyboard.ts b/src/renderer/src/hooks/useKeyboard.tsindex d9d268da..31a137a8 100644--- a/src/renderer/src/hooks/useKeyboard.ts+++ b/src/renderer/src/hooks/useKeyboard.ts@@ -148,9 +148,13 @@ export default ({ keyBindings, keyUpActions, getKeyboardAction, closeExportConfi// only use first one, if multiple matches (shouldn't happen anyway)const matchingKeyBinding = (keyBindingsByKeyCode[e.code] ?? []).find((kb) => {const kbKeys = new Set(kb.keys.split('+'));+ // eslint-disable-next-line unicorn-js/no-chained-comparison -- false positive: this compares a boolean on purposeif ((controlModifiers.intersection(kbKeys).size > 0) !== ctrl) return false;+ // eslint-disable-next-line unicorn-js/no-chained-comparison -- false positive: this compares a boolean on purposeif ((shiftModifiers.intersection(kbKeys).size > 0) !== shift) return false;+ // eslint-disable-next-line unicorn-js/no-chained-comparison -- false positive: this compares a boolean on purposeif ((altModifiers.intersection(kbKeys).size > 0) !== alt) return false;+ // eslint-disable-next-line unicorn-js/no-chained-comparison -- false positive: this compares a boolean on purposeif ((metaModifiers.intersection(kbKeys).size > 0) !== meta) return false;return true;});diff --git a/src/renderer/src/hooks/useKeyframes.ts b/src/renderer/src/hooks/useKeyframes.tsindex 97d39aa9..1c9d1004 100644--- a/src/renderer/src/hooks/useKeyframes.ts+++ b/src/renderer/src/hooks/useKeyframes.ts@@ -4,6 +4,7 @@ import useDebounceOld from 'react-use/lib/useDebounce'; // Want to phase out thiimport { useTranslation } from 'react-i18next';import type { Frame } from '../ffmpeg';+// eslint-disable-next-line unicorn-js/consistent-compound-words -- TODO fix (new rule in @mifi/lint-config)import { readFramesAroundTime, findNearestKeyFrameTime as ffmpegFindNearestKeyFrameTime, readFrames } from '../ffmpeg';import type { FFprobeStream } from '../../../common/ffprobe';import { getFrameCountRaw } from '../edlFormats';@@ -42,6 +43,7 @@ function useKeyframes({ keyframesEnabled, filePath, commandedTime, videoStream,return map;}, [detectedFps, neighbouringKeyFrames]);+ // eslint-disable-next-line unicorn-js/consistent-compound-words -- TODO fix (new rule in @mifi/lint-config)const findNearestKeyFrameTime = useCallback(({ time, direction }: { time: number, direction: number }) => ffmpegFindNearestKeyFrameTime({ frames: neighbouringKeyFrames, time, direction }), [neighbouringKeyFrames]);// eslint-disable-next-line react-hooks/set-state-in-effectdiff --git a/src/renderer/src/hooks/useSegments.tsx b/src/renderer/src/hooks/useSegments.tsxindex ff0a6236..e71795e7 100644--- a/src/renderer/src/hooks/useSegments.tsx+++ b/src/renderer/src/hooks/useSegments.tsx@@ -37,9 +37,6 @@ import mainApi from '../mainApi';const remote = window.require('@electron/remote');const { ffmpeg: { blackDetect, silenceDetect } } = remote.require('./index.js');--type ParameterDialogParameters = Record<string, string>;-const offsetSegments = (segments: DefiniteSegmentBase[], offset: number) => segments.map((s) => ({ start: s.start + offset, end: s.end + offset }));function useSegments({ filePath, workingRef, setWorking, setProgress, videoStream, fileDuration, getRelevantTime, maxLabelLength, checkFileOpened, invertCutSegments, segmentsToChaptersOnly, timecodePlaceholder, parseTimecode, appendFfmpegCommandLog, fileDurationNonZero, mainFileMeta, seekAbs, activeVideoStreamIndex, activeAudioStreamIndexes, handleError, showGenericDialog, simpleMode, ffmpegHwaccel }: {@@ -67,6 +64,7 @@ function useSegments({ filePath, workingRef, setWorking, setProgress, videoStreasimpleMode: boolean,ffmpegHwaccel: FfmpegHwAccel,}) {+ type ParameterDialogParameters = Record<string, string>;const { t } = useTranslation();// Segment related state@@ -107,7 +105,6 @@ function useSegments({ filePath, workingRef, setWorking, setProgress, videoStrea},})), []);-const clearSegColorCounter = useCallback(() => {// eslint-disable-next-line no-param-reassignsetSegColorCounter(0);@@ -453,6 +450,7 @@ function useSegments({ filePath, workingRef, setWorking, setProgress, videoStreaconst cutSegmentsNew = [...cutSegments];const existing = cutSegments[index];invariant(existing != null);+ // eslint-disable-next-line unicorn-js/no-confusing-array-splice -- TODO fix (new rule in @mifi/lint-config)cutSegmentsNew.splice(index, 1, { ...existing, ...newProps });safeSetCutSegments(cutSegmentsNew, fileDuration);}, [cutSegments, safeSetCutSegments, fileDuration]);@@ -460,6 +458,7 @@ function useSegments({ filePath, workingRef, setWorking, setProgress, videoStreaconst setCutTime = useCallback((type: 'start' | 'end' | 'move', time: number | undefined) => {if (!isDurationValid(fileDuration) || currentCutSeg == null) return;+ // eslint-disable-next-line unicorn-js/no-unnecessary-parameters -- TODO fix (new rule in @mifi/lint-config)const clampStart = (start: number) => Math.min(Math.max(start, 0), fileDuration);const clampEnd = (end?: number | undefined) => (end != null ? Math.min(Math.max(end, 0), fileDuration) : undefined);@@ -470,12 +469,14 @@ function useSegments({ filePath, workingRef, setWorking, setProgress, videoStrea}updateSegAtIndex(currentSegIndexSafe, { start: clampStart(time) });}+ // eslint-disable-next-line unicorn-js/prefer-else-if -- TODO fix (new rule in @mifi/lint-config)if (type === 'end') {if (time != null && time <= currentCutSeg.start) {throw new UserFacingError(i18n.t('Segment start time must precede end time'));}updateSegAtIndex(currentSegIndexSafe, { end: clampEnd(time) });}+ // eslint-disable-next-line unicorn-js/prefer-else-if -- TODO fix (new rule in @mifi/lint-config)if (type === 'move') {invariant(time != null);updateSegAtIndex(currentSegIndexSafe, {diff --git a/src/renderer/src/hooks/useTimelineScroll.ts b/src/renderer/src/hooks/useTimelineScroll.tsindex 00d39d0a..8637de00 100644--- a/src/renderer/src/hooks/useTimelineScroll.ts+++ b/src/renderer/src/hooks/useTimelineScroll.ts@@ -25,10 +25,10 @@ function useIsCtrlHeldRef() {useEffect(() => {const onEvent = (e: KeyboardEvent | PointerEvent) => { isCtrlHeldRef.current = e.ctrlKey; };const onBlur = () => { isCtrlHeldRef.current = undefined; };- window.addEventListener('keydown', onEvent, true);- window.addEventListener('keyup', onEvent, true);- window.addEventListener('pointermove', onEvent, true);- window.addEventListener('pointerdown', onEvent, true);+ window.addEventListener('keydown', onEvent, { capture: true });+ window.addEventListener('keyup', onEvent, { capture: true });+ window.addEventListener('pointermove', onEvent, { capture: true });+ window.addEventListener('pointerdown', onEvent, { capture: true });window.addEventListener('blur', onBlur);return () => {window.removeEventListener('keydown', onEvent, true);diff --git a/src/renderer/src/reporting.tsx b/src/renderer/src/reporting.tsxindex a201f648..d9d74fc0 100644--- a/src/renderer/src/reporting.tsx+++ b/src/renderer/src/reporting.tsx@@ -12,7 +12,6 @@ const { platform, arch } = remote.require('./index.js');// This cannot be a radix dialog, because it needs to be called even if the React tree is broken.-// eslint-disable-next-line import/prefer-default-exportexport function openSendReportDialog({ err, message, state }: {err?: unknown | undefined,message?: string,diff --git a/src/renderer/src/smartcut.ts b/src/renderer/src/smartcut.tsindex 4d18892c..e1db5fb8 100644--- a/src/renderer/src/smartcut.ts+++ b/src/renderer/src/smartcut.ts@@ -46,7 +46,6 @@ export async function needsSmartCut({ path, desiredCutFrom, videoStream }: {};}-// eslint-disable-next-line import/prefer-default-exportexport async function getCodecParams({ path, fileDuration, streams }: {path: string,fileDuration: number | undefined,diff --git a/src/renderer/src/util.ts b/src/renderer/src/util.tsindex 73bbdab9..096017de 100644--- a/src/renderer/src/util.ts+++ b/src/renderer/src/util.ts@@ -185,7 +185,7 @@ export function filenamify(name: string) {}// eslint-disable-next-line eslint-js/space-before-function-paren-export function withBlur<T extends { target?: { blur?: () => unknown } | object }>(cb: (a: T) => void) {+export function withBlur<T extends { target?: object | { blur?: () => unknown } }>(cb: (a: T) => void) {return (e: T) => {cb(e);if (e.target && 'blur' in e.target) e.target?.blur?.();@@ -311,6 +311,7 @@ export const isMuxNotSupported = (err: InvariantExecaError) => (export function shuffleArray<T>(arrayIn: T[]) {const array = [...arrayIn];let currentIndex = array.length;+ // eslint-disable-next-line unicorn-js/prefer-smaller-scope -- TODO fix (new rule in @mifi/lint-config)let randomIndex: number;// While there remain elements to shuffle...@@ -421,7 +422,7 @@ export const shiftModifiers = new Set(['ShiftLeft', 'ShiftRight']);export const controlModifiers = new Set(['ControlLeft', 'ControlRight']);export const altModifiers = new Set(['AltLeft', 'AltRight']);export const metaModifiers = new Set(['MetaLeft', 'MetaRight']);-export const allModifiers = new Set([...shiftModifiers, ...controlModifiers, ...altModifiers, ...metaModifiers]);+export const allModifiers = shiftModifiers.union(controlModifiers).union(altModifiers).union(metaModifiers);export function getMetaKeyName() {diff --git a/src/renderer/src/util/colors.ts b/src/renderer/src/util/colors.tsindex 8fc94a57..e029e1de 100644--- a/src/renderer/src/util/colors.ts+++ b/src/renderer/src/util/colors.ts@@ -3,6 +3,7 @@ import invariant from 'tiny-invariant';import type { SegmentColorIndex } from '../types';+// eslint-disable-next-line unicorn-js/prefer-https -- TODO fix (new rule in @mifi/lint-config)// http://phrogz.net/css/distinct-colors.htmlconst colorStrings = '#ff5100, #ffc569, #ddffd1, #00ccff, #e9d1ff, #ff0084, #ff6975, #ffe6d1, #ffff69, #69ff96, #008cff, #ae00ff, #ff002b, #ff8c00, #8cff00, #69ffff, #0044ff, #ff00d4, #ffd1d9'.split(',').map((str) => str.trim());const colors = colorStrings.map((str) => color(str));@@ -13,7 +14,6 @@ function getColor(n: number) {return ret;}-// eslint-disable-next-line import/prefer-default-exportexport function getSegColor(seg: SegmentColorIndex | undefined) {if (!seg) {return color({diff --git a/src/renderer/src/util/metadata.test.ts b/src/renderer/src/util/metadata.test.tsindex 0c1566f9..0b95a9a9 100644--- a/src/renderer/src/util/metadata.test.ts+++ b/src/renderer/src/util/metadata.test.ts@@ -72,5 +72,5 @@ test('getCopyableMetadata', () => {filename: 'font.ttf',})).toEqual({ title: 'a', language: 'eng' });expect(getCopyableMetadata({ handler_name: 'English Commentary' })).toEqual({ handler_name: 'English Commentary' });- expect(getCopyableMetadata({ handler_name: '\u0010DJI.Subtitle' })).toEqual({});+ expect(getCopyableMetadata({ handler_name: '\u{10}DJI.Subtitle' })).toEqual({});});diff --git a/src/renderer/src/util/streams.ts b/src/renderer/src/util/streams.tsindex 6711e71c..0a883bc1 100644--- a/src/renderer/src/util/streams.ts+++ b/src/renderer/src/util/streams.ts@@ -350,7 +350,7 @@ export function getKeyframeCutSeekCompensation({ formatName, streams, cutFrom }:export const getAudioStreams = <T extends Pick<FFprobeStream, 'codec_type'>>(streams: T[]) => streams.filter((stream) => stream.codec_type === 'audio');export const getRealVideoStreams = <T extends Pick<FFprobeStream, 'codec_type' | 'disposition'>>(streams: T[]) => streams.filter((stream) => stream.codec_type === 'video' && !isStreamThumbnail(stream));export const getSubtitleStreams = <T extends Pick<FFprobeStream, 'codec_type'>>(streams: T[]) => streams.filter((stream) => stream.codec_type === 'subtitle');-export const isGpsStream = (stream: Pick<FileStream, 'guessedType' | 'codec_type' | 'tags'>) => stream.codec_type === 'subtitle' && (stream.tags?.['handler_name'] === '\u0010DJI.Subtitle' || stream.guessedType === 'dji-gps-srt');+export const isGpsStream = (stream: Pick<FileStream, 'guessedType' | 'codec_type' | 'tags'>) => stream.codec_type === 'subtitle' && (stream.tags?.handler_name === '\u{10}DJI.Subtitle' || stream.guessedType === 'dji-gps-srt');// videoTracks/audioTracks seems to be 1-indexed, while ffmpeg is 0-indexesconst getHtml5TrackId = (ffmpegTrackIndex: number) => String(ffmpegTrackIndex + 1);diff --git a/src/renderer/src/worker/evalWorker.ts b/src/renderer/src/worker/evalWorker.tsindex c02432ed..30ff5b4c 100644--- a/src/renderer/src/worker/evalWorker.ts+++ b/src/renderer/src/worker/evalWorker.ts@@ -96,13 +96,14 @@ Object.defineProperty(Array.prototype, 'join', {// eslint-disable-next-line func-namesreturn function (arg?: unknown[]) {// @ts-expect-error dunno how to fix+ // eslint-disable-next-line unicorn-js/no-this-outside-of-class -- TODO fix (new rule in @mifi/lint-config)if (this.length > 500 || (arg && arg.length > 500)) {// eslint-disable-next-line no-throw-literal, @typescript-eslint/only-throw-errorthrow 'Exception: too many items';}// @ts-expect-error dunno how to fix- // eslint-disable-next-line unicorn/prefer-reflect-apply, prefer-rest-params+ // eslint-disable-next-line unicorn/prefer-reflect-apply, prefer-rest-params, unicorn-js/no-this-outside-of-class -- TODO fix (new rule in @mifi/lint-config)return old.apply(this, arguments);};}(Array.prototype.join),@@ -124,7 +125,7 @@ Object.defineProperty(Array.prototype, 'join', {myGlobal.fetch = undefined;-// eslint-disable-next-line eslint-js/wrap-iife, func-names+// eslint-disable-next-line eslint-js/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-directivediff --git a/website/scripts/appLinks.ts b/website/scripts/appLinks.tsindex 36931245..839f5c09 100644--- a/website/scripts/appLinks.ts+++ b/website/scripts/appLinks.ts@@ -33,6 +33,7 @@ await Promise.all(Object.entries(appLinkTargets).map(async ([name, target]) => {}));if (problems.length > 0) {+ // eslint-disable-next-line unicorn-js/require-array-sort-compare -- TODO fix (new rule in @mifi/lint-config)console.error(`The app links to website pages that don't exist (see src/common/websiteUrls.ts):\n${problems.toSorted().join('\n')}`);process.exitCode = 1;} else {diff --git a/website/src/content.config.ts b/website/src/content.config.tsindex afa1e4f6..f986bcb1 100644--- a/website/src/content.config.ts+++ b/website/src/content.config.ts@@ -4,7 +4,6 @@ import { defineCollection } from 'astro:content';import { repoDocsLoader } from './lib/docs.ts';// Astro requires this named export-// eslint-disable-next-line import/prefer-default-exportexport const collections = {docs: defineCollection({ loader: repoDocsLoader(), schema: docsSchema() }),};diff --git a/website/src/lib/docs.ts b/website/src/lib/docs.tsindex f9c2a503..79e1ced8 100644--- a/website/src/lib/docs.ts+++ b/website/src/lib/docs.ts@@ -28,7 +28,7 @@ export function getDocUrl(docPath: string) {// Titles are shown without the emojis that some docs headings have (but keep symbols like ™).const stripEmoji = (text: string) => text- .replaceAll(/(\p{Emoji_Presentation}|\p{Extended_Pictographic}\uFE0F)(\uFE0F|\u200D\p{Extended_Pictographic}\uFE0F?)*/gu, '')+ .replaceAll(/(\p{Emoji_Presentation}|\p{Extended_Pictographic}\u{FE0F})(\u{FE0F}|\u{200D}\p{Extended_Pictographic}\u{FE0F}?)*/gu, '').replaceAll(/\s+/g, ' ').trim();