From 9778695b4ad1fd999eb79b01c768a2f2b9938917 Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 4 Jun 2018 19:48:21 -0700 Subject: Try enabling no-unused-variable... --- .../src/order_watcher/order_watcher.ts | 2 +- packages/order-watcher/src/types.ts | 9 ----- packages/order-watcher/src/utils/assert.ts | 3 -- packages/order-watcher/test/event_watcher_test.ts | 2 +- .../order-watcher/test/expiration_watcher_test.ts | 3 +- packages/order-watcher/test/global_hooks.ts | 2 -- packages/order-watcher/test/order_watcher_test.ts | 39 +++++++++------------- packages/order-watcher/test/utils/web3_wrapper.ts | 2 +- 8 files changed, 20 insertions(+), 42 deletions(-) (limited to 'packages/order-watcher') diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts index 29936a066..c1f6c9230 100644 --- a/packages/order-watcher/src/order_watcher/order_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -14,7 +14,7 @@ import { Provider, SignedOrder, } from '@0xproject/types'; -import { AbiDecoder, intervalUtils } from '@0xproject/utils'; +import { intervalUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; diff --git a/packages/order-watcher/src/types.ts b/packages/order-watcher/src/types.ts index 9125af236..b6a1115bd 100644 --- a/packages/order-watcher/src/types.ts +++ b/packages/order-watcher/src/types.ts @@ -1,17 +1,8 @@ -import { BigNumber } from '@0xproject/utils'; import { - BlockParam, BlockParamLiteral, - ContractAbi, - ContractEventArg, - ExchangeContractErrs, - FilterObject, LogEntryEvent, - LogWithDecodedArgs, - Order, OrderState, - SignedOrder, } from '@0xproject/types'; export enum OrderWatcherError { diff --git a/packages/order-watcher/src/utils/assert.ts b/packages/order-watcher/src/utils/assert.ts index 9e02f8bdc..e88f9ac72 100644 --- a/packages/order-watcher/src/utils/assert.ts +++ b/packages/order-watcher/src/utils/assert.ts @@ -4,9 +4,6 @@ import { assert as sharedAssert } from '@0xproject/assert'; import { Schema } from '@0xproject/json-schemas'; // tslint:disable-next-line:no-unused-variable import { ECSignature } from '@0xproject/types'; -import { BigNumber } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as _ from 'lodash'; import { isValidSignature } from '@0xproject/order-utils'; diff --git a/packages/order-watcher/test/event_watcher_test.ts b/packages/order-watcher/test/event_watcher_test.ts index ba77d50dd..8a43ef8f9 100644 --- a/packages/order-watcher/test/event_watcher_test.ts +++ b/packages/order-watcher/test/event_watcher_test.ts @@ -1,4 +1,4 @@ -import { callbackErrorReporter, web3Factory } from '@0xproject/dev-utils'; +import { callbackErrorReporter } from '@0xproject/dev-utils'; import { DoneCallback, LogEntry, LogEntryEvent } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; diff --git a/packages/order-watcher/test/expiration_watcher_test.ts b/packages/order-watcher/test/expiration_watcher_test.ts index ef15bf006..068c267c3 100644 --- a/packages/order-watcher/test/expiration_watcher_test.ts +++ b/packages/order-watcher/test/expiration_watcher_test.ts @@ -1,5 +1,5 @@ import { ContractWrappers } from '@0xproject/contract-wrappers'; -import { BlockchainLifecycle, callbackErrorReporter, devConstants } from '@0xproject/dev-utils'; +import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils'; import { FillScenarios } from '@0xproject/fill-scenarios'; import { getOrderHashHex } from '@0xproject/order-utils'; import { DoneCallback, Token } from '@0xproject/types'; @@ -10,7 +10,6 @@ import 'make-promises-safe'; import 'mocha'; import * as Sinon from 'sinon'; -import { artifacts } from '../src/artifacts'; import { ExpirationWatcher } from '../src/order_watcher/expiration_watcher'; import { utils } from '../src/utils/utils'; diff --git a/packages/order-watcher/test/global_hooks.ts b/packages/order-watcher/test/global_hooks.ts index 3d3f0e474..f18eef379 100644 --- a/packages/order-watcher/test/global_hooks.ts +++ b/packages/order-watcher/test/global_hooks.ts @@ -1,9 +1,7 @@ import { devConstants } from '@0xproject/dev-utils'; import { runV1MigrationsAsync } from '@0xproject/migrations'; import 'make-promises-safe'; -import * as path from 'path'; -import { constants } from './utils/constants'; import { provider } from './utils/web3_wrapper'; before('migrate contracts', async function(): Promise { diff --git a/packages/order-watcher/test/order_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts index 0d33e7ea2..d8c918f16 100644 --- a/packages/order-watcher/test/order_watcher_test.ts +++ b/packages/order-watcher/test/order_watcher_test.ts @@ -1,16 +1,8 @@ import { ContractWrappers } from '@0xproject/contract-wrappers'; -import { BlockchainLifecycle, callbackErrorReporter, devConstants } from '@0xproject/dev-utils'; +import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils'; import { FillScenarios } from '@0xproject/fill-scenarios'; import { getOrderHashHex } from '@0xproject/order-utils'; -import { - DoneCallback, - ExchangeContractErrs, - OrderState, - OrderStateInvalid, - OrderStateValid, - SignedOrder, - Token, -} from '@0xproject/types'; +import { DoneCallback, ExchangeContractErrs, OrderState, SignedOrder, Token } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -53,6 +45,7 @@ describe('OrderWatcher', () => { const fillableAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5), decimals); before(async () => { contractWrappers = new ContractWrappers(provider, config); + // tslint:disable-next-line:no-unused-variable const networkId = await web3Wrapper.getNetworkIdAsync(); orderWatcher = new OrderWatcher(provider, constants.TESTRPC_NETWORK_ID); exchangeContractAddress = contractWrappers.exchange.getContractAddress(); @@ -139,7 +132,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); - const invalidOrderState = orderState as OrderStateInvalid; + const invalidOrderState = orderState; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerAllowance); }); @@ -188,7 +181,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); - const invalidOrderState = orderState as OrderStateInvalid; + const invalidOrderState = orderState; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerBalance); }); @@ -212,7 +205,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); - const invalidOrderState = orderState as OrderStateInvalid; + const invalidOrderState = orderState; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero); }); @@ -244,7 +237,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); - const validOrderState = orderState as OrderStateValid; + const validOrderState = orderState; expect(validOrderState.orderHash).to.be.equal(orderHash); const orderRelevantState = validOrderState.orderRelevantState; const remainingMakerBalance = makerBalance.sub(fillAmountInBaseUnits); @@ -305,7 +298,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); - const validOrderState = orderState as OrderStateValid; + const validOrderState = orderState; expect(validOrderState.orderHash).to.be.equal(orderHash); const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( @@ -339,7 +332,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { - const validOrderState = orderState as OrderStateValid; + const validOrderState = orderState; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( changedMakerApprovalAmount, @@ -374,7 +367,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); - const validOrderState = orderState as OrderStateValid; + const validOrderState = orderState; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( remainingAmount, @@ -414,7 +407,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); - const validOrderState = orderState as OrderStateValid; + const validOrderState = orderState; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( remainingTokenAmount, @@ -447,7 +440,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { - const validOrderState = orderState as OrderStateValid; + const validOrderState = orderState; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( remainingFeeAmount, @@ -482,7 +475,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { - const validOrderState = orderState as OrderStateValid; + const validOrderState = orderState; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( fillableAmount, @@ -511,7 +504,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); - const invalidOrderState = orderState as OrderStateInvalid; + const invalidOrderState = orderState; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero); }); @@ -535,7 +528,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); - const invalidOrderState = orderState as OrderStateInvalid; + const invalidOrderState = orderState; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderFillRoundingError); }); @@ -562,7 +555,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); - const validOrderState = orderState as OrderStateValid; + const validOrderState = orderState; expect(validOrderState.orderHash).to.be.equal(orderHash); const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.cancelledTakerTokenAmount).to.be.bignumber.equal(cancelAmountInBaseUnits); diff --git a/packages/order-watcher/test/utils/web3_wrapper.ts b/packages/order-watcher/test/utils/web3_wrapper.ts index 71a0dc1c2..f7d11f138 100644 --- a/packages/order-watcher/test/utils/web3_wrapper.ts +++ b/packages/order-watcher/test/utils/web3_wrapper.ts @@ -1,4 +1,4 @@ -import { devConstants, web3Factory } from '@0xproject/dev-utils'; +import { web3Factory } from '@0xproject/dev-utils'; import { Provider } from '@0xproject/types'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -- cgit