Skip to content

Commit 9d8d5ac

Browse files
ESLint manual fixes
1 parent 79f1295 commit 9d8d5ac

File tree

20 files changed

+26
-17
lines changed

20 files changed

+26
-17
lines changed

src/components/Channel/Channel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ const ChannelInner = <
10101010
});
10111011

10121012
thread?.upsertReplyLocally({
1013-
// @ts-expect-error
1013+
// @ts-expect-error message type mismatch
10141014
message: {
10151015
...message,
10161016
error: parsedError,
@@ -1049,7 +1049,7 @@ const ChannelInner = <
10491049
};
10501050

10511051
thread?.upsertReplyLocally({
1052-
// @ts-expect-error
1052+
// @ts-expect-error message type mismatch
10531053
message: messagePreview,
10541054
});
10551055

@@ -1226,7 +1226,7 @@ const ChannelInner = <
12261226
],
12271227
);
12281228

1229-
// @ts-expect-error
1229+
// @ts-expect-error message type mismatch
12301230
const componentContextValue: Partial<ComponentContextValue> = useMemo(
12311231
() => ({
12321232
Attachment: props.Attachment,

src/components/Channel/__tests__/Channel.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ describe('Channel', () => {
206206
it('should render empty channel container if channel does not have cid', async () => {
207207
const { channel } = await initClient();
208208
const childrenContent = 'Channel children';
209+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
209210
const { cid, ...channelWithoutCID } = channel;
210211
const { asFragment } = render(
211212
<ChatProvider
@@ -1482,6 +1483,7 @@ describe('Channel', () => {
14821483
});
14831484
describe('delete message', () => {
14841485
it('should throw error instead of calling default client.deleteMessage() function', async () => {
1486+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
14851487
const { id, ...message } = generateMessage();
14861488
const { channel, chatClient } = await initClient();
14871489
const clientDeleteMessageSpy = jest.spyOn(chatClient, 'deleteMessage');
@@ -1509,6 +1511,7 @@ describe('Channel', () => {
15091511
});
15101512

15111513
it('should throw error instead of calling custom doDeleteMessageRequest function', async () => {
1514+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
15121515
const { id, ...message } = generateMessage();
15131516
const { channel, chatClient } = await initClient();
15141517
const clientDeleteMessageSpy = jest

src/components/ChatView/ChatView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import type { PropsWithChildren } from 'react';
1010
import type { Thread, ThreadManagerState } from 'stream-chat';
1111
import clsx from 'clsx';
1212

13-
const availableChatViews = ['channels', 'threads'] as const;
13+
type ChatView = 'channels' | 'threads';
1414

1515
type ChatViewContextValue = {
16-
activeChatView: typeof availableChatViews[number];
16+
activeChatView: ChatView;
1717
setActiveChatView: (cv: ChatViewContextValue['activeChatView']) => void;
1818
};
1919

src/components/MML/MML.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useChatContext } from '../../context/ChatContext';
55
import type { ActionHandlerReturnType } from '../Message/hooks/useActionHandler';
66

77
const MMLReact = React.lazy(async () => {
8+
// eslint-disable-next-line import/no-extraneous-dependencies
89
const mml = await import('mml-react');
910
return { default: mml.MML };
1011
});

src/components/MediaRecorder/AudioRecorder/__tests__/AudioRecorder.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ describe('MessageInput', () => {
307307
});
308308

309309
expect(doFileUploadRequest).toHaveBeenCalledTimes(1);
310+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
310311
const { localMetadata, ...uploadedRecordingAtt } = recording;
311312
expect(sendMessage.mock.calls[0][0]).toStrictEqual({
312313
attachments: [uploadedRecordingAtt],

src/components/Message/hooks/useReactionHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const useReactionHandler = <
9494

9595
try {
9696
updateMessage(tempMessage);
97-
// @ts-expect-error
97+
// @ts-expect-error message type mismatch
9898
thread?.upsertReplyLocally({ message: tempMessage });
9999

100100
const messageResponse = add
@@ -106,7 +106,7 @@ export const useReactionHandler = <
106106
} catch (error) {
107107
// revert to the original message if the API call fails
108108
updateMessage(message);
109-
// @ts-expect-error
109+
// @ts-expect-error message type mismatch
110110
thread?.upsertReplyLocally({ message });
111111
}
112112
}, 1000);

src/components/Message/renderText/renderText.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ export const markDownRenderers: RenderTextOptions['customMarkDownRenderers'] = {
7373
export type RenderTextOptions<
7474
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics
7575
> = {
76-
// eslint-disable-next-line @typescript-eslint/ban-types
77-
allowedTagNames?: Array<keyof JSX.IntrinsicElements | 'emoji' | 'mention' | (string & {})>;
76+
allowedTagNames?: Array<
77+
keyof JSX.IntrinsicElements | 'emoji' | 'mention' | (string & {})
78+
>;
7879
customMarkDownRenderers?: Options['components'] &
7980
Partial<{
8081
emoji: ComponentType;

src/components/Message/utils.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ export const validateAndGetMessage = <T extends unknown[]>(
2525

2626
// below is due to tests passing a single argument
2727
// rather than an array.
28-
if (!(args instanceof Array)) {
29-
// @ts-expect-error
30-
args = [args];
28+
if (!Array.isArray(args)) {
29+
args = [args] as unknown as T;
3130
}
3231

3332
const returnValue = func(...args);

0 commit comments

Comments
 (0)