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",
"tauri": "tauri",
"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": {
"@tauri-apps/api": "^2",
@@ -20,14 +23,18 @@
"react-dom": "^19.2.8"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@tauri-apps/cli": "^2",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.6.0",
"eslint": "^10.14.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.6",
"eslint-plugin-react-hooks": "^7.1.1",
"prettier": "^3.9.6",
"typescript": "~5.8.3",
"typescript-eslint": "^8.72.1",
"vite": "^7.0.4"
}
}
@@ -213,7 +213,6 @@ function ChoiceSelect<T extends string>({
latest.current = value;
lastCommitted.current = value;
setDisplayValue(value);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [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;
lastCommitted.current = v;
setDisplayValue(v);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [disabled]);
useEffect(() => {
@@ -286,7 +284,6 @@ function ChoiceSelect<T extends string>({
window.removeEventListener('scroll', recalc, true);
window.removeEventListener('resize', recalc);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]);
// --- wheel on the trigger ----------------------------------------------
@@ -288,7 +288,6 @@ function StepperCore<T>({
lastCommitted.current = value;
setLocalValue(value);
setText(formatLabel(value));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value, formatLabel]);
// When disabled, drop any in-progress interaction and show the real value.
@@ -309,7 +308,6 @@ function StepperCore<T>({
lastCommitted.current = v;
setLocalValue(v);
setText(formatLabelRef.current(v));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [disabled]);
useEffect(() => {
@@ -431,6 +431,7 @@ export const LinearGraph = forwardRef<LinearGraphHandle, LinearGraphProps>(funct
formatX,
formatY,
draw,
cq.w
]);
useEffect(() => {
@@ -163,9 +163,16 @@ function SignalFlowMatrix({
const commitTimers = useRef<Map<string, ReturnType<typeof setTimeout>>>(new Map());
useEffect(() => {
const timers = commitTimers.current;
const tooltipTimer = hideTooltipTimer.current;
return () => {
if (hideTooltipTimer.current) clearTimeout(hideTooltipTimer.current);
commitTimers.current.forEach(clearTimeout);
if (tooltipTimer) {
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);
if (scale === 'log' && !values && (min <= 0 || max <= 0)) {
// eslint-disable-next-line no-console
console.warn(
'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 { getCrossoverCurvePoints, getCrossoverPhasePoints } from '../../utils/graph/crossover';
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.
const GRAPH_FREQS = logSpace(GRAPH_X_MIN, GRAPH_X_MAX, 1000);
@@ -38,7 +40,7 @@ export const MagnitudeGraph = memo(function MagnitudeGraph({
);
const draw = useCallback(
({ ctx, toPx }: any) => {
({ ctx, toPx }: LinearGraphHelpers) => {
drawCurves({
ctx,
toPx,
@@ -87,7 +89,7 @@ export const PhaseGraph = memo(function PhaseGraph({
);
const draw = useCallback(
({ ctx, toPx }: any) => {
({ ctx, toPx }: LinearGraphHelpers) => {
drawCurves({
ctx,
toPx,
@@ -1,7 +1,9 @@
import { memo, useCallback, useMemo } from 'react';
import { Ratio } from '../../types';
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();
@@ -66,7 +68,7 @@ export const CompressorGraph = memo(function CompressorGraph({
}, [threshold, ratio, knee]);
const draw = useCallback(
({ ctx, toPx }: any) => {
({ ctx, toPx }: LinearGraphHelpers) => {
// Unity reference line
ctx.strokeStyle = '#6b7280';
ctx.lineWidth = 1;
@@ -1,8 +1,10 @@
import { memo, useCallback, useMemo } from 'react';
import { DelayUnit } from '../../types';
import { DELAY_RANGES } from '../../constants';
import LinearGraph from '../../../../components/LinearGraph/LinearGraph';
import { DELAY_UNIT_LABEL } from '../../constants';
import LinearGraph, {
type LinearGraphHelpers,
} from '../../../../components/LinearGraph/LinearGraph';
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 draw = useCallback(
({ ctx, toPx, plot }: any) => {
({ ctx, toPx, plot }: LinearGraphHelpers) => {
const barWidth = (plot.width / rows.length) * 0.55;
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 { Curve, CurvePoint } from '../../utils/graph/curve';
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
// 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(
({ ctx, toPx }: any) => {
({ ctx, toPx }: LinearGraphHelpers) => {
drawCurves({ ctx, toPx, xMin: GRAPH_X_MIN, xMax: GRAPH_X_MAX, yMin, yMax, curves });
},
[curves, yMin, yMax]
@@ -1,5 +1,7 @@
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();
@@ -25,7 +27,7 @@ export const GateGraph = memo(function GateGraph({
}, [attack, hold, release]);
const draw = useCallback(
({ toPx, ctx }: any) => {
({ ctx, toPx }: LinearGraphHelpers) => {
const { t0, t1, t2, t3, t4, t5 } = envelope;
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 { DiscreteFrequency } from '../../types';
import { GEQ_BANDS_LABEL } from '../../constants';
import LinearGraph from '../../../../components/LinearGraph/LinearGraph';
import { getGeqCurvePoints } from '../../utils/graph/geq';
import { LiveBands } from './GeqSection';
import LinearGraph, {
type LinearGraphHelpers,
} from '../../../../components/LinearGraph/LinearGraph';
const GEQ_FREQS = logSpace(GRAPH_X_MIN, GRAPH_X_MAX, 1000);
@@ -29,7 +31,7 @@ export const GeqGraph = memo(function GeqGraph({
}, [gains, liveBands]);
const draw = useCallback(
({ ctx, toPx }: any) => {
({ ctx, toPx }: LinearGraphHelpers) => {
drawCurves({
ctx,
toPx,
@@ -1,5 +1,7 @@
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();
@@ -20,7 +22,7 @@ export const LimiterGraph = memo(function LimiterGraph({ threshold }: { threshol
}, [threshold]);
const draw = useCallback(
({ ctx, toPx }: any) => {
({ ctx, toPx }: LinearGraphHelpers) => {
// Unity reference line
ctx.strokeStyle = '#6b7280';
ctx.lineWidth = 1;
@@ -93,8 +93,9 @@ function MatrixSection({
setLiveGains((prev) => {
if (value === null) {
if (!(key in prev)) return prev;
const { [key]: _removed, ...rest } = prev;
return rest;
return Object.fromEntries(
Object.entries(prev).filter(([k]) => k !== key)
);
}
return { ...prev, [key]: value };
});
@@ -235,7 +235,6 @@ function LinkChannelsModal({
];
for (const group of groups) {
// eslint-disable-next-line no-await-in-loop
await linkChannels(group.source, group.destinations);
}
+28 -4
View File
@@ -1,11 +1,20 @@
import { useEffect, useId, useRef, useState } from 'react';
import { useIsTouch } from './useIsTouch';
declare global {
interface Window {
VolumeBridge?: {
setIntercept: (on: boolean) => void;
};
}
}
/** The control that currently owns the hardware volume buttons. */
let activeId: string | null = null;
function setNativeIntercept(on: boolean) {
(window as any).VolumeBridge?.setIntercept(on);
window.VolumeBridge?.setIntercept(on);
}
type Options = {
@@ -25,6 +34,7 @@ export function useVolumeKeys({ rootRef, onStep, disabled }: Options) {
function select() {
if (!isMobile || disabled) return;
activeId = id;
setNativeIntercept(true);
setSelected(true);
@@ -32,6 +42,7 @@ export function useVolumeKeys({ rootRef, onStep, disabled }: Options) {
function deselect() {
setSelected(false);
if (activeId === id) {
activeId = null;
setNativeIntercept(false);
@@ -57,16 +68,23 @@ export function useVolumeKeys({ rootRef, onStep, disabled }: Options) {
// Release when tapping outside
useEffect(() => {
if (!isMobile) return;
const onDown = (e: PointerEvent) => {
if (rootRef.current?.contains(e.target as Node)) return;
setSelected(false);
if (activeId === id) {
activeId = null;
setNativeIntercept(false);
}
};
document.addEventListener('pointerdown', onDown, true);
return () => document.removeEventListener('pointerdown', onDown, true);
return () => {
document.removeEventListener('pointerdown', onDown, true);
};
}, [isMobile, id, rootRef]);
// Volume events from the native bridge
@@ -76,17 +94,23 @@ export function useVolumeKeys({ rootRef, onStep, disabled }: Options) {
const onUp = () => {
if (activeId === id) onStepRef.current(1);
};
const onDown = () => {
if (activeId === id) onStepRef.current(-1);
};
document.addEventListener('volumeupbutton', onUp);
document.addEventListener('volumedownbutton', onDown);
return () => {
document.removeEventListener('volumeupbutton', onUp);
document.removeEventListener('volumedownbutton', onDown);
};
}, [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 () => {
cancelled = true;
};
}, []);
}, [onNotificationsDisabledChange]);
async function updateSetting<K extends keyof AppSettings>(
key: K,