Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"categories": {
"correctness": "off"
"correctness": "error"
},
"options": {
"typeAware": true
Expand Down Expand Up @@ -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"
}
},
{
Expand Down Expand Up @@ -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
}
}
]
Expand Down
12 changes: 9 additions & 3 deletions apps/common-app/.oxlintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "../../node_modules/oxlint/configuration_schema.json",
"categories": {
"correctness": "off"
"correctness": "error"
},
"options": {
"typeAware": true
Expand Down Expand Up @@ -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"
}
}
3 changes: 3 additions & 0 deletions apps/common-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 0 additions & 1 deletion apps/common-app/src/components/VerticalSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/components/icons/PlayPauseIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type Props = {
};

const PlayPauseIcon: React.FC<Props> = ({
isPlaying = true,
isPlaying,
size = 48,
color = '#FFFFFF',
}) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/demos/PedalBoard/AutoWahPedal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function AutoWahPedal({
return () => {
try {
lfoOscillatorRef.current?.stop();
} catch (e) {}
} catch {}
};
}, [context]);

Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/demos/Record/Record.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
};

Expand Down
8 changes: 4 additions & 4 deletions apps/common-app/src/examples/AudioTag/AudioTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(() => {
Expand All @@ -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(() => {
Expand Down
4 changes: 4 additions & 0 deletions apps/common-app/src/examples/AudioVisualizer/Charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ const TimeChart: React.FC<ChartProps> = (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]);
Expand Down Expand Up @@ -134,6 +136,8 @@ const FrequencyChart: React.FC<ChartProps> = (props) => {
);

const freqPath = useDerivedValue(() => {
// Reading the tick subscribes this derived value to new frequency data.
// oxlint-disable-next-line no-unused-expressions
Comment on lines 99 to +140

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you try to refactor that code?

frequencyDataTickSV.value;
return buildFrequencyPath(frequencyDataSV.value, frequencyBinCount, layout);
}, [frequencyBinCount, frequencyDataSV, frequencyDataTickSV, layout]);
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion apps/common-app/src/examples/Record/Record.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import type {
ScenarioStatus,
StepResult,
} from './types';
import { describeError } from '../AudioIOPlayground/log';

const AudioPipelineStress: FC = () => {
const resourcesRef = useRef(new StressResourceOwner(staticAsset));
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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.');
}
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions apps/common-app/src/other/LatencyValidation/latencyTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
5 changes: 3 additions & 2 deletions packages/audiodocs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/audiodocs/src/audio/AudioManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {} });
}
Expand Down
4 changes: 2 additions & 2 deletions packages/audiodocs/src/audio/Equalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/audiodocs/src/audio/MockAudioContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const MockAudioContext = {
onended: null,
}),
currentTime: 0,
decodeAudioData: (data: ArrayBuffer) =>
decodeAudioData: (_data: ArrayBuffer) =>
Promise.resolve({
duration: 0,
} as AudioBuffer),
Expand Down
9 changes: 2 additions & 7 deletions packages/audiodocs/src/audio/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) }]),

Expand Down
6 changes: 3 additions & 3 deletions packages/audiodocs/src/audio/useEqualizerControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
16 changes: 7 additions & 9 deletions packages/audiodocs/src/audio/useIsPlaying.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import React, { useEffect, useState } from 'react';
import { useEffect, useState } from 'react';

import AudioManager from './AudioManager';

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);
};
}, []);

Expand Down
4 changes: 2 additions & 2 deletions packages/audiodocs/src/audio/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export function downSampleLog(
const binCount = fft.length;
const maxFreq = nyquist;

const buckets = new Array<number>(targetBucketCount).fill(0);
const bucketCounts = new Array<number>(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;
Expand Down
5 changes: 0 additions & 5 deletions packages/audiodocs/src/canvasUtils/drawEqGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/audiodocs/src/components/AnimableIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface Props {
const AnimableIcon = ({
icon,
iconDark,
animation = Animation.FADE_IN_OUT,
animation,
onClick,
}: Props): JSX.Element => {
const { colorMode } = useColorMode();
Expand Down
Loading
Loading