Skip to content

Commit 0d1b262

Browse files
fixing linter errors
1 parent 173f48c commit 0d1b262

File tree

56 files changed

+144
-253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+144
-253
lines changed

.verdaccio/config.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

backend/eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import globals from 'globals';
2+
import baseConfig from '../eslint.config.mjs';
23

34
export default [
45
{
6+
...baseConfig,
7+
58
files: ['**/*.{ts,tsx,js,jsx}'],
69
languageOptions: {
710
globals: globals.node,

frontend/eslint.config.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import nx from '@nx/eslint-plugin';
22
import baseConfig from '../eslint.config.mjs';
33

44
export default [
5-
// inherit everything from root
6-
...baseConfig,
7-
85
// add Nx React presets for this app
96
...nx.configs['flat/react'],
107

8+
// inherit everything from root
9+
...baseConfig,
10+
1111
{
1212
files: ['**/*.{ts,tsx,js,jsx}'],
1313
settings: {

frontend/src/Context/AppConfig/AppConfigContext.spec.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('AppConfigContext', () => {
4646
};
4747

4848
vi.spyOn(global, 'fetch').mockResolvedValue({
49-
json: async () => mockConfig,
49+
json: () => mockConfig,
5050
headers: {
5151
get: () => 'application/json',
5252
},
@@ -80,6 +80,8 @@ describe('AppConfigContext', () => {
8080
expect(appConfig.isAppConfigLoaded).toBe(false);
8181
expect(loadAppConfig()).rejects.toThrow('mocking a failure to fetch');
8282

83+
// test will fail without the await act
84+
// eslint-disable-next-line @typescript-eslint/await-thenable
8385
await act(() => {
8486
rerender();
8587
});
@@ -113,6 +115,8 @@ describe('AppConfigContext', () => {
113115

114116
expect(loadAppConfig()).rejects.toThrow('No valid JSON found, using default config');
115117

118+
// test will fail without the await act
119+
// eslint-disable-next-line @typescript-eslint/await-thenable
116120
await act(() => {
117121
rerender();
118122
});

frontend/src/Context/BackgroundPublisherProvider/useBackgroundPublisher/useBackgroundPublisher.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ describe('useBackgroundPublisher', () => {
212212
});
213213
});
214214

215-
it('handles permission denial', async () => {
215+
it('handles permission denial', () => {
216216
mockedInitPublisher.mockReturnValue(mockPublisher);
217217

218218
const { result } = renderHook(() => useBackgroundPublisher());
@@ -227,7 +227,7 @@ describe('useBackgroundPublisher', () => {
227227
expect(mockSetAccessStatus).toBeCalledWith(DEVICE_ACCESS_STATUS.REJECTED);
228228
});
229229

230-
it('does not throw on older, unsupported browsers', async () => {
230+
it('does not throw on older, unsupported browsers', () => {
231231
mockQuery.mockImplementation(() => {
232232
throw new Error('Whoops');
233233
});

frontend/src/Context/BackgroundPublisherProvider/useBackgroundPublisher/useBackgroundPublisher.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export type BackgroundPublisherContextType = {
2323
publisherVideoElement: HTMLVideoElement | HTMLObjectElement | undefined;
2424
destroyBackgroundPublisher: () => void;
2525
toggleVideo: () => void;
26-
changeBackground: (backgroundSelected: string) => void;
26+
changeBackground: (backgroundSelected: string) => Promise<void>;
2727
backgroundFilter: VideoFilter | undefined;
2828
localVideoSource: string | undefined;
2929
accessStatus: string | null;
@@ -87,7 +87,7 @@ const useBackgroundPublisher = (): BackgroundPublisherContextType => {
8787
*/
8888
const changeBackground = useCallback(
8989
(backgroundSelected: string) => {
90-
applyBackgroundFilter({
90+
return applyBackgroundFilter({
9191
publisher: backgroundPublisherRef.current,
9292
backgroundSelected,
9393
setUser: undefined,
@@ -222,11 +222,13 @@ const useBackgroundPublisher = (): BackgroundPublisherContextType => {
222222
setIsVideoEnabled(!isVideoEnabled);
223223
};
224224

225+
// eslint-disable-next-line react-hooks/refs
225226
return {
226227
initBackgroundLocalPublisher,
227228
isPublishing,
228229
isVideoEnabled,
229230
destroyBackgroundPublisher,
231+
// eslint-disable-next-line react-hooks/refs
230232
publisher: backgroundPublisherRef.current,
231233
publisherVideoElement,
232234
toggleVideo,

frontend/src/Context/PreviewPublisherProvider/usePreviewPublisher/usePreviewPublisher.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ describe('usePreviewPublisher', () => {
203203
});
204204
});
205205

206-
it('handles permission denial', async () => {
206+
it('handles permission denial', () => {
207207
mockedInitPublisher.mockReturnValue(mockPublisher);
208208

209209
const { result } = renderHook(() => usePreviewPublisher());
@@ -218,7 +218,7 @@ describe('usePreviewPublisher', () => {
218218
expect(mockSetAccessStatus).toBeCalledWith(DEVICE_ACCESS_STATUS.REJECTED);
219219
});
220220

221-
it('does not throw on older, unsupported browsers', async () => {
221+
it('does not throw on older, unsupported browsers', () => {
222222
mockQuery.mockImplementation(() => {
223223
throw new Error('Whoops');
224224
});

frontend/src/Context/PreviewPublisherProvider/usePreviewPublisher/usePreviewPublisher.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export type PreviewPublisherContextType = {
3232
destroyPublisher: () => void;
3333
toggleAudio: () => void;
3434
toggleVideo: () => void;
35-
changeBackground: (backgroundSelected: string) => void;
35+
changeBackground: (backgroundSelected: string) => Promise<void>;
3636
backgroundFilter: VideoFilter | undefined;
3737
localAudioSource: string | undefined;
3838
localVideoSource: string | undefined;
@@ -104,7 +104,7 @@ const usePreviewPublisher = (): PreviewPublisherContextType => {
104104
*/
105105
const changeBackground = useCallback(
106106
(backgroundSelected: string) => {
107-
applyBackgroundFilter({
107+
return applyBackgroundFilter({
108108
publisher: publisherRef.current,
109109
backgroundSelected,
110110
setUser,
@@ -317,12 +317,14 @@ const usePreviewPublisher = (): PreviewPublisherContextType => {
317317
}
318318
};
319319

320+
// eslint-disable-next-line react-hooks/refs
320321
return {
321322
isAudioEnabled,
322323
initLocalPublisher,
323324
isPublishing,
324325
isVideoEnabled,
325326
destroyPublisher,
327+
// eslint-disable-next-line react-hooks/refs
326328
publisher: publisherRef.current,
327329
publisherVideoElement,
328330
toggleAudio,

frontend/src/Context/PublisherProvider/usePublisher/usePublisher.spec.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,37 +120,37 @@ describe('usePublisher', () => {
120120

121121
describe('changeBackground', () => {
122122
let result: ReturnType<typeof renderHook>['result'];
123-
beforeEach(async () => {
123+
beforeEach(() => {
124124
vi.mocked(initPublisher).mockImplementation(() => mockPublisher);
125125
result = renderHook(() => usePublisher()).result;
126-
await act(async () => {
127-
await (result.current as ReturnType<typeof usePublisher>).initializeLocalPublisher({});
126+
act(() => {
127+
(result.current as ReturnType<typeof usePublisher>).initializeLocalPublisher({});
128128
});
129129
});
130130

131-
it('applies low blur filter', async () => {
132-
await act(async () => {
133-
await (result.current as ReturnType<typeof usePublisher>).changeBackground('low-blur');
131+
it('applies low blur filter', () => {
132+
act(() => {
133+
(result.current as ReturnType<typeof usePublisher>).changeBackground('low-blur');
134134
});
135135
expect(mockPublisher.applyVideoFilter).toHaveBeenCalledWith({
136136
type: 'backgroundBlur',
137137
blurStrength: 'low',
138138
});
139139
});
140140

141-
it('applies background replacement with image', async () => {
142-
await act(async () => {
143-
await (result.current as ReturnType<typeof usePublisher>).changeBackground('bg1.jpg');
141+
it('applies background replacement with image', () => {
142+
act(() => {
143+
(result.current as ReturnType<typeof usePublisher>).changeBackground('bg1.jpg');
144144
});
145145
expect(mockPublisher.applyVideoFilter).toHaveBeenCalledWith({
146146
type: 'backgroundReplacement',
147147
backgroundImgUrl: expect.stringContaining('bg1.jpg'),
148148
});
149149
});
150150

151-
it('clears video filter for unknown option', async () => {
152-
await act(async () => {
153-
await (result.current as ReturnType<typeof usePublisher>).changeBackground('none');
151+
it('clears video filter for unknown option', () => {
152+
act(() => {
153+
(result.current as ReturnType<typeof usePublisher>).changeBackground('none');
154154
});
155155
expect(mockPublisher.clearVideoFilter).toHaveBeenCalled();
156156
});

frontend/src/Context/PublisherProvider/usePublisherQuality/usePublisherQuality.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const usePublisherQuality = (publisher: Publisher | null): NetworkQuality => {
1818

1919
const handleVideoDisabled = useCallback(() => {
2020
setQuality('bad');
21+
// eslint-disable-next-line react-hooks/immutability
2122
user.issues.audioFallbacks += 1;
2223
}, [user]);
2324

0 commit comments

Comments
 (0)