From c49f68ef3ebb11f779868b35f938c1d1cb08c665 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 4 Jan 2018 14:53:38 +0100 Subject: Fix linter errors --- packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts | 2 +- packages/0x.js/src/contract_wrappers/exchange_wrapper.ts | 2 +- packages/0x.js/src/contract_wrappers/token_wrapper.ts | 2 +- packages/0x.js/src/order_watcher/expiration_watcher.ts | 3 +-- packages/0x.js/src/utils/assert.ts | 2 +- packages/0x.js/test/token_wrapper_test.ts | 2 +- packages/0x.js/test/utils/fill_scenarios.ts | 2 +- packages/abi-gen/src/utils.ts | 5 ++++- 8 files changed, 11 insertions(+), 9 deletions(-) (limited to 'packages') diff --git a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts index 3e17b756e..b03571636 100644 --- a/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/ether_token_wrapper.ts @@ -1,6 +1,6 @@ import { schemas } from '@0xproject/json-schemas'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts index 2f78ca091..e1d80e01a 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts @@ -1,6 +1,6 @@ import { schemas } from '@0xproject/json-schemas'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import * as Web3 from 'web3'; diff --git a/packages/0x.js/src/contract_wrappers/token_wrapper.ts b/packages/0x.js/src/contract_wrappers/token_wrapper.ts index ead1c8274..7943f4a60 100644 --- a/packages/0x.js/src/contract_wrappers/token_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/token_wrapper.ts @@ -1,6 +1,6 @@ import { schemas } from '@0xproject/json-schemas'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; diff --git a/packages/0x.js/src/order_watcher/expiration_watcher.ts b/packages/0x.js/src/order_watcher/expiration_watcher.ts index 88c44f9a2..e7d085fc8 100644 --- a/packages/0x.js/src/order_watcher/expiration_watcher.ts +++ b/packages/0x.js/src/order_watcher/expiration_watcher.ts @@ -1,5 +1,4 @@ -import { intervalUtils } from '@0xproject/utils'; -import { BigNumber } from '@0xproject/utils'; +import { BigNumber, intervalUtils } from '@0xproject/utils'; import { RBTree } from 'bintrees'; import * as _ from 'lodash'; diff --git a/packages/0x.js/src/utils/assert.ts b/packages/0x.js/src/utils/assert.ts index cf20e7ed7..c21f2dbca 100644 --- a/packages/0x.js/src/utils/assert.ts +++ b/packages/0x.js/src/utils/assert.ts @@ -2,9 +2,9 @@ import { assert as sharedAssert } from '@0xproject/assert'; // We need those two unused imports because they're actually used by sharedAssert which gets injected here // tslint:disable-next-line:no-unused-variable import { Schema } from '@0xproject/json-schemas'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; // tslint:disable-next-line:no-unused-variable import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import { ECSignature } from '../types'; diff --git a/packages/0x.js/test/token_wrapper_test.ts b/packages/0x.js/test/token_wrapper_test.ts index b30a906c5..296a704dd 100644 --- a/packages/0x.js/test/token_wrapper_test.ts +++ b/packages/0x.js/test/token_wrapper_test.ts @@ -1,6 +1,6 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import 'mocha'; import * as Web3 from 'web3'; diff --git a/packages/0x.js/test/utils/fill_scenarios.ts b/packages/0x.js/test/utils/fill_scenarios.ts index 3aa9e483e..1a61487f4 100644 --- a/packages/0x.js/test/utils/fill_scenarios.ts +++ b/packages/0x.js/test/utils/fill_scenarios.ts @@ -1,5 +1,5 @@ -import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { SignedOrder, Token, ZeroEx } from '../../src'; import { artifacts } from '../../src/artifacts'; diff --git a/packages/abi-gen/src/utils.ts b/packages/abi-gen/src/utils.ts index 764daa142..f407ae23d 100644 --- a/packages/abi-gen/src/utils.ts +++ b/packages/abi-gen/src/utils.ts @@ -10,7 +10,7 @@ export const utils = { if (solType.match(trailingArrayRegex)) { const arrayItemSolType = solType.replace(trailingArrayRegex, ''); const arrayItemTsType = utils.solTypeToTsType(paramKind, arrayItemSolType); - const arrayTsType = `(${arrayItemTsType})[]`; + const arrayTsType = utils.isUnionType(arrayItemTsType) ? `Array<${arrayItemTsType}>` : `${arrayItemTsType}[]`; return arrayTsType; } else { const solTypeRegexToTsType = [ @@ -37,6 +37,9 @@ export const utils = { throw new Error(`Unknown Solidity type found: ${solType}`); } }, + isUnionType(tsType: string): boolean { + return tsType === 'number|BigNumber'; + }, log(...args: any[]): void { console.log(...args); // tslint:disable-line:no-console }, -- cgit v1.2.3