Skip to content

Commit b361034

Browse files
authored
[Event Hubs] Fix remaining lint errors (Azure#13882)
1 parent 391dd59 commit b361034

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

sdk/eventhub/event-hubs/src/eventhubConnectionConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export interface EventHubConnectionConfig extends ConnectionConfig {
6969
* different entities.
7070
* @internal
7171
*/
72+
// eslint-disable-next-line @typescript-eslint/no-redeclare -- renaming constant would be a breaking change.
7273
export const EventHubConnectionConfig = {
7374
/**
7475
* Creates the connection config.

sdk/eventhub/event-hubs/test/perf/track-2/receive.spec.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT license.
3+
14
/*
25
# Overview
36
Measures the maximum throughput of `receiver.receive()` in package `@azure/event-hubs`.
@@ -48,18 +51,22 @@ async function main(): Promise<void> {
4851
await sendBatch(numberOfEvents, partitionIds, eventBodySize);
4952
const writeResultsPromise = WriteResults(numberOfEvents);
5053

51-
await RunTest(connectionString, eventHubName, maxBatchSize, numberOfEvents);
54+
await RunTest(maxBatchSize, numberOfEvents);
5255
await writeResultsPromise;
5356
}
5457

55-
async function sendBatch(numberOfEvents: number, partitionIds: string[], eventBodySize: number) {
58+
async function sendBatch(
59+
numberOfEvents: number,
60+
partitionIds: string[],
61+
eventBodySize: number
62+
): Promise<void> {
5663
const _payload = Buffer.alloc(eventBodySize);
5764
const producer = new EventHubProducerClient(connectionString, eventHubName);
5865
const numberOfPartitions = partitionIds.length;
5966
const numberOfEventsPerPartition = Math.ceil(numberOfEvents / numberOfPartitions);
6067

61-
for (let partitionId of partitionIds) {
62-
let batch = await producer.createBatch({ partitionId });
68+
for (const partitionId of partitionIds) {
69+
const batch = await producer.createBatch({ partitionId });
6370
let numberOfEventsSent = 0;
6471
// add events to our batch
6572
while (numberOfEventsSent <= numberOfEventsPerPartition) {
@@ -75,23 +82,16 @@ async function sendBatch(numberOfEvents: number, partitionIds: string[], eventBo
7582
await producer.close();
7683
}
7784

78-
async function RunTest(
79-
connectionString: string,
80-
eventHubName: string,
81-
maxBatchSize: number,
82-
messages: number
83-
): Promise<void> {
85+
async function RunTest(maxBatchSize: number, messages: number): Promise<void> {
8486
const consumerClient = new EventHubConsumerClient(consumerGroup, connectionString, eventHubName);
8587

86-
const processEvents = async (events: EventData[]) => {
88+
const processEvents = async (events: EventData[]): Promise<void> => {
8789
_messages = _messages + events.length;
88-
for (const _ of events) {
89-
}
9090
if (_messages === messages) {
9191
await consumerClient.close();
9292
}
9393
};
94-
const processError = async (err: Error, context: PartitionContext) => {
94+
const processError = async (err: Error, context: PartitionContext): Promise<void> => {
9595
console.log(`Error on partition "${context.partitionId}": ${err}`);
9696
};
9797

sdk/eventhub/event-hubs/test/perf/track-2/send.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class SendTest extends PerfStressTest<SendTestOptions> {
5050
this.eventBatch = new Array(this.parsedOptions.numberOfEvents.value!).fill(event);
5151
}
5252

53-
public async globalCleanup() {
53+
public async globalCleanup(): Promise<void> {
5454
await this.producer.close();
5555
}
5656

sdk/eventhub/event-hubs/test/public/eventHubConsumerClient.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ describe("EventHubConsumerClient", () => {
810810
let subscription: Subscription | undefined;
811811
await new Promise<void>((resolve, reject) => {
812812
subscription = consumerClient.subscribe(
813-
// @ts-expect-error
813+
// @ts-expect-error number for partitionId should work even if type is string
814814
0,
815815
{
816816
processEvents: async () => {
@@ -1248,7 +1248,9 @@ describe("EventHubConsumerClient", () => {
12481248
let subscription: Subscription | undefined;
12491249
const caughtErr = await new Promise<Error | MessagingError>((resolve) => {
12501250
subscription = badConsumerClient.subscribe({
1251-
processEvents: async () => {},
1251+
processEvents: async () => {
1252+
/** Nothing to do here */
1253+
},
12521254
processError: async (err) => {
12531255
resolve(err);
12541256
}
@@ -1267,7 +1269,9 @@ describe("EventHubConsumerClient", () => {
12671269
let subscription: Subscription | undefined;
12681270
const caughtErr = await new Promise<Error | MessagingError>((resolve) => {
12691271
subscription = consumerClient.subscribe("boo", {
1270-
processEvents: async () => {},
1272+
processEvents: async () => {
1273+
/** Nothing to do here */
1274+
},
12711275
processError: async (err) => {
12721276
resolve(err);
12731277
}

0 commit comments

Comments
 (0)