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

[service-bus] Hit low-hanging fruit with linting errors #13521

Merged
merged 17 commits into from
Feb 3, 2021
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: 5 additions & 5 deletions sdk/servicebus/service-bus/src/connectionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,26 @@ import { ReceiverType } from "./core/linkEntity";
*/
export interface ConnectionContext extends ConnectionContextBase {
/**
* @property {SharedKeyCredential | TokenCredential} [tokenCredential] The credential to be used for Authentication.
* The credential to be used for Authentication.
* Default value: SharedKeyCredentials.
*/
tokenCredential: SharedKeyCredential | TokenCredential;
/**
* @property A map of active Service Bus Senders with sender name as key.
* A map of active Service Bus Senders with sender name as key.
*/
senders: { [name: string]: MessageSender };
/**
* @property A map of active Service Bus receivers for non session enabled queues/subscriptions
* A map of active Service Bus receivers for non session enabled queues/subscriptions
* with receiver name as key.
*/
messageReceivers: { [name: string]: MessageReceiver };
/**
* @property A map of active Service Bus receivers for session enabled queues/subscriptions
* A map of active Service Bus receivers for session enabled queues/subscriptions
* with receiver name as key.
*/
messageSessions: { [name: string]: MessageSession };
/**
* @property A map of ManagementClient instances for operations over the $management link
* A map of ManagementClient instances for operations over the $management link
* with key as the entity path.
*/
managementClients: { [name: string]: ManagementClient };
Expand Down
11 changes: 1 addition & 10 deletions sdk/servicebus/service-bus/src/constructorHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface ServiceBusClientOptions {
*/
retryOptions?: RetryOptions;
/**
* @property
* Options to configure the channelling of the AMQP connection over Web Sockets.
*/
webSocketOptions?: WebSocketOptions;
Expand All @@ -43,9 +42,6 @@ export interface ServiceBusClientOptions {
/**
* @internal
*
* @param {string} connectionString
* @param {(SharedKeyCredential | TokenCredential)} credential
* @param {ServiceBusClientOptions} options
*/
export function createConnectionContext(
connectionString: string,
Expand All @@ -62,8 +58,6 @@ export function createConnectionContext(
}

/**
* @param connectionString
* @param options
* @internal
*/
export function createConnectionContextForConnectionString(
Expand All @@ -76,9 +70,6 @@ export function createConnectionContextForConnectionString(

/**
*
* @param credential
* @param host
* @param options
* @internal
*/
export function createConnectionContextForTokenCredential(
Expand All @@ -100,7 +91,7 @@ export function createConnectionContextForTokenCredential(

/**
* Parses a connection string and extracts the EntityPath named entity out.
* @param connectionString An entity specific Service Bus connection string.
* @param connectionString - An entity specific Service Bus connection string.
* @internal
*/
export function getEntityNameFromConnectionString(connectionString: string): string {
Expand Down
12 changes: 6 additions & 6 deletions sdk/servicebus/service-bus/src/core/autoLockRenewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type MinimalLink = Pick<LinkEntity<any>, "name" | "logPrefix" | "entityPath">;
*/
export class LockRenewer {
/**
* @property _messageRenewLockTimers A map of link names to individual maps for each
* A map of link names to individual maps for each
* link that map a message ID to its auto-renewal timer.
*/
private _messageRenewLockTimers: Map<string, Map<string, NodeJS.Timer | undefined>> = new Map<
Expand All @@ -50,9 +50,9 @@ export class LockRenewer {
/**
* Creates an AutoLockRenewer.
*
* @param linkEntity Your link entity instance (probably 'this')
* @param context The connection context for your link entity (probably 'this._context')
* @param options The ReceiveOptions passed through to your message receiver.
* @param linkEntity - Your link entity instance (probably 'this')
* @param context - The connection context for your link entity (probably 'this._context')
* @param options - The ReceiveOptions passed through to your message receiver.
* @returns if the lock mode is peek lock (or if is unspecified, thus defaulting to peekLock)
* and the options.maxAutoLockRenewalDurationInMs is > 0..Otherwise, returns undefined.
*/
Expand Down Expand Up @@ -96,7 +96,7 @@ export class LockRenewer {
/**
* Stops lock renewal for a single message.
*
* @param bMessage The message whose lock renewal we will stop.
* @param bMessage - The message whose lock renewal we will stop.
*/
stop(linkEntity: MinimalLink, bMessage: RenewableMessageProperties) {
const messageId = bMessage.messageId as string;
Expand All @@ -113,7 +113,7 @@ export class LockRenewer {
/**
* Starts lock renewal for a single message.
*
* @param bMessage The message whose lock renewal we will start.
* @param bMessage - The message whose lock renewal we will start.
*/
start(linkEntity: MinimalLink, bMessage: RenewableMessageProperties, onError: OnErrorNoContext) {
try {
Expand Down
21 changes: 9 additions & 12 deletions sdk/servicebus/service-bus/src/core/batchingReceiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ import { ServiceBusError, translateServiceBusError } from "../serviceBusError";
* Describes the batching receiver where the user can receive a specified number of messages for
* a predefined time.
* @internal
* @class BatchingReceiver
* @extends MessageReceiver
*/
export class BatchingReceiver extends MessageReceiver {
/**
* Instantiate a new BatchingReceiver.
*
* @constructor
* @param {ClientEntityContext} context The client entity context.
* @param {ReceiveOptions} [options] Options for how you'd like to connect.
* @param context - The client entity context.
* @param options - Options for how you'd like to connect.
*/
constructor(context: ConnectionContext, entityPath: string, options: ReceiveOptions) {
super(context, entityPath, "batching", options);
Expand Down Expand Up @@ -80,7 +77,7 @@ export class BatchingReceiver extends MessageReceiver {

/**
* To be called when connection is disconnected to gracefully close ongoing receive request.
* @param {AmqpError | Error} [connectionError] The connection error if any.
* @param connectionError - The connection error if any.
* @returns {Promise<void>} Promise<void>.
*/
async onDetached(connectionError?: AmqpError | Error): Promise<void> {
Expand All @@ -97,10 +94,10 @@ export class BatchingReceiver extends MessageReceiver {

/**
* Receives a batch of messages from a ServiceBus Queue/Topic.
* @param maxMessageCount The maximum number of messages to receive.
* @param maxMessageCount - The maximum number of messages to receive.
* In Peeklock mode, this number is capped at 2047 due to constraints of the underlying buffer.
* @param maxWaitTimeInMs The total wait time in milliseconds until which the receiver will attempt to receive specified number of messages.
* @param maxTimeAfterFirstMessageInMs The total amount of time to wait after the first message
* @param maxWaitTimeInMs - The total wait time in milliseconds until which the receiver will attempt to receive specified number of messages.
* @param maxTimeAfterFirstMessageInMs - The total amount of time to wait after the first message
* has been received. Defaults to 1 second.
* If this time elapses before the `maxMessageCount` is reached, then messages collected till then will be returned to the user.
* @returns {Promise<ServiceBusMessageImpl[]>} A promise that resolves with an array of Message objects.
Expand Down Expand Up @@ -160,8 +157,8 @@ export class BatchingReceiver extends MessageReceiver {
* taking into account elapsed time from when getRemainingWaitTimeInMsFn
* was called.
*
* @param maxWaitTimeInMs Maximum time to wait for the first message
* @param maxTimeAfterFirstMessageInMs Maximum time to wait after the first message before completing the receive.
* @param maxWaitTimeInMs - Maximum time to wait for the first message
* @param maxTimeAfterFirstMessageInMs - Maximum time to wait after the first message before completing the receive.
*
* @internal
*/
Expand Down Expand Up @@ -299,7 +296,7 @@ export class BatchingReceiverLite {
/**
* Closes the receiver (optionally with an error), cancelling any current operations.
*
* @param connectionError An optional error (rhea doesn't always deliver one for certain disconnection events)
* @param connectionError - An optional error (rhea doesn't always deliver one for certain disconnection events)
*/
terminate(connectionError?: Error | AmqpError) {
if (this._closeHandler) {
Expand Down
34 changes: 16 additions & 18 deletions sdk/servicebus/service-bus/src/core/linkEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import { ServiceBusError } from "../serviceBusError";
*/
export interface LinkEntityOptions {
/**
* @property {string} address The client entity address in one of the following forms:
* The client entity address in one of the following forms:
*/
address?: string;
/**
* @property {string} audience The client entity token audience in one of the following forms:
* The client entity token audience in one of the following forms:
*/
audience?: string;
}
Expand Down Expand Up @@ -85,12 +85,12 @@ type LinkTypeT<
*/
export abstract class LinkEntity<LinkT extends Receiver | AwaitableSender | RequestResponseLink> {
/**
* @property {string} id The unique name for the entity in the format:
* The unique name for the entity in the format:
* `${name of the entity}-${guid}`.
*/
name: string;
/**
* @property {string} address The client entity address in one of the following forms:
* The client entity address in one of the following forms:
*
* **Sender**
* - `"<queue-name>"`.
Expand All @@ -105,7 +105,7 @@ export abstract class LinkEntity<LinkT extends Receiver | AwaitableSender | Requ
*/
address: string;
/**
* @property {string} audience The client entity token audience in one of the following forms:
* The client entity token audience in one of the following forms:
*
* **Sender**
* - `"sb://<yournamespace>.servicebus.windows.net/<queue-name>"`
Expand All @@ -121,17 +121,17 @@ export abstract class LinkEntity<LinkT extends Receiver | AwaitableSender | Requ
*/
audience: string;
/**
* @property _context Provides relevant information about the amqp connection,
* Provides relevant information about the amqp connection,
* cbs and $management sessions, token provider, sender and receivers.
*/
protected _context: ConnectionContext;
/**
* @property {NodeJS.Timer} _tokenRenewalTimer The token renewal timer that keeps track of when
* The token renewal timer that keeps track of when
* the Client Entity is due for token renewal.
*/
private _tokenRenewalTimer?: NodeJS.Timer;
/**
* @property _tokenTimeout Indicates token timeout
* Indicates token timeout
*/
protected _tokenTimeout?: number;

Expand Down Expand Up @@ -163,11 +163,10 @@ export abstract class LinkEntity<LinkT extends Receiver | AwaitableSender | Requ

/**
* Creates a new ClientEntity instance.
* @constructor
* @param baseName The base name to use for the link. A unique ID will be appended to this.
* @param entityPath The entity path (ex: 'your-queue')
* @param context The connection context.
* @param options Options that can be provided while creating the LinkEntity.
* @param baseName - The base name to use for the link. A unique ID will be appended to this.
* @param entityPath - The entity path (ex: 'your-queue')
* @param context - The connection context.
* @param options - Options that can be provided while creating the LinkEntity.
*/
constructor(
public readonly baseName: string,
Expand All @@ -187,7 +186,7 @@ export abstract class LinkEntity<LinkT extends Receiver | AwaitableSender | Requ

/**
* Determines whether the AMQP link is open. If open then returns true else returns false.
* @return {boolean} boolean
* @returns boolean
*/
isOpen(): boolean {
const result: boolean = this._link ? this._link.isOpen() : false;
Expand Down Expand Up @@ -305,7 +304,6 @@ export abstract class LinkEntity<LinkT extends Receiver | AwaitableSender | Requ
* NOTE: This method should be implemented by any child classes to actually create the underlying
* Rhea link (AwaitableSender or Receiver or RequestResponseLink)
*
* @param _options
*/
protected abstract createRheaLink(_options: LinkOptionsT<LinkT>): Promise<LinkT>;

Expand Down Expand Up @@ -346,7 +344,7 @@ export abstract class LinkEntity<LinkT extends Receiver | AwaitableSender | Requ

/**
* Provides the current type of the ClientEntity.
* @return {string} The entity type.
* @returns The entity type.
*/
private get _type(): string {
let result = "LinkEntity";
Expand All @@ -366,8 +364,8 @@ export abstract class LinkEntity<LinkT extends Receiver | AwaitableSender | Requ

/**
* Negotiates the cbs claim for the ClientEntity.
* @param {boolean} [setTokenRenewal] Set the token renewal timer. Default false.
* @return {Promise<void>} Promise<void>
* @param setTokenRenewal - Set the token renewal timer. Default false.
* @returns Promise<void>
*/
private async _negotiateClaim(setTokenRenewal?: boolean): Promise<void> {
this._logger.verbose(`${this._logPrefix} negotiateclaim() has been called`);
Expand Down
Loading