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
+15 -15
View File
@@ -1,13 +1,13 @@
import { useCallback, useEffect, useRef } from "react";
import type { RecordingMode } from "@/hooks/use-recording-mode";
import { useCallback, useEffect, useRef } from 'react';
import type { RecordingMode } from '@/hooks/use-recording-mode';
const VIDEO_PREFERRED_MIME = "video/webm;codecs=vp9,opus";
const VIDEO_FALLBACK_MIME = "video/webm";
const AUDIO_PREFERRED_MIME = "audio/webm;codecs=opus";
const AUDIO_FALLBACK_MIME = "audio/webm";
const VIDEO_PREFERRED_MIME = 'video/webm;codecs=vp9,opus';
const VIDEO_FALLBACK_MIME = 'video/webm';
const AUDIO_PREFERRED_MIME = 'audio/webm;codecs=opus';
const AUDIO_FALLBACK_MIME = 'audio/webm';
function getMediaMime(mode: "video" | "audio"): string {
if (mode === "audio") {
function getMediaMime(mode: 'video' | 'audio'): string {
if (mode === 'audio') {
return MediaRecorder.isTypeSupported(AUDIO_PREFERRED_MIME)
? AUDIO_PREFERRED_MIME
: AUDIO_FALLBACK_MIME;
@@ -36,7 +36,7 @@ function buildConstraints(
? { deviceId: { exact: micDeviceId } }
: true;
if (mode === "audio") return { audio };
if (mode === 'audio') return { audio };
const video: MediaTrackConstraints = cameraDeviceId
? { deviceId: { exact: cameraDeviceId }, aspectRatio: { ideal: 4 / 3 } }
@@ -57,13 +57,13 @@ async function getStreamWithFallback(
if (
hasDeviceId &&
err instanceof Error &&
(err.name === "OverconstrainedError" || err.name === "NotFoundError")
(err.name === 'OverconstrainedError' || err.name === 'NotFoundError')
) {
const relaxed: MediaStreamConstraints = {
audio: typeof constraints.audio === "object" ? true : constraints.audio,
audio: typeof constraints.audio === 'object' ? true : constraints.audio,
...(constraints.video !== undefined && {
video:
typeof constraints.video === "object"
typeof constraints.video === 'object'
? { aspectRatio: { ideal: 4 / 3 } }
: constraints.video,
}),
@@ -143,13 +143,13 @@ export function useRecorder({
} catch (err) {
stopTracks();
onErrorRef.current(
err instanceof Error ? err.message : "Failed to start recording",
err instanceof Error ? err.message : 'Failed to start recording',
);
}
}, [mode, micDeviceId, cameraDeviceId, onStreamReady, stopTracks]);
const stopRecording = useCallback(() => {
if (recorderRef.current?.state === "recording") {
if (recorderRef.current?.state === 'recording') {
recorderRef.current.stop();
}
}, []);
@@ -158,7 +158,7 @@ export function useRecorder({
if (recorderRef.current) {
recorderRef.current.ondataavailable = null;
recorderRef.current.onstop = null;
if (recorderRef.current.state === "recording") {
if (recorderRef.current.state === 'recording') {
recorderRef.current.stop();
}
}