Skip to content

Commit

Permalink
fix: [#4684] ESLint issues in botbuilder-azure-blobs (#4802)
Browse files Browse the repository at this point in the history
* Fix ESLint issues in botbuilder-azure-blobs

* Remove eslint-plugin-only-warn dependency
  • Loading branch information
ceciliaavila authored Dec 3, 2024
1 parent 7feb456 commit 925a2c6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 29 deletions.
10 changes: 0 additions & 10 deletions libraries/botbuilder-azure-blobs/eslint.config.cjs

This file was deleted.

3 changes: 1 addition & 2 deletions libraries/botbuilder-azure-blobs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"@azure/storage-blob": "^12.24.0",
"botbuilder-core": "4.1.6",
"botbuilder-stdlib": "4.1.6",
"eslint-plugin-only-warn": "^1.1.0",
"p-map": "^4.0.0",
"zod": "^3.23.8",
"@azure/core-http": "^3.0.4"
Expand All @@ -40,7 +39,7 @@
"build-docs": "typedoc --theme markdown --entryPoint botbuilder-azure-blobs --excludePrivate --includeDeclarations --ignoreCompilerErrors --module amd --out ..\\..\\doc\\botbuilder-azure-blobs .\\lib\\index.d.ts --hideGenerator --name \"Bot Builder SDK - Azure Blobs\" --readme none",
"clean": "rimraf _ts3.4 lib tsconfig.tsbuildinfo",
"depcheck": "depcheck --config ../../.depcheckrc",
"lint": "eslint .",
"lint": "eslint . --config ../../eslint.config.cjs",
"postbuild": "downlevel-dts lib _ts3.4/lib --checksum",
"test": "yarn build && nyc mocha --check-leaks tests",
"test:compat": "api-extractor run --verbose"
Expand Down
10 changes: 5 additions & 5 deletions libraries/botbuilder-azure-blobs/src/blobsStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class BlobsStorage implements Storage {
containerName: string,
options?: BlobsStorageOptions,
url = '',
credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential
credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential,
) {
if (url != '' && credential != null) {
z.object({ url: z.string() }).parse({
Expand All @@ -80,7 +80,7 @@ export class BlobsStorage implements Storage {
this._containerClient = new ContainerClient(
connectionString,
containerName,
options?.storagePipelineOptions
options?.storagePipelineOptions,
);

// At most one promise at a time to be friendly to local emulator users
Expand Down Expand Up @@ -121,7 +121,7 @@ export class BlobsStorage implements Storage {

const blob = await ignoreError(
this._containerClient.getBlobClient(sanitizeBlobKey(key)).download(),
isStatusCodeError(404)
isStatusCodeError(404),
);

if (!blob) {
Expand All @@ -140,7 +140,7 @@ export class BlobsStorage implements Storage {
},
{
concurrency: this._concurrency,
}
},
)
).reduce((acc, { key, value }) => (value ? { ...acc, [key]: value } : acc), {});
}
Expand Down Expand Up @@ -196,7 +196,7 @@ export class BlobsStorage implements Storage {
(key) => ignoreError(this._containerClient.deleteBlob(sanitizeBlobKey(key)), isStatusCodeError(404)),
{
concurrency: this._concurrency,
}
},
);
}
}
14 changes: 7 additions & 7 deletions libraries/botbuilder-azure-blobs/src/blobsTranscriptStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function getBlobKey(activity: Activity, options?: BlobsTranscriptStoreOptions):

return sanitizeBlobKey(
[activity.channelId, activity.conversation.id, `${formatTicks(timestamp)}-${activity.id}.json`].join('/'),
options
options,
);
}

Expand Down Expand Up @@ -102,7 +102,7 @@ export class BlobsTranscriptStore implements TranscriptStore {
containerName: string,
options?: BlobsTranscriptStoreOptions,
blobServiceUri = '',
tokenCredential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential
tokenCredential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential,
) {
if (blobServiceUri != '' && tokenCredential != null) {
z.object({ blobServiceUri: z.string() }).parse({
Expand All @@ -116,7 +116,7 @@ export class BlobsTranscriptStore implements TranscriptStore {
this._containerClient = new ContainerClient(
blobServiceUri,
tokenCredential,
options?.storagePipelineOptions
options?.storagePipelineOptions,
);

// At most one promise at a time to be friendly to local emulator users
Expand All @@ -132,7 +132,7 @@ export class BlobsTranscriptStore implements TranscriptStore {
this._containerClient = new ContainerClient(
connectionString,
containerName,
options?.storagePipelineOptions
options?.storagePipelineOptions,
);

// At most one promise at a time to be friendly to local emulator users
Expand Down Expand Up @@ -170,7 +170,7 @@ export class BlobsTranscriptStore implements TranscriptStore {
channelId: string,
conversationId: string,
continuationToken?: string,
startDate?: Date
startDate?: Date,
): Promise<PagedResult<Activity>> {
z.object({ channelId: z.string(), conversationId: z.string() }).parse({ channelId, conversationId });

Expand All @@ -195,7 +195,7 @@ export class BlobsTranscriptStore implements TranscriptStore {
const fromIdx =
startDate != null
? blobItems.findIndex(
(blobItem) => blobItem?.properties?.createdOn && blobItem?.properties?.createdOn >= startDate
(blobItem) => blobItem?.properties?.createdOn && blobItem?.properties?.createdOn >= startDate,
)
: 0;

Expand All @@ -213,7 +213,7 @@ export class BlobsTranscriptStore implements TranscriptStore {
const activity = (await StreamConsumers.json(readableStreamBody)) as any;
return { ...activity, timestamp: new Date(activity.timestamp) } as Activity;
},
{ concurrency: this._concurrency }
{ concurrency: this._concurrency },
);

activities.forEach((activity) => {
Expand Down
5 changes: 3 additions & 2 deletions libraries/botbuilder-azure-blobs/tests/blobsStorage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('BlobsStorage', function () {
assert.throws(() => new BlobsStorage(null, null, null, [], {}), 'throws for missing url');
assert.throws(
() => new BlobsStorage(null, null, null, 'url', {}),
ReferenceError('Invalid credential type.')
ReferenceError('Invalid credential type.'),
);
});

Expand All @@ -40,7 +40,7 @@ describe('BlobsStorage', function () {
null,
null,
'https://test.blob.core.windows.net/blob',
new StorageSharedKeyCredential('accountName', 'accountKey')
new StorageSharedKeyCredential('accountName', 'accountKey'),
);
});
});
Expand Down Expand Up @@ -102,6 +102,7 @@ describe('BlobsStorage', function () {
}

let sandbox;

beforeEach(function () {
sandbox = sinon.createSandbox({});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('BlobsTranscriptStore', function () {
assert.throws(() => new BlobsTranscriptStore(null, null, null, [], {}), 'throws for missing url');
assert.throws(
() => new BlobsTranscriptStore(null, null, null, 'url', {}),
ReferenceError('Invalid credential type.')
ReferenceError('Invalid credential type.'),
);
});

Expand Down Expand Up @@ -110,7 +110,7 @@ describe('BlobsTranscriptStore', function () {
channelId,
conversationId,
undefined,
rest[0].timestamp
rest[0].timestamp,
);
assert.deepStrictEqual(result.items, rest);
});
Expand Down Expand Up @@ -154,7 +154,7 @@ describe('BlobsTranscriptStore', function () {
channelId,
id,
created,
}))
})),
);
});
});
Expand Down

0 comments on commit 925a2c6

Please sign in to comment.