Skip to content

Commit

Permalink
[Storage] Run lint:fix (#13710)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a authored Feb 10, 2021
1 parent 57c3030 commit bc9154f
Show file tree
Hide file tree
Showing 306 changed files with 918 additions and 552 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { Readable, ReadableOptions } from "stream";
import { BlobClient, CommonOptions } from "@azure/storage-blob";
Expand Down Expand Up @@ -144,7 +144,7 @@ export class LazyLoadingBlobStream extends Readable {
}
let count = 0;
let chunkSize = 0;
let chunksToPush = [];
const chunksToPush = [];
do {
if (this.lastDownloadData === undefined || this.lastDownloadData?.byteLength === 0) {
await this.downloadBlock({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { BlobClient } from "@azure/storage-blob";
import { LazyLoadingBlobStreamOptions, LazyLoadingBlobStream } from "./LazyLoadingBlobStream";
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/storage-blob-changefeed/src/log.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Licensed under the MIT license.

import { createClientLogger } from "@azure/logger";

Expand Down
3 changes: 3 additions & 0 deletions sdk/storage/storage-blob-changefeed/src/models/models.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { CommonOptions } from "@azure/storage-blob";
import { AbortSignalLike } from "@azure/core-http";

Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/storage-blob-changefeed/src/utils/tracing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Licensed under the MIT license.

import { getTracer, OperationTracingOptions, SpanOptions } from "@azure/core-tracing";
import { Span, SpanOptions as OTSpanOptions, SpanKind } from "@opentelemetry/api";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as assert from "assert";
import { record, isPlaybackMode, Recorder } from "@azure/test-utils-recorder";
import { recorderEnvSetup, getBlobChangeFeedClient } from "./utils";
Expand Down
3 changes: 3 additions & 0 deletions sdk/storage/storage-blob-changefeed/test/changefeed.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as assert from "assert";
import * as fs from "fs";
import * as path from "path";
Expand Down
3 changes: 3 additions & 0 deletions sdk/storage/storage-blob-changefeed/test/chunk.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as assert from "assert";
import { Chunk } from "../src/Chunk";
import * as sinon from "sinon";
Expand Down
3 changes: 3 additions & 0 deletions sdk/storage/storage-blob-changefeed/test/segment.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as assert from "assert";
import * as fs from "fs";
import * as path from "path";
Expand Down
3 changes: 3 additions & 0 deletions sdk/storage/storage-blob-changefeed/test/shard.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as assert from "assert";
import * as sinon from "sinon";
import { ShardFactory } from "../src/ShardFactory";
Expand Down
3 changes: 3 additions & 0 deletions sdk/storage/storage-blob-changefeed/test/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as dotenv from "dotenv";
import { SimpleTokenCredential } from "./testutils.common";
import { StorageSharedKeyCredential, BlobServiceClient } from "@azure/storage-blob";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { TokenCredential, GetTokenOptions, AccessToken } from "@azure/core-http";
import { isPlaybackMode, env, RecorderEnvironmentSetup } from "@azure/test-utils-recorder";

Expand Down Expand Up @@ -125,7 +128,7 @@ export function isSuperSet(m1?: BlobMetadata, m2?: BlobMetadata): boolean {
throw new RangeError("m1 or m2 is invalid");
}

for (let p in m2) {
for (const p in m2) {
if (m1[p] !== m2[p]) {
return false;
}
Expand Down
3 changes: 3 additions & 0 deletions sdk/storage/storage-blob/src/BatchResponse.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { BatchSubRequest } from "./BlobBatch";
import { HttpHeaders } from "@azure/core-http";

Expand Down
19 changes: 11 additions & 8 deletions sdk/storage/storage-blob/src/BatchResponseParser.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { HttpHeaders } from "@azure/core-http";

import { ServiceSubmitBatchResponseModel } from "./generatedModels";
Expand Down Expand Up @@ -57,13 +60,13 @@ export class BatchResponseParser {
);
}

let responseBodyAsText = await getBodyAsText(this.batchResponse);
const responseBodyAsText = await getBodyAsText(this.batchResponse);

let subResponses = responseBodyAsText
const subResponses = responseBodyAsText
.split(this.batchResponseEnding)[0] // string after ending is useless
.split(this.perResponsePrefix)
.slice(1); // string before first response boundary is useless
let subResponseCount = subResponses.length;
const subResponseCount = subResponses.length;

// Defensive coding in case of potential error parsing.
// Note: subResponseCount == 1 is special case where sub request is invalid.
Expand All @@ -73,17 +76,17 @@ export class BatchResponseParser {
throw new Error("Invalid state: sub responses' count is not equal to sub requests' count.");
}

let deserializedSubResponses: Array<BatchSubResponse> = new Array(subResponseCount);
const deserializedSubResponses: Array<BatchSubResponse> = new Array(subResponseCount);
let subResponsesSucceededCount: number = 0;
let subResponsesFailedCount: number = 0;

// Parse sub subResponses.
for (let index = 0; index < subResponseCount; index++) {
const subResponse = subResponses[index];
let deserializedSubResponse = {} as BatchSubResponse;
const deserializedSubResponse = {} as BatchSubResponse;
deserializedSubResponse.headers = new HttpHeaders();

let responseLines = subResponse.split(`${HTTP_LINE_ENDING}`);
const responseLines = subResponse.split(`${HTTP_LINE_ENDING}`);
let subRespHeaderStartFound = false;
let subRespHeaderEndFound = false;
let subRespFailed = false;
Expand All @@ -101,7 +104,7 @@ export class BatchResponseParser {
if (responseLine.startsWith(HTTP_VERSION_1_1)) {
subRespHeaderStartFound = true;

let tokens = responseLine.split(SPACE_DELIMITER);
const tokens = responseLine.split(SPACE_DELIMITER);
deserializedSubResponse.status = parseInt(tokens[1]);
deserializedSubResponse.statusMessage = tokens.slice(2).join(SPACE_DELIMITER);
}
Expand All @@ -128,7 +131,7 @@ export class BatchResponseParser {
}

// Parse headers of sub response.
let tokens = responseLine.split(HTTP_HEADER_DELIMITER);
const tokens = responseLine.split(HTTP_HEADER_DELIMITER);
deserializedSubResponse.headers.set(tokens[0], tokens[1]);
if (tokens[0] === HeaderConstants.X_MS_ERROR_CODE) {
deserializedSubResponse.errorCode = tokens[1];
Expand Down
3 changes: 3 additions & 0 deletions sdk/storage/storage-blob/src/BatchUtils.browser.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { ServiceSubmitBatchResponseModel } from "./generatedModels";
import { blobToString } from "./utils/utils.browser";

Expand Down
5 changes: 4 additions & 1 deletion sdk/storage/storage-blob/src/BatchUtils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { ServiceSubmitBatchResponseModel } from "./generatedModels";
import { streamToBuffer2 } from "./utils/utils.node";
import { BATCH_MAX_PAYLOAD_IN_BYTES } from "./utils/constants";
Expand All @@ -7,7 +10,7 @@ export async function getBodyAsText(
): Promise<string> {
let buffer = Buffer.alloc(BATCH_MAX_PAYLOAD_IN_BYTES);

let responseLength = await streamToBuffer2(
const responseLength = await streamToBuffer2(
batchResponse.readableStreamBody as NodeJS.ReadableStream,
buffer
);
Expand Down
7 changes: 5 additions & 2 deletions sdk/storage/storage-blob/src/BlobBatch.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import {
BaseRequestPolicy,
deserializationPolicy,
Expand Down Expand Up @@ -368,7 +371,7 @@ class InnerBatchRequest {
this.operationCount = 0;
this.body = "";

let tempGuid = generateUuid();
const tempGuid = generateUuid();

// batch_{batchid}
this.boundary = `batch_${tempGuid}`;
Expand Down Expand Up @@ -396,7 +399,7 @@ class InnerBatchRequest {
): Pipeline {
const isAnonymousCreds = credential instanceof AnonymousCredential;
const policyFactoryLength = 3 + (isAnonymousCreds ? 0 : 1); // [deserializationPolicy, BatchHeaderFilterPolicyFactory, (Optional)Credential, BatchRequestAssemblePolicyFactory]
let factories: RequestPolicyFactory[] = new Array(policyFactoryLength);
const factories: RequestPolicyFactory[] = new Array(policyFactoryLength);

factories[0] = deserializationPolicy(); // Default deserializationPolicy is provided by protocol layer
factories[1] = new BatchHeaderFilterPolicyFactory(); // Use batch header filter policy to exclude unnecessary headers
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/BlobBatchClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import {
AccessTier,
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/BlobDownloadResponse.browser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

// This file is used as a shim of "BlobDownloadResponse" for some browser bundlers
// when trying to bundle "BlobDownloadResponse"
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/BlobDownloadResponse.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { HttpResponse, isNode } from "@azure/core-http";

import {
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/BlobLeaseClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { generateUuid, HttpResponse } from "@azure/core-http";
import { StorageClientContext } from "./generated/src/storageClient";
import { ContainerBreakLeaseOptionalParams } from "./generatedModels";
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/BlobQueryResponse.browser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { HttpResponse } from "@azure/core-http";

Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/BlobQueryResponse.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { HttpResponse, isNode } from "@azure/core-http";

Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/BlobServiceClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import {
TokenCredential,
isTokenCredential,
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/Clients.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { AbortSignalLike } from "@azure/abort-controller";
import {
generateUuid,
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/ContainerClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { AbortSignalLike } from "@azure/abort-controller";
import {
getDefaultProxySettings,
Expand Down
3 changes: 3 additions & 0 deletions sdk/storage/storage-blob/src/PageBlobRangeResponse.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { HttpResponse } from "@azure/core-http";
import {
PageBlobGetPageRangesHeaders,
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/Pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import {
BaseRequestPolicy,
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/Range.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

// tslint:disable:max-line-length
/**
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/StorageBrowserPolicyFactory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "@azure/core-http";
import { StorageBrowserPolicy } from "./policies/StorageBrowserPolicy";
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/StorageClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { StorageClientContext } from "./generated/src/storageClientContext";
import { Pipeline } from "./Pipeline";
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/StorageRetryPolicyFactory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "@azure/core-http";
import { StorageRetryPolicy, StorageRetryPolicyType } from "./policies/StorageRetryPolicy";
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/TelemetryPolicyFactory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import {
isNode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { RequestPolicy, RequestPolicyOptions } from "@azure/core-http";

Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/storage-blob/src/credentials/Credential.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "@azure/core-http";
import { CredentialPolicy } from "../policies/CredentialPolicy";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

export class StorageSharedKeyCredential {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { createHmac } from "crypto";
import { RequestPolicy, RequestPolicyOptions } from "@azure/core-http";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

export class UserDelegationKeyCredential {}
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { createHmac } from "crypto";
import { UserDelegationKey } from "../BlobServiceClient";

Expand Down
Loading

0 comments on commit bc9154f

Please sign in to comment.