Skip to content

Commit 9fdf5a4

Browse files
authored
Calling component binding ESlint (#5912)
* update * Change files
1 parent fcfe671 commit 9fdf5a4

12 files changed

Lines changed: 40 additions & 26 deletions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "improvement",
4+
"workstream": "Eslint",
5+
"comment": "Fix eslint errors for calling component binding",
6+
"packageName": "@azure/communication-react",
7+
"email": "96077406+carocao-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "improvement",
4+
"workstream": "Eslint",
5+
"comment": "Fix eslint errors for calling component binding",
6+
"packageName": "@azure/communication-react",
7+
"email": "96077406+carocao-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}

packages/calling-component-bindings/eslint.config.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,4 @@ import {
55
testFilesBaseConfig
66
} from '../../common/config/ESLint/eslint.config';
77

8-
export default globalConfig([
9-
baseConfig,
10-
testFilesBaseConfig,
11-
{
12-
rules: {
13-
'@typescript-eslint/no-explicit-any': 'off',
14-
'@typescript-eslint/no-unused-vars': [
15-
'warn',
16-
{
17-
argsIgnorePattern: '^_'
18-
}
19-
],
20-
'jsdoc/require-jsdoc': 'off'
21-
}
22-
},
23-
baseGlobalIgnores
24-
]);
8+
export default globalConfig([baseConfig, testFilesBaseConfig, baseGlobalIgnores]);

packages/calling-component-bindings/src/callUtils.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const validLocalVideoStreamMock: LocalVideoStreamState = {
2828
view: {
2929
scalingMode: 'Stretch',
3030
isMirrored: false,
31+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
3132
target: null as any
3233
}
3334
};

packages/calling-component-bindings/src/handlers/createCommonHandlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ export const createDefaultCommonCallingHandlers = memoizeOne(
629629
};
630630

631631
const onSendDtmfTone = async (dtmfTone: DtmfTone): Promise<void> => await call?.sendDtmf(dtmfTone);
632-
632+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
633633
const notImplemented = (): any => {
634634
throw new Error('Not implemented, cannot call a method from an abstract object');
635635
};

packages/calling-component-bindings/src/handlers/createDefaultCallingHandlersForComponent.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const createDefaultCallingHandlersForComponent = <Props>(
3636
callAgent: CallAgentCommon | undefined,
3737
deviceManager: StatefulDeviceManager | undefined,
3838
call: CallCommon | undefined,
39+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
3940
_Component: (props: Props) => ReactElement | null
4041
): Common<CommonCallingHandlers, Props> => {
4142
if (!callAgent && !call && !deviceManager) {

packages/calling-component-bindings/src/handlers/createHandlers.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ import { CallingHandlers } from './createHandlers';
1212
function TestCallClientComponent(props: CallingHandlers): ReactElement | null {
1313
return null;
1414
}
15-
1615
class MockCallClient {
16+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
1717
getState(): any {
1818
throw new Error('Method not implemented.');
1919
}
20-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
20+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
2121
onStateChange(handler: (state: any) => void): void {
2222
throw new Error('Method not implemented.');
2323
}
2424
createView(
2525
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2626
callId: string,
27-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
27+
//eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
2828
participantId: any,
29-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
29+
//eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
3030
stream: any,
31-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
31+
//eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
3232
options?: any
3333
): Promise<CreateViewResult | undefined> {
3434
throw new Error('Method not implemented.');
3535
}
36-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
36+
//eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
3737
disposeView(callId: string, participantId: any, stream: any): void {
3838
throw new Error('Method not implemented.');
3939
}

packages/calling-component-bindings/src/handlers/createTeamsCallHandlers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export const createTeamsCallingHandlersForComponent = <Props>(
171171
callAgent: undefined | TeamsCallAgent,
172172
deviceManager: StatefulDeviceManager | undefined,
173173
call: undefined | TeamsCall,
174+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
174175
_Component: (props: Props) => ReactElement | null
175176
): Common<TeamsCallingHandlers, Props> => {
176177
return createDefaultTeamsCallingHandlers(callClient, callAgent, deviceManager, call);
@@ -184,6 +185,7 @@ const teamsSingleParticipantTrampoline = (
184185
if (participants.length !== 1) {
185186
throw new Error('Only one participant is supported in Teams call!');
186187
} else {
188+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
187189
return callAgent.startCall(participants[0] as any, options);
188190
}
189191
};

packages/calling-component-bindings/src/hooks/useHandlers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { CallAgentContext, CallClientContext, CallContext, useDeviceManager } fr
2222
*/
2323
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
2424
export const useHandlers = <PropsT>(component: (props: PropsT) => ReactElement | null) => {
25-
const callClient: StatefulCallClient = (useContext(CallClientContext) as any)?.callClient;
25+
const callClient: StatefulCallClient = useContext(CallClientContext)?.callClient as StatefulCallClient;
2626
const deviceManager = useDeviceManager();
2727
const call = useContext(CallContext)?.call;
2828
const callAgent = useContext(CallAgentContext)?.callAgent;

packages/calling-component-bindings/src/hooks/usePropsFor.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ import {
7575
*
7676
* @public
7777
*/
78+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
7879
export const usePropsFor = <Component extends (props: any) => JSX.Element>(
7980
component: Component
81+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
8082
): GetSelector<Component> extends (props: any) => any
8183
? ReturnType<GetSelector<Component>> &
8284
Common<CommonCallingHandlers & _ComponentCallingHandlers, Parameters<Component>[0]>
@@ -85,8 +87,10 @@ export const usePropsFor = <Component extends (props: any) => JSX.Element>(
8587
const props = useSelector(selector);
8688
const handlers = useHandlers<Parameters<Component>[0]>(component);
8789
if (props !== undefined) {
90+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
8891
return { ...props, ...handlers } as any;
8992
}
93+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
9094
return undefined as any;
9195
};
9296

@@ -106,6 +110,7 @@ const emptySelector: EmptySelector = (): Record<string, never> => ({});
106110
*
107111
* @public
108112
*/
113+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
109114
export type GetSelector<Component extends (props: any) => JSX.Element | undefined> =
110115
AreEqual<Component, typeof VideoGallery> extends true
111116
? VideoGallerySelector
@@ -153,12 +158,13 @@ export type GetSelector<Component extends (props: any) => JSX.Element | undefine
153158
*
154159
* @public
155160
*/
161+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
156162
export const getSelector = <Component extends (props: any) => JSX.Element | undefined>(
157163
component: Component
158164
): GetSelector<Component> => {
159165
return findSelector(component);
160166
};
161-
167+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
162168
const findSelector = (component: (props: any) => JSX.Element | undefined): any => {
163169
// Dialpad only has handlers currently and doesn't require any props from the stateful layer so return the emptySelector
164170
if (component === Dialpad) {

0 commit comments

Comments
 (0)