diff options
-rw-r--r-- | packages/assert/src/index.ts | 10 | ||||
-rw-r--r-- | packages/assert/test/assert_test.ts | 11 | ||||
-rw-r--r-- | packages/connect/package.json | 2 | ||||
-rw-r--r-- | packages/connect/src/http_client.ts | 11 | ||||
-rw-r--r-- | packages/connect/src/utils/orderbook_channel_message_parsers.ts | 4 | ||||
-rw-r--r-- | packages/connect/src/utils/type_converters.ts | 2 | ||||
-rw-r--r-- | packages/connect/src/ws_orderbook_channel.ts | 7 | ||||
-rw-r--r-- | packages/connect/test/fixtures/standard_relayer_api/fees.ts | 1 | ||||
-rw-r--r-- | packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts | 1 | ||||
-rw-r--r-- | packages/connect/test/http_client_test.ts | 18 | ||||
-rw-r--r-- | packages/connect/test/orderbook_channel_message_parsers_test.ts | 18 | ||||
-rw-r--r-- | packages/connect/test/ws_orderbook_channel_test.ts | 7 |
12 files changed, 52 insertions, 40 deletions
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts index eb224223f..92bcf6f03 100644 --- a/packages/assert/src/index.ts +++ b/packages/assert/src/index.ts @@ -1,11 +1,11 @@ +import { + Schema, + SchemaValidator, +} from '@0xproject/json-schemas'; import BigNumber from 'bignumber.js'; import * as ethereum_address from 'ethereum-address'; import * as _ from 'lodash'; import * as validUrl from 'valid-url'; -import { - SchemaValidator, - Schema, -} from '@0xproject/json-schemas'; const HEX_REGEX = /^0x[0-9A-F]*$/i; @@ -62,7 +62,7 @@ export const assert = { this.assert(_.isBoolean(value), this.typeAssertionMessage(variableName, 'boolean', value)); }, isWeb3Provider(variableName: string, value: any): void { - const isWeb3Provider = _.isFunction((value as any).send) || _.isFunction((value as any).sendAsync); + const isWeb3Provider = _.isFunction((value).send) || _.isFunction((value).sendAsync); this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Web3.Provider', value)); }, doesConformToSchema(variableName: string, value: any, schema: Schema): void { diff --git a/packages/assert/test/assert_test.ts b/packages/assert/test/assert_test.ts index 66fa4eb54..3f8ae1f40 100644 --- a/packages/assert/test/assert_test.ts +++ b/packages/assert/test/assert_test.ts @@ -1,8 +1,9 @@ -import 'mocha'; -import * as dirtyChai from 'dirty-chai'; -import * as chai from 'chai'; -import {BigNumber} from 'bignumber.js'; import {schemas} from '@0xproject/json-schemas'; +import {BigNumber} from 'bignumber.js'; +import * as chai from 'chai'; +import * as dirtyChai from 'dirty-chai'; +import 'mocha'; + import {assert} from '../src/index'; chai.config.includeStack = true; @@ -183,7 +184,7 @@ describe('Assertions', () => { it('should not throw for valid input', () => { const validInputs = [ 42, - 0.00, + 0.00, // tslint:disable-line:number-literal-format 21e+42, ]; validInputs.forEach(input => expect(assert.isNumber.bind(assert, variableName, input)).to.not.throw()); diff --git a/packages/connect/package.json b/packages/connect/package.json index 7da40ced4..0257b4496 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -17,7 +17,7 @@ "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_DIR", "upload_docs_json": "aws s3 cp docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type aplication/json", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", - "lint": "tslint 'src/**/*.ts' 'test/**/*.ts'", + "lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'", "run_mocha": "mocha lib/test/**/*_test.js", "test": "run-s clean build copy_test_fixtures run_mocha", "test:circleci": "yarn test" diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts index 85dc83c61..0a85dced5 100644 --- a/packages/connect/src/http_client.ts +++ b/packages/connect/src/http_client.ts @@ -1,10 +1,12 @@ +import {SignedOrder} from '0x.js'; +import {assert} from '@0xproject/assert'; +import {schemas} from '@0xproject/json-schemas'; +import {BigNumber} from 'bignumber.js'; import 'isomorphic-fetch'; import * as _ from 'lodash'; -import {BigNumber} from 'bignumber.js'; import * as queryString from 'query-string'; -import {assert} from '@0xproject/assert'; -import {schemas} from '@0xproject/json-schemas'; -import {SignedOrder} from '0x.js'; + +import {schemas as clientSchemas} from './schemas/schemas'; import { Client, FeesRequest, @@ -15,7 +17,6 @@ import { TokenPairsItem, TokenPairsRequest, } from './types'; -import {schemas as clientSchemas} from './schemas/schemas'; import {typeConverters} from './utils/type_converters'; // TODO: move this and bigNumberConfigs in the 0x.js package into one place diff --git a/packages/connect/src/utils/orderbook_channel_message_parsers.ts b/packages/connect/src/utils/orderbook_channel_message_parsers.ts index b590b189b..f3497db34 100644 --- a/packages/connect/src/utils/orderbook_channel_message_parsers.ts +++ b/packages/connect/src/utils/orderbook_channel_message_parsers.ts @@ -1,11 +1,13 @@ -import * as _ from 'lodash'; import {SignedOrder} from '0x.js'; import {assert} from '@0xproject/assert'; import {schemas} from '@0xproject/json-schemas'; +import * as _ from 'lodash'; + import { OrderbookChannelMessage, OrderbookChannelMessageTypes, } from '../types'; + import {typeConverters} from './type_converters'; export const orderbookChannelMessageParsers = { diff --git a/packages/connect/src/utils/type_converters.ts b/packages/connect/src/utils/type_converters.ts index bf17a5629..c136382fd 100644 --- a/packages/connect/src/utils/type_converters.ts +++ b/packages/connect/src/utils/type_converters.ts @@ -1,5 +1,5 @@ -import * as _ from 'lodash'; import {BigNumber} from 'bignumber.js'; +import * as _ from 'lodash'; // TODO: convert all of these to non-mutating, pure functions export const typeConverters = { diff --git a/packages/connect/src/ws_orderbook_channel.ts b/packages/connect/src/ws_orderbook_channel.ts index 78b823dbe..d3aadb25e 100644 --- a/packages/connect/src/ws_orderbook_channel.ts +++ b/packages/connect/src/ws_orderbook_channel.ts @@ -1,8 +1,9 @@ -import * as _ from 'lodash'; -import * as WebSocket from 'websocket'; +import {SignedOrder} from '0x.js'; import {assert} from '@0xproject/assert'; import {schemas} from '@0xproject/json-schemas'; -import {SignedOrder} from '0x.js'; +import * as _ from 'lodash'; +import * as WebSocket from 'websocket'; + import { OrderbookChannel, OrderbookChannelHandler, diff --git a/packages/connect/test/fixtures/standard_relayer_api/fees.ts b/packages/connect/test/fixtures/standard_relayer_api/fees.ts index c57b42717..68421880e 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/fees.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/fees.ts @@ -1,4 +1,5 @@ import {BigNumber} from 'bignumber.js'; + import {FeesResponse} from '../../../src/types'; export const feesResponse: FeesResponse = { diff --git a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts index 250277436..b3ae7a1b1 100644 --- a/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts +++ b/packages/connect/test/fixtures/standard_relayer_api/token_pairs.ts @@ -1,4 +1,5 @@ import {BigNumber} from 'bignumber.js'; + import {TokenPairsItem} from '../../../src/types'; export const tokenPairsResponse: TokenPairsItem[] = [ diff --git a/packages/connect/test/http_client_test.ts b/packages/connect/test/http_client_test.ts index 4ac93df76..3d72ca185 100644 --- a/packages/connect/test/http_client_test.ts +++ b/packages/connect/test/http_client_test.ts @@ -1,23 +1,25 @@ -import 'mocha'; -import * as dirtyChai from 'dirty-chai'; +import {BigNumber} from 'bignumber.js'; import * as chai from 'chai'; import * as chaiAsPromised from 'chai-as-promised'; +import * as dirtyChai from 'dirty-chai'; import * as fetchMock from 'fetch-mock'; -import {BigNumber} from 'bignumber.js'; +import 'mocha'; + import {HttpClient} from '../src/index'; + import {feesResponse} from './fixtures/standard_relayer_api/fees'; +import * as feesResponseJSON from './fixtures/standard_relayer_api/fees.json'; import { orderResponse, } from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; -import {ordersResponse} from './fixtures/standard_relayer_api/orders'; -import {tokenPairsResponse} from './fixtures/standard_relayer_api/token_pairs'; -import {orderbookResponse} from './fixtures/standard_relayer_api/orderbook'; -import * as feesResponseJSON from './fixtures/standard_relayer_api/fees.json'; // tslint:disable-next-line:max-line-length import * as orderResponseJSON from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f.json'; +import {orderbookResponse} from './fixtures/standard_relayer_api/orderbook'; +import * as orderbookJSON from './fixtures/standard_relayer_api/orderbook.json'; +import {ordersResponse} from './fixtures/standard_relayer_api/orders'; import * as ordersResponseJSON from './fixtures/standard_relayer_api/orders.json'; +import {tokenPairsResponse} from './fixtures/standard_relayer_api/token_pairs'; import * as tokenPairsResponseJSON from './fixtures/standard_relayer_api/token_pairs.json'; -import * as orderbookJSON from './fixtures/standard_relayer_api/orderbook.json'; chai.config.includeStack = true; chai.use(dirtyChai); diff --git a/packages/connect/test/orderbook_channel_message_parsers_test.ts b/packages/connect/test/orderbook_channel_message_parsers_test.ts index 8efc5e500..0ad0b12b3 100644 --- a/packages/connect/test/orderbook_channel_message_parsers_test.ts +++ b/packages/connect/test/orderbook_channel_message_parsers_test.ts @@ -1,19 +1,21 @@ -import 'mocha'; -import * as dirtyChai from 'dirty-chai'; import * as chai from 'chai'; +import * as dirtyChai from 'dirty-chai'; +import 'mocha'; + import {orderbookChannelMessageParsers} from '../src/utils/orderbook_channel_message_parsers'; + +// tslint:disable-next-line:max-line-length +import {orderResponse} from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; +import {orderbookResponse} from './fixtures/standard_relayer_api/orderbook'; import { - snapshotOrderbookChannelMessage, malformedSnapshotOrderbookChannelMessage, + snapshotOrderbookChannelMessage, } from './fixtures/standard_relayer_api/snapshot_orderbook_channel_message'; +import {unknownOrderbookChannelMessage} from './fixtures/standard_relayer_api/unknown_orderbook_channel_message'; import { - updateOrderbookChannelMessage, malformedUpdateOrderbookChannelMessage, + updateOrderbookChannelMessage, } from './fixtures/standard_relayer_api/update_orderbook_channel_message'; -import {unknownOrderbookChannelMessage} from './fixtures/standard_relayer_api/unknown_orderbook_channel_message'; -import {orderbookResponse} from './fixtures/standard_relayer_api/orderbook'; -// tslint:disable-next-line:max-line-length -import {orderResponse} from './fixtures/standard_relayer_api/order/0xabc67323774bdbd24d94f977fa9ac94a50f016026fd13f42990861238897721f'; chai.config.includeStack = true; chai.use(dirtyChai); diff --git a/packages/connect/test/ws_orderbook_channel_test.ts b/packages/connect/test/ws_orderbook_channel_test.ts index e92c6f44a..6190a5ac3 100644 --- a/packages/connect/test/ws_orderbook_channel_test.ts +++ b/packages/connect/test/ws_orderbook_channel_test.ts @@ -1,7 +1,8 @@ -import 'mocha'; -import * as _ from 'lodash'; -import * as dirtyChai from 'dirty-chai'; import * as chai from 'chai'; +import * as dirtyChai from 'dirty-chai'; +import * as _ from 'lodash'; +import 'mocha'; + import { WebSocketOrderbookChannel, } from '../src/ws_orderbook_channel'; |