infra: add linting and formatting for js projects (#230)

* wip

* wip

* wip

* format

* wip(mobile): lint and format

* cleanup

* nits

* nits

* idiomatic react

* nit

* format all root files
This commit was merged in pull request #230.
This commit is contained in:
Arjun Patel
2026-06-02 07:44:24 -07:00
committed by GitHub
parent 2fe562ce2b
commit a8a0b7db1b
258 changed files with 7822 additions and 5195 deletions
+20 -16
View File
@@ -1,9 +1,11 @@
import { useEffect, useRef, useState, type RefObject } from "react";
import type { MediaParticleHandle } from "@/features/particles/media-particle-view";
import { useSuspendPlayback } from "@/hooks/use-suspend-playback";
import { selectIsPaused, usePlaybackPauseStore } from "@/stores/playback-pause-store";
import { isTypingTarget } from "@/lib/keyboard";
import { set } from "zod";
import { useEffect, useRef, useState, type RefObject } from 'react';
import type { MediaParticleHandle } from '@/features/particles/media-particle-view';
import { useSuspendPlayback } from '@/hooks/use-suspend-playback';
import {
selectIsPaused,
usePlaybackPauseStore,
} from '@/stores/playback-pause-store';
import { isTypingTarget } from '@/lib/keyboard';
const SPACE_TAP_THRESHOLD_MS = 250;
@@ -20,12 +22,14 @@ interface UsePlaybackKeysResult {
* manages its own suspender via useSuspendPlayback); other keys bail when
* playback is already paused for an external reason.
*/
export function usePlaybackKeys({ mediaRef }: UsePlaybackKeysOptions): UsePlaybackKeysResult {
export function usePlaybackKeys({
mediaRef,
}: UsePlaybackKeysOptions): UsePlaybackKeysResult {
const [spaceHeld, setSpaceHeld] = useState(false);
const [fastPlayback, setFastPlayback] = useState(false);
const spaceStartRef = useRef(0);
useSuspendPlayback(spaceHeld, "hold-space");
useSuspendPlayback(spaceHeld, 'hold-space');
useEffect(() => {
const isExternallyPaused = () =>
@@ -34,7 +38,7 @@ export function usePlaybackKeys({ mediaRef }: UsePlaybackKeysOptions): UsePlayba
const onKeyDown = (e: KeyboardEvent) => {
if (isTypingTarget(e)) return;
if (e.key === " ") {
if (e.key === ' ') {
e.preventDefault();
if (!e.repeat) {
if (spaceHeld) {
@@ -50,7 +54,7 @@ export function usePlaybackKeys({ mediaRef }: UsePlaybackKeysOptions): UsePlayba
if (isExternallyPaused()) return;
if (e.key === "Shift" && !e.repeat) {
if (e.key === 'Shift' && !e.repeat) {
mediaRef.current?.setPlaybackRate(1.5);
setFastPlayback(true);
}
@@ -59,7 +63,7 @@ export function usePlaybackKeys({ mediaRef }: UsePlaybackKeysOptions): UsePlayba
const onKeyUp = (e: KeyboardEvent) => {
if (isTypingTarget(e)) return;
if (e.key === " ") {
if (e.key === ' ') {
e.preventDefault();
// keep space-held if it was a quick tap, to allow for space-to-toggle behavior
@@ -74,17 +78,17 @@ export function usePlaybackKeys({ mediaRef }: UsePlaybackKeysOptions): UsePlayba
if (isExternallyPaused()) return;
if (e.key === "Shift") {
if (e.key === 'Shift') {
mediaRef.current?.setPlaybackRate(1);
setFastPlayback(false);
}
};
window.addEventListener("keydown", onKeyDown);
window.addEventListener("keyup", onKeyUp);
window.addEventListener('keydown', onKeyDown);
window.addEventListener('keyup', onKeyUp);
return () => {
window.removeEventListener("keydown", onKeyDown);
window.removeEventListener("keyup", onKeyUp);
window.removeEventListener('keydown', onKeyDown);
window.removeEventListener('keyup', onKeyUp);
};
}, [mediaRef, spaceHeld]);