chore; add lint
CI / Frontend (push) Successful in 1m19s
CI / Rust (Tauri backend) (push) Failing after 1m13s

This commit is contained in:
Lucas
2026-11-04 11:36:41 +01:00
parent e640ae17e5
commit 4b5606dd15
19 changed files with 614 additions and 156 deletions
+22
View File
@@ -0,0 +1,22 @@
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import reactHooks from "eslint-plugin-react-hooks";
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
{
ignores: ["node_modules/**", "dist/**", "src-tauri/target/**"],
},
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: {
"react-hooks": reactHooks,
},
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
}
);
+513 -124
View File
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -9,7 +9,10 @@
"preview": "vite preview", "preview": "vite preview",
"tauri": "tauri", "tauri": "tauri",
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,css}\"", "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,css}\"",
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,css}\"" "format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,css}\"",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"typecheck": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"@tauri-apps/api": "^2", "@tauri-apps/api": "^2",
@@ -20,14 +23,18 @@
"react-dom": "^19.2.8" "react-dom": "^19.2.8"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^10.0.1",
"@tauri-apps/cli": "^2", "@tauri-apps/cli": "^2",
"@types/react": "^19.1.8", "@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6", "@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.6.0", "@vitejs/plugin-react": "^4.6.0",
"eslint": "^10.14.0",
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.6", "eslint-plugin-prettier": "^5.5.6",
"eslint-plugin-react-hooks": "^7.1.1",
"prettier": "^3.9.6", "prettier": "^3.9.6",
"typescript": "~5.8.3", "typescript": "~5.8.3",
"typescript-eslint": "^8.72.1",
"vite": "^7.0.4" "vite": "^7.0.4"
} }
} }
@@ -213,7 +213,6 @@ function ChoiceSelect<T extends string>({
latest.current = value; latest.current = value;
lastCommitted.current = value; lastCommitted.current = value;
setDisplayValue(value); setDisplayValue(value);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value]); }, [value]);
// When disabled, drop any in-progress interaction, close the list and show the real value. // When disabled, drop any in-progress interaction, close the list and show the real value.
@@ -232,7 +231,6 @@ function ChoiceSelect<T extends string>({
latest.current = v; latest.current = v;
lastCommitted.current = v; lastCommitted.current = v;
setDisplayValue(v); setDisplayValue(v);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [disabled]); }, [disabled]);
useEffect(() => { useEffect(() => {
@@ -286,7 +284,6 @@ function ChoiceSelect<T extends string>({
window.removeEventListener('scroll', recalc, true); window.removeEventListener('scroll', recalc, true);
window.removeEventListener('resize', recalc); window.removeEventListener('resize', recalc);
}; };
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]); }, [open]);
// --- wheel on the trigger ---------------------------------------------- // --- wheel on the trigger ----------------------------------------------
@@ -288,7 +288,6 @@ function StepperCore<T>({
lastCommitted.current = value; lastCommitted.current = value;
setLocalValue(value); setLocalValue(value);
setText(formatLabel(value)); setText(formatLabel(value));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value, formatLabel]); }, [value, formatLabel]);
// When disabled, drop any in-progress interaction and show the real value. // When disabled, drop any in-progress interaction and show the real value.
@@ -309,7 +308,6 @@ function StepperCore<T>({
lastCommitted.current = v; lastCommitted.current = v;
setLocalValue(v); setLocalValue(v);
setText(formatLabelRef.current(v)); setText(formatLabelRef.current(v));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [disabled]); }, [disabled]);
useEffect(() => { useEffect(() => {
@@ -431,6 +431,7 @@ export const LinearGraph = forwardRef<LinearGraphHandle, LinearGraphProps>(funct
formatX, formatX,
formatY, formatY,
draw, draw,
cq.w
]); ]);
useEffect(() => { useEffect(() => {
@@ -163,9 +163,16 @@ function SignalFlowMatrix({
const commitTimers = useRef<Map<string, ReturnType<typeof setTimeout>>>(new Map()); const commitTimers = useRef<Map<string, ReturnType<typeof setTimeout>>>(new Map());
useEffect(() => { useEffect(() => {
const timers = commitTimers.current;
const tooltipTimer = hideTooltipTimer.current;
return () => { return () => {
if (hideTooltipTimer.current) clearTimeout(hideTooltipTimer.current); if (tooltipTimer) {
commitTimers.current.forEach(clearTimeout); clearTimeout(tooltipTimer);
}
timers.forEach((timer) => clearTimeout(timer));
timers.clear();
}; };
}, []); }, []);
@@ -222,7 +222,6 @@ export default function VerticalSlider({
const wheelTimeout = useRef<ReturnType<typeof setTimeout> | null>(null); const wheelTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);
if (scale === 'log' && !values && (min <= 0 || max <= 0)) { if (scale === 'log' && !values && (min <= 0 || max <= 0)) {
// eslint-disable-next-line no-console
console.warn( console.warn(
'VerticalSlider: scale="log" requires min > 0 and max > 0. Falling back to linear behavior for out-of-range bounds.' 'VerticalSlider: scale="log" requires min > 0 and max > 0. Falling back to linear behavior for out-of-range bounds.'
); );
@@ -6,7 +6,9 @@ import { sumCurvePoints, sumPhaseCurvePoints } from '../../utils/graph/curve';
import { getPeqCurvePoints, getPeqPhasePoints } from '../../utils/graph/peq'; import { getPeqCurvePoints, getPeqPhasePoints } from '../../utils/graph/peq';
import { getCrossoverCurvePoints, getCrossoverPhasePoints } from '../../utils/graph/crossover'; import { getCrossoverCurvePoints, getCrossoverPhasePoints } from '../../utils/graph/crossover';
import { drawCurves } from '../../utils/graph/draw'; import { drawCurves } from '../../utils/graph/draw';
import LinearGraph from '../../../../components/LinearGraph/LinearGraph'; import LinearGraph, {
type LinearGraphHelpers,
} from '../../../../components/LinearGraph/LinearGraph';
// Constant, so compute once instead of every render. // Constant, so compute once instead of every render.
const GRAPH_FREQS = logSpace(GRAPH_X_MIN, GRAPH_X_MAX, 1000); const GRAPH_FREQS = logSpace(GRAPH_X_MIN, GRAPH_X_MAX, 1000);
@@ -38,7 +40,7 @@ export const MagnitudeGraph = memo(function MagnitudeGraph({
); );
const draw = useCallback( const draw = useCallback(
({ ctx, toPx }: any) => { ({ ctx, toPx }: LinearGraphHelpers) => {
drawCurves({ drawCurves({
ctx, ctx,
toPx, toPx,
@@ -87,7 +89,7 @@ export const PhaseGraph = memo(function PhaseGraph({
); );
const draw = useCallback( const draw = useCallback(
({ ctx, toPx }: any) => { ({ ctx, toPx }: LinearGraphHelpers) => {
drawCurves({ drawCurves({
ctx, ctx,
toPx, toPx,
@@ -1,7 +1,9 @@
import { memo, useCallback, useMemo } from 'react'; import { memo, useCallback, useMemo } from 'react';
import { Ratio } from '../../types'; import { Ratio } from '../../types';
import { RATIO_NUMERIC } from '../../constants'; import { RATIO_NUMERIC } from '../../constants';
import LinearGraph from '../../../../components/LinearGraph/LinearGraph'; import LinearGraph, {
type LinearGraphHelpers,
} from '../../../../components/LinearGraph/LinearGraph';
const formatTick = (v: number) => Math.round(v).toString(); const formatTick = (v: number) => Math.round(v).toString();
@@ -66,7 +68,7 @@ export const CompressorGraph = memo(function CompressorGraph({
}, [threshold, ratio, knee]); }, [threshold, ratio, knee]);
const draw = useCallback( const draw = useCallback(
({ ctx, toPx }: any) => { ({ ctx, toPx }: LinearGraphHelpers) => {
// Unity reference line // Unity reference line
ctx.strokeStyle = '#6b7280'; ctx.strokeStyle = '#6b7280';
ctx.lineWidth = 1; ctx.lineWidth = 1;
@@ -1,8 +1,10 @@
import { memo, useCallback, useMemo } from 'react'; import { memo, useCallback, useMemo } from 'react';
import { DelayUnit } from '../../types'; import { DelayUnit } from '../../types';
import { DELAY_RANGES } from '../../constants'; import { DELAY_RANGES } from '../../constants';
import LinearGraph from '../../../../components/LinearGraph/LinearGraph';
import { DELAY_UNIT_LABEL } from '../../constants'; import { DELAY_UNIT_LABEL } from '../../constants';
import LinearGraph, {
type LinearGraphHelpers,
} from '../../../../components/LinearGraph/LinearGraph';
const formatY = (v: number) => v.toFixed(0); const formatY = (v: number) => v.toFixed(0);
@@ -34,7 +36,7 @@ export const DelayGraph = memo(
const formatX = useCallback((v: number) => labelByX.get(Math.round(v)) ?? '', [labelByX]); const formatX = useCallback((v: number) => labelByX.get(Math.round(v)) ?? '', [labelByX]);
const draw = useCallback( const draw = useCallback(
({ ctx, toPx, plot }: any) => { ({ ctx, toPx, plot }: LinearGraphHelpers) => {
const barWidth = (plot.width / rows.length) * 0.55; const barWidth = (plot.width / rows.length) * 0.55;
rows.forEach((row, i) => { rows.forEach((row, i) => {
@@ -2,7 +2,9 @@ import { memo, useCallback, useMemo } from 'react';
import { GRAPH_FREQS, GRAPH_X_MAX, GRAPH_X_MIN, GRAPH_Y_MIN, Y_AXIS_STEP } from '../../constants'; import { GRAPH_FREQS, GRAPH_X_MAX, GRAPH_X_MIN, GRAPH_Y_MIN, Y_AXIS_STEP } from '../../constants';
import { Curve, CurvePoint } from '../../utils/graph/curve'; import { Curve, CurvePoint } from '../../utils/graph/curve';
import { drawCurves } from '../../utils/graph/draw'; import { drawCurves } from '../../utils/graph/draw';
import LinearGraph from '../../../../components/LinearGraph/LinearGraph'; import LinearGraph, {
type LinearGraphHelpers,
} from '../../../../components/LinearGraph/LinearGraph';
// Expands [baseMin, baseMax] outward to fit whatever the curves actually // Expands [baseMin, baseMax] outward to fit whatever the curves actually
// contain (e.g. gain + geq + peq stacking past the nominal graph range), // contain (e.g. gain + geq + peq stacking past the nominal graph range),
@@ -115,7 +117,7 @@ function ResponseGraphInner<T extends string, S>({
); );
const draw = useCallback( const draw = useCallback(
({ ctx, toPx }: any) => { ({ ctx, toPx }: LinearGraphHelpers) => {
drawCurves({ ctx, toPx, xMin: GRAPH_X_MIN, xMax: GRAPH_X_MAX, yMin, yMax, curves }); drawCurves({ ctx, toPx, xMin: GRAPH_X_MIN, xMax: GRAPH_X_MAX, yMin, yMax, curves });
}, },
[curves, yMin, yMax] [curves, yMin, yMax]
@@ -1,5 +1,7 @@
import { memo, useCallback, useMemo } from 'react'; import { memo, useCallback, useMemo } from 'react';
import LinearGraph from '../../../../components/LinearGraph/LinearGraph'; import LinearGraph, {
type LinearGraphHelpers,
} from '../../../../components/LinearGraph/LinearGraph';
const formatTick = (v: number) => Math.round(v).toString(); const formatTick = (v: number) => Math.round(v).toString();
@@ -25,7 +27,7 @@ export const GateGraph = memo(function GateGraph({
}, [attack, hold, release]); }, [attack, hold, release]);
const draw = useCallback( const draw = useCallback(
({ toPx, ctx }: any) => { ({ ctx, toPx }: LinearGraphHelpers) => {
const { t0, t1, t2, t3, t4, t5 } = envelope; const { t0, t1, t2, t3, t4, t5 } = envelope;
ctx.strokeStyle = '#fbbf24'; ctx.strokeStyle = '#fbbf24';
@@ -4,9 +4,11 @@ import { drawCurves } from '../../utils/graph/draw';
import { GRAPH_X_MIN, GRAPH_X_MAX, GRAPH_Y_MIN, GRAPH_Y_MAX, GEQ_CURVE_Q } from '../../constants'; import { GRAPH_X_MIN, GRAPH_X_MAX, GRAPH_Y_MIN, GRAPH_Y_MAX, GEQ_CURVE_Q } from '../../constants';
import { DiscreteFrequency } from '../../types'; import { DiscreteFrequency } from '../../types';
import { GEQ_BANDS_LABEL } from '../../constants'; import { GEQ_BANDS_LABEL } from '../../constants';
import LinearGraph from '../../../../components/LinearGraph/LinearGraph';
import { getGeqCurvePoints } from '../../utils/graph/geq'; import { getGeqCurvePoints } from '../../utils/graph/geq';
import { LiveBands } from './GeqSection'; import { LiveBands } from './GeqSection';
import LinearGraph, {
type LinearGraphHelpers,
} from '../../../../components/LinearGraph/LinearGraph';
const GEQ_FREQS = logSpace(GRAPH_X_MIN, GRAPH_X_MAX, 1000); const GEQ_FREQS = logSpace(GRAPH_X_MIN, GRAPH_X_MAX, 1000);
@@ -29,7 +31,7 @@ export const GeqGraph = memo(function GeqGraph({
}, [gains, liveBands]); }, [gains, liveBands]);
const draw = useCallback( const draw = useCallback(
({ ctx, toPx }: any) => { ({ ctx, toPx }: LinearGraphHelpers) => {
drawCurves({ drawCurves({
ctx, ctx,
toPx, toPx,
@@ -1,5 +1,7 @@
import { memo, useCallback, useMemo } from 'react'; import { memo, useCallback, useMemo } from 'react';
import LinearGraph from '../../../../components/LinearGraph/LinearGraph'; import LinearGraph, {
type LinearGraphHelpers,
} from '../../../../components/LinearGraph/LinearGraph';
const formatTick = (v: number) => Math.round(v).toString(); const formatTick = (v: number) => Math.round(v).toString();
@@ -20,7 +22,7 @@ export const LimiterGraph = memo(function LimiterGraph({ threshold }: { threshol
}, [threshold]); }, [threshold]);
const draw = useCallback( const draw = useCallback(
({ ctx, toPx }: any) => { ({ ctx, toPx }: LinearGraphHelpers) => {
// Unity reference line // Unity reference line
ctx.strokeStyle = '#6b7280'; ctx.strokeStyle = '#6b7280';
ctx.lineWidth = 1; ctx.lineWidth = 1;
@@ -93,8 +93,9 @@ function MatrixSection({
setLiveGains((prev) => { setLiveGains((prev) => {
if (value === null) { if (value === null) {
if (!(key in prev)) return prev; if (!(key in prev)) return prev;
const { [key]: _removed, ...rest } = prev; return Object.fromEntries(
return rest; Object.entries(prev).filter(([k]) => k !== key)
);
} }
return { ...prev, [key]: value }; return { ...prev, [key]: value };
}); });
@@ -235,7 +235,6 @@ function LinkChannelsModal({
]; ];
for (const group of groups) { for (const group of groups) {
// eslint-disable-next-line no-await-in-loop
await linkChannels(group.source, group.destinations); await linkChannels(group.source, group.destinations);
} }
+27 -3
View File
@@ -1,11 +1,20 @@
import { useEffect, useId, useRef, useState } from 'react'; import { useEffect, useId, useRef, useState } from 'react';
import { useIsTouch } from './useIsTouch'; import { useIsTouch } from './useIsTouch';
declare global {
interface Window {
VolumeBridge?: {
setIntercept: (on: boolean) => void;
};
}
}
/** The control that currently owns the hardware volume buttons. */ /** The control that currently owns the hardware volume buttons. */
let activeId: string | null = null; let activeId: string | null = null;
function setNativeIntercept(on: boolean) { function setNativeIntercept(on: boolean) {
(window as any).VolumeBridge?.setIntercept(on); window.VolumeBridge?.setIntercept(on);
} }
type Options = { type Options = {
@@ -25,6 +34,7 @@ export function useVolumeKeys({ rootRef, onStep, disabled }: Options) {
function select() { function select() {
if (!isMobile || disabled) return; if (!isMobile || disabled) return;
activeId = id; activeId = id;
setNativeIntercept(true); setNativeIntercept(true);
setSelected(true); setSelected(true);
@@ -32,6 +42,7 @@ export function useVolumeKeys({ rootRef, onStep, disabled }: Options) {
function deselect() { function deselect() {
setSelected(false); setSelected(false);
if (activeId === id) { if (activeId === id) {
activeId = null; activeId = null;
setNativeIntercept(false); setNativeIntercept(false);
@@ -57,16 +68,23 @@ export function useVolumeKeys({ rootRef, onStep, disabled }: Options) {
// Release when tapping outside // Release when tapping outside
useEffect(() => { useEffect(() => {
if (!isMobile) return; if (!isMobile) return;
const onDown = (e: PointerEvent) => { const onDown = (e: PointerEvent) => {
if (rootRef.current?.contains(e.target as Node)) return; if (rootRef.current?.contains(e.target as Node)) return;
setSelected(false); setSelected(false);
if (activeId === id) { if (activeId === id) {
activeId = null; activeId = null;
setNativeIntercept(false); setNativeIntercept(false);
} }
}; };
document.addEventListener('pointerdown', onDown, true); document.addEventListener('pointerdown', onDown, true);
return () => document.removeEventListener('pointerdown', onDown, true);
return () => {
document.removeEventListener('pointerdown', onDown, true);
};
}, [isMobile, id, rootRef]); }, [isMobile, id, rootRef]);
// Volume events from the native bridge // Volume events from the native bridge
@@ -76,17 +94,23 @@ export function useVolumeKeys({ rootRef, onStep, disabled }: Options) {
const onUp = () => { const onUp = () => {
if (activeId === id) onStepRef.current(1); if (activeId === id) onStepRef.current(1);
}; };
const onDown = () => { const onDown = () => {
if (activeId === id) onStepRef.current(-1); if (activeId === id) onStepRef.current(-1);
}; };
document.addEventListener('volumeupbutton', onUp); document.addEventListener('volumeupbutton', onUp);
document.addEventListener('volumedownbutton', onDown); document.addEventListener('volumedownbutton', onDown);
return () => { return () => {
document.removeEventListener('volumeupbutton', onUp); document.removeEventListener('volumeupbutton', onUp);
document.removeEventListener('volumedownbutton', onDown); document.removeEventListener('volumedownbutton', onDown);
}; };
}, [isMobile, disabled, id]); }, [isMobile, disabled, id]);
return { isSelected: isMobile && selected, select, deselect }; return {
isSelected: isMobile && selected,
select,
deselect,
};
} }
+1 -1
View File
@@ -43,7 +43,7 @@ function SettingsPage({
return () => { return () => {
cancelled = true; cancelled = true;
}; };
}, []); }, [onNotificationsDisabledChange]);
async function updateSetting<K extends keyof AppSettings>( async function updateSetting<K extends keyof AppSettings>(
key: K, key: K,