style: clean up code with prettier and eslint

This commit is contained in:
openhands committed 2026-07-12 20:31:05 +02:00
1 parent 60278b9e71
commit fb8e77bb68
378 files changed
+22407 -20689

No files matched your search

+19 -19
View File
@@ -15,32 +15,32 @@
* length equals the max per-channel tick-sum × 2 seconds.
*/
export const TRAX_TICK_SECONDS = 2
export const TRAX_TICK_SECONDS = 2;
export interface TraxEvent {
sampleId: number
ticks: number
sampleId: number;
ticks: number;
}
export interface TraxChannel {
channel: number
events: TraxEvent[]
channel: number;
events: TraxEvent[];
}
/** Split a raw track string into per-channel event lists. */
export function parseTraxChannels(track: string | null | undefined): TraxChannel[] {
if (!track) return []
const channels: TraxChannel[] = []
if (!track) return [];
const channels: TraxChannel[] = [];
for (const m of track.matchAll(/(\d+):([^:]+)/g)) {
const channel = Number(m[1])
const events: TraxEvent[] = []
for (const raw of m[2].split(';')) {
const pair = raw.match(/^(\d+),(\d+)$/)
if (pair) events.push({ sampleId: Number(pair[1]), ticks: Number(pair[2]) })
const channel = Number(m[1]);
const events: TraxEvent[] = [];
for (const raw of m[2].split(";")) {
const pair = raw.match(/^(\d+),(\d+)$/);
if (pair) events.push({ sampleId: Number(pair[1]), ticks: Number(pair[2]) });
}
if (events.length > 0) channels.push({ channel, events })
if (events.length > 0) channels.push({ channel, events });
}
return channels
return channels;
}
/**
@@ -48,15 +48,15 @@ export function parseTraxChannels(track: string | null | undefined): TraxChannel
* Returns [] for empty or unparseable tracks (i.e. single-sample song disks).
*/
export function parseTrackSamples(track: string | null | undefined): number[] {
const set = new Set<number>()
const set = new Set<number>();
for (const ch of parseTraxChannels(track)) {
for (const ev of ch.events) {
if (ev.sampleId > 0) set.add(ev.sampleId)
if (ev.sampleId > 0) set.add(ev.sampleId);
}
}
return [...set].sort((a, b) => a - b)
return [...set].sort((a, b) => a - b);
}
export function detectSoundtrackKind(track: string | null | undefined): 'single' | 'composition' {
return parseTrackSamples(track).length > 0 ? 'composition' : 'single'
export function detectSoundtrackKind(track: string | null | undefined): "single" | "composition" {
return parseTrackSamples(track).length > 0 ? "composition" : "single";
}