Skip to content

The swiss army knife of lossless video/audio editing

Adapt to the latest @mifi/lint-config rule changes

Claude902f76737606
diff --git a/.oxlintrc.json b/.oxlintrc.json
index 5b49bd0a..0acfd250 100644
--- a/.oxlintrc.json
+++ b/.oxlintrc.json
@@ -67,6 +67,8 @@
"typescript/no-unnecessary-boolean-literal-compare": "off", // (7)
"@eslint-react/use-state": "off", // (87)
"@eslint-react/no-forward-ref": "off", // (7)
+ "vitest/prefer-snapshot-hint": "off", // (11)
+ "oxc/no-map-spread": "off", // (8)
// TODO remove the type assertions (58), then use the shared config's assertionStyle: never
"@typescript-eslint/consistent-type-assertions": [
"error",
diff --git a/src/main/pathToFileURL.test.ts b/src/main/pathToFileURL.test.ts
index 237413ae..141d20d0 100644
--- a/src/main/pathToFileURL.test.ts
+++ b/src/main/pathToFileURL.test.ts
@@ -4,6 +4,7 @@ import { test, expect, describe } from 'vitest';
import { pathToFileURL } from 'node:url';
+// eslint-disable-next-line vitest/no-conditional-tests -- TODO fix (new rule in @mifi/lint-config)
if (process.platform === 'win32') {
describe('file uri windows only', () => {
test('converts path to file url', () => {
diff --git a/src/main/util.test.ts b/src/main/util.test.ts
index 3415dcfc..11e6cc9a 100644
--- a/src/main/util.test.ts
+++ b/src/main/util.test.ts
@@ -30,6 +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();
});
});
diff --git a/src/renderer/src/NoFileLoaded.tsx b/src/renderer/src/NoFileLoaded.tsx
index ff58e732..51a7806e 100644
--- a/src/renderer/src/NoFileLoaded.tsx
+++ b/src/renderer/src/NoFileLoaded.tsx
@@ -86,7 +86,7 @@ function NoFileLoaded({ mifiLink, currentCutSeg, onClick, darkMode, keyBindingBy
{mifiLink && typeof mifiLink === 'object' && 'loadUrl' in mifiLink && typeof mifiLink.loadUrl === 'string' && mifiLink.loadUrl ? (
<div style={{ position: 'relative', margin: '.3em', width: '24em', height: '8em' }}>
- {/* eslint-disable-next-line @eslint-react/dom-no-missing-iframe-sandbox -- TODO fix (new rule in @mifi/lint-config) */}
+ {/* eslint-disable-next-line react/iframe-missing-sandbox -- TODO fix (new rule in @mifi/lint-config) */}
<iframe src={`${mifiLink.loadUrl}#dark=${darkMode ? 'true' : 'false'}`} title="iframe" style={{ background: 'rgba(0,0,0,0)', border: 'none', pointerEvents: 'none', width: '100%', height: '100%', position: 'absolute', colorScheme: 'initial' }} />
{/* eslint-disable-next-line jsx-a11y/interactive-supports-focus */}
<div style={{ width: '100%', height: '100%', position: 'absolute', cursor: 'pointer' }} title={t('Open link in browser')} role="button" onClick={(e) => { e.stopPropagation(); if ('targetUrl' in mifiLink && typeof mifiLink.targetUrl === 'string') mainApi.openExternal(mifiLink.targetUrl); }} />
diff --git a/src/renderer/src/SegmentList.tsx b/src/renderer/src/SegmentList.tsx
index b91fb670..c2bcac47 100644
--- a/src/renderer/src/SegmentList.tsx
+++ b/src/renderer/src/SegmentList.tsx
@@ -250,9 +250,7 @@ const Segment = memo(({
className="segment-list-entry"
>
<div
- // eslint-disable-next-line react/jsx-props-no-spreading
{...sortable.attributes}
- // eslint-disable-next-line react/jsx-props-no-spreading
{...sortable.listeners}
role="button"
tabIndex={-1}
diff --git a/src/renderer/src/components/AlertDialog.tsx b/src/renderer/src/components/AlertDialog.tsx
index 26f34667..09750945 100644
--- a/src/renderer/src/components/AlertDialog.tsx
+++ b/src/renderer/src/components/AlertDialog.tsx
@@ -15,7 +15,6 @@ export const Title = withClass(AlertDialog.Title, styles['AlertDialogTitle']!);
export const Description = withClass(AlertDialog.Description, styles['AlertDialogDescription']!);
-// eslint-disable-next-line react/jsx-props-no-spreading
export const Portal = (props: AlertDialog.AlertDialogPortalProps) => <AlertDialog.Portal container={document.getElementById('app-root')!} {...props} />;
export function CancelButton() {
diff --git a/src/renderer/src/components/AnimatedTr.tsx b/src/renderer/src/components/AnimatedTr.tsx
index 086ee63c..287df6e7 100644
--- a/src/renderer/src/components/AnimatedTr.tsx
+++ b/src/renderer/src/components/AnimatedTr.tsx
@@ -4,7 +4,6 @@ import { motion } from 'motion/react';
export default function AnimatedTr(props: HTMLMotionProps<'tr'>) {
return (
<motion.tr
- // eslint-disable-next-line react/jsx-props-no-spreading
{...props}
transition={{ duration: 0.5, ease: 'easeIn' }}
initial={{ opacity: 0 }}
diff --git a/src/renderer/src/components/BatchFile.tsx b/src/renderer/src/components/BatchFile.tsx
index 33a43aa6..2056da6a 100644
--- a/src/renderer/src/components/BatchFile.tsx
+++ b/src/renderer/src/components/BatchFile.tsx
@@ -68,9 +68,7 @@ function BatchFile({ path, index, isOpen, isSelected, name, onSelect, onDelete,
return (
<div
- // eslint-disable-next-line react/jsx-props-no-spreading
{...sortable.attributes}
- // eslint-disable-next-line react/jsx-props-no-spreading
{...sortable.listeners}
ref={setRef}
role="button"
diff --git a/src/renderer/src/components/Button.tsx b/src/renderer/src/components/Button.tsx
index 459737d5..c2913673 100644
--- a/src/renderer/src/components/Button.tsx
+++ b/src/renderer/src/components/Button.tsx
@@ -8,7 +8,7 @@ export type ButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonEleme
// eslint-disable-next-line react/display-name
const Button = forwardRef<HTMLButtonElement, ButtonProps>(({ type = 'button', className, ...props }, ref) => (
- // eslint-disable-next-line react/jsx-props-no-spreading, react/button-has-type
+ // eslint-disable-next-line react/button-has-type
<button ref={ref} className={[...(className ? [className] : []), styles['button']].join(' ')} type={type} {...props} />
));
@@ -16,6 +16,5 @@ export default Button;
// eslint-disable-next-line react/display-name
export const DialogButton = forwardRef<HTMLButtonElement, { primary?: boolean } & ButtonProps>(({ primary, ...props }, ref) => (
- // eslint-disable-next-line react/jsx-props-no-spreading
<Button ref={ref} style={{ padding: '.5em 2em', ...(primary && { color: 'white', backgroundColor: primaryColor, borderColor: primaryTextColor }) }} {...props} />
));
diff --git a/src/renderer/src/components/CaptureFormatButton.tsx b/src/renderer/src/components/CaptureFormatButton.tsx
index 56fd0acb..fa71d783 100644
--- a/src/renderer/src/components/CaptureFormatButton.tsx
+++ b/src/renderer/src/components/CaptureFormatButton.tsx
@@ -16,7 +16,6 @@ function CaptureFormatButton({ showIcon = false, ...props }: { showIcon?: boolea
<Button
title={actionTitle(t('Capture frame format'), 'toggleCaptureFormat')}
onClick={withBlur(toggleCaptureFormat)}
- // eslint-disable-next-line react/jsx-props-no-spreading
{...props}
>
{showIcon && <FaImage style={{ verticalAlign: 'middle', fontSize: '1.3em', marginRight: '.7em' }} />}
diff --git a/src/renderer/src/components/Checkbox.tsx b/src/renderer/src/components/Checkbox.tsx
index 2e29acce..db6af221 100644
--- a/src/renderer/src/components/Checkbox.tsx
+++ b/src/renderer/src/components/Checkbox.tsx
@@ -10,7 +10,6 @@ export default function Checkbox({ label, disabled, style, ...props }: CheckboxP
const id = useId();
return (
<div style={{ display: 'flex', alignItems: 'center', ...style }}>
- {/* eslint-disable-next-line react/jsx-props-no-spreading */}
<Root className={classes['CheckboxRoot']} disabled={disabled} {...props} id={id}>
<Indicator className={classes['CheckboxIndicator']}>
<FaCheck style={{ fontSize: '.7em' }} />
diff --git a/src/renderer/src/components/CloseButton.tsx b/src/renderer/src/components/CloseButton.tsx
index 6439d321..6a96d84b 100644
--- a/src/renderer/src/components/CloseButton.tsx
+++ b/src/renderer/src/components/CloseButton.tsx
@@ -9,7 +9,7 @@ export default function CloseButton({ type = 'button', ...props }: DetailedHTMLP
const { t } = useTranslation();
return (
- // eslint-disable-next-line react/jsx-props-no-spreading, react/button-has-type
+ // eslint-disable-next-line react/button-has-type
<button type={type} className={styles['close-button']} title={t('Close')} aria-label={t('Close')} {...props}>
<FaTimes />
</button>
diff --git a/src/renderer/src/components/Dialog.tsx b/src/renderer/src/components/Dialog.tsx
index 20b14503..6de21b4b 100644
--- a/src/renderer/src/components/Dialog.tsx
+++ b/src/renderer/src/components/Dialog.tsx
@@ -16,7 +16,6 @@ export const Description = withClass(Dialog.Description, styles['DialogDescripti
export const Title = withClass(Dialog.Title, styles['DialogTitle']!);
-// eslint-disable-next-line react/jsx-props-no-spreading
export const Portal = (props: Dialog.DialogPortalProps) => <Dialog.Portal container={document.getElementById('app-root')!} {...props} />;
export const CloseButton = () => (
diff --git a/src/renderer/src/components/DropdownMenu.tsx b/src/renderer/src/components/DropdownMenu.tsx
index 0308420c..8c5a266a 100644
--- a/src/renderer/src/components/DropdownMenu.tsx
+++ b/src/renderer/src/components/DropdownMenu.tsx
@@ -13,5 +13,4 @@ export const Arrow = withClass(DropdownMenu.Arrow, styles['DropdownMenuArrow']!)
export const Separator = withClass(DropdownMenu.Separator, styles['DropdownMenuSeparator']!);
-// eslint-disable-next-line react/jsx-props-no-spreading
export const Portal = (props: DropdownMenu.DropdownMenuPortalProps) => <DropdownMenu.Portal container={document.getElementById('app-root')!} {...props} />;
diff --git a/src/renderer/src/components/ExportModeButton.tsx b/src/renderer/src/components/ExportModeButton.tsx
index df841ffd..7a365652 100644
--- a/src/renderer/src/components/ExportModeButton.tsx
+++ b/src/renderer/src/components/ExportModeButton.tsx
@@ -51,7 +51,6 @@ function ExportModeButton({ selectedSegments, style }: { selectedSegments: unkno
], [effectiveExportMode, selectedSegments.length]);
return (
- // eslint-disable-next-line react/jsx-props-no-spreading
<Select
style={style}
value={effectiveExportMode}
diff --git a/src/renderer/src/components/HighlightedText.tsx b/src/renderer/src/components/HighlightedText.tsx
index 58eb9319..f4b16833 100644
--- a/src/renderer/src/components/HighlightedText.tsx
+++ b/src/renderer/src/components/HighlightedText.tsx
@@ -8,7 +8,6 @@ export const highlightedTextStyle: CSSProperties = { textDecorationColor: primar
// eslint-disable-next-line react/display-name
const HighlightedText = forwardRef<HTMLButtonElement, HTMLAttributes<HTMLButtonElement>>(({ children, style, ...props }, ref) => (
- // eslint-disable-next-line react/jsx-props-no-spreading
<button ref={ref} type="button" {...props} className={styles['button']} style={{ ...highlightedTextStyle, ...style }}>{children}</button>
));
diff --git a/src/renderer/src/components/Kbd.tsx b/src/renderer/src/components/Kbd.tsx
index 4d53d3a5..4dcf1890 100644
--- a/src/renderer/src/components/Kbd.tsx
+++ b/src/renderer/src/components/Kbd.tsx
@@ -15,7 +15,6 @@ export default function Kbd({ code, ...props }: { code: string } & HTMLAttribute
}
return (
- // eslint-disable-next-line react/jsx-props-no-spreading
<kbd {...props}>{keyName}</kbd>
);
}
diff --git a/src/renderer/src/components/OutputFormatSelect.tsx b/src/renderer/src/components/OutputFormatSelect.tsx
index ed337e75..52d33f9b 100644
--- a/src/renderer/src/components/OutputFormatSelect.tsx
+++ b/src/renderer/src/components/OutputFormatSelect.tsx
@@ -34,7 +34,6 @@ function OutputFormatSelect({ style, disabled, detectedFileFormat, fileFormat, o
const otherFormats = useMemo(() => (Object.keys(allOutFormats) as (keyof typeof allOutFormats)[]).filter((format) => !commonFormatsAndDetectedFormat.has(format)), [commonFormatsAndDetectedFormat]);
return (
- // eslint-disable-next-line react/jsx-props-no-spreading
<Select style={style} disabled={disabled} value={fileFormat || ''} title={t('Output container format:')} onChange={withBlur((e) => onOutputFormatUserChange(e.target.value))}>
<option key="disabled1" value="" disabled>{t('Output container format:')}</option>
diff --git a/src/renderer/src/components/Select.tsx b/src/renderer/src/components/Select.tsx
index d970d99e..8f5c707a 100644
--- a/src/renderer/src/components/Select.tsx
+++ b/src/renderer/src/components/Select.tsx
@@ -7,7 +7,6 @@ export type SelectProps = SelectHTMLAttributes<HTMLSelectElement>;
function Select(props: SelectProps) {
return (
- // eslint-disable-next-line react/jsx-props-no-spreading
<select className={styles['select']} {...props} />
);
}
diff --git a/src/renderer/src/components/Settings.tsx b/src/renderer/src/components/Settings.tsx
index d4a22f3f..c8548eaf 100644
--- a/src/renderer/src/components/Settings.tsx
+++ b/src/renderer/src/components/Settings.tsx
@@ -25,14 +25,11 @@ import Truncated from './Truncated';
import { dangerColor } from '../colors';
import OutDirSelector from './OutDirSelector.js';
-// eslint-disable-next-line react/jsx-props-no-spreading
const Button = ({ style, ...props }: ButtonProps) => <ButtonRaw style={{ padding: '.5em .9em', ...style }} {...props} />;
-// eslint-disable-next-line react/jsx-props-no-spreading
const Select = ({ style, ...props }: SelectProps) => <SelectRaw style={{ padding: '.5em 1.9em .5em .9em', maxWidth: '15em', ...style }} {...props} />;
-// eslint-disable-next-line react/jsx-props-no-spreading
const KeyCell = (props: TdHTMLAttributes<HTMLTableCellElement>) => <td {...props} />;
const Header = ({ title }: { title: string }) => (
diff --git a/src/renderer/src/components/SuggestionTextField.tsx b/src/renderer/src/components/SuggestionTextField.tsx
index 6c0607ba..b6639592 100644
--- a/src/renderer/src/components/SuggestionTextField.tsx
+++ b/src/renderer/src/components/SuggestionTextField.tsx
@@ -20,7 +20,6 @@ export default function SuggestionTextField({ ref, suggestions, onValueChange, d
useImperativeHandle(ref, () => inputRef.current!, []);
return (
- // eslint-disable-next-line react/jsx-props-no-spreading
<TextField.Root {...props} ref={inputRef} disabled={disabled} onChange={(e) => onValueChange(e.target.value)}>
{suggestions.length > 0 && (
<TextField.Slot side="right">
diff --git a/src/renderer/src/components/SwalContainer.tsx b/src/renderer/src/components/SwalContainer.tsx
index 7c728d22..c80d3e56 100644
--- a/src/renderer/src/components/SwalContainer.tsx
+++ b/src/renderer/src/components/SwalContainer.tsx
@@ -6,7 +6,6 @@ export default function SwalContainer({ darkMode, ...props }: HTMLAttributes<HTM
<div
id={swalContainerWrapperId}
className={darkMode ? 'dark-theme' : undefined}
- // eslint-disable-next-line react/jsx-props-no-spreading
{...props}
/>
);
diff --git a/src/renderer/src/components/Switch.tsx b/src/renderer/src/components/Switch.tsx
index 6714654f..97cfefbd 100644
--- a/src/renderer/src/components/Switch.tsx
+++ b/src/renderer/src/components/Switch.tsx
@@ -4,7 +4,6 @@ import * as RadixSwitch from '@radix-ui/react-switch';
import classes from './Switch.module.css';
const Switch = (props: RadixSwitch.SwitchProps & RefAttributes<HTMLButtonElement>) => (
- // eslint-disable-next-line react/jsx-props-no-spreading
<RadixSwitch.Root className={classes['SwitchRoot']} {...props}>
<RadixSwitch.Thumb className={classes['SwitchThumb']} />
</RadixSwitch.Root>
diff --git a/src/renderer/src/components/TagEditor.tsx b/src/renderer/src/components/TagEditor.tsx
index fc080a3f..45b33c98 100644
--- a/src/renderer/src/components/TagEditor.tsx
+++ b/src/renderer/src/components/TagEditor.tsx
@@ -37,7 +37,7 @@ export const cancelTagEditOnEscape = (editingTag: string | undefined, setEditing
setEditingTag(undefined);
};
-// eslint-disable-next-line @eslint-react/no-unstable-default-props -- TODO fix (new rule in @mifi/lint-config)
+// eslint-disable-next-line react/no-object-type-as-default-prop -- TODO fix (new rule in @mifi/lint-config)
function TagEditor({ existingTags = emptyObject, customTags = emptyObject, editingTag, setEditingTag, onTagsChange, onTagReset, addTagTitle, tagInfo, keySuggestions, canDeleteExisting, onApplyToAll, applyToAllTitle, copyFromSources = [] }: {
existingTags?: SegmentTags,
customTags?: SegmentTags | undefined,
diff --git a/src/renderer/src/components/TextInput.tsx b/src/renderer/src/components/TextInput.tsx
index 6c081a3d..35ad1358 100644
--- a/src/renderer/src/components/TextInput.tsx
+++ b/src/renderer/src/components/TextInput.tsx
@@ -7,7 +7,6 @@ const inputStyle: CSSProperties = { borderRadius: '.4em', flexGrow: 1, fontFamil
// eslint-disable-next-line react/display-name
const TextInput = forwardRef<HTMLInputElement, Props>(({ style, ...props }, forwardedRef) => (
- // eslint-disable-next-line react/jsx-props-no-spreading
<input type="text" ref={forwardedRef} style={{ ...inputStyle, ...style }} {...props} />
));
diff --git a/src/renderer/src/components/Truncated.tsx b/src/renderer/src/components/Truncated.tsx
index be2b023f..e7d4a1d7 100644
--- a/src/renderer/src/components/Truncated.tsx
+++ b/src/renderer/src/components/Truncated.tsx
@@ -11,7 +11,6 @@ export default function Truncated({ maxWidth, style, ...props }: DetailedHTMLPro
textOverflow: 'ellipsis',
...style,
}}
- // eslint-disable-next-line react/jsx-props-no-spreading
{...props}
/>
);
diff --git a/src/renderer/src/components/Warning.tsx b/src/renderer/src/components/Warning.tsx
index e20a0fdc..81227ae1 100644
--- a/src/renderer/src/components/Warning.tsx
+++ b/src/renderer/src/components/Warning.tsx
@@ -5,6 +5,5 @@ import { warningColor } from '../colors';
export default function Warning({ style, ...props }: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>) {
const mergedStyle = useMemo(() => ({ color: warningColor, ...style }), [style]);
- // eslint-disable-next-line react/jsx-props-no-spreading
return <div style={mergedStyle} {...props} />;
}
diff --git a/src/renderer/src/components/WhatsNew.tsx b/src/renderer/src/components/WhatsNew.tsx
index 3d91be73..6efde0de 100644
--- a/src/renderer/src/components/WhatsNew.tsx
+++ b/src/renderer/src/components/WhatsNew.tsx
@@ -62,7 +62,6 @@ export default function WhatsNew() {
components={{
// eslint-disable-next-line react/no-unstable-nested-components
code(props) {
- // eslint-disable-next-line react/jsx-props-no-spreading
return <code className="highlighted" {...props} />;
},
}}
diff --git a/src/renderer/src/components/util.tsx b/src/renderer/src/components/util.tsx
index 906f3916..106e2709 100644
--- a/src/renderer/src/components/util.tsx
+++ b/src/renderer/src/components/util.tsx
@@ -6,7 +6,6 @@ export function withClass<P extends { className?: string | undefined }>(Componen
return React.forwardRef<React.ForwardRefExoticComponent<P>, P>((props, ref) => {
const { className, ...rest } = props ?? {};
// @ts-expect-error dunno how to type this
- // eslint-disable-next-line react/jsx-props-no-spreading
return <Component ref={ref} className={[cls, className].filter(Boolean).join(' ')} {...rest} />;
});
}
diff --git a/src/renderer/src/hooks/useWhatChanged.ts b/src/renderer/src/hooks/useWhatChanged.ts
index 06ac97a3..a5ec0460 100644
--- a/src/renderer/src/hooks/useWhatChanged.ts
+++ b/src/renderer/src/hooks/useWhatChanged.ts
@@ -11,6 +11,7 @@ export default function useWhatChanged(props: Record<string, unknown>) {
const changed = Object.entries(props).reduce((a, [key, prop]) => {
if (prev.current[key] === prop) return a;
return {
+ // eslint-disable-next-line oxc/no-accumulating-spread -- TODO fix (new rule in @mifi/lint-config)
...a,
[key]: {
prev: prev.current[key],
diff --git a/src/renderer/src/segments.ts b/src/renderer/src/segments.ts
index e25a4e6c..6184ffd9 100644
--- a/src/renderer/src/segments.ts
+++ b/src/renderer/src/segments.ts
@@ -124,6 +124,7 @@ export function combineOverlappingSegments<T extends SegmentBase>(existingSegmen
const combinedSegments: T[] = [];
+ // eslint-disable-next-line oxc/no-accumulating-spread -- TODO fix (new rule in @mifi/lint-config)
for (let i = 1; i < sortedSegments.length; i += 1) {
const nextSegment = sortedSegments[i]!;
diff --git a/src/renderer/src/util/rate-calculator.test.ts b/src/renderer/src/util/rate-calculator.test.ts
index 02c28abe..cd54a00e 100644
--- a/src/renderer/src/util/rate-calculator.test.ts
+++ b/src/renderer/src/util/rate-calculator.test.ts
@@ -22,7 +22,7 @@ describe('speeding up', () => {
expect(adjustRate(1 / DEFAULT_PLAYBACK_RATE + 0.01, 1)).toBe(1);
});
- it('sets rate to 1 if passing 1 ', () => {
+ it('sets rate to 1 if passing 1', () => {
expect(adjustRate(0.5, 1, 2)).toBe(1);
});