The swiss army knife of lossless video/audio editing
Adapt to @mifi/lint-config's @stylistic formatting rules
Claudee68234b7a309
diff --git a/.oxlintrc.json b/.oxlintrc.jsonindex 0acfd250..082b5983 100644--- a/.oxlintrc.json+++ b/.oxlintrc.json@@ -23,7 +23,7 @@"jsx-a11y/click-events-have-key-events": "off","jsx-a11y/interactive-supports-focus": "off","jsx-a11y/control-has-associated-label": "off",- "eslint-js/func-call-spacing": "off",+ "@stylistic/function-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)diff --git a/src/common/ffprobe.ts b/src/common/ffprobe.tsindex ca356e60..4b0bca3a 100644--- a/src/common/ffprobe.ts+++ b/src/common/ffprobe.ts@@ -287,7 +287,7 @@ export type FFprobeStreamTags = {// https://github.com/mifi/lossless-cut/issues/1530title?: string,-} & Record<string, string>+} & Record<string, string>;/*** An FFprobe response stream object@@ -682,7 +682,7 @@ export type FFprobeFormatTags = {* The song's publisher (only present in audio files)*/PUBLISHER?: string-} & Record<string, string>+} & Record<string, string>;/*** An FFprobe response format objectdiff --git a/src/common/i18n.ts b/src/common/i18n.tsindex bf816f79..8d8b74ca 100644--- a/src/common/i18n.ts+++ b/src/common/i18n.ts@@ -1,8 +1,7 @@// returned from app.getLocale()// https://www.electronjs.org/docs/api/app#appgetlocale// https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.cc-export type ElectronLanguageKey =-'af' // Afrikaans+export type ElectronLanguageKey = 'af' // Afrikaans| 'ak' // Twi| 'am' // Amharic| 'an' // Aragonese@@ -185,7 +184,7 @@ export type ElectronLanguageKey =| 'zh-CN' // Chinese (China)| 'zh-HK' // Chinese (Hong Kong)| 'zh-TW' // Chinese (Taiwan)-| 'zu' // Zulu+| 'zu'; // Zulu// https://www.electronjs.org/docs/api/app#appgetlocale// https://source.chromium.org/chromium/chromium/src/+/master:ui/base/l10n/l10n_util.ccdiff --git a/src/main/configStore.ts b/src/main/configStore.tsindex 07fd9ef4..a6f8a41e 100644--- a/src/main/configStore.ts+++ b/src/main/configStore.ts@@ -297,7 +297,7 @@ export async function init({ customConfigDir }: { customConfigDir: string | undeassert(keysOrig.length > 0 && keysOrig.every((k) => k.length > 0), 'Invalid keys');const map: Record<string, string> = {- /* eslint-disable eslint-js/quote-props */+ /* eslint-disable @stylistic/quote-props */'esc': 'Escape','1': 'Digit1','2': 'Digit2',@@ -397,7 +397,7 @@ export async function init({ customConfigDir }: { customConfigDir: string | unde'shift': 'ShiftLeft','alt': 'AltLeft','meta': 'MetaLeft',- /* eslint-enable eslint-js/quote-props */+ /* eslint-enable @stylistic/quote-props */};const newKeys = keysOrig.flatMap((k) => {diff --git a/src/main/ffmpeg.ts b/src/main/ffmpeg.tsindex 3beb1066..1e4e40fd 100644--- a/src/main/ffmpeg.ts+++ b/src/main/ffmpeg.ts@@ -434,7 +434,8 @@ export async function silenceDetect({ streamId, filterOptions, ...rest }: {boundingMode: boolean,onProgress: (p: number) => void,onSegmentDetected: (p: DetectedSegment) => void,- from: number, to: number,+ from: number,+ to: number,ffmpegHwaccel: FfmpegHwAccel,}) {return detectIntervals({diff --git a/src/main/index.ts b/src/main/index.tsindex 426162fd..dbc51639 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -107,7 +107,7 @@ export type AppEvent = {} | {eventName: 'export-start',path: string,-}+};const appEventEmitter = mitt<{ appEvent: AppEvent }>();diff --git a/src/renderer/src/StreamsSelector.tsx b/src/renderer/src/StreamsSelector.tsxindex f7243201..dfa59143 100644--- a/src/renderer/src/StreamsSelector.tsx+++ b/src/renderer/src/StreamsSelector.tsx@@ -521,7 +521,8 @@ const Stream = memo(({ filePath, stream, onToggle, toggleCopyStreamIds, copyStrestream: FileStream,onToggle: (a: number) => void,toggleCopyStreamIds: (filter: (a: FFprobeStream) => boolean) => void,- copyStream: boolean, fileDuration: number | undefined,+ copyStream: boolean,+ fileDuration: number | undefined,setEditingStream: (a: EditingStream) => void,onExtractStreamPress?: () => void,paramsByFile: ParamsByFile,diff --git a/src/renderer/src/contexts.ts b/src/renderer/src/contexts.tsindex 92312946..bf97451c 100644--- a/src/renderer/src/contexts.ts+++ b/src/renderer/src/contexts.ts@@ -18,7 +18,7 @@ export type UserSettingsContextType = Omit<UserSettingsRoot, 'settings'> & UserStoggleSafeOutputFileName: () => void,effectiveExportMode: ExportMode,ensureWritableOutDirWithFilePath: ({ outDir }: { outDir: string | undefined }) => Promise<string | undefined>,-}+};export interface SegColorsContextType {getSegColor: (seg: SegmentColorIndex | undefined) => ColorInstance,diff --git a/src/renderer/src/dialogs/index.tsx b/src/renderer/src/dialogs/index.tsxindex 5fe119a1..e5bb5831 100644--- a/src/renderer/src/dialogs/index.tsx+++ b/src/renderer/src/dialogs/index.tsx@@ -590,7 +590,7 @@ export async function checkAppPath() {const forceCheckMs = false;const forceCheckTitle = false;// this code is purposefully obfuscated to try to detect the most basic cloned app submissions to the MS Store- // eslint-disable-next-line no-useless-concat, one-var, eslint-js/one-var-declaration-per-line+ // eslint-disable-next-line no-useless-concat, one-var, @stylistic/one-var-declaration-per-lineconst mf = 'mi' + 'fi.no', ap = 'Los' + 'slessC' + 'ut';let payload: string | undefined;if (isWindowsStoreBuild || (isDev && forceCheckMs)) {diff --git a/src/renderer/src/hooks/useFrameCapture.ts b/src/renderer/src/hooks/useFrameCapture.tsindex 1c1f5403..4f664931 100644--- a/src/renderer/src/hooks/useFrameCapture.ts+++ b/src/renderer/src/hooks/useFrameCapture.ts@@ -138,7 +138,7 @@ export default ({ appendFfmpegCommandLog, formatTimecode, treatInputFileModifiedfilePath: string,time: number,quality: number,- }) => ffmpeg.captureFrameToClipboard({ timestamp: time, videoPath: filePath, quality }), []);+ }) => ffmpeg.captureFrameToClipboard({ timestamp: time, videoPath: filePath, quality }), []);return {captureFramesRange,diff --git a/src/renderer/src/index.tsx b/src/renderer/src/index.tsxindex a326c769..b0d4d4c8 100644--- a/src/renderer/src/index.tsx+++ b/src/renderer/src/index.tsx@@ -35,13 +35,14 @@ import './main.css';import './swal2.scss';+/* eslint-disable @stylistic/operator-linebreak, @stylistic/indent -- chained conditional types read best like this */type TypedRemote = Omit<typeof Remote, 'require'> & {require: <T extends string>(module: T) => (T extends './index.js' ? RemoteApiLegacy :// eslint-disable-next-line @typescript-eslint/no-explicit-anyany);-}+};declare global {interface Window {@@ -55,6 +56,7 @@ declare global {T extends 'cue-parser' ? typeof cueParser :never);+ /* eslint-enable @stylistic/operator-linebreak, @stylistic/indent */electron: RemoteRpcApi;}interface Navigator {diff --git a/src/renderer/src/segments.ts b/src/renderer/src/segments.tsindex 6184ffd9..ad6b4050 100644--- a/src/renderer/src/segments.ts+++ b/src/renderer/src/segments.ts@@ -156,7 +156,7 @@ export function hasAnySegmentOverlap(sortedSegments: { start: number, end: numbereturn overlappingGroups.length > 0;}-// eslint-disable-next-line eslint-js/space-before-function-paren+// eslint-disable-next-line @stylistic/space-before-function-parenexport function invertSegments(sortedSegmentsIn: ({ start: number, end?: number | undefined, segId?: string | undefined, name?: string | undefined })[],includeFirstSegment: boolean,diff --git a/src/renderer/src/timelineWheel.ts b/src/renderer/src/timelineWheel.tsindex db672b91..0dba4a47 100644--- a/src/renderer/src/timelineWheel.ts+++ b/src/renderer/src/timelineWheel.ts@@ -10,8 +10,7 @@ export const keyMap = {// Trackpad pinch deltas are much smaller than mouse wheel deltasconst pinchSensitivityFactor = 5;-export type WheelAction =- | { type: 'none' }+export type WheelAction = { type: 'none' }| { type: 'zoom', amount: number }| { type: 'frameSeek', direction: number }| { type: 'keyframeSeek', direction: number }diff --git a/src/renderer/src/types.ts b/src/renderer/src/types.tsindex 9acb613a..494f47e4 100644--- a/src/renderer/src/types.ts+++ b/src/renderer/src/types.ts@@ -12,16 +12,16 @@ export interface ChromiumHTMLAudioElement extends HTMLAudioElement {}export const goToTimecodeDirectArgsSchema = z.tuple([z.object({ time: z.string() })]);-export type GoToTimecodeDirectArgs = z.infer<typeof goToTimecodeDirectArgsSchema>+export type GoToTimecodeDirectArgs = z.infer<typeof goToTimecodeDirectArgsSchema>;export const awaitEventArgsSchema = z.tuple([z.object({ eventName: z.string() })]);export type AwaitEventArgs = z.infer<typeof awaitEventArgsSchema>;export const segmentTagsSchema = z.record(z.string(), z.string());-export type SegmentTags = z.infer<typeof segmentTagsSchema>+export type SegmentTags = z.infer<typeof segmentTagsSchema>;-export type EditingSegmentTags = Record<string, SegmentTags>+export type EditingSegmentTags = Record<string, SegmentTags>;// todo remove some time in the futureexport const llcProjectV1Schema = z.object({@@ -47,7 +47,7 @@ export const llcProjectV2Schema = z.object({}).array(),});-export type LlcProject = z.infer<typeof llcProjectV2Schema>+export type LlcProject = z.infer<typeof llcProjectV2Schema>;export interface SegmentBase {start: number,@@ -133,12 +133,12 @@ export type FilesMeta = Record<string, {streams: FileStream[];format: FFprobeFormat;chapters: FFprobeChapter[];-}>+}>;export type CopyfileStreams = {path: string;streamIds: number[];-}[]+}[];export interface Chapter { start: number, end: number, name?: string | undefined }@@ -156,7 +156,7 @@ export type AllFilesMeta = Record<string, {streams: LiteFFprobeStream[];format: FFprobeFormat;chapters: FFprobeChapter[];-}>+}>;export interface BsfCropParams {left: number;diff --git a/src/renderer/src/util.ts b/src/renderer/src/util.tsindex 096017de..d75a40d3 100644--- a/src/renderer/src/util.ts+++ b/src/renderer/src/util.ts@@ -184,7 +184,7 @@ export function filenamify(name: string) {return name.replaceAll(/[^\p{L}\p{N} ._-]/gu, '_');}-// eslint-disable-next-line eslint-js/space-before-function-paren+// eslint-disable-next-line @stylistic/space-before-function-parenexport function withBlur<T extends { target?: object | { blur?: () => unknown } }>(cb: (a: T) => void) {return (e: T) => {cb(e);diff --git a/src/renderer/src/worker/eval.ts b/src/renderer/src/worker/eval.tsindex abbf2635..e4d358d1 100644--- a/src/renderer/src/worker/eval.ts+++ b/src/renderer/src/worker/eval.ts@@ -15,7 +15,7 @@ export type ResponseMessageData = { id: number } & ({error: string,} | {data: unknown,-})+});// https://v3.vitejs.dev/guide/features.html#web-workers// todo terminate() and recreate in case of error?diff --git a/src/renderer/src/worker/evalWorker.ts b/src/renderer/src/worker/evalWorker.tsindex 30ff5b4c..c16f045e 100644--- a/src/renderer/src/worker/evalWorker.ts+++ b/src/renderer/src/worker/evalWorker.ts@@ -91,7 +91,7 @@ Object.defineProperty(Array.prototype, 'join', {writable: false,configurable: false,enumerable: false,- // eslint-disable-next-line eslint-js/wrap-iife, func-names+ // eslint-disable-next-line @stylistic/wrap-iife, func-namesvalue: function (old) {// eslint-disable-next-line func-namesreturn function (arg?: unknown[]) {@@ -125,7 +125,7 @@ Object.defineProperty(Array.prototype, 'join', {myGlobal.fetch = undefined;-// 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)+// 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