diff --git a/.oxlintrc.json b/.oxlintrc.json index 848d0f7759..d1a6c92494 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -1,7 +1,7 @@ { "$schema": "./node_modules/oxlint/configuration_schema.json", "categories": { - "correctness": "off" + "correctness": "error" }, "options": { "typeAware": true @@ -258,7 +258,24 @@ "allowPattern": "" } ], - "tsdoc/syntax": "error" + "tsdoc/syntax": "error", + "typescript/no-unsafe-call": "off", + "typescript/no-unsafe-member-access": "off", + "typescript/no-floating-promises": "off", + "typescript/no-misused-promises": "off", + "typescript/no-unsafe-return": "off", + "typescript/no-unsafe-assignment": "off", + "typescript/no-unsafe-argument": "off", + "typescript/no-require-imports": "off", + "typescript/no-empty-object-type": "off", + "typescript/no-non-null-assertion": "off", + "no-use-before-define": "off", + "react/react-in-jsx-scope": "off", + "react/refs": "warn", + "react/immutability": "warn", + "react/set-state-in-effect": "warn", + "react/purity": "warn", + "react/preserve-manual-memoization": "warn" } }, { @@ -514,7 +531,22 @@ "allowKeywords": true, "allowPattern": "" } - ] + ], + "react/refs": "warn", + "react/immutability": "warn", + "react/set-state-in-effect": "warn", + "react/purity": "warn", + "react/preserve-manual-memoization": "warn" + } + }, + { + "files": [ + "packages/audiodocs/src/**", + "packages/internaldocs/src/**", + "packages/docs-theme/**" + ], + "env": { + "browser": true } } ] diff --git a/apps/common-app/.oxlintrc.json b/apps/common-app/.oxlintrc.json index 188255693d..7a94b6303c 100644 --- a/apps/common-app/.oxlintrc.json +++ b/apps/common-app/.oxlintrc.json @@ -1,7 +1,7 @@ { "$schema": "../../node_modules/oxlint/configuration_schema.json", "categories": { - "correctness": "off" + "correctness": "error" }, "options": { "typeAware": true @@ -87,8 +87,14 @@ ], "no-shadow": ["warn"], "react/rules-of-hooks": ["error"], - "react/exhaustive-deps": ["error"], + "react/exhaustive-deps": "warn", "typescript/dot-notation": ["warn"], - "react-native/no-inline-styles": "warn" + "react-native/no-inline-styles": "warn", + "react/refs": "warn", + "react/immutability": "warn", + "react/set-state-in-effect": "warn", + "react/purity": "warn", + "react/preserve-manual-memoization": "warn", + "typescript/no-floating-promises": "off" } } diff --git a/apps/common-app/package.json b/apps/common-app/package.json index 4cadab3a8f..e5283a9e1c 100644 --- a/apps/common-app/package.json +++ b/apps/common-app/package.json @@ -3,6 +3,9 @@ "version": "0.0.1", "private": true, "scripts": { + "check": "bash ../../scripts/run-steps.sh lint typecheck", + "lint": "oxlint .", + "typecheck": "tsc --noEmit", "typecheck:voice": "tsc --project tsconfig.voice.json --noEmit" }, "peerDependencies": { diff --git a/apps/common-app/src/components/VerticalSlider.tsx b/apps/common-app/src/components/VerticalSlider.tsx index 5462afcb9c..039d84d594 100644 --- a/apps/common-app/src/components/VerticalSlider.tsx +++ b/apps/common-app/src/components/VerticalSlider.tsx @@ -7,7 +7,6 @@ import Animated, { withSpring, useAnimatedProps, } from 'react-native-reanimated'; -import { runOnJS } from 'react-native-reanimated'; import { scheduleOnRN } from 'react-native-worklets'; const SLIDER_HEIGHT = 100; diff --git a/apps/common-app/src/components/icons/PlayPauseIcon.tsx b/apps/common-app/src/components/icons/PlayPauseIcon.tsx index 7259ad01e5..9804e47118 100644 --- a/apps/common-app/src/components/icons/PlayPauseIcon.tsx +++ b/apps/common-app/src/components/icons/PlayPauseIcon.tsx @@ -9,7 +9,7 @@ type Props = { }; const PlayPauseIcon: React.FC = ({ - isPlaying = true, + isPlaying, size = 48, color = '#FFFFFF', }) => { diff --git a/apps/common-app/src/demos/PedalBoard/AutoWahPedal.tsx b/apps/common-app/src/demos/PedalBoard/AutoWahPedal.tsx index 865b0d10b3..631eb81d6e 100644 --- a/apps/common-app/src/demos/PedalBoard/AutoWahPedal.tsx +++ b/apps/common-app/src/demos/PedalBoard/AutoWahPedal.tsx @@ -56,7 +56,7 @@ export default function AutoWahPedal({ return () => { try { lfoOscillatorRef.current?.stop(); - } catch (e) {} + } catch {} }; }, [context]); diff --git a/apps/common-app/src/demos/Record/Record.tsx b/apps/common-app/src/demos/Record/Record.tsx index 4e6a6fdc44..7d45b50bad 100644 --- a/apps/common-app/src/demos/Record/Record.tsx +++ b/apps/common-app/src/demos/Record/Record.tsx @@ -73,7 +73,7 @@ const Record: FC = () => { try { await selectInput(input); } catch (error) { - Alert.alert('Input Device Error', `${error}`); + Alert.alert('Input Device Error', String(error)); } }; diff --git a/apps/common-app/src/examples/AudioTag/AudioTag.tsx b/apps/common-app/src/examples/AudioTag/AudioTag.tsx index 6820b266d5..888987a75c 100644 --- a/apps/common-app/src/examples/AudioTag/AudioTag.tsx +++ b/apps/common-app/src/examples/AudioTag/AudioTag.tsx @@ -5,7 +5,7 @@ import React, { useRef, useState, } from 'react'; -import { Text, useWindowDimensions, View } from 'react-native'; +import { useWindowDimensions, View } from 'react-native'; import { Audio, AudioTagHandle, @@ -81,10 +81,10 @@ const AudioTag: React.FC = () => { const handleLoad = useCallback(() => { // console.log('onLoad'); }, []); - const handleError = useCallback((error: Error) => { + const handleError = useCallback((_error: Error) => { // console.log('onError', error); }, []); - const handlePositionChange = useCallback((seconds: number) => { + const handlePositionChange = useCallback((_seconds: number) => { // console.log('onPositionChange', seconds); }, []); const handleEnded = useCallback(() => { @@ -96,7 +96,7 @@ const AudioTag: React.FC = () => { const handlePause = useCallback(() => { // console.log('onPause'); }, []); - const handleVolumeEvent = useCallback((volume: number) => { + const handleVolumeEvent = useCallback((_volume: number) => { // console.log('onVolumeChange', volume); }, []); const handleWaiting = useCallback(() => { diff --git a/apps/common-app/src/examples/AudioVisualizer/Charts.tsx b/apps/common-app/src/examples/AudioVisualizer/Charts.tsx index 852f547bf8..ab717694b8 100644 --- a/apps/common-app/src/examples/AudioVisualizer/Charts.tsx +++ b/apps/common-app/src/examples/AudioVisualizer/Charts.tsx @@ -97,6 +97,8 @@ const TimeChart: React.FC = (props) => { }, []); const timePath = useDerivedValue(() => { + // Reading the tick subscribes this derived value to new time-domain data. + // oxlint-disable-next-line no-unused-expressions timeDataTickSV.value; return buildTimePath(timeDataSV.value, fftSize, layout); }, [fftSize, layout, timeDataSV, timeDataTickSV]); @@ -134,6 +136,8 @@ const FrequencyChart: React.FC = (props) => { ); const freqPath = useDerivedValue(() => { + // Reading the tick subscribes this derived value to new frequency data. + // oxlint-disable-next-line no-unused-expressions frequencyDataTickSV.value; return buildFrequencyPath(frequencyDataSV.value, frequencyBinCount, layout); }, [frequencyBinCount, frequencyDataSV, frequencyDataTickSV, layout]); diff --git a/apps/common-app/src/examples/DrumMachine/NotesHighlight.tsx b/apps/common-app/src/examples/DrumMachine/NotesHighlight.tsx index fd5b26f53c..22f9725edd 100644 --- a/apps/common-app/src/examples/DrumMachine/NotesHighlight.tsx +++ b/apps/common-app/src/examples/DrumMachine/NotesHighlight.tsx @@ -1,5 +1,5 @@ import React, { memo } from 'react'; -import { Circle, Paint } from '@shopify/react-native-skia'; +import { Circle } from '@shopify/react-native-skia'; import { SharedValue, useDerivedValue } from 'react-native-reanimated'; import { Instrument, PlayingInstruments } from '../../types'; diff --git a/apps/common-app/src/examples/Record/Record.tsx b/apps/common-app/src/examples/Record/Record.tsx index 87f9b4f681..00786a6b4b 100644 --- a/apps/common-app/src/examples/Record/Record.tsx +++ b/apps/common-app/src/examples/Record/Record.tsx @@ -234,7 +234,7 @@ const Record: FC = () => { } catch (error) { // Android refuses a switch while a recorder is running, and either // platform refuses a device that went away between listing and picking. - Alert.alert('Input Device Error', `${error}`); + Alert.alert('Input Device Error', String(error)); } }, [availableInputs, selectInput] diff --git a/apps/common-app/src/other/AudioPipelineStress/AudioPipelineStress.tsx b/apps/common-app/src/other/AudioPipelineStress/AudioPipelineStress.tsx index 08747bff87..70342baefc 100644 --- a/apps/common-app/src/other/AudioPipelineStress/AudioPipelineStress.tsx +++ b/apps/common-app/src/other/AudioPipelineStress/AudioPipelineStress.tsx @@ -45,6 +45,7 @@ import type { ScenarioStatus, StepResult, } from './types'; +import { describeError } from '../AudioIOPlayground/log'; const AudioPipelineStress: FC = () => { const resourcesRef = useRef(new StressResourceOwner(staticAsset)); @@ -729,9 +730,7 @@ const AudioPipelineStress: FC = () => { steps, 'expected-recording-failure', 'Recorder rejected the wrong category as expected', - startError instanceof Error - ? startError.message - : String(startError) + describeError(startError) ); resourcesRef.current.recorder?.clearOnAudioReady(); @@ -782,14 +781,12 @@ const AudioPipelineStress: FC = () => { } finally { await resourcesRef.current.cleanup(); - if (!isMountedRef.current || currentRunId !== runIdRef.current) { - return; - } - - setRunnerState(stopRequestedRef.current ? 'finished' : 'finished'); + if (isMountedRef.current && currentRunId === runIdRef.current) { + setRunnerState(stopRequestedRef.current ? 'finished' : 'finished'); - if (!stopRequestedRef.current && scenarioResults.length === 0) { - setVisibleStep('Suite finished.'); + if (!stopRequestedRef.current && scenarioResults.length === 0) { + setVisibleStep('Suite finished.'); + } } } }; diff --git a/apps/common-app/src/other/LatencyValidation/latencyTests.ts b/apps/common-app/src/other/LatencyValidation/latencyTests.ts index 8c467a1262..5ce929ce71 100644 --- a/apps/common-app/src/other/LatencyValidation/latencyTests.ts +++ b/apps/common-app/src/other/LatencyValidation/latencyTests.ts @@ -22,6 +22,7 @@ import type { LoopbackAnalysis, WaveformSeries, } from './types'; +import { describeError } from '../AudioIOPlayground/log'; // Keep the live full-duplex window (mic + speaker both active) as short as // possible: the raw loopback path produces an idle buzz, so we only settle the @@ -304,8 +305,7 @@ async function runLoopbackLatencyTest( id: 'loopback-recorder-start', message: 'Recorder is available for loopback measurement', status: 'fail', - details: - startError instanceof Error ? startError.message : String(startError), + details: describeError(startError), }); return createEmptyAnalysis( diff --git a/packages/audiodocs/package.json b/packages/audiodocs/package.json index d80b5f2eeb..7008858451 100644 --- a/packages/audiodocs/package.json +++ b/packages/audiodocs/package.json @@ -3,9 +3,10 @@ "version": "0.0.0", "private": true, "scripts": { - "check": "bash ../../scripts/run-steps.sh typecheck", - "typecheck": "tsc --noEmit", + "check": "bash ../../scripts/run-steps.sh lint typecheck", "test": "exit 0", + "lint": "oxlint src", + "typecheck": "tsc --noEmit", "docusaurus": "docusaurus", "start": "docusaurus start", "build": "docusaurus build", diff --git a/packages/audiodocs/src/audio/AudioManager.ts b/packages/audiodocs/src/audio/AudioManager.ts index f59bc6180a..f50661357c 100644 --- a/packages/audiodocs/src/audio/AudioManager.ts +++ b/packages/audiodocs/src/audio/AudioManager.ts @@ -153,7 +153,7 @@ class AudioManager { this.activeSounds.delete(id); - if (this.activeSounds.size == 0) { + if (this.activeSounds.size === 0) { this.isPlaying = false; this.dispatchEvent({ type: 'stopped', payload: {} }); } diff --git a/packages/audiodocs/src/audio/Equalizer.ts b/packages/audiodocs/src/audio/Equalizer.ts index 9b81df36d3..8688f14de1 100644 --- a/packages/audiodocs/src/audio/Equalizer.ts +++ b/packages/audiodocs/src/audio/Equalizer.ts @@ -25,8 +25,8 @@ export default class Equalizer { } } - setFrequencies(frequencies: number[]) { - frequencies.forEach((freq, i) => { + setFrequencies(values: number[]) { + values.forEach((freq, i) => { if (i < this.bands.length) { this.bands[i].frequency.value = freq; } diff --git a/packages/audiodocs/src/audio/MockAudioContext.ts b/packages/audiodocs/src/audio/MockAudioContext.ts index 2f1e1d2a43..8cf5754e3d 100644 --- a/packages/audiodocs/src/audio/MockAudioContext.ts +++ b/packages/audiodocs/src/audio/MockAudioContext.ts @@ -23,7 +23,7 @@ const MockAudioContext = { onended: null, }), currentTime: 0, - decodeAudioData: (data: ArrayBuffer) => + decodeAudioData: (_data: ArrayBuffer) => Promise.resolve({ duration: 0, } as AudioBuffer), diff --git a/packages/audiodocs/src/audio/effects.ts b/packages/audiodocs/src/audio/effects.ts index 2eaf1439e5..cd51e4469a 100644 --- a/packages/audiodocs/src/audio/effects.ts +++ b/packages/audiodocs/src/audio/effects.ts @@ -52,11 +52,7 @@ export function createSimpleReverb( return convolver; } -export function createDelay( - delayTime: number = 0.3, - feedback: number = 0.3, - wet: number = 0.5 -): AudioNode { +export function createDelay(delayTime: number = 0.3): AudioNode { const audioContext = AudioManager.aCtx; const delay = audioContext.createDelay(1.0); @@ -147,8 +143,7 @@ export const presetEffects = { { name: 'gain', node: createGainEffect(0.2) }, ]), - echo: () => - createEffectsMap([{ name: 'delay', node: createDelay(0.25, 0.4, 0.3) }]), + echo: () => createEffectsMap([{ name: 'delay', node: createDelay(0.25) }]), test: () => createEffectsMap([{ name: 'gain', node: createGainEffect(0.3) }]), diff --git a/packages/audiodocs/src/audio/useEqualizerControls.ts b/packages/audiodocs/src/audio/useEqualizerControls.ts index 923d57cfb0..30fe693eab 100644 --- a/packages/audiodocs/src/audio/useEqualizerControls.ts +++ b/packages/audiodocs/src/audio/useEqualizerControls.ts @@ -50,10 +50,10 @@ export default function useEqualizerControls( }, []); const getControlPointPosition = useCallback( - (frequency: number, gain: number, canvasRect: DOMRect, index: number) => { + (frequency: number, gain: number, rect: DOMRect, index: number) => { const labelBoxSize = 32; - const drawingWidth = canvasRect.width - labelBoxSize; - const drawingHeight = canvasRect.height - labelBoxSize; + const drawingWidth = rect.width - labelBoxSize; + const drawingHeight = rect.height - labelBoxSize; const offsetX = 0; const offsetY = 0; diff --git a/packages/audiodocs/src/audio/useIsPlaying.ts b/packages/audiodocs/src/audio/useIsPlaying.ts index 080662407e..64a36ba496 100644 --- a/packages/audiodocs/src/audio/useIsPlaying.ts +++ b/packages/audiodocs/src/audio/useIsPlaying.ts @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import { useEffect, useState } from 'react'; import AudioManager from './AudioManager'; @@ -6,17 +6,15 @@ export default function useIsPlaying() { const [isPlaying, setIsPlaying] = useState(AudioManager.isPlaying); useEffect(() => { - AudioManager.addEventListener('playing', () => { - setIsPlaying(true); - }); + const onPlaying = () => setIsPlaying(true); + const onStopped = () => setIsPlaying(false); - AudioManager.addEventListener('stopped', () => { - setIsPlaying(false); - }); + AudioManager.addEventListener('playing', onPlaying); + AudioManager.addEventListener('stopped', onStopped); return () => { - AudioManager.removeEventListener('playing', () => setIsPlaying(true)); - AudioManager.removeEventListener('stopped', () => setIsPlaying(false)); + AudioManager.removeEventListener('playing', onPlaying); + AudioManager.removeEventListener('stopped', onStopped); }; }, []); diff --git a/packages/audiodocs/src/audio/utils.ts b/packages/audiodocs/src/audio/utils.ts index 718d3a4fac..9a40b40813 100644 --- a/packages/audiodocs/src/audio/utils.ts +++ b/packages/audiodocs/src/audio/utils.ts @@ -8,8 +8,8 @@ export function downSampleLog( const binCount = fft.length; const maxFreq = nyquist; - const buckets = new Array(targetBucketCount).fill(0); - const bucketCounts = new Array(targetBucketCount).fill(0); + const buckets = Array.from({ length: targetBucketCount }, () => 0); + const bucketCounts = Array.from({ length: targetBucketCount }, () => 0); for (let i = 0; i < binCount; i += 1) { const freq = (i / binCount) * nyquist; diff --git a/packages/audiodocs/src/canvasUtils/drawEqGrid.ts b/packages/audiodocs/src/canvasUtils/drawEqGrid.ts index c1e45e998c..f1bdfaa816 100644 --- a/packages/audiodocs/src/canvasUtils/drawEqGrid.ts +++ b/packages/audiodocs/src/canvasUtils/drawEqGrid.ts @@ -102,7 +102,6 @@ function drawColumnLabels( ctx.fillStyle = '#C1C6E5'; ctx.font = '400 16px Aeonik'; - const textWidth = ctx.measureText(column.label).width; const colX = x + index * columnWidth; const textX = colX; @@ -127,10 +126,6 @@ function drawRowLabels( ctx.fillStyle = '#C1C6E5'; ctx.font = '400 16px Aeonik'; - const textMetrics = ctx.measureText(row.label); - const textHeight = - textMetrics.actualBoundingBoxAscent + - textMetrics.actualBoundingBoxDescent; const rowY = y + index * rowHeight; ctx.fillText(row.label, width + 16, rowY); diff --git a/packages/audiodocs/src/components/AnimableIcon/index.tsx b/packages/audiodocs/src/components/AnimableIcon/index.tsx index 64c84676db..733c6e3953 100644 --- a/packages/audiodocs/src/components/AnimableIcon/index.tsx +++ b/packages/audiodocs/src/components/AnimableIcon/index.tsx @@ -21,7 +21,7 @@ interface Props { const AnimableIcon = ({ icon, iconDark, - animation = Animation.FADE_IN_OUT, + animation, onClick, }: Props): JSX.Element => { const { colorMode } = useColorMode(); diff --git a/packages/audiodocs/src/components/InteractiveExample/index.tsx b/packages/audiodocs/src/components/InteractiveExample/index.tsx index 5e1667c035..a8587b2855 100644 --- a/packages/audiodocs/src/components/InteractiveExample/index.tsx +++ b/packages/audiodocs/src/components/InteractiveExample/index.tsx @@ -2,9 +2,7 @@ import React from 'react'; import clsx from 'clsx'; import { useCopyToClipboard } from 'usehooks-ts'; -// @ts-ignore import BrowserOnly from '@docusaurus/BrowserOnly'; -// @ts-ignore import CodeBlock from '@theme/CodeBlock'; import Copy from '@site/static/img/copy.svg'; @@ -19,7 +17,6 @@ interface Props { src: string; component: React.FC<{ width?: number }>; label?: string; - showCode?: boolean; // whether to show code by default larger?: boolean; // should the view be enlarged? } @@ -32,10 +29,9 @@ export default function InteractiveExample({ src: tsxCode, component: Component, label, - showCode = false, larger = false, }: Props) { - const [_, copy] = useCopyToClipboard(); + const [, copy] = useCopyToClipboard(); const [key, setKey] = React.useState(0); const [tab, setTab] = React.useState(Tab.PREVIEW); const [width, setWidth] = React.useState(null); diff --git a/packages/audiodocs/src/components/InteractivePlayground/AudioBufferSourceExample/AudioBufferSourceExample.tsx b/packages/audiodocs/src/components/InteractivePlayground/AudioBufferSourceExample/AudioBufferSourceExample.tsx index 63b53720d4..c7b1b3fe7d 100644 --- a/packages/audiodocs/src/components/InteractivePlayground/AudioBufferSourceExample/AudioBufferSourceExample.tsx +++ b/packages/audiodocs/src/components/InteractivePlayground/AudioBufferSourceExample/AudioBufferSourceExample.tsx @@ -60,8 +60,8 @@ const AudioBufferSourceExample: FC = (props) => { stopSound(); } - const source = await ctx.createBufferSource({ - pitchCorrection: pitchCorrection, + const source = ctx.createBufferSource({ + pitchCorrection, }); source.buffer = audioBufferRef.current; diff --git a/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/sources.ts b/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/sources.ts index 22f7f23903..95203b2f2b 100644 --- a/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/sources.ts +++ b/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/sources.ts @@ -88,6 +88,6 @@ export function prefetchSample(id: SampleSourceId): void { return; } if (sample.url) { - void fetchSampleBytes(sample.url).catch(() => undefined); + fetchSampleBytes(sample.url).catch(() => undefined); } } diff --git a/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/useEffectChain.ts b/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/useEffectChain.ts index 4a1e76c851..4c2594efa6 100644 --- a/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/useEffectChain.ts +++ b/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/useEffectChain.ts @@ -67,13 +67,13 @@ export interface EffectChain { enabled: boolean; isPlaying: boolean; isLoading: boolean; - setEnabled(enabled: boolean): void; - togglePlayback(): void; + setEnabled: (enabled: boolean) => void; + togglePlayback: () => void; /** * Click handler for the effect node: starts playback while silent, otherwise * toggles bypass. */ - toggleEffect(): void; + toggleEffect: () => void; } /** @@ -135,7 +135,7 @@ export function useEffectChain({ playRequestRef.current += 1; stopSourceNode(sourceNodeRef); effect.dispose(); - void ctx.close(); + ctx.close(); nodesRef.current = null; decodedSamplesRef.current.clear(); }; @@ -218,14 +218,14 @@ export function useEffectChain({ if (isPlayingRef.current) { stop(); } else { - void play(); + play(); } }, [play, stop]); const toggleEffect = useCallback(() => { if (!isPlayingRef.current) { setEnabled(true); - void play(); + play(); return; } setEnabled(!enabledRef.current); @@ -234,7 +234,7 @@ export function useEffectChain({ // `play` changes identity only with the sample, so this restarts playback on a sample switch. useEffect(() => { if (isPlayingRef.current) { - void play(); + play(); } }, [play]); diff --git a/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/useEffectPlayground.tsx b/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/useEffectPlayground.tsx index e5cdeeb541..055e74fd4b 100644 --- a/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/useEffectPlayground.tsx +++ b/packages/audiodocs/src/components/InteractivePlayground/EffectPlayground/useEffectPlayground.tsx @@ -22,8 +22,8 @@ interface TransportState { enabled: boolean; isPlaying: boolean; isLoading: boolean; - togglePlayback(): void; - toggleEffect(): void; + togglePlayback: () => void; + toggleEffect: () => void; } interface EffectPlaygroundHeaderProps { diff --git a/packages/audiodocs/src/components/InteractivePlayground/GainAdsrExample/GainAdsrExample.tsx b/packages/audiodocs/src/components/InteractivePlayground/GainAdsrExample/GainAdsrExample.tsx index 1c3b7d0270..3ab5f97b06 100644 --- a/packages/audiodocs/src/components/InteractivePlayground/GainAdsrExample/GainAdsrExample.tsx +++ b/packages/audiodocs/src/components/InteractivePlayground/GainAdsrExample/GainAdsrExample.tsx @@ -39,7 +39,7 @@ const GainAdsrExample: FC = (props) => { }; }, []); - const playSound = async () => { + const playSound = () => { const ctx = audioContextRef.current; if (!ctx) return; @@ -56,8 +56,8 @@ const GainAdsrExample: FC = (props) => { } setPlaybackProgress(0); - const osc = await ctx.createOscillator(); - const gain = await ctx.createGain(); + const osc = ctx.createOscillator(); + const gain = ctx.createGain(); oscRef.current = osc; gainRef.current = gain; diff --git a/packages/audiodocs/src/components/InteractivePlayground/OscillatorExample/OscillatorExample.tsx b/packages/audiodocs/src/components/InteractivePlayground/OscillatorExample/OscillatorExample.tsx index 29d9b4c220..0c7bacd909 100644 --- a/packages/audiodocs/src/components/InteractivePlayground/OscillatorExample/OscillatorExample.tsx +++ b/packages/audiodocs/src/components/InteractivePlayground/OscillatorExample/OscillatorExample.tsx @@ -41,7 +41,7 @@ const OscillatorExample: FC = ({ setIsPlaying(false); }, []); - const playSound = useCallback(async () => { + const playSound = useCallback(() => { if (isPlaying) { stopSound(); return; @@ -50,7 +50,7 @@ const OscillatorExample: FC = ({ const ctx = audioContextRef.current; if (!ctx) return; - const osc = await ctx.createOscillator(); + const osc = ctx.createOscillator(); osc.type = type; diff --git a/packages/audiodocs/src/components/InteractivePlayground/PeriodicWaveExample/PeriodicWaveExample.tsx b/packages/audiodocs/src/components/InteractivePlayground/PeriodicWaveExample/PeriodicWaveExample.tsx index d93222b42c..4aabb94594 100644 --- a/packages/audiodocs/src/components/InteractivePlayground/PeriodicWaveExample/PeriodicWaveExample.tsx +++ b/packages/audiodocs/src/components/InteractivePlayground/PeriodicWaveExample/PeriodicWaveExample.tsx @@ -108,7 +108,7 @@ const PeriodicWaveExample: FC = ({ return () => { oscillatorRef.current = null; - void ctx.close(); + ctx.close(); }; }, []); @@ -201,7 +201,7 @@ const PeriodicWaveExample: FC = ({ />