Skip to content

Commit

Permalink
[Lint] fixing low hanging fruit linter warnings (Azure#13856)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLai authored Feb 18, 2021
1 parent 350612d commit 38a2bdd
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ export interface UpdatePhoneNumberCapabilitiesResponse {
}

// @public
export type VoidResponse = WithResponse<{}>;
export type VoidResponse = WithResponse<Record<string, unknown>>;

// @public
export type WithResponse<T> = T & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export type WithResponse<T> = T & { _response: HttpResponse };
/**
* Represents a generic HTTP response
*/
export type VoidResponse = WithResponse<{}>;
export type VoidResponse = WithResponse<Record<string, unknown>>;
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ export class PurchaseReservationPollOperation extends PhoneNumberReservationPoll
const result = await this.getReservation(reservationId, this.requestOptions);
state.isCompleted = isComplete(result, "Success");
}

return this;
} catch (error) {
state.error = error;
state.isCompleted = true;
} finally {

return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,12 @@ export class ReleasePhoneNumbersPollOperation extends PhoneNumberPollOperationBa
state.result = await this.getRelease(state.releaseId, this.requestOptions);
state.isCompleted = isComplete(state.result, "Complete");
}

return this;
} catch (error) {
state.error = error;
state.isCompleted = true;
} finally {

return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ export class ReservePhoneNumbersPollOperation extends PhoneNumberReservationPoll
state.result = await this.getReservation(state.reservationId, this.requestOptions);
state.isCompleted = isComplete(state.result, "Reserved");
}

return this;
} catch (error) {
state.error = error;
state.isCompleted = true;
} finally {

return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ export class PhoneNumberAdministrationClient {
* for await (const phonePlan of client.listPhonePlanGroups(PLAN_GROUP_INFO)) {
* console.log("plan id: ", phonePlan.phonePlanId);
* }
*
* ```
* Gets all available phone plans for a given plan group.
* @param planGroupInfo - Information need to search for plans.
* @param options - Additional request options.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("PhoneNumber - LROs - Purchase Reservation [Playback/Live]", function()

let phonePlanGroupId: string = "";
for await (const phonePlanGroup of client.listPhonePlanGroups(countryCode)) {
if (phonePlanGroup.phoneNumberType == "Geographic") {
if (phonePlanGroup.phoneNumberType === "Geographic") {
assert.isString(phonePlanGroup.phonePlanGroupId);
({ phonePlanGroupId } = phonePlanGroup);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe("PhoneNumber - LROs - Phone Number Reservations [Playback/Live]", funct

let phonePlanGroupId: string = "";
for await (const phonePlanGroup of client.listPhonePlanGroups(countryCode)) {
if (phonePlanGroup.phoneNumberType == "Geographic") {
if (phonePlanGroup.phoneNumberType === "Geographic") {
assert.isString(phonePlanGroup.phonePlanGroupId);
({ phonePlanGroupId } = phonePlanGroup);
assert.isString(phonePlanGroupId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import {
UpdateNumberCapabilitiesResponse
} from "../../src";

export const createMockHttpClient = <T = {}>(status: number = 200, parsedBody?: T): HttpClient => {
export const createMockHttpClient = <T = Record<string, unknown>>(
status: number = 200,
parsedBody?: T
): HttpClient => {
return {
async sendRequest(httpRequest: WebResourceLike): Promise<HttpOperationResponse> {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ export const environmentSetup: RecorderEnvironmentSetup = {
customizationsOnRecordings: [
(recording: string): string =>
recording.replace(/"token"\s?:\s?"[^"]*"/g, `"token":"sanitized"`),
(recording: string): string => recording.replace(/(https:\/\/)([^\/',]*)/, "$1endpoint"),
(recording: string): string => recording.replace(/(https:\/\/)([^/',]*)/, "$1endpoint"),
(recording: string): string => recording.replace(/"id"\s?:\s?"[^"]*"/g, `"id":"sanitized"`),
(recording: string): string => {
return recording.replace(
/(https:\/\/[^\/',]*\/identities\/)[^\/',]*(\/token)/,
/(https:\/\/[^/',]*\/identities\/)[^/',]*(\/token)/,
"$1sanitized$2"
);
},
(recording: string): string =>
recording.replace(/\/identities\/[^\/'",]*/, "/identities/sanitized"),
recording.replace(/\/identities\/[^/'",]*/, "/identities/sanitized"),
(recording: string): string => recording.replace(/\+\d{1}\d{3}\d{3}\d{4}/g, "+18005551234"),
(recording: string): string =>
recording.replace(/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}/gi, "sanitized")
Expand All @@ -65,7 +65,7 @@ export function createRecordedPhoneNumberAdministrationClient(
return {
client: new PhoneNumberAdministrationClient(env.COMMUNICATION_CONNECTION_STRING),
recorder,
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS == "true"
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS === "true"
};
}

Expand All @@ -90,7 +90,7 @@ export function createRecordedPhoneNumberAdministrationClientWithToken(
return {
client: new PhoneNumberAdministrationClient(endpoint, credential),
recorder,
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS == "true"
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS === "true"
};
}

Expand All @@ -103,7 +103,7 @@ export function createRecordedPhoneNumberAdministrationClientWithToken(
return {
client: new PhoneNumberAdministrationClient(endpoint, credential),
recorder,
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS == "true"
includePhoneNumberLiveTests: env.INCLUDE_PHONENUMBER_LIVE_TESTS === "true"
};
}

Expand Down

0 comments on commit 38a2bdd

Please sign in to comment.