From bf8ac3b9e6ee59f267f7850418febfe84dedceb8 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 17 Jul 2018 12:59:02 +0200 Subject: Fix tslint issues --- .../src/order_watcher/event_watcher.ts | 8 ++++---- .../src/order_watcher/expiration_watcher.ts | 10 +++++----- .../src/order_watcher/order_watcher.ts | 22 +++++++++++----------- packages/order-watcher/src/utils/assert.ts | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) (limited to 'packages/order-watcher/src') diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index 08ecf81cb..b45e2c8c0 100644 --- a/packages/order-watcher/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -19,14 +19,14 @@ enum LogEventState { * depth. */ export class EventWatcher { - private _web3Wrapper: Web3Wrapper; + private readonly _web3Wrapper: Web3Wrapper; private _blockAndLogStreamerIfExists: BlockAndLogStreamer | undefined; private _blockAndLogStreamIntervalIfExists?: NodeJS.Timer; private _onLogAddedSubscriptionToken: string | undefined; private _onLogRemovedSubscriptionToken: string | undefined; - private _pollingIntervalMs: number; - private _stateLayer: BlockParamLiteral; - private _isVerbose: boolean; + private readonly _pollingIntervalMs: number; + private readonly _stateLayer: BlockParamLiteral; + private readonly _isVerbose: boolean; constructor( web3Wrapper: Web3Wrapper, pollingIntervalIfExistsMs: undefined | number, diff --git a/packages/order-watcher/src/order_watcher/expiration_watcher.ts b/packages/order-watcher/src/order_watcher/expiration_watcher.ts index 31fda7dca..c1f34d13d 100644 --- a/packages/order-watcher/src/order_watcher/expiration_watcher.ts +++ b/packages/order-watcher/src/order_watcher/expiration_watcher.ts @@ -13,10 +13,10 @@ const DEFAULT_ORDER_EXPIRATION_CHECKING_INTERVAL_MS = 50; * It stores them in a min heap by expiration time and checks for expired ones every `orderExpirationCheckingIntervalMs` */ export class ExpirationWatcher { - private _orderHashByExpirationRBTree: RBTree; - private _expiration: { [orderHash: string]: BigNumber } = {}; - private _orderExpirationCheckingIntervalMs: number; - private _expirationMarginMs: number; + private readonly _orderHashByExpirationRBTree: RBTree; + private readonly _expiration: { [orderHash: string]: BigNumber } = {}; + private readonly _orderExpirationCheckingIntervalMs: number; + private readonly _expirationMarginMs: number; private _orderExpirationCheckingIntervalIdIfExists?: NodeJS.Timer; constructor(expirationMarginIfExistsMs?: number, orderExpirationCheckingIntervalIfExistsMs?: number) { this._orderExpirationCheckingIntervalMs = @@ -44,7 +44,7 @@ export class ExpirationWatcher { this._orderExpirationCheckingIntervalIdIfExists = intervalUtils.setInterval( this._pruneExpiredOrders.bind(this, callback), this._orderExpirationCheckingIntervalMs, - _.noop, // _pruneExpiredOrders never throws + _.noop.bind(_), // _pruneExpiredOrders never throws ); } public unsubscribe(): void { diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts index b09ba8d9d..b32354687 100644 --- a/packages/order-watcher/src/order_watcher/order_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -69,18 +69,18 @@ const DEFAULT_CLEANUP_JOB_INTERVAL_MS = 1000 * 60 * 60; // 1h * the order should be deemed invalid. */ export class OrderWatcher { - private _contractWrappers: ContractWrappers; - private _orderStateByOrderHashCache: OrderStateByOrderHash = {}; - private _orderByOrderHash: OrderByOrderHash = {}; - private _dependentOrderHashes: DependentOrderHashes = {}; + private readonly _contractWrappers: ContractWrappers; + private readonly _orderStateByOrderHashCache: OrderStateByOrderHash = {}; + private readonly _orderByOrderHash: OrderByOrderHash = {}; + private readonly _dependentOrderHashes: DependentOrderHashes = {}; private _callbackIfExists?: OnOrderStateChangeCallback; - private _eventWatcher: EventWatcher; - private _web3Wrapper: Web3Wrapper; - private _expirationWatcher: ExpirationWatcher; - private _orderStateUtils: OrderStateUtils; - private _orderFilledCancelledLazyStore: OrderFilledCancelledLazyStore; - private _balanceAndProxyAllowanceLazyStore: BalanceAndProxyAllowanceLazyStore; - private _cleanupJobInterval: number; + private readonly _eventWatcher: EventWatcher; + private readonly _web3Wrapper: Web3Wrapper; + private readonly _expirationWatcher: ExpirationWatcher; + private readonly _orderStateUtils: OrderStateUtils; + private readonly _orderFilledCancelledLazyStore: OrderFilledCancelledLazyStore; + private readonly _balanceAndProxyAllowanceLazyStore: BalanceAndProxyAllowanceLazyStore; + private readonly _cleanupJobInterval: number; private _cleanupJobIntervalIdIfExists?: NodeJS.Timer; constructor(provider: Provider, networkId: number, config?: OrderWatcherConfig) { this._web3Wrapper = new Web3Wrapper(provider); diff --git a/packages/order-watcher/src/utils/assert.ts b/packages/order-watcher/src/utils/assert.ts index 9c992d9b4..4a1441474 100644 --- a/packages/order-watcher/src/utils/assert.ts +++ b/packages/order-watcher/src/utils/assert.ts @@ -12,6 +12,6 @@ export const assert = { ...sharedAssert, isValidSignature(orderHash: string, ecSignature: ECSignature, signerAddress: string): void { const isValid = isValidSignature(orderHash, ecSignature, signerAddress); - this.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`); + assert.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`); }, }; -- cgit v1.2.3