Skip to content

Commit 38a2bdd

Browse files
authored
[Lint] fixing low hanging fruit linter warnings (Azure#13856)
1 parent 350612d commit 38a2bdd

File tree

10 files changed

+24
-15
lines changed

10 files changed

+24
-15
lines changed

sdk/communication/communication-administration/review/communication-administration.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ export interface UpdatePhoneNumberCapabilitiesResponse {
495495
}
496496

497497
// @public
498-
export type VoidResponse = WithResponse<{}>;
498+
export type VoidResponse = WithResponse<Record<string, unknown>>;
499499

500500
// @public
501501
export type WithResponse<T> = T & {

sdk/communication/communication-administration/src/common/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ export type WithResponse<T> = T & { _response: HttpResponse };
1212
/**
1313
* Represents a generic HTTP response
1414
*/
15-
export type VoidResponse = WithResponse<{}>;
15+
export type VoidResponse = WithResponse<Record<string, unknown>>;

sdk/communication/communication-administration/src/phoneNumber/lro/purchase/operation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,12 @@ export class PurchaseReservationPollOperation extends PhoneNumberReservationPoll
9090
const result = await this.getReservation(reservationId, this.requestOptions);
9191
state.isCompleted = isComplete(result, "Success");
9292
}
93+
94+
return this;
9395
} catch (error) {
9496
state.error = error;
9597
state.isCompleted = true;
96-
} finally {
98+
9799
return this;
98100
}
99101
}

sdk/communication/communication-administration/src/phoneNumber/lro/release/operation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@ export class ReleasePhoneNumbersPollOperation extends PhoneNumberPollOperationBa
129129
state.result = await this.getRelease(state.releaseId, this.requestOptions);
130130
state.isCompleted = isComplete(state.result, "Complete");
131131
}
132+
133+
return this;
132134
} catch (error) {
133135
state.error = error;
134136
state.isCompleted = true;
135-
} finally {
137+
136138
return this;
137139
}
138140
}

sdk/communication/communication-administration/src/phoneNumber/lro/reserve/operation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,12 @@ export class ReservePhoneNumbersPollOperation extends PhoneNumberReservationPoll
107107
state.result = await this.getReservation(state.reservationId, this.requestOptions);
108108
state.isCompleted = isComplete(state.result, "Reserved");
109109
}
110+
111+
return this;
110112
} catch (error) {
111113
state.error = error;
112114
state.isCompleted = true;
113-
} finally {
115+
114116
return this;
115117
}
116118
}

sdk/communication/communication-administration/src/phoneNumber/phoneNumberAdministrationClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ export class PhoneNumberAdministrationClient {
931931
* for await (const phonePlan of client.listPhonePlanGroups(PLAN_GROUP_INFO)) {
932932
* console.log("plan id: ", phonePlan.phonePlanId);
933933
* }
934-
*
934+
* ```
935935
* Gets all available phone plans for a given plan group.
936936
* @param planGroupInfo - Information need to search for plans.
937937
* @param options - Additional request options.

sdk/communication/communication-administration/test/lro.purchase.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe("PhoneNumber - LROs - Purchase Reservation [Playback/Live]", function()
4444

4545
let phonePlanGroupId: string = "";
4646
for await (const phonePlanGroup of client.listPhonePlanGroups(countryCode)) {
47-
if (phonePlanGroup.phoneNumberType == "Geographic") {
47+
if (phonePlanGroup.phoneNumberType === "Geographic") {
4848
assert.isString(phonePlanGroup.phonePlanGroupId);
4949
({ phonePlanGroupId } = phonePlanGroup);
5050
break;

sdk/communication/communication-administration/test/lro.reserve.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe("PhoneNumber - LROs - Phone Number Reservations [Playback/Live]", funct
4646

4747
let phonePlanGroupId: string = "";
4848
for await (const phonePlanGroup of client.listPhonePlanGroups(countryCode)) {
49-
if (phonePlanGroup.phoneNumberType == "Geographic") {
49+
if (phonePlanGroup.phoneNumberType === "Geographic") {
5050
assert.isString(phonePlanGroup.phonePlanGroupId);
5151
({ phonePlanGroupId } = phonePlanGroup);
5252
assert.isString(phonePlanGroupId);

sdk/communication/communication-administration/test/utils/mockHttpClients.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ import {
1717
UpdateNumberCapabilitiesResponse
1818
} from "../../src";
1919

20-
export const createMockHttpClient = <T = {}>(status: number = 200, parsedBody?: T): HttpClient => {
20+
export const createMockHttpClient = <T = Record<string, unknown>>(
21+
status: number = 200,
22+
parsedBody?: T
23+
): HttpClient => {
2124
return {
2225
async sendRequest(httpRequest: WebResourceLike): Promise<HttpOperationResponse> {
2326
return {

sdk/communication/communication-administration/test/utils/recordedClient.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ export const environmentSetup: RecorderEnvironmentSetup = {
3838
customizationsOnRecordings: [
3939
(recording: string): string =>
4040
recording.replace(/"token"\s?:\s?"[^"]*"/g, `"token":"sanitized"`),
41-
(recording: string): string => recording.replace(/(https:\/\/)([^\/',]*)/, "$1endpoint"),
41+
(recording: string): string => recording.replace(/(https:\/\/)([^/',]*)/, "$1endpoint"),
4242
(recording: string): string => recording.replace(/"id"\s?:\s?"[^"]*"/g, `"id":"sanitized"`),
4343
(recording: string): string => {
4444
return recording.replace(
45-
/(https:\/\/[^\/',]*\/identities\/)[^\/',]*(\/token)/,
45+
/(https:\/\/[^/',]*\/identities\/)[^/',]*(\/token)/,
4646
"$1sanitized$2"
4747
);
4848
},
4949
(recording: string): string =>
50-
recording.replace(/\/identities\/[^\/'",]*/, "/identities/sanitized"),
50+
recording.replace(/\/identities\/[^/'",]*/, "/identities/sanitized"),
5151
(recording: string): string => recording.replace(/\+\d{1}\d{3}\d{3}\d{4}/g, "+18005551234"),
5252
(recording: string): string =>
5353
recording.replace(/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}/gi, "sanitized")
@@ -65,7 +65,7 @@ export function createRecordedPhoneNumberAdministrationClient(
6565
return {
6666
client: new PhoneNumberAdministrationClient(env.COMMUNICATION_CONNECTION_STRING),
6767
recorder,
68-
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS == "true"
68+
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS === "true"
6969
};
7070
}
7171

@@ -90,7 +90,7 @@ export function createRecordedPhoneNumberAdministrationClientWithToken(
9090
return {
9191
client: new PhoneNumberAdministrationClient(endpoint, credential),
9292
recorder,
93-
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS == "true"
93+
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS === "true"
9494
};
9595
}
9696

@@ -103,7 +103,7 @@ export function createRecordedPhoneNumberAdministrationClientWithToken(
103103
return {
104104
client: new PhoneNumberAdministrationClient(endpoint, credential),
105105
recorder,
106-
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS == "true"
106+
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS === "true"
107107
};
108108
}
109109

0 commit comments

Comments
 (0)