Skip to content

Commit f812c35

Browse files
ESLint manual fixes
1 parent ddc1032 commit f812c35

File tree

20 files changed

+23
-16
lines changed

20 files changed

+23
-16
lines changed

src/components/Channel/Channel.tsx

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

10641064
thread?.upsertReplyLocally({
1065-
// @ts-expect-error
1065+
// @ts-expect-error message type mismatch
10661066
message: {
10671067
...message,
10681068
error: parsedError,
@@ -1101,7 +1101,7 @@ const ChannelInner = <
11011101
};
11021102

11031103
thread?.upsertReplyLocally({
1104-
// @ts-expect-error
1104+
// @ts-expect-error message type mismatch
11051105
message: messagePreview,
11061106
});
11071107

@@ -1288,7 +1288,7 @@ const ChannelInner = <
12881288
],
12891289
);
12901290

1291-
// @ts-expect-error
1291+
// @ts-expect-error message type mismatch
12921292
const componentContextValue: Partial<ComponentContextValue> = useMemo(
12931293
() => ({
12941294
Attachment: props.Attachment,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ describe('Channel', () => {
211211
it('should render empty channel container if channel does not have cid', async () => {
212212
const { channel } = await initClient();
213213
const childrenContent = 'Channel children';
214+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
214215
const { cid, ...channelWithoutCID } = channel;
215216
const { asFragment } = render(
216217
<ChatProvider
@@ -1545,6 +1546,7 @@ describe('Channel', () => {
15451546
});
15461547
describe('delete message', () => {
15471548
it('should throw error instead of calling default client.deleteMessage() function', async () => {
1549+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
15481550
const { id, ...message } = generateMessage();
15491551
const { channel, chatClient } = await initClient();
15501552
const clientDeleteMessageSpy = jest.spyOn(chatClient, 'deleteMessage');
@@ -1574,6 +1576,7 @@ describe('Channel', () => {
15741576
});
15751577

15761578
it('should throw error instead of calling custom doDeleteMessageRequest function', async () => {
1579+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
15771580
const { id, ...message } = generateMessage();
15781581
const { channel, chatClient } = await initClient();
15791582
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
@@ -320,6 +320,7 @@ describe('MessageInput', () => {
320320
});
321321

322322
expect(doFileUploadRequest).toHaveBeenCalledTimes(1);
323+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
323324
const { localMetadata, ...uploadedRecordingAtt } = recording;
324325
expect(sendMessage.mock.calls[0][0]).toStrictEqual({
325326
attachments: [uploadedRecordingAtt],

src/components/Message/hooks/useReactionHandler.ts

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

103103
try {
104104
updateMessage(tempMessage);
105-
// @ts-expect-error
105+
// @ts-expect-error message type mismatch
106106
thread?.upsertReplyLocally({ message: tempMessage });
107107

108108
const messageResponse = add
@@ -114,7 +114,7 @@ export const useReactionHandler = <
114114
} catch (error) {
115115
// revert to the original message if the API call fails
116116
updateMessage(message);
117-
// @ts-expect-error
117+
// @ts-expect-error message type mismatch
118118
thread?.upsertReplyLocally({ message });
119119
}
120120
}, 1000);

src/components/Message/renderText/renderText.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export const markDownRenderers: RenderTextOptions['customMarkDownRenderers'] = {
7979
export type RenderTextOptions<
8080
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
8181
> = {
82-
// eslint-disable-next-line @typescript-eslint/ban-types
8382
allowedTagNames?: Array<
8483
keyof JSX.IntrinsicElements | 'emoji' | 'mention' | (string & {})
8584
>;

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)