Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [#4684] ESLint issues in botbuilder-azure-blobs #4802

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 6 additions & 6 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 @@ -169,7 +169,7 @@ export class BlobsStorage implements Storage {
},
{
concurrency: this._concurrency,
}
},
);
}

Expand All @@ -189,7 +189,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 @@ -87,6 +87,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
Loading