aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-07-18 20:54:47 +0800
committerGitHub <noreply@github.com>2018-07-18 20:54:47 +0800
commitf3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0 (patch)
tree4aacfa2652ba2c5f976e36ac25449decb561d3f0
parent904968cf4a899642d3f4e78abc53352125e17447 (diff)
parentbf8ac3b9e6ee59f267f7850418febfe84dedceb8 (diff)
downloaddexon-0x-contracts-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar
dexon-0x-contracts-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar.gz
dexon-0x-contracts-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar.bz2
dexon-0x-contracts-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar.lz
dexon-0x-contracts-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar.xz
dexon-0x-contracts-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.tar.zst
dexon-0x-contracts-f3241ff86a0d99f4291c5a5f4eaaa5ebe1736da0.zip
Merge pull request #883 from 0xProject/feature/tslint-improvements
New tslint rules
-rw-r--r--packages/0x.js/package.json2
-rw-r--r--packages/0x.js/src/0x.ts2
-rw-r--r--packages/0x.js/test/global_hooks.ts2
-rw-r--r--packages/abi-gen/package.json2
-rw-r--r--packages/assert/package.json2
-rw-r--r--packages/assert/src/index.ts32
-rw-r--r--packages/assert/test/assert_test.ts2
-rw-r--r--packages/base-contract/package.json2
-rw-r--r--packages/base-contract/src/index.ts12
-rw-r--r--packages/connect/package.json2
-rw-r--r--packages/connect/src/http_client.ts2
-rw-r--r--packages/connect/src/utils/type_converters.ts6
-rw-r--r--packages/connect/src/ws_orderbook_channel.ts6
-rw-r--r--packages/connect/test/ws_orderbook_channel_test.ts2
-rw-r--r--packages/contract-wrappers/package.json2
-rw-r--r--packages/contract-wrappers/test/global_hooks.ts2
-rw-r--r--packages/contracts/package.json2
-rw-r--r--packages/contracts/test/utils/asset_wrapper.ts2
-rw-r--r--packages/contracts/test/utils/erc20_wrapper.ts10
-rw-r--r--packages/contracts/test/utils/erc721_wrapper.ts10
-rw-r--r--packages/contracts/test/utils/exchange_wrapper.ts6
-rw-r--r--packages/contracts/test/utils/forwarder_wrapper.ts8
-rw-r--r--packages/contracts/test/utils/log_decoder.ts6
-rw-r--r--packages/contracts/test/utils/match_order_tester.ts8
-rw-r--r--packages/contracts/test/utils/multi_sig_wrapper.ts6
-rw-r--r--packages/contracts/test/utils/order_factory.ts4
-rw-r--r--packages/contracts/test/utils/order_factory_from_scenario.ts14
-rw-r--r--packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts2
-rw-r--r--packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts4
-rw-r--r--packages/contracts/test/utils/token_registry_wrapper.ts4
-rw-r--r--packages/contracts/test/utils/transaction_factory.ts6
-rw-r--r--packages/contracts/test/utils/web3_wrapper.ts6
-rw-r--r--packages/dev-utils/package.json2
-rw-r--r--packages/dev-utils/src/blockchain_lifecycle.ts4
-rw-r--r--packages/ethereum-types/package.json2
-rw-r--r--packages/fill-scenarios/package.json2
-rw-r--r--packages/fill-scenarios/src/index.ts12
-rw-r--r--packages/json-schemas/package.json2
-rw-r--r--packages/json-schemas/src/schema_validator.ts2
-rw-r--r--packages/metacoin/package.json2
-rw-r--r--packages/migrations/package.json2
-rw-r--r--packages/migrations/src/utils/artifact_writer.ts4
-rw-r--r--packages/monorepo-scripts/package.json2
-rw-r--r--packages/monorepo-scripts/src/postpublish_utils.ts21
-rw-r--r--packages/monorepo-scripts/src/utils/changelog_utils.ts8
-rw-r--r--packages/monorepo-scripts/src/utils/utils.ts6
-rw-r--r--packages/order-utils/package.json2
-rw-r--r--packages/order-utils/src/exchange_transfer_simulator.ts2
-rw-r--r--packages/order-utils/src/order_state_utils.ts4
-rw-r--r--packages/order-utils/src/order_validation_utils.ts2
-rw-r--r--packages/order-utils/src/remaining_fillable_calculator.ts14
-rw-r--r--packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts2
-rw-r--r--packages/order-utils/test/exchange_transfer_simulator_test.ts5
-rw-r--r--packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts4
-rw-r--r--packages/order-watcher/package.json2
-rw-r--r--packages/order-watcher/src/order_watcher/event_watcher.ts8
-rw-r--r--packages/order-watcher/src/order_watcher/expiration_watcher.ts10
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts22
-rw-r--r--packages/order-watcher/src/utils/assert.ts2
-rw-r--r--packages/order-watcher/test/global_hooks.ts2
-rw-r--r--packages/order-watcher/test/order_watcher_test.ts4
-rw-r--r--packages/order-watcher/test/utils/token_utils.ts2
-rw-r--r--packages/react-docs/src/docs_info.ts2
-rw-r--r--packages/react-docs/src/utils/doxity_utils.ts22
-rw-r--r--packages/react-docs/src/utils/typedoc_utils.ts2
-rw-r--r--packages/react-shared/src/components/nested_sidebar_menu.tsx2
-rw-r--r--packages/sol-compiler/package.json2
-rw-r--r--packages/sol-compiler/src/compiler.ts14
-rw-r--r--packages/sol-compiler/test/compiler_test.ts2
-rw-r--r--packages/sol-cov/package.json2
-rw-r--r--packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts4
-rw-r--r--packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts4
-rw-r--r--packages/sol-cov/src/ast_visitor.ts14
-rw-r--r--packages/sol-cov/src/coverage_subprovider.ts2
-rw-r--r--packages/sol-cov/src/get_source_range_snippet.ts2
-rw-r--r--packages/sol-cov/src/profiler_subprovider.ts2
-rw-r--r--packages/sol-cov/src/revert_trace_subprovider.ts4
-rw-r--r--packages/sol-cov/src/trace_collection_subprovider.ts6
-rw-r--r--packages/sol-cov/src/trace_collector.ts8
-rw-r--r--packages/sol-resolver/package.json2
-rw-r--r--packages/sol-resolver/src/resolvers/fallthrough_resolver.ts2
-rw-r--r--packages/sol-resolver/src/resolvers/name_resolver.ts2
-rw-r--r--packages/sol-resolver/src/resolvers/npm_resolver.ts2
-rw-r--r--packages/sol-resolver/src/resolvers/relative_fs_resolver.ts2
-rw-r--r--packages/sra-report/package.json2
-rw-r--r--packages/subproviders/package.json2
-rw-r--r--packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts4
-rw-r--r--packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts2
-rw-r--r--packages/subproviders/src/subproviders/ganache.ts2
-rw-r--r--packages/subproviders/src/subproviders/ledger.ts12
-rw-r--r--packages/subproviders/src/subproviders/mnemonic_wallet.ts4
-rw-r--r--packages/subproviders/src/subproviders/nonce_tracker.ts2
-rw-r--r--packages/subproviders/src/subproviders/private_key_wallet.ts4
-rw-r--r--packages/subproviders/src/subproviders/redundant_subprovider.ts2
-rw-r--r--packages/subproviders/src/subproviders/rpc_subprovider.ts4
-rw-r--r--packages/subproviders/src/subproviders/signer.ts2
-rw-r--r--packages/subproviders/src/utils/wallet_utils.ts4
-rw-r--r--packages/subproviders/test/integration/ledger_subprovider_test.ts2
-rw-r--r--packages/subproviders/test/unit/ledger_subprovider_test.ts2
-rw-r--r--packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts24
-rw-r--r--packages/testnet-faucets/package.json2
-rw-r--r--packages/testnet-faucets/src/ts/dispatch_queue.ts4
-rw-r--r--packages/testnet-faucets/src/ts/error_reporter.ts4
-rw-r--r--packages/testnet-faucets/src/ts/handler.ts2
-rw-r--r--packages/testnet-faucets/src/ts/server.ts24
-rw-r--r--packages/tslint-config/package.json2
-rw-r--r--packages/tslint-config/rules/customNoMagicNumbersRule.ts1
-rw-r--r--packages/tslint-config/tslint.json76
-rw-r--r--packages/types/package.json2
-rw-r--r--packages/utils/package.json2
-rw-r--r--packages/utils/src/abi_decoder.ts2
-rw-r--r--packages/utils/src/abi_utils.ts6
-rw-r--r--packages/web3-wrapper/package.json2
-rw-r--r--packages/web3-wrapper/src/marshaller.ts12
-rw-r--r--packages/web3-wrapper/src/utils.ts4
-rw-r--r--packages/web3-wrapper/src/web3_wrapper.ts2
-rw-r--r--packages/website/package.json2
-rw-r--r--packages/website/ts/blockchain.ts10
-rw-r--r--packages/website/ts/blockchain_watcher.ts6
-rw-r--r--packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx4
-rw-r--r--packages/website/ts/components/eth_weth_conversion_button.tsx2
-rw-r--r--packages/website/ts/components/fill_warning_dialog.tsx6
-rw-r--r--packages/website/ts/components/generate_order/asset_picker.tsx2
-rw-r--r--packages/website/ts/components/inputs/allowance_toggle.tsx2
-rw-r--r--packages/website/ts/components/inputs/balance_bounded_input.tsx4
-rw-r--r--packages/website/ts/components/inputs/expiration_input.tsx2
-rw-r--r--packages/website/ts/components/order_json.tsx2
-rw-r--r--packages/website/ts/components/portal/portal.tsx4
-rw-r--r--packages/website/ts/components/ui/menu_item.tsx2
-rw-r--r--packages/website/ts/components/ui/overlay.tsx2
-rw-r--r--packages/website/ts/components/ui/simple_menu.tsx2
-rw-r--r--packages/website/ts/components/wallet/wallet.tsx2
-rw-r--r--packages/website/ts/local_storage/local_storage.ts8
-rw-r--r--packages/website/ts/local_storage/tracked_token_storage.ts4
-rw-r--r--packages/website/ts/local_storage/trade_history_storage.tsx18
-rw-r--r--packages/website/ts/pages/jobs/jobs.tsx2
-rw-r--r--packages/website/ts/pages/landing/landing.tsx2
-rw-r--r--packages/website/ts/redux/dispatcher.ts2
-rw-r--r--packages/website/ts/utils/utils.ts10
-rw-r--r--yarn.lock25
140 files changed, 421 insertions, 365 deletions
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index 966770cf0..502a346e4 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -94,7 +94,7 @@
"shx": "^0.2.2",
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typedoc": "0xProject/typedoc",
"typescript": "2.7.1",
"webpack": "^3.1.0"
diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts
index 5d9a03719..1d33eb7ca 100644
--- a/packages/0x.js/src/0x.ts
+++ b/packages/0x.js/src/0x.ts
@@ -61,7 +61,7 @@ export class ZeroEx {
* ERC721 proxy smart contract.
*/
public erc721Proxy: ERC721ProxyWrapper;
- private _contractWrappers: ContractWrappers;
+ private readonly _contractWrappers: ContractWrappers;
/**
* Generates a pseudo-random 256-bit salt.
* The salt can be included in a 0x order, ensuring that the order generates a unique orderHash
diff --git a/packages/0x.js/test/global_hooks.ts b/packages/0x.js/test/global_hooks.ts
index 3d74634fe..364828231 100644
--- a/packages/0x.js/test/global_hooks.ts
+++ b/packages/0x.js/test/global_hooks.ts
@@ -7,7 +7,7 @@ before('migrate contracts', async function(): Promise<void> {
// HACK: Since the migrations take longer then our global mocha timeout limit
// we manually increase it for this before hook.
const mochaTestTimeoutMs = 20000;
- this.timeout(mochaTestTimeoutMs);
+ this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
const txDefaults = {
gas: devConstants.GAS_LIMIT,
from: devConstants.TESTRPC_FIRST_ADDRESS,
diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json
index 4fb335545..a0df6445c 100644
--- a/packages/abi-gen/package.json
+++ b/packages/abi-gen/package.json
@@ -63,7 +63,7 @@
"mocha": "^5.2.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"publishConfig": {
diff --git a/packages/assert/package.json b/packages/assert/package.json
index 3b9ecbb49..053c9673d 100644
--- a/packages/assert/package.json
+++ b/packages/assert/package.json
@@ -44,7 +44,7 @@
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts
index 8e18416c5..ccf2c9ad8 100644
--- a/packages/assert/src/index.ts
+++ b/packages/assert/src/index.ts
@@ -8,33 +8,33 @@ const HEX_REGEX = /^0x[0-9A-F]*$/i;
export const assert = {
isBigNumber(variableName: string, value: BigNumber): void {
const isBigNumber = _.isObject(value) && (value as any).isBigNumber;
- this.assert(isBigNumber, this.typeAssertionMessage(variableName, 'BigNumber', value));
+ assert.assert(isBigNumber, assert.typeAssertionMessage(variableName, 'BigNumber', value));
},
isValidBaseUnitAmount(variableName: string, value: BigNumber): void {
assert.isBigNumber(variableName, value);
const isNegative = value.lessThan(0);
- this.assert(!isNegative, `${variableName} cannot be a negative number, found value: ${value.toNumber()}`);
+ assert.assert(!isNegative, `${variableName} cannot be a negative number, found value: ${value.toNumber()}`);
const hasDecimals = value.decimalPlaces() !== 0;
- this.assert(
+ assert.assert(
!hasDecimals,
`${variableName} should be in baseUnits (no decimals), found value: ${value.toNumber()}`,
);
},
isString(variableName: string, value: string): void {
- this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value));
+ assert.assert(_.isString(value), assert.typeAssertionMessage(variableName, 'string', value));
},
isFunction(variableName: string, value: any): void {
- this.assert(_.isFunction(value), this.typeAssertionMessage(variableName, 'function', value));
+ assert.assert(_.isFunction(value), assert.typeAssertionMessage(variableName, 'function', value));
},
isHexString(variableName: string, value: string): void {
- this.assert(
+ assert.assert(
_.isString(value) && HEX_REGEX.test(value),
- this.typeAssertionMessage(variableName, 'HexString', value),
+ assert.typeAssertionMessage(variableName, 'HexString', value),
);
},
isETHAddressHex(variableName: string, value: string): void {
- this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value));
- this.assert(addressUtils.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value));
+ assert.assert(_.isString(value), assert.typeAssertionMessage(variableName, 'string', value));
+ assert.assert(addressUtils.isAddress(value), assert.typeAssertionMessage(variableName, 'ETHAddressHex', value));
},
doesBelongToStringEnum(
variableName: string,
@@ -51,17 +51,17 @@ export const assert = {
);
},
hasAtMostOneUniqueValue(value: any[], errMsg: string): void {
- this.assert(_.uniq(value).length <= 1, errMsg);
+ assert.assert(_.uniq(value).length <= 1, errMsg);
},
isNumber(variableName: string, value: number): void {
- this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value));
+ assert.assert(_.isFinite(value), assert.typeAssertionMessage(variableName, 'number', value));
},
isBoolean(variableName: string, value: boolean): void {
- this.assert(_.isBoolean(value), this.typeAssertionMessage(variableName, 'boolean', value));
+ assert.assert(_.isBoolean(value), assert.typeAssertionMessage(variableName, 'boolean', value));
},
isWeb3Provider(variableName: string, value: any): void {
const isWeb3Provider = _.isFunction(value.send) || _.isFunction(value.sendAsync);
- this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Provider', value));
+ assert.assert(isWeb3Provider, assert.typeAssertionMessage(variableName, 'Provider', value));
},
doesConformToSchema(variableName: string, value: any, schema: Schema, subSchemas?: Schema[]): void {
if (_.isUndefined(value)) {
@@ -76,15 +76,15 @@ export const assert = {
const msg = `Expected ${variableName} to conform to schema ${schema.id}
Encountered: ${JSON.stringify(value, null, '\t')}
Validation errors: ${validationResult.errors.join(', ')}`;
- this.assert(!hasValidationErrors, msg);
+ assert.assert(!hasValidationErrors, msg);
},
isWebUri(variableName: string, value: any): void {
const isValidUrl = !_.isUndefined(validUrl.isWebUri(value));
- this.assert(isValidUrl, this.typeAssertionMessage(variableName, 'web uri', value));
+ assert.assert(isValidUrl, assert.typeAssertionMessage(variableName, 'web uri', value));
},
isUri(variableName: string, value: any): void {
const isValidUri = !_.isUndefined(validUrl.isUri(value));
- this.assert(isValidUri, this.typeAssertionMessage(variableName, 'uri', value));
+ assert.assert(isValidUri, assert.typeAssertionMessage(variableName, 'uri', value));
},
assert(condition: boolean, message: string): void {
if (!condition) {
diff --git a/packages/assert/test/assert_test.ts b/packages/assert/test/assert_test.ts
index 15fd3e6a8..cbbfe39db 100644
--- a/packages/assert/test/assert_test.ts
+++ b/packages/assert/test/assert_test.ts
@@ -49,7 +49,7 @@ describe('Assertions', () => {
});
describe('#isFunction', () => {
it('should not throw for valid input', () => {
- const validInputs = [BigNumber, assert.isString];
+ const validInputs = [BigNumber, assert.isString.bind(assert)];
validInputs.forEach(input => expect(assert.isFunction.bind(assert, variableName, input)).to.not.throw());
});
it('should throw for invalid input', () => {
diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json
index afde81561..a7ce7cc73 100644
--- a/packages/base-contract/package.json
+++ b/packages/base-contract/package.json
@@ -39,7 +39,7 @@
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts
index 6b970ec27..a240fb8b6 100644
--- a/packages/base-contract/src/index.ts
+++ b/packages/base-contract/src/index.ts
@@ -72,15 +72,13 @@ export class BaseContract {
// 1. Optional param passed in to public method call
// 2. Global config passed in at library instantiation
// 3. Gas estimate calculation + safety margin
- const removeUndefinedProperties = _.pickBy;
- const txDataWithDefaults: TxData = {
+ const removeUndefinedProperties = _.pickBy.bind(_);
+ const txDataWithDefaults = {
...removeUndefinedProperties(txDefaults),
- ...removeUndefinedProperties(txData as any),
- // HACK: TS can't prove that T is spreadable.
- // Awaiting https://github.com/Microsoft/TypeScript/pull/13288 to be merged
- } as any;
+ ...removeUndefinedProperties(txData),
+ };
if (_.isUndefined(txDataWithDefaults.gas) && !_.isUndefined(estimateGasAsync)) {
- txDataWithDefaults.gas = await estimateGasAsync(txDataWithDefaults as any);
+ txDataWithDefaults.gas = await estimateGasAsync(txDataWithDefaults);
}
return txDataWithDefaults;
}
diff --git a/packages/connect/package.json b/packages/connect/package.json
index 343df4031..5102c7d2c 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -81,7 +81,7 @@
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typedoc": "~0.8.0",
"typescript": "2.7.1"
},
diff --git a/packages/connect/src/http_client.ts b/packages/connect/src/http_client.ts
index f3800d581..03cc590e4 100644
--- a/packages/connect/src/http_client.ts
+++ b/packages/connect/src/http_client.ts
@@ -38,7 +38,7 @@ const OPTS_TO_QUERY_FIELD_MAP = {
* that implement the standard relayer API v0
*/
export class HttpClient implements Client {
- private _apiEndpointUrl: string;
+ private readonly _apiEndpointUrl: string;
/**
* Format parameters to be appended to http requests into query string form
*/
diff --git a/packages/connect/src/utils/type_converters.ts b/packages/connect/src/utils/type_converters.ts
index c1808ce8a..210d452b9 100644
--- a/packages/connect/src/utils/type_converters.ts
+++ b/packages/connect/src/utils/type_converters.ts
@@ -6,12 +6,12 @@ export const typeConverters = {
const bids = _.get(orderbook, 'bids', []);
const asks = _.get(orderbook, 'asks', []);
return {
- bids: bids.map((order: any) => this.convertOrderStringFieldsToBigNumber(order)),
- asks: asks.map((order: any) => this.convertOrderStringFieldsToBigNumber(order)),
+ bids: bids.map((order: any) => typeConverters.convertOrderStringFieldsToBigNumber(order)),
+ asks: asks.map((order: any) => typeConverters.convertOrderStringFieldsToBigNumber(order)),
};
},
convertOrderStringFieldsToBigNumber(order: any): any {
- return this.convertStringsFieldsToBigNumbers(order, [
+ return typeConverters.convertStringsFieldsToBigNumbers(order, [
'makerTokenAmount',
'takerTokenAmount',
'makerFee',
diff --git a/packages/connect/src/ws_orderbook_channel.ts b/packages/connect/src/ws_orderbook_channel.ts
index e1c55cce3..fa9f5e37f 100644
--- a/packages/connect/src/ws_orderbook_channel.ts
+++ b/packages/connect/src/ws_orderbook_channel.ts
@@ -15,9 +15,9 @@ import { orderbookChannelMessageParser } from './utils/orderbook_channel_message
* that implements the standard relayer API v0
*/
export class WebSocketOrderbookChannel implements OrderbookChannel {
- private _client: WebSocket.w3cwebsocket;
- private _handler: OrderbookChannelHandler;
- private _subscriptionOptsList: OrderbookChannelSubscriptionOpts[] = [];
+ private readonly _client: WebSocket.w3cwebsocket;
+ private readonly _handler: OrderbookChannelHandler;
+ private readonly _subscriptionOptsList: OrderbookChannelSubscriptionOpts[] = [];
/**
* Instantiates a new WebSocketOrderbookChannel instance
* @param client A WebSocket client
diff --git a/packages/connect/test/ws_orderbook_channel_test.ts b/packages/connect/test/ws_orderbook_channel_test.ts
index fed4f2217..5a63cbdcc 100644
--- a/packages/connect/test/ws_orderbook_channel_test.ts
+++ b/packages/connect/test/ws_orderbook_channel_test.ts
@@ -29,7 +29,7 @@ describe('WebSocketOrderbookChannel', () => {
const websocketUrl = 'ws://localhost:8080';
const openClient = new WebSocket.w3cwebsocket(websocketUrl);
Sinon.stub(openClient, 'readyState').get(() => WebSocket.w3cwebsocket.OPEN);
- Sinon.stub(openClient, 'send').callsFake(_.noop);
+ Sinon.stub(openClient, 'send').callsFake(_.noop.bind(_));
const openOrderbookChannel = new WebSocketOrderbookChannel(openClient, emptyOrderbookChannelHandler);
const subscriptionOpts = {
baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json
index a781496ab..cc9ea21e8 100644
--- a/packages/contract-wrappers/package.json
+++ b/packages/contract-wrappers/package.json
@@ -69,7 +69,7 @@
"shx": "^0.2.2",
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/contract-wrappers/test/global_hooks.ts b/packages/contract-wrappers/test/global_hooks.ts
index bf80e0908..05b23d5b8 100644
--- a/packages/contract-wrappers/test/global_hooks.ts
+++ b/packages/contract-wrappers/test/global_hooks.ts
@@ -7,7 +7,7 @@ before('migrate contracts', async function(): Promise<void> {
// HACK: Since the migrations take longer then our global mocha timeout limit
// we manually increase it for this before hook.
const mochaTestTimeoutMs = 50000;
- this.timeout(mochaTestTimeoutMs);
+ this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
const txDefaults = {
gas: devConstants.GAS_LIMIT,
from: devConstants.TESTRPC_FIRST_ADDRESS,
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index 98b133e63..4d23860bf 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -67,7 +67,7 @@
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.2.1",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1",
"yargs": "^10.0.3"
},
diff --git a/packages/contracts/test/utils/asset_wrapper.ts b/packages/contracts/test/utils/asset_wrapper.ts
index f291170a2..3e548d186 100644
--- a/packages/contracts/test/utils/asset_wrapper.ts
+++ b/packages/contracts/test/utils/asset_wrapper.ts
@@ -17,7 +17,7 @@ interface ProxyIdToAssetWrappers {
* the logic that uses it does not need to care what standard a token belongs to.
*/
export class AssetWrapper {
- private _proxyIdToAssetWrappers: ProxyIdToAssetWrappers;
+ private readonly _proxyIdToAssetWrappers: ProxyIdToAssetWrappers;
constructor(assetWrappers: AbstractAssetWrapper[]) {
this._proxyIdToAssetWrappers = {};
_.each(assetWrappers, assetWrapper => {
diff --git a/packages/contracts/test/utils/erc20_wrapper.ts b/packages/contracts/test/utils/erc20_wrapper.ts
index cf1433791..e1863be36 100644
--- a/packages/contracts/test/utils/erc20_wrapper.ts
+++ b/packages/contracts/test/utils/erc20_wrapper.ts
@@ -13,11 +13,11 @@ import { ERC20BalancesByOwner } from './types';
import { txDefaults } from './web3_wrapper';
export class ERC20Wrapper {
- private _tokenOwnerAddresses: string[];
- private _contractOwnerAddress: string;
- private _web3Wrapper: Web3Wrapper;
- private _provider: Provider;
- private _dummyTokenContracts: DummyERC20TokenContract[];
+ private readonly _tokenOwnerAddresses: string[];
+ private readonly _contractOwnerAddress: string;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _provider: Provider;
+ private readonly _dummyTokenContracts: DummyERC20TokenContract[];
private _proxyContract?: ERC20ProxyContract;
private _proxyIdIfExists?: string;
constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
diff --git a/packages/contracts/test/utils/erc721_wrapper.ts b/packages/contracts/test/utils/erc721_wrapper.ts
index a38dfb811..d023b4d02 100644
--- a/packages/contracts/test/utils/erc721_wrapper.ts
+++ b/packages/contracts/test/utils/erc721_wrapper.ts
@@ -13,11 +13,11 @@ import { ERC721TokenIdsByOwner } from './types';
import { txDefaults } from './web3_wrapper';
export class ERC721Wrapper {
- private _tokenOwnerAddresses: string[];
- private _contractOwnerAddress: string;
- private _web3Wrapper: Web3Wrapper;
- private _provider: Provider;
- private _dummyTokenContracts: DummyERC721TokenContract[];
+ private readonly _tokenOwnerAddresses: string[];
+ private readonly _contractOwnerAddress: string;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _provider: Provider;
+ private readonly _dummyTokenContracts: DummyERC721TokenContract[];
private _proxyContract?: ERC721ProxyContract;
private _proxyIdIfExists?: string;
private _initialTokenIdsByOwner: ERC721TokenIdsByOwner = {};
diff --git a/packages/contracts/test/utils/exchange_wrapper.ts b/packages/contracts/test/utils/exchange_wrapper.ts
index a71a0d495..490ea959b 100644
--- a/packages/contracts/test/utils/exchange_wrapper.ts
+++ b/packages/contracts/test/utils/exchange_wrapper.ts
@@ -11,9 +11,9 @@ import { orderUtils } from './order_utils';
import { OrderInfo, SignedTransaction } from './types';
export class ExchangeWrapper {
- private _exchange: ExchangeContract;
- private _web3Wrapper: Web3Wrapper;
- private _logDecoder: LogDecoder;
+ private readonly _exchange: ExchangeContract;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _logDecoder: LogDecoder;
constructor(exchangeContract: ExchangeContract, provider: Provider) {
this._exchange = exchangeContract;
this._web3Wrapper = new Web3Wrapper(provider);
diff --git a/packages/contracts/test/utils/forwarder_wrapper.ts b/packages/contracts/test/utils/forwarder_wrapper.ts
index d227420ee..0d4214402 100644
--- a/packages/contracts/test/utils/forwarder_wrapper.ts
+++ b/packages/contracts/test/utils/forwarder_wrapper.ts
@@ -18,10 +18,10 @@ const ZERO_AMOUNT = new BigNumber(0);
const INSUFFICENT_ORDERS_FOR_MAKER_AMOUNT = 'Unable to satisfy makerAssetFillAmount with provided orders';
export class ForwarderWrapper {
- private _web3Wrapper: Web3Wrapper;
- private _forwarderContract: ForwarderContract;
- private _logDecoder: LogDecoder;
- private _zrxAddress: string;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _forwarderContract: ForwarderContract;
+ private readonly _logDecoder: LogDecoder;
+ private readonly _zrxAddress: string;
private static _createOptimizedSellOrders(signedOrders: SignedOrder[]): MarketSellOrders {
const marketSellOrders = formatters.createMarketSellOrders(signedOrders, ZERO_AMOUNT);
const assetDataId = assetProxyUtils.decodeAssetDataId(signedOrders[0].makerAssetData);
diff --git a/packages/contracts/test/utils/log_decoder.ts b/packages/contracts/test/utils/log_decoder.ts
index 07127ba79..5a4801319 100644
--- a/packages/contracts/test/utils/log_decoder.ts
+++ b/packages/contracts/test/utils/log_decoder.ts
@@ -15,9 +15,9 @@ import { artifacts } from './artifacts';
import { constants } from './constants';
export class LogDecoder {
- private _web3Wrapper: Web3Wrapper;
- private _contractAddress: string;
- private _abiDecoder: AbiDecoder;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _contractAddress: string;
+ private readonly _abiDecoder: AbiDecoder;
public static wrapLogBigNumbers(log: any): any {
const argNames = _.keys(log.args);
for (const argName of argNames) {
diff --git a/packages/contracts/test/utils/match_order_tester.ts b/packages/contracts/test/utils/match_order_tester.ts
index 6145779b0..0d5ad5e9f 100644
--- a/packages/contracts/test/utils/match_order_tester.ts
+++ b/packages/contracts/test/utils/match_order_tester.ts
@@ -14,10 +14,10 @@ chaiSetup.configure();
const expect = chai.expect;
export class MatchOrderTester {
- private _exchangeWrapper: ExchangeWrapper;
- private _erc20Wrapper: ERC20Wrapper;
- private _erc721Wrapper: ERC721Wrapper;
- private _feeTokenAddress: string;
+ private readonly _exchangeWrapper: ExchangeWrapper;
+ private readonly _erc20Wrapper: ERC20Wrapper;
+ private readonly _erc721Wrapper: ERC721Wrapper;
+ private readonly _feeTokenAddress: string;
/// @dev Compares a pair of ERC20 balances and a pair of ERC721 token owners.
/// @param expectedNewERC20BalancesByOwner Expected ERC20 balances.
diff --git a/packages/contracts/test/utils/multi_sig_wrapper.ts b/packages/contracts/test/utils/multi_sig_wrapper.ts
index 2024c177d..8c8055d4a 100644
--- a/packages/contracts/test/utils/multi_sig_wrapper.ts
+++ b/packages/contracts/test/utils/multi_sig_wrapper.ts
@@ -10,9 +10,9 @@ import { constants } from './constants';
import { LogDecoder } from './log_decoder';
export class MultiSigWrapper {
- private _multiSig: MultiSigWalletContract;
- private _web3Wrapper: Web3Wrapper;
- private _logDecoder: LogDecoder;
+ private readonly _multiSig: MultiSigWalletContract;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _logDecoder: LogDecoder;
constructor(multiSigContract: MultiSigWalletContract, provider: Provider) {
this._multiSig = multiSigContract;
this._web3Wrapper = new Web3Wrapper(provider);
diff --git a/packages/contracts/test/utils/order_factory.ts b/packages/contracts/test/utils/order_factory.ts
index c81aff269..63a893695 100644
--- a/packages/contracts/test/utils/order_factory.ts
+++ b/packages/contracts/test/utils/order_factory.ts
@@ -7,8 +7,8 @@ import { constants } from './constants';
import { signingUtils } from './signing_utils';
export class OrderFactory {
- private _defaultOrderParams: Partial<Order>;
- private _privateKey: Buffer;
+ private readonly _defaultOrderParams: Partial<Order>;
+ private readonly _privateKey: Buffer;
constructor(privateKey: Buffer, defaultOrderParams: Partial<Order>) {
this._defaultOrderParams = defaultOrderParams;
this._privateKey = privateKey;
diff --git a/packages/contracts/test/utils/order_factory_from_scenario.ts b/packages/contracts/test/utils/order_factory_from_scenario.ts
index 526505871..e0edbff26 100644
--- a/packages/contracts/test/utils/order_factory_from_scenario.ts
+++ b/packages/contracts/test/utils/order_factory_from_scenario.ts
@@ -24,13 +24,13 @@ const FIVE_UNITS_FIVE_DECIMALS = new BigNumber(500_000);
const ONE_NFT_UNIT = new BigNumber(1);
export class OrderFactoryFromScenario {
- private _userAddresses: string[];
- private _zrxAddress: string;
- private _nonZrxERC20EighteenDecimalTokenAddresses: string[];
- private _erc20FiveDecimalTokenAddresses: string[];
- private _erc721Token: DummyERC721TokenContract;
- private _erc721Balances: ERC721TokenIdsByOwner;
- private _exchangeAddress: string;
+ private readonly _userAddresses: string[];
+ private readonly _zrxAddress: string;
+ private readonly _nonZrxERC20EighteenDecimalTokenAddresses: string[];
+ private readonly _erc20FiveDecimalTokenAddresses: string[];
+ private readonly _erc721Token: DummyERC721TokenContract;
+ private readonly _erc721Balances: ERC721TokenIdsByOwner;
+ private readonly _exchangeAddress: string;
constructor(
userAddresses: string[],
zrxAddress: string,
diff --git a/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts b/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
index a295a40c4..598ee6d29 100644
--- a/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
+++ b/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
@@ -4,7 +4,7 @@ import { BigNumber } from '@0xproject/utils';
import { AssetWrapper } from './asset_wrapper';
export class SimpleAssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher {
- private _assetWrapper: AssetWrapper;
+ private readonly _assetWrapper: AssetWrapper;
constructor(assetWrapper: AssetWrapper) {
this._assetWrapper = assetWrapper;
}
diff --git a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts
index 24afe36b7..ed69ecc63 100644
--- a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts
+++ b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts
@@ -4,8 +4,8 @@ import { BigNumber } from '@0xproject/utils';
import { ExchangeWrapper } from './exchange_wrapper';
export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher {
- private _exchangeWrapper: ExchangeWrapper;
- private _zrxAssetData: string;
+ private readonly _exchangeWrapper: ExchangeWrapper;
+ private readonly _zrxAssetData: string;
constructor(exchange: ExchangeWrapper, zrxAssetData: string) {
this._exchangeWrapper = exchange;
this._zrxAssetData = zrxAssetData;
diff --git a/packages/contracts/test/utils/token_registry_wrapper.ts b/packages/contracts/test/utils/token_registry_wrapper.ts
index 0abf20e03..f1c40e8ff 100644
--- a/packages/contracts/test/utils/token_registry_wrapper.ts
+++ b/packages/contracts/test/utils/token_registry_wrapper.ts
@@ -8,8 +8,8 @@ import { Token } from './types';
import { constants } from './constants';
export class TokenRegWrapper {
- private _tokenReg: TokenRegistryContract;
- private _web3Wrapper: Web3Wrapper;
+ private readonly _tokenReg: TokenRegistryContract;
+ private readonly _web3Wrapper: Web3Wrapper;
constructor(tokenRegContract: TokenRegistryContract, provider: Provider) {
this._tokenReg = tokenRegContract;
this._web3Wrapper = new Web3Wrapper(provider);
diff --git a/packages/contracts/test/utils/transaction_factory.ts b/packages/contracts/test/utils/transaction_factory.ts
index 348c0715d..281c1e30d 100644
--- a/packages/contracts/test/utils/transaction_factory.ts
+++ b/packages/contracts/test/utils/transaction_factory.ts
@@ -15,9 +15,9 @@ const EIP712_ZEROEX_TRANSACTION_SCHEMA: EIP712Schema = {
};
export class TransactionFactory {
- private _signerBuff: Buffer;
- private _exchangeAddress: string;
- private _privateKey: Buffer;
+ private readonly _signerBuff: Buffer;
+ private readonly _exchangeAddress: string;
+ private readonly _privateKey: Buffer;
constructor(privateKey: Buffer, exchangeAddress: string) {
this._privateKey = privateKey;
this._exchangeAddress = exchangeAddress;
diff --git a/packages/contracts/test/utils/web3_wrapper.ts b/packages/contracts/test/utils/web3_wrapper.ts
index c9d83a02d..acb3103b7 100644
--- a/packages/contracts/test/utils/web3_wrapper.ts
+++ b/packages/contracts/test/utils/web3_wrapper.ts
@@ -51,8 +51,10 @@ export const provider = web3Factory.getRpcProvider(providerConfigs);
const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage);
const isProfilerEnabled = env.parseBoolean(EnvVars.SolidityProfiler);
const isRevertTraceEnabled = env.parseBoolean(EnvVars.SolidityRevertTrace);
-const enabledSubproviderCount = _.filter([isCoverageEnabled, isProfilerEnabled, isRevertTraceEnabled], _.identity)
- .length;
+const enabledSubproviderCount = _.filter(
+ [isCoverageEnabled, isProfilerEnabled, isRevertTraceEnabled],
+ _.identity.bind(_),
+).length;
if (enabledSubproviderCount > 1) {
throw new Error(`Only one of coverage, profiler, or revert trace subproviders can be enabled at a time`);
}
diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json
index f0ef24684..82e8c73b9 100644
--- a/packages/dev-utils/package.json
+++ b/packages/dev-utils/package.json
@@ -41,7 +41,7 @@
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/dev-utils/src/blockchain_lifecycle.ts b/packages/dev-utils/src/blockchain_lifecycle.ts
index a0424f01f..a48cb0856 100644
--- a/packages/dev-utils/src/blockchain_lifecycle.ts
+++ b/packages/dev-utils/src/blockchain_lifecycle.ts
@@ -10,8 +10,8 @@ import * as _ from 'lodash';
const MINIMUM_BLOCKS = 3;
export class BlockchainLifecycle {
- private _web3Wrapper: Web3Wrapper;
- private _snapshotIdsStack: number[];
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _snapshotIdsStack: number[];
private _addresses: string[] = [];
private _nodeType: NodeType | undefined;
constructor(web3Wrapper: Web3Wrapper) {
diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json
index 9d4930826..e8652383d 100644
--- a/packages/ethereum-types/package.json
+++ b/packages/ethereum-types/package.json
@@ -40,7 +40,7 @@
"copyfiles": "^1.2.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json
index 4e1ceeac0..63ae9d4ad 100644
--- a/packages/fill-scenarios/package.json
+++ b/packages/fill-scenarios/package.json
@@ -37,7 +37,7 @@
"make-promises-safe": "^1.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/fill-scenarios/src/index.ts b/packages/fill-scenarios/src/index.ts
index f9b69e1f3..3ffcb3aa9 100644
--- a/packages/fill-scenarios/src/index.ts
+++ b/packages/fill-scenarios/src/index.ts
@@ -11,12 +11,12 @@ import { ERC20TokenContract } from './generated_contract_wrappers/erc20_token';
import { ExchangeContract } from './generated_contract_wrappers/exchange';
export class FillScenarios {
- private _web3Wrapper: Web3Wrapper;
- private _userAddresses: string[];
- private _coinbase: string;
- private _zrxTokenAddress: string;
- private _exchangeAddress: string;
- private _erc20ProxyAddress: string;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _userAddresses: string[];
+ private readonly _coinbase: string;
+ private readonly _zrxTokenAddress: string;
+ private readonly _exchangeAddress: string;
+ private readonly _erc20ProxyAddress: string;
constructor(
provider: Provider,
userAddresses: string[],
diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json
index 8ecb41721..e15faeeb5 100644
--- a/packages/json-schemas/package.json
+++ b/packages/json-schemas/package.json
@@ -68,7 +68,7 @@
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typedoc": "0xProject/typedoc",
"typescript": "2.7.1"
},
diff --git a/packages/json-schemas/src/schema_validator.ts b/packages/json-schemas/src/schema_validator.ts
index f0392d1d1..3f303137b 100644
--- a/packages/json-schemas/src/schema_validator.ts
+++ b/packages/json-schemas/src/schema_validator.ts
@@ -7,7 +7,7 @@ import { schemas } from './schemas';
* A validator for [JSON-schemas](http://json-schema.org/)
*/
export class SchemaValidator {
- private _validator: Validator;
+ private readonly _validator: Validator;
/**
* Instantiates a SchemaValidator instance
*/
diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json
index 744e9e69a..3f85bf4b7 100644
--- a/packages/metacoin/package.json
+++ b/packages/metacoin/package.json
@@ -55,7 +55,7 @@
"make-promises-safe": "^1.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
}
}
diff --git a/packages/migrations/package.json b/packages/migrations/package.json
index d4aa73912..e8b749cda 100644
--- a/packages/migrations/package.json
+++ b/packages/migrations/package.json
@@ -46,7 +46,7 @@
"make-promises-safe": "^1.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/migrations/src/utils/artifact_writer.ts b/packages/migrations/src/utils/artifact_writer.ts
index 2da5a09dd..b7522df05 100644
--- a/packages/migrations/src/utils/artifact_writer.ts
+++ b/packages/migrations/src/utils/artifact_writer.ts
@@ -4,8 +4,8 @@ import * as fs from 'fs';
import * as path from 'path';
export class ArtifactWriter {
- private _artifactsDir: string;
- private _networkId: number;
+ private readonly _artifactsDir: string;
+ private readonly _networkId: number;
constructor(artifactsDir: string, networkId: number) {
this._artifactsDir = artifactsDir;
this._networkId = networkId;
diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json
index 7ebe4fb84..f3a6aa793 100644
--- a/packages/monorepo-scripts/package.json
+++ b/packages/monorepo-scripts/package.json
@@ -39,7 +39,7 @@
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"@types/semver": "5.5.0",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts
index b55a88539..85b32ed83 100644
--- a/packages/monorepo-scripts/src/postpublish_utils.ts
+++ b/packages/monorepo-scripts/src/postpublish_utils.ts
@@ -51,8 +51,13 @@ export const postpublishUtils = {
return configs;
},
async runAsync(packageJSON: any, tsConfigJSON: any, cwd: string): Promise<void> {
- const configs = this.generateConfig(packageJSON, tsConfigJSON, cwd);
- await this.publishReleaseNotesAsync(configs.cwd, configs.packageName, configs.version, configs.assets);
+ const configs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd);
+ await postpublishUtils.publishReleaseNotesAsync(
+ configs.cwd,
+ configs.packageName,
+ configs.version,
+ configs.assets,
+ );
if (
!_.isUndefined(configs.docPublishConfigs.s3BucketPath) ||
!_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath)
@@ -69,7 +74,7 @@ export const postpublishUtils = {
}
},
async publishDocsToStagingAsync(packageJSON: any, tsConfigJSON: any, cwd: string): Promise<void> {
- const configs = this.generateConfig(packageJSON, tsConfigJSON, cwd);
+ const configs = postpublishUtils.generateConfig(packageJSON, tsConfigJSON, cwd);
if (_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath)) {
utils.log('config.postpublish.docPublishConfigs.s3StagingBucketPath entry in package.json not found!');
return;
@@ -84,10 +89,10 @@ export const postpublishUtils = {
);
},
async publishReleaseNotesAsync(cwd: string, packageName: string, version: string, assets: string[]): Promise<void> {
- const notes = this.getReleaseNotes(packageName, version);
- const releaseName = this.getReleaseName(packageName, version);
- const tag = this.getTag(packageName, version);
- this.adjustAssetPaths(cwd, assets);
+ const notes = postpublishUtils.getReleaseNotes(packageName, version);
+ const releaseName = postpublishUtils.getReleaseName(packageName, version);
+ const tag = postpublishUtils.getTag(packageName, version);
+ postpublishUtils.adjustAssetPaths(cwd, assets);
utils.log('POSTPUBLISH: Releasing ', releaseName, '...');
await publishReleaseAsync({
token: constants.githubPersonalAccessToken,
@@ -165,7 +170,7 @@ export const postpublishUtils = {
version: string,
S3BucketPath: string,
): Promise<void> {
- const fileIncludesAdjusted = this.adjustFileIncludePaths(fileIncludes, cwd);
+ const fileIncludesAdjusted = postpublishUtils.adjustFileIncludePaths(fileIncludes, cwd);
const projectFiles = fileIncludesAdjusted.join(' ');
const jsonFilePath = `${cwd}/${generatedDocsDirectoryName}/index.json`;
const result = await execAsync(
diff --git a/packages/monorepo-scripts/src/utils/changelog_utils.ts b/packages/monorepo-scripts/src/utils/changelog_utils.ts
index dbafb6f16..4781b3b7d 100644
--- a/packages/monorepo-scripts/src/utils/changelog_utils.ts
+++ b/packages/monorepo-scripts/src/utils/changelog_utils.ts
@@ -10,7 +10,7 @@ import { Change, Changelog, VersionChangelog } from '../types';
const CHANGELOG_MD_HEADER = `
<!--
-This file is auto-generated using the monorepo-scripts package. Don't edit directly.
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
Edit the package's CHANGELOG.json file only.
-->
@@ -74,7 +74,7 @@ export const changelogUtils = {
},
getChangelogOrCreateIfMissing(packageName: string, packageLocation: string): Changelog {
const changelogJSONPath = path.join(packageLocation, 'CHANGELOG.json');
- let changelogJsonIfExists = this.getChangelogJSONIfExists(changelogJSONPath);
+ let changelogJsonIfExists = changelogUtils.getChangelogJSONIfExists(changelogJSONPath);
if (_.isUndefined(changelogJsonIfExists)) {
// If none exists, create new, empty one.
changelogJsonIfExists = '[]';
@@ -91,12 +91,12 @@ export const changelogUtils = {
async writeChangelogJsonFileAsync(packageLocation: string, changelog: Changelog): Promise<void> {
const changelogJSONPath = path.join(packageLocation, 'CHANGELOG.json');
fs.writeFileSync(changelogJSONPath, JSON.stringify(changelog, null, '\t'));
- await this.prettifyAsync(changelogJSONPath, constants.monorepoRootPath);
+ await changelogUtils.prettifyAsync(changelogJSONPath, constants.monorepoRootPath);
},
async writeChangelogMdFileAsync(packageLocation: string, changelogMdString: string): Promise<void> {
const changelogMarkdownPath = path.join(packageLocation, 'CHANGELOG.md');
fs.writeFileSync(changelogMarkdownPath, changelogMdString);
- await this.prettifyAsync(changelogMarkdownPath, constants.monorepoRootPath);
+ await changelogUtils.prettifyAsync(changelogMarkdownPath, constants.monorepoRootPath);
},
async prettifyAsync(filePath: string, cwd: string): Promise<void> {
await execAsync(`prettier --write ${filePath} --config .prettierrc`, {
diff --git a/packages/monorepo-scripts/src/utils/utils.ts b/packages/monorepo-scripts/src/utils/utils.ts
index f819ab6f1..be3ad950f 100644
--- a/packages/monorepo-scripts/src/utils/utils.ts
+++ b/packages/monorepo-scripts/src/utils/utils.ts
@@ -13,7 +13,7 @@ export const utils = {
console.log(...args); // tslint:disable-line:no-console
},
async getUpdatedLernaPackagesAsync(shouldIncludePrivate: boolean): Promise<LernaPackage[]> {
- const updatedPublicPackages = await this.getLernaUpdatedPackagesAsync(shouldIncludePrivate);
+ const updatedPublicPackages = await utils.getLernaUpdatedPackagesAsync(shouldIncludePrivate);
const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name);
const allLernaPackages = lernaGetPackages(constants.monorepoRootPath);
@@ -110,7 +110,7 @@ export const utils = {
} catch (err) {
throw new Error(`Failed to delete local git tag. Got err: ${err}`);
}
- this.log(`Removed local tag: ${tagName}`);
+ utils.log(`Removed local tag: ${tagName}`);
},
async removeRemoteTagAsync(tagName: string): Promise<void> {
try {
@@ -120,6 +120,6 @@ export const utils = {
} catch (err) {
throw new Error(`Failed to delete remote git tag. Got err: ${err}`);
}
- this.log(`Removed remote tag: ${tagName}`);
+ utils.log(`Removed remote tag: ${tagName}`);
},
};
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json
index 8f5041609..a8205f848 100644
--- a/packages/order-utils/package.json
+++ b/packages/order-utils/package.json
@@ -67,7 +67,7 @@
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"sinon": "^4.0.0",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typedoc": "0xProject/typedoc",
"typescript": "2.7.1"
},
diff --git a/packages/order-utils/src/exchange_transfer_simulator.ts b/packages/order-utils/src/exchange_transfer_simulator.ts
index 72ed85406..c3a4f9c2a 100644
--- a/packages/order-utils/src/exchange_transfer_simulator.ts
+++ b/packages/order-utils/src/exchange_transfer_simulator.ts
@@ -34,7 +34,7 @@ const ERR_MSG_MAPPING = {
};
export class ExchangeTransferSimulator {
- private _store: AbstractBalanceAndProxyAllowanceLazyStore;
+ private readonly _store: AbstractBalanceAndProxyAllowanceLazyStore;
private static _throwValidationError(
failureReason: FailureReason,
tradeSide: TradeSide,
diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts
index dd45a1298..189bf4180 100644
--- a/packages/order-utils/src/order_state_utils.ts
+++ b/packages/order-utils/src/order_state_utils.ts
@@ -27,8 +27,8 @@ interface SidedOrderRelevantState {
const ACCEPTABLE_RELATIVE_ROUNDING_ERROR = 0.0001;
export class OrderStateUtils {
- private _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher;
- private _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher;
+ private readonly _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher;
+ private readonly _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher;
private static _validateIfOrderIsValid(
signedOrder: SignedOrder,
sidedOrderRelevantState: SidedOrderRelevantState,
diff --git a/packages/order-utils/src/order_validation_utils.ts b/packages/order-utils/src/order_validation_utils.ts
index 94df3ef82..67d747081 100644
--- a/packages/order-utils/src/order_validation_utils.ts
+++ b/packages/order-utils/src/order_validation_utils.ts
@@ -13,7 +13,7 @@ import { isValidSignatureAsync } from './signature_utils';
import { utils } from './utils';
export class OrderValidationUtils {
- private _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher;
+ private readonly _orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher;
public static isRoundingError(numerator: BigNumber, denominator: BigNumber, target: BigNumber): boolean {
// Solidity's mulmod() in JS
// Source: https://solidity.readthedocs.io/en/latest/units-and-global-variables.html#mathematical-and-cryptographic-functions
diff --git a/packages/order-utils/src/remaining_fillable_calculator.ts b/packages/order-utils/src/remaining_fillable_calculator.ts
index 29e19e5ab..7022aa979 100644
--- a/packages/order-utils/src/remaining_fillable_calculator.ts
+++ b/packages/order-utils/src/remaining_fillable_calculator.ts
@@ -1,14 +1,14 @@
import { BigNumber } from '@0xproject/utils';
export class RemainingFillableCalculator {
- private _isTraderAssetZRX: boolean;
+ private readonly _isTraderAssetZRX: boolean;
// Transferrable Amount is the minimum of Approval and Balance
- private _transferrableAssetAmount: BigNumber;
- private _transferrableFeeAmount: BigNumber;
- private _remainingOrderAssetAmount: BigNumber;
- private _remainingOrderFeeAmount: BigNumber;
- private _orderFee: BigNumber;
- private _orderAssetAmount: BigNumber;
+ private readonly _transferrableAssetAmount: BigNumber;
+ private readonly _transferrableFeeAmount: BigNumber;
+ private readonly _remainingOrderAssetAmount: BigNumber;
+ private readonly _remainingOrderFeeAmount: BigNumber;
+ private readonly _orderFee: BigNumber;
+ private readonly _orderAssetAmount: BigNumber;
constructor(
orderFee: BigNumber,
orderAssetAmount: BigNumber,
diff --git a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts
index e7352119d..6d5a02adf 100644
--- a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts
+++ b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts
@@ -8,7 +8,7 @@ import { AbstractBalanceAndProxyAllowanceLazyStore } from '../abstract/abstract_
* Copy on read store for balances/proxyAllowances of tokens/accounts
*/
export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProxyAllowanceLazyStore {
- private _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher;
+ private readonly _balanceAndProxyAllowanceFetcher: AbstractBalanceAndProxyAllowanceFetcher;
private _balance: {
[assetData: string]: {
[userAddress: string]: BigNumber;
diff --git a/packages/order-utils/test/exchange_transfer_simulator_test.ts b/packages/order-utils/test/exchange_transfer_simulator_test.ts
index 37b2bd712..f86b05e20 100644
--- a/packages/order-utils/test/exchange_transfer_simulator_test.ts
+++ b/packages/order-utils/test/exchange_transfer_simulator_test.ts
@@ -34,7 +34,7 @@ describe('ExchangeTransferSimulator', async () => {
let erc20ProxyAddress: string;
before(async function(): Promise<void> {
const mochaTestTimeoutMs = 20000;
- this.timeout(mochaTestTimeoutMs);
+ this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
[coinbase, sender, recipient] = userAddresses;
@@ -77,8 +77,7 @@ describe('ExchangeTransferSimulator', async () => {
describe('#transferFromAsync', function(): void {
// HACK: For some reason these tests need a slightly longer timeout
const mochaTestTimeoutMs = 3000;
- this.timeout(mochaTestTimeoutMs);
-
+ this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
beforeEach(() => {
const simpleERC20BalanceAndProxyAllowanceFetcher = new SimpleERC20BalanceAndProxyAllowanceFetcher(
(dummyERC20Token as any) as ERC20TokenContract,
diff --git a/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts b/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts
index 68f6a164c..279a5c0db 100644
--- a/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts
+++ b/packages/order-utils/test/utils/simple_erc20_balance_and_proxy_allowance_fetcher.ts
@@ -5,8 +5,8 @@ import { AbstractBalanceAndProxyAllowanceFetcher } from '../../src/abstract/abst
import { ERC20TokenContract } from '../../src/generated_contract_wrappers/erc20_token';
export class SimpleERC20BalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher {
- private _erc20TokenContract: ERC20TokenContract;
- private _erc20ProxyAddress: string;
+ private readonly _erc20TokenContract: ERC20TokenContract;
+ private readonly _erc20ProxyAddress: string;
constructor(erc20TokenWrapper: ERC20TokenContract, erc20ProxyAddress: string) {
this._erc20TokenContract = erc20TokenWrapper;
this._erc20ProxyAddress = erc20ProxyAddress;
diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json
index 27d64a371..30cd90ef9 100644
--- a/packages/order-watcher/package.json
+++ b/packages/order-watcher/package.json
@@ -73,7 +73,7 @@
"shx": "^0.2.2",
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts
index 60a3c6297..8ad52989b 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<Block, Log> | 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<string>;
- private _expiration: { [orderHash: string]: BigNumber } = {};
- private _orderExpirationCheckingIntervalMs: number;
- private _expirationMarginMs: number;
+ private readonly _orderHashByExpirationRBTree: RBTree<string>;
+ 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 95671684f..765747e35 100644
--- a/packages/order-watcher/src/order_watcher/order_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/order_watcher.ts
@@ -70,18 +70,18 @@ const STATE_LAYER = BlockParamLiteral.Latest;
* 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`);
},
};
diff --git a/packages/order-watcher/test/global_hooks.ts b/packages/order-watcher/test/global_hooks.ts
index 30b0cd697..8ff4a120f 100644
--- a/packages/order-watcher/test/global_hooks.ts
+++ b/packages/order-watcher/test/global_hooks.ts
@@ -7,7 +7,7 @@ before('migrate contracts', async function(): Promise<void> {
// HACK: Since the migrations take longer then our global mocha timeout limit
// we manually increase it for this before hook.
const mochaTestTimeoutMs = 25000;
- this.timeout(mochaTestTimeoutMs);
+ this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
const txDefaults = {
gas: devConstants.GAS_LIMIT,
from: devConstants.TESTRPC_FIRST_ADDRESS,
diff --git a/packages/order-watcher/test/order_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts
index 2889051bc..8e9223efe 100644
--- a/packages/order-watcher/test/order_watcher_test.ts
+++ b/packages/order-watcher/test/order_watcher_test.ts
@@ -116,8 +116,8 @@ describe('OrderWatcher', () => {
orderWatcher.unsubscribe();
});
it('should fail when trying to subscribe twice', async () => {
- orderWatcher.subscribe(_.noop);
- expect(() => orderWatcher.subscribe(_.noop)).to.throw(OrderWatcherError.SubscriptionAlreadyPresent);
+ orderWatcher.subscribe(_.noop.bind(_));
+ expect(() => orderWatcher.subscribe(_.noop.bind(_))).to.throw(OrderWatcherError.SubscriptionAlreadyPresent);
});
});
describe('tests with cleanup', async () => {
diff --git a/packages/order-watcher/test/utils/token_utils.ts b/packages/order-watcher/test/utils/token_utils.ts
index e1191b5bb..f91b3797f 100644
--- a/packages/order-watcher/test/utils/token_utils.ts
+++ b/packages/order-watcher/test/utils/token_utils.ts
@@ -7,7 +7,7 @@ const PROTOCOL_TOKEN_SYMBOL = 'ZRX';
const WETH_TOKEN_SYMBOL = 'WETH';
export class TokenUtils {
- private _tokens: Token[];
+ private readonly _tokens: Token[];
constructor(tokens: Token[]) {
this._tokens = tokens;
}
diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts
index 6f4f39f00..5d46dbda6 100644
--- a/packages/react-docs/src/docs_info.ts
+++ b/packages/react-docs/src/docs_info.ts
@@ -27,7 +27,7 @@ export class DocsInfo {
public sectionNameToMarkdown: { [sectionName: string]: string };
public contractsByVersionByNetworkId?: ContractsByVersionByNetworkId;
public typeConfigs: DocsInfoTypeConfigs;
- private _docsInfo: DocsInfoConfig;
+ private readonly _docsInfo: DocsInfoConfig;
constructor(config: DocsInfoConfig) {
this.id = config.id;
this.type = config.type;
diff --git a/packages/react-docs/src/utils/doxity_utils.ts b/packages/react-docs/src/utils/doxity_utils.ts
index 374ee07dd..6815daa0c 100644
--- a/packages/react-docs/src/utils/doxity_utils.ts
+++ b/packages/react-docs/src/utils/doxity_utils.ts
@@ -31,8 +31,8 @@ export const doxityUtils = {
comment: doxityConstructor.details,
returnComment: doxityConstructor.return,
callPath: '',
- parameters: this._convertParameters(doxityConstructor.inputs),
- returnType: this._convertType(doxityContractObj.name),
+ parameters: doxityUtils._convertParameters(doxityConstructor.inputs),
+ returnType: doxityUtils._convertType(doxityContractObj.name),
};
constructors.push(constructor);
}
@@ -40,7 +40,7 @@ export const doxityUtils = {
const doxityMethods: DoxityAbiDoc[] = _.filter<DoxityAbiDoc>(
doxityContractObj.abiDocs,
(abiDoc: DoxityAbiDoc) => {
- return this._isMethod(abiDoc);
+ return doxityUtils._isMethod(abiDoc);
},
);
const methods: SolidityMethod[] = _.map<DoxityAbiDoc, SolidityMethod>(
@@ -52,10 +52,10 @@ export const doxityUtils = {
// no-op. It's already undefined
} else if (outputs.length === 1) {
const outputsType = outputs[0].type;
- returnTypeIfExists = this._convertType(outputsType);
+ returnTypeIfExists = doxityUtils._convertType(outputsType);
} else {
const outputsType = `[${_.map(outputs, output => output.type).join(', ')}]`;
- returnTypeIfExists = this._convertType(outputsType);
+ returnTypeIfExists = doxityUtils._convertType(outputsType);
}
// For ZRXToken, we want to convert it to zrxToken, rather then simply zRXToken
const callPath =
@@ -70,7 +70,7 @@ export const doxityUtils = {
comment: doxityMethod.details,
returnComment: doxityMethod.return,
callPath,
- parameters: this._convertParameters(doxityMethod.inputs),
+ parameters: doxityUtils._convertParameters(doxityMethod.inputs),
returnType: returnTypeIfExists,
};
return method;
@@ -80,7 +80,7 @@ export const doxityUtils = {
const doxityProperties: DoxityAbiDoc[] = _.filter<DoxityAbiDoc>(
doxityContractObj.abiDocs,
(abiDoc: DoxityAbiDoc) => {
- return this._isProperty(abiDoc);
+ return doxityUtils._isProperty(abiDoc);
},
);
const properties = _.map<DoxityAbiDoc, Property>(doxityProperties, (doxityProperty: DoxityAbiDoc) => {
@@ -92,7 +92,7 @@ export const doxityUtils = {
}
const property = {
name: doxityProperty.name,
- type: this._convertType(typeName),
+ type: doxityUtils._convertType(typeName),
comment: doxityProperty.details,
};
return property;
@@ -105,7 +105,7 @@ export const doxityUtils = {
const events = _.map(doxityEvents, doxityEvent => {
const event = {
name: doxityEvent.name,
- eventArgs: this._convertEventArgs(doxityEvent.inputs),
+ eventArgs: doxityUtils._convertEventArgs(doxityEvent.inputs),
};
return event;
});
@@ -129,7 +129,7 @@ export const doxityUtils = {
name: input.name,
comment: input.description,
isOptional: false,
- type: this._convertType(input.type),
+ type: doxityUtils._convertType(input.type),
};
return parameter;
});
@@ -167,7 +167,7 @@ export const doxityUtils = {
const eventArg = {
isIndexed: input.indexed,
name: input.name,
- type: this._convertType(input.type),
+ type: doxityUtils._convertType(input.type),
};
return eventArg;
});
diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts
index 5633d9040..a6d938e94 100644
--- a/packages/react-docs/src/utils/typedoc_utils.ts
+++ b/packages/react-docs/src/utils/typedoc_utils.ts
@@ -235,7 +235,7 @@ export const typeDocUtils = {
childTypeIfExists = {
name: child.name,
typeDocType: TypeDocTypes.Reflection,
- method: this._convertMethod(child, isConstructor, sections, sectionName, docId),
+ method: typeDocUtils._convertMethod(child, isConstructor, sections, sectionName, docId),
};
}
const c: CustomTypeChild = {
diff --git a/packages/react-shared/src/components/nested_sidebar_menu.tsx b/packages/react-shared/src/components/nested_sidebar_menu.tsx
index 9b08e3c53..aa00d5985 100644
--- a/packages/react-shared/src/components/nested_sidebar_menu.tsx
+++ b/packages/react-shared/src/components/nested_sidebar_menu.tsx
@@ -41,7 +41,7 @@ const styles: Styles = {
export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, NestedSidebarMenuState> {
public static defaultProps: Partial<NestedSidebarMenuProps> = {
shouldDisplaySectionHeaders: true,
- onMenuItemClick: _.noop,
+ onMenuItemClick: _.noop.bind(_),
};
public render(): React.ReactNode {
const navigation = _.map(this.props.topLevelMenu, (menuItems: string[], sectionName: string) => {
diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json
index 8460420ad..99e00cdc2 100644
--- a/packages/sol-compiler/package.json
+++ b/packages/sol-compiler/package.json
@@ -68,7 +68,7 @@
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typedoc": "0xProject/typedoc",
"types-bn": "^0.0.1",
"typescript": "2.7.1",
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts
index e61c606be..3620a3ec1 100644
--- a/packages/sol-compiler/src/compiler.ts
+++ b/packages/sol-compiler/src/compiler.ts
@@ -58,13 +58,13 @@ const CONFIG_FILE = 'compiler.json';
* to artifact files.
*/
export class Compiler {
- private _resolver: Resolver;
- private _nameResolver: NameResolver;
- private _contractsDir: string;
- private _compilerSettings: solc.CompilerSettings;
- private _artifactsDir: string;
- private _solcVersionIfExists: string | undefined;
- private _specifiedContracts: string[] | TYPE_ALL_FILES_IDENTIFIER;
+ private readonly _resolver: Resolver;
+ private readonly _nameResolver: NameResolver;
+ private readonly _contractsDir: string;
+ private readonly _compilerSettings: solc.CompilerSettings;
+ private readonly _artifactsDir: string;
+ private readonly _solcVersionIfExists: string | undefined;
+ private readonly _specifiedContracts: string[] | TYPE_ALL_FILES_IDENTIFIER;
/**
* Instantiates a new instance of the Compiler class.
* @return An instance of the Compiler class.
diff --git a/packages/sol-compiler/test/compiler_test.ts b/packages/sol-compiler/test/compiler_test.ts
index ce359dceb..c9e141ee9 100644
--- a/packages/sol-compiler/test/compiler_test.ts
+++ b/packages/sol-compiler/test/compiler_test.ts
@@ -12,7 +12,7 @@ import { constants } from './util/constants';
const expect = chai.expect;
describe('#Compiler', function(): void {
- this.timeout(constants.timeoutMs);
+ this.timeout(constants.timeoutMs); // tslint:disable-line:no-invalid-this
const artifactsDir = `${__dirname}/fixtures/artifacts`;
const contractsDir = `${__dirname}/fixtures/contracts`;
const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json
index 8553da7a4..cfdc14123 100644
--- a/packages/sol-cov/package.json
+++ b/packages/sol-cov/package.json
@@ -86,7 +86,7 @@
"nyc": "^11.0.1",
"shx": "^0.2.2",
"sinon": "^4.0.0",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typedoc": "0xProject/typedoc",
"typescript": "2.7.1"
},
diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
index 220a9f98c..8e03bf7fd 100644
--- a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
+++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts
@@ -12,8 +12,8 @@ import { AbstractArtifactAdapter } from './abstract_artifact_adapter';
const CONFIG_FILE = 'compiler.json';
export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter {
- private _artifactsPath: string;
- private _sourcesPath: string;
+ private readonly _artifactsPath: string;
+ private readonly _sourcesPath: string;
constructor(artifactsPath?: string, sourcesPath?: string) {
super();
const config: CompilerOptions = fs.existsSync(CONFIG_FILE)
diff --git a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts
index 53449e5e1..53b77aed5 100644
--- a/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts
+++ b/packages/sol-cov/src/artifact_adapters/truffle_artifact_adapter.ts
@@ -7,8 +7,8 @@ import { AbstractArtifactAdapter } from './abstract_artifact_adapter';
import { SolCompilerArtifactAdapter } from './sol_compiler_artifact_adapter';
export class TruffleArtifactAdapter extends AbstractArtifactAdapter {
- private _solcVersion: string;
- private _sourcesPath: string;
+ private readonly _solcVersion: string;
+ private readonly _sourcesPath: string;
constructor(sourcesPath: string, solcVersion: string) {
super();
this._solcVersion = solcVersion;
diff --git a/packages/sol-cov/src/ast_visitor.ts b/packages/sol-cov/src/ast_visitor.ts
index a6bca4704..e55cdf6ec 100644
--- a/packages/sol-cov/src/ast_visitor.ts
+++ b/packages/sol-cov/src/ast_visitor.ts
@@ -18,15 +18,15 @@ enum BranchType {
export class ASTVisitor {
private _entryId = 0;
- private _fnMap: FnMap = {};
- private _branchMap: BranchMap = {};
- private _modifiersStatementIds: number[] = [];
- private _statementMap: StatementMap = {};
- private _locationByOffset: LocationByOffset;
- private _ignoreRangesBeginningAt: number[];
+ private readonly _fnMap: FnMap = {};
+ private readonly _branchMap: BranchMap = {};
+ private readonly _modifiersStatementIds: number[] = [];
+ private readonly _statementMap: StatementMap = {};
+ private readonly _locationByOffset: LocationByOffset;
+ private readonly _ignoreRangesBeginningAt: number[];
// keep track of contract/function ranges that are to be ignored
// so we can also ignore any children nodes within the contract/function
- private _ignoreRangesWithin: Array<[number, number]> = [];
+ private readonly _ignoreRangesWithin: Array<[number, number]> = [];
constructor(locationByOffset: LocationByOffset, ignoreRangesBeginningAt: number[] = []) {
this._locationByOffset = locationByOffset;
this._ignoreRangesBeginningAt = ignoreRangesBeginningAt;
diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts
index 45843bc96..9667e891c 100644
--- a/packages/sol-cov/src/coverage_subprovider.ts
+++ b/packages/sol-cov/src/coverage_subprovider.ts
@@ -23,7 +23,7 @@ import { utils } from './utils';
* It's used to compute your code coverage while running solidity tests.
*/
export class CoverageSubprovider extends TraceInfoSubprovider {
- private _coverageCollector: TraceCollector;
+ private readonly _coverageCollector: TraceCollector;
/**
* Instantiates a CoverageSubprovider instance
* @param artifactAdapter Adapter for used artifacts format (0x, truffle, giveth, etc.)
diff --git a/packages/sol-cov/src/get_source_range_snippet.ts b/packages/sol-cov/src/get_source_range_snippet.ts
index 30d6ec802..bea17beae 100644
--- a/packages/sol-cov/src/get_source_range_snippet.ts
+++ b/packages/sol-cov/src/get_source_range_snippet.ts
@@ -38,7 +38,7 @@ export function getSourceRangeSnippet(sourceRange: SourceRange, sourceCode: stri
// A visitor which collects ASTInfo for most nodes in the AST.
class ASTInfoVisitor {
- private _astInfos: ASTInfo[] = [];
+ private readonly _astInfos: ASTInfo[] = [];
public getASTInfoForRange(sourceRange: SourceRange): ASTInfo | null {
// HACK(albrow): Sometimes the source range doesn't exactly match that
// of astInfo. To work around that we try with a +/-1 offset on
diff --git a/packages/sol-cov/src/profiler_subprovider.ts b/packages/sol-cov/src/profiler_subprovider.ts
index 9f98da524..ae9351f17 100644
--- a/packages/sol-cov/src/profiler_subprovider.ts
+++ b/packages/sol-cov/src/profiler_subprovider.ts
@@ -12,7 +12,7 @@ import { utils } from './utils';
* ProfilerSubprovider is used to profile Solidity code while running tests.
*/
export class ProfilerSubprovider extends TraceInfoSubprovider {
- private _profilerCollector: TraceCollector;
+ private readonly _profilerCollector: TraceCollector;
/**
* Instantiates a ProfilerSubprovider instance
* @param artifactAdapter Adapter for used artifacts format (0x, truffle, giveth, etc.)
diff --git a/packages/sol-cov/src/revert_trace_subprovider.ts b/packages/sol-cov/src/revert_trace_subprovider.ts
index fed305bd3..6ccf59653 100644
--- a/packages/sol-cov/src/revert_trace_subprovider.ts
+++ b/packages/sol-cov/src/revert_trace_subprovider.ts
@@ -18,8 +18,8 @@ import { utils } from './utils';
export class RevertTraceSubprovider extends TraceCollectionSubprovider {
// Lock is used to not accept normal transactions while doing call/snapshot magic because they'll be reverted later otherwise
private _contractsData!: ContractData[];
- private _artifactAdapter: AbstractArtifactAdapter;
- private _logger: Logger;
+ private readonly _artifactAdapter: AbstractArtifactAdapter;
+ private readonly _logger: Logger;
/**
* Instantiates a RevertTraceSubprovider instance
diff --git a/packages/sol-cov/src/trace_collection_subprovider.ts b/packages/sol-cov/src/trace_collection_subprovider.ts
index 9866472b9..b530b59db 100644
--- a/packages/sol-cov/src/trace_collection_subprovider.ts
+++ b/packages/sol-cov/src/trace_collection_subprovider.ts
@@ -32,10 +32,10 @@ export interface TraceCollectionSubproviderConfig {
export abstract class TraceCollectionSubprovider extends Subprovider {
protected _web3Wrapper!: Web3Wrapper;
// Lock is used to not accept normal transactions while doing call/snapshot magic because they'll be reverted later otherwise
- private _lock = new Lock();
- private _defaultFromAddress: string;
+ private readonly _lock = new Lock();
+ private readonly _defaultFromAddress: string;
private _isEnabled = true;
- private _config: TraceCollectionSubproviderConfig;
+ private readonly _config: TraceCollectionSubproviderConfig;
/**
* Instantiates a TraceCollectionSubprovider instance
* @param defaultFromAddress default from address to use when sending transactions
diff --git a/packages/sol-cov/src/trace_collector.ts b/packages/sol-cov/src/trace_collector.ts
index 1b458edec..3e2ae3516 100644
--- a/packages/sol-cov/src/trace_collector.ts
+++ b/packages/sol-cov/src/trace_collector.ts
@@ -33,11 +33,11 @@ export type SingleFileSubtraceHandler = (
* TraceCollector is used by CoverageSubprovider to compute code coverage based on collected trace data.
*/
export class TraceCollector {
- private _artifactAdapter: AbstractArtifactAdapter;
- private _logger: Logger;
+ private readonly _artifactAdapter: AbstractArtifactAdapter;
+ private readonly _logger: Logger;
private _contractsData!: ContractData[];
- private _collector = new Collector();
- private _singleFileSubtraceHandler: SingleFileSubtraceHandler;
+ private readonly _collector = new Collector();
+ private readonly _singleFileSubtraceHandler: SingleFileSubtraceHandler;
/**
* Instantiates a TraceCollector instance
diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json
index 715b19d0e..f3fd62a2e 100644
--- a/packages/sol-resolver/package.json
+++ b/packages/sol-resolver/package.json
@@ -29,7 +29,7 @@
"copyfiles": "^1.2.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts b/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
index 8f6af9be0..338f334f4 100644
--- a/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/fallthrough_resolver.ts
@@ -5,7 +5,7 @@ import { ContractSource } from '../types';
import { Resolver } from './resolver';
export class FallthroughResolver extends Resolver {
- private _resolvers: Resolver[] = [];
+ private readonly _resolvers: Resolver[] = [];
public appendResolver(resolver: Resolver): void {
this._resolvers.push(resolver);
}
diff --git a/packages/sol-resolver/src/resolvers/name_resolver.ts b/packages/sol-resolver/src/resolvers/name_resolver.ts
index bcd98615f..d6ac6a499 100644
--- a/packages/sol-resolver/src/resolvers/name_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/name_resolver.ts
@@ -8,7 +8,7 @@ import { EnumerableResolver } from './enumerable_resolver';
const SOLIDITY_FILE_EXTENSION = '.sol';
export class NameResolver extends EnumerableResolver {
- private _contractsDir: string;
+ private readonly _contractsDir: string;
constructor(contractsDir: string) {
super();
this._contractsDir = contractsDir;
diff --git a/packages/sol-resolver/src/resolvers/npm_resolver.ts b/packages/sol-resolver/src/resolvers/npm_resolver.ts
index 2c0a44aad..9f8617145 100644
--- a/packages/sol-resolver/src/resolvers/npm_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/npm_resolver.ts
@@ -6,7 +6,7 @@ import { ContractSource } from '../types';
import { Resolver } from './resolver';
export class NPMResolver extends Resolver {
- private _packagePath: string;
+ private readonly _packagePath: string;
constructor(packagePath: string) {
super();
this._packagePath = packagePath;
diff --git a/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts b/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts
index 2317ede83..77103b8c1 100644
--- a/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts
@@ -6,7 +6,7 @@ import { ContractSource } from '../types';
import { Resolver } from './resolver';
export class RelativeFSResolver extends Resolver {
- private _contractsDir: string;
+ private readonly _contractsDir: string;
constructor(contractsDir: string) {
super();
this._contractsDir = contractsDir;
diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json
index 29a2dcfcb..9974111e6 100644
--- a/packages/sra-report/package.json
+++ b/packages/sra-report/package.json
@@ -65,7 +65,7 @@
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"publishConfig": {
diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json
index 796d87cf4..02e51a614 100644
--- a/packages/subproviders/package.json
+++ b/packages/subproviders/package.json
@@ -82,7 +82,7 @@
"nyc": "^11.0.1",
"shx": "^0.2.2",
"sinon": "^4.0.0",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typedoc": "0xProject/typedoc",
"typescript": "2.7.1",
"webpack": "^3.1.0"
diff --git a/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts b/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts
index a9ebbb790..454dae58e 100644
--- a/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts
+++ b/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts
@@ -12,8 +12,8 @@ import { PrivateKeyWalletSubprovider } from './private_key_wallet';
* Source: https://github.com/MetaMask/provider-engine/blob/master/subproviders/subprovider.js
*/
export class EthLightwalletSubprovider extends BaseWalletSubprovider {
- private _keystore: lightwallet.keystore;
- private _pwDerivedKey: Uint8Array;
+ private readonly _keystore: lightwallet.keystore;
+ private readonly _pwDerivedKey: Uint8Array;
constructor(keystore: lightwallet.keystore, pwDerivedKey: Uint8Array) {
super();
this._keystore = keystore;
diff --git a/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts b/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts
index d750505e7..bc1b34aba 100644
--- a/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts
+++ b/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts
@@ -14,7 +14,7 @@ import { Subprovider } from './subprovider';
* It intercepts the `eth_estimateGas` JSON RPC call and always returns a constant gas amount when queried.
*/
export class FakeGasEstimateSubprovider extends Subprovider {
- private _constantGasAmount: number;
+ private readonly _constantGasAmount: number;
/**
* Instantiates an instance of the FakeGasEstimateSubprovider
* @param constantGasAmount The constant gas amount you want returned
diff --git a/packages/subproviders/src/subproviders/ganache.ts b/packages/subproviders/src/subproviders/ganache.ts
index 79c43bc68..986094dba 100644
--- a/packages/subproviders/src/subproviders/ganache.ts
+++ b/packages/subproviders/src/subproviders/ganache.ts
@@ -10,7 +10,7 @@ import { Subprovider } from './subprovider';
* It intercepts all JSON RPC requests and relays them to an in-process ganache instance.
*/
export class GanacheSubprovider extends Subprovider {
- private _ganacheProvider: Provider;
+ private readonly _ganacheProvider: Provider;
/**
* Instantiates a GanacheSubprovider
* @param opts The desired opts with which to instantiate the Ganache provider
diff --git a/packages/subproviders/src/subproviders/ledger.ts b/packages/subproviders/src/subproviders/ledger.ts
index 8345be33c..6ad5de2e2 100644
--- a/packages/subproviders/src/subproviders/ledger.ts
+++ b/packages/subproviders/src/subproviders/ledger.ts
@@ -32,14 +32,14 @@ const DEFAULT_ADDRESS_SEARCH_LIMIT = 1000;
*/
export class LedgerSubprovider extends BaseWalletSubprovider {
// tslint:disable-next-line:no-unused-variable
- private _nonceLock = new Lock();
- private _connectionLock = new Lock();
- private _networkId: number;
+ private readonly _nonceLock = new Lock();
+ private readonly _connectionLock = new Lock();
+ private readonly _networkId: number;
private _baseDerivationPath: string;
- private _ledgerEthereumClientFactoryAsync: LedgerEthereumClientFactoryAsync;
+ private readonly _ledgerEthereumClientFactoryAsync: LedgerEthereumClientFactoryAsync;
private _ledgerClientIfExists?: LedgerEthereumClient;
- private _shouldAlwaysAskForConfirmation: boolean;
- private _addressSearchLimit: number;
+ private readonly _shouldAlwaysAskForConfirmation: boolean;
+ private readonly _addressSearchLimit: number;
/**
* Instantiates a LedgerSubprovider. Defaults to derivationPath set to `44'/60'/0'`.
* TestRPC/Ganache defaults to `m/44'/60'/0'/0`, so set this in the configs if desired.
diff --git a/packages/subproviders/src/subproviders/mnemonic_wallet.ts b/packages/subproviders/src/subproviders/mnemonic_wallet.ts
index 596300425..1495112b6 100644
--- a/packages/subproviders/src/subproviders/mnemonic_wallet.ts
+++ b/packages/subproviders/src/subproviders/mnemonic_wallet.ts
@@ -20,10 +20,10 @@ const DEFAULT_ADDRESS_SEARCH_LIMIT = 1000;
* all requests with accounts derived from the supplied mnemonic.
*/
export class MnemonicWalletSubprovider extends BaseWalletSubprovider {
- private _addressSearchLimit: number;
+ private readonly _addressSearchLimit: number;
private _baseDerivationPath: string;
private _derivedKeyInfo: DerivedHDKeyInfo;
- private _mnemonic: string;
+ private readonly _mnemonic: string;
/**
* Instantiates a MnemonicWalletSubprovider. Defaults to baseDerivationPath set to `44'/60'/0'/0`.
diff --git a/packages/subproviders/src/subproviders/nonce_tracker.ts b/packages/subproviders/src/subproviders/nonce_tracker.ts
index dcc421574..eea722aee 100644
--- a/packages/subproviders/src/subproviders/nonce_tracker.ts
+++ b/packages/subproviders/src/subproviders/nonce_tracker.ts
@@ -17,7 +17,7 @@ const NONCE_TOO_LOW_ERROR_MESSAGE = 'Transaction nonce is too low';
* We added the additional feature of clearing the cached nonce value when a `nonce value too low` error occurs.
*/
export class NonceTrackerSubprovider extends Subprovider {
- private _nonceCache: { [address: string]: string } = {};
+ private readonly _nonceCache: { [address: string]: string } = {};
private static _reconstructTransaction(payload: JSONRPCRequestPayload): EthereumTx {
const raw = payload.params[0];
if (_.isUndefined(raw)) {
diff --git a/packages/subproviders/src/subproviders/private_key_wallet.ts b/packages/subproviders/src/subproviders/private_key_wallet.ts
index b3f48fd90..9d6fc487e 100644
--- a/packages/subproviders/src/subproviders/private_key_wallet.ts
+++ b/packages/subproviders/src/subproviders/private_key_wallet.ts
@@ -13,8 +13,8 @@ import { BaseWalletSubprovider } from './base_wallet_subprovider';
* all requests with the supplied Ethereum private key.
*/
export class PrivateKeyWalletSubprovider extends BaseWalletSubprovider {
- private _address: string;
- private _privateKeyBuffer: Buffer;
+ private readonly _address: string;
+ private readonly _privateKeyBuffer: Buffer;
/**
* Instantiates a PrivateKeyWalletSubprovider.
* @param privateKey The corresponding private key to an Ethereum address
diff --git a/packages/subproviders/src/subproviders/redundant_subprovider.ts b/packages/subproviders/src/subproviders/redundant_subprovider.ts
index a60d6706e..7aa6226d5 100644
--- a/packages/subproviders/src/subproviders/redundant_subprovider.ts
+++ b/packages/subproviders/src/subproviders/redundant_subprovider.ts
@@ -12,7 +12,7 @@ import { Subprovider } from './subprovider';
* set of JSON RPC endpoints.
*/
export class RedundantSubprovider extends Subprovider {
- private _subproviders: Subprovider[];
+ private readonly _subproviders: Subprovider[];
private static async _firstSuccessAsync(
subproviders: Subprovider[],
payload: JSONRPCRequestPayload,
diff --git a/packages/subproviders/src/subproviders/rpc_subprovider.ts b/packages/subproviders/src/subproviders/rpc_subprovider.ts
index 3ad0e5325..d874c6f05 100644
--- a/packages/subproviders/src/subproviders/rpc_subprovider.ts
+++ b/packages/subproviders/src/subproviders/rpc_subprovider.ts
@@ -13,8 +13,8 @@ import { Subprovider } from './subprovider';
* It forwards on JSON RPC requests to the supplied `rpcUrl` endpoint
*/
export class RPCSubprovider extends Subprovider {
- private _rpcUrl: string;
- private _requestTimeoutMs: number;
+ private readonly _rpcUrl: string;
+ private readonly _requestTimeoutMs: number;
constructor(rpcUrl: string, requestTimeoutMs: number = 20000) {
super();
assert.isString('rpcUrl', rpcUrl);
diff --git a/packages/subproviders/src/subproviders/signer.ts b/packages/subproviders/src/subproviders/signer.ts
index f7329e00c..d5fd86897 100644
--- a/packages/subproviders/src/subproviders/signer.ts
+++ b/packages/subproviders/src/subproviders/signer.ts
@@ -12,7 +12,7 @@ import { Subprovider } from './subprovider';
* are passed onwards for subsequent subproviders to handle.
*/
export class SignerSubprovider extends Subprovider {
- private _web3Wrapper: Web3Wrapper;
+ private readonly _web3Wrapper: Web3Wrapper;
/**
* Instantiates a new SignerSubprovider
* @param provider Web3 provider that should handle all user account related requests
diff --git a/packages/subproviders/src/utils/wallet_utils.ts b/packages/subproviders/src/utils/wallet_utils.ts
index 3748077ef..4c233645b 100644
--- a/packages/subproviders/src/utils/wallet_utils.ts
+++ b/packages/subproviders/src/utils/wallet_utils.ts
@@ -6,8 +6,8 @@ import { DerivedHDKeyInfo } from '../types';
const DEFAULT_ADDRESS_SEARCH_LIMIT = 1000;
class DerivedHDKeyInfoIterator implements IterableIterator<DerivedHDKeyInfo> {
- private _parentDerivedKeyInfo: DerivedHDKeyInfo;
- private _searchLimit: number;
+ private readonly _parentDerivedKeyInfo: DerivedHDKeyInfo;
+ private readonly _searchLimit: number;
private _index: number;
constructor(initialDerivedKey: DerivedHDKeyInfo, searchLimit: number = DEFAULT_ADDRESS_SEARCH_LIMIT) {
diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts
index 103e8f952..527ee5b22 100644
--- a/packages/subproviders/test/integration/ledger_subprovider_test.ts
+++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts
@@ -176,7 +176,7 @@ describe('LedgerSubprovider', () => {
params: [tx],
id: 1,
};
- await promisify(defaultProvider.sendAsync, defaultProvider)(payload);
+ await promisify(defaultProvider.sendAsync.bind(defaultProvider))(payload);
// Send transaction from Ledger
tx = {
diff --git a/packages/subproviders/test/unit/ledger_subprovider_test.ts b/packages/subproviders/test/unit/ledger_subprovider_test.ts
index edff5144e..a1d146dbc 100644
--- a/packages/subproviders/test/unit/ledger_subprovider_test.ts
+++ b/packages/subproviders/test/unit/ledger_subprovider_test.ts
@@ -55,7 +55,7 @@ describe('LedgerSubprovider', () => {
return ecSignature;
},
transport: {
- close: _.noop,
+ close: _.noop.bind(_),
} as LedgerCommunicationClient,
};
// tslint:enable:no-object-literal-type-assertion
diff --git a/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts b/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts
index c437d0815..05f213cf5 100644
--- a/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts
+++ b/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts
@@ -60,9 +60,9 @@ describe('NonceTrackerSubprovider', () => {
const payload = { ...getTransactionCountPayload, params: ['0x0', 'pending'] };
- const response = await promisify<any>(provider.sendAsync, provider)(payload);
+ const response = await promisify<any>(provider.sendAsync.bind(provider))(payload);
expect(response.result).to.be.eq('0x00');
- const secondResponse = await promisify<any>(provider.sendAsync, provider)(payload);
+ const secondResponse = await promisify<any>(provider.sendAsync.bind(provider))(payload);
expect(secondResponse.result).to.be.eq('0x00');
});
it('does not cache the result for latest transaction count', async () => {
@@ -74,9 +74,9 @@ describe('NonceTrackerSubprovider', () => {
const payload = { ...getTransactionCountPayload, params: ['0x0', 'latest'] };
- const response = await promisify<any>(provider.sendAsync, provider)(payload);
+ const response = await promisify<any>(provider.sendAsync.bind(provider))(payload);
expect(response.result).to.be.eq('0x00');
- const secondResponse = await promisify<any>(provider.sendAsync, provider)(payload);
+ const secondResponse = await promisify<any>(provider.sendAsync.bind(provider))(payload);
expect(secondResponse.result).to.be.eq('0x99');
});
it('clears the cache on a Nonce Too Low Error', async () => {
@@ -103,14 +103,14 @@ describe('NonceTrackerSubprovider', () => {
params: [transaction.serialize()],
};
- const response = await promisify<any>(provider.sendAsync, provider)(noncePayload);
+ const response = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
expect(response.result).to.be.eq('0x00');
- const secondResponse = await promisify<any>(provider.sendAsync, provider)(noncePayload);
+ const secondResponse = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
expect(secondResponse.result).to.be.eq('0x00');
try {
- await promisify(provider.sendAsync, provider)(txPayload);
+ await promisify(provider.sendAsync.bind(provider))(txPayload);
} catch (err) {
- const thirdResponse = await promisify<any>(provider.sendAsync, provider)(noncePayload);
+ const thirdResponse = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
expect(thirdResponse.result).to.be.eq('0x99');
}
});
@@ -138,12 +138,12 @@ describe('NonceTrackerSubprovider', () => {
params: [transaction.serialize()],
};
- const response = await promisify<any>(provider.sendAsync, provider)(noncePayload);
+ const response = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
expect(response.result).to.be.eq('0x00');
- const secondResponse = await promisify<any>(provider.sendAsync, provider)(noncePayload);
+ const secondResponse = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
expect(secondResponse.result).to.be.eq('0x00');
- await promisify(provider.sendAsync, provider)(txPayload);
- const thirdResponse = await promisify<any>(provider.sendAsync, provider)(noncePayload);
+ await promisify(provider.sendAsync.bind(provider))(txPayload);
+ const thirdResponse = await promisify<any>(provider.sendAsync.bind(provider))(noncePayload);
expect(thirdResponse.result).to.be.eq('0x01');
});
});
diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json
index 442f488c9..6711817f0 100644
--- a/packages/testnet-faucets/package.json
+++ b/packages/testnet-faucets/package.json
@@ -42,7 +42,7 @@
"nodemon": "^1.11.0",
"shx": "^0.2.2",
"source-map-loader": "^0.1.6",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1",
"webpack": "^3.1.0",
"webpack-node-externals": "^1.6.0"
diff --git a/packages/testnet-faucets/src/ts/dispatch_queue.ts b/packages/testnet-faucets/src/ts/dispatch_queue.ts
index b1996a0c2..0a13df7c9 100644
--- a/packages/testnet-faucets/src/ts/dispatch_queue.ts
+++ b/packages/testnet-faucets/src/ts/dispatch_queue.ts
@@ -7,8 +7,8 @@ const MAX_QUEUE_SIZE = 500;
const DEFAULT_QUEUE_INTERVAL_MS = 1000;
export class DispatchQueue {
- private _queueIntervalMs: number;
- private _queue: Array<() => Promise<void>>;
+ private readonly _queueIntervalMs: number;
+ private readonly _queue: Array<() => Promise<void>>;
private _queueIntervalIdIfExists?: NodeJS.Timer;
constructor() {
this._queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS;
diff --git a/packages/testnet-faucets/src/ts/error_reporter.ts b/packages/testnet-faucets/src/ts/error_reporter.ts
index a0abcc07b..49c37b6eb 100644
--- a/packages/testnet-faucets/src/ts/error_reporter.ts
+++ b/packages/testnet-faucets/src/ts/error_reporter.ts
@@ -12,7 +12,7 @@ export const errorReporter = {
rollbar.handleUncaughtExceptions(configs.ROLLBAR_ACCESS_KEY);
process.on('unhandledRejection', async (err: Error) => {
logUtils.log(`Uncaught exception ${err}. Stack: ${err.stack}`);
- await this.reportAsync(err);
+ await errorReporter.reportAsync(err);
process.exit(1);
});
},
@@ -20,7 +20,7 @@ export const errorReporter = {
if (configs.ENVIRONMENT === 'development') {
return; // Do not log development environment errors
}
- return new Promise((resolve, reject) => {
+ return new Promise<any>((resolve, reject) => {
rollbar.handleError(err, req, (rollbarErr: Error) => {
if (rollbarErr) {
logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`);
diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts
index 0f61159fa..3749bc70b 100644
--- a/packages/testnet-faucets/src/ts/handler.ts
+++ b/packages/testnet-faucets/src/ts/handler.ts
@@ -37,7 +37,7 @@ enum RequestedAssetType {
const FIVE_DAYS_IN_MS = 4.32e8; // TODO: make this configurable
export class Handler {
- private _networkConfigByNetworkId: ItemByNetworkId<NetworkConfig> = {};
+ private readonly _networkConfigByNetworkId: ItemByNetworkId<NetworkConfig> = {};
private static _createProviderEngine(rpcUrl: string): Provider {
if (_.isUndefined(configs.DISPENSER_PRIVATE_KEY)) {
throw new Error('Dispenser Private key not found');
diff --git a/packages/testnet-faucets/src/ts/server.ts b/packages/testnet-faucets/src/ts/server.ts
index 5416cdcc3..f00562000 100644
--- a/packages/testnet-faucets/src/ts/server.ts
+++ b/packages/testnet-faucets/src/ts/server.ts
@@ -24,10 +24,26 @@ app.get('/ping', (req: express.Request, res: express.Response) => {
res.status(constants.SUCCESS_STATUS).send('pong');
});
app.get('/info', handler.getQueueInfo.bind(handler));
-app.get('/ether/:recipient', parameterTransformer.transform, handler.dispenseEther.bind(handler));
-app.get('/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRX.bind(handler));
-app.get('/order/weth/:recipient', parameterTransformer.transform, handler.dispenseWETHOrderAsync.bind(handler));
-app.get('/order/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRXOrderAsync.bind(handler));
+app.get(
+ '/ether/:recipient',
+ parameterTransformer.transform.bind(parameterTransformer),
+ handler.dispenseEther.bind(handler),
+);
+app.get(
+ '/zrx/:recipient',
+ parameterTransformer.transform.bind(parameterTransformer),
+ handler.dispenseZRX.bind(handler),
+);
+app.get(
+ '/order/weth/:recipient',
+ parameterTransformer.transform.bind(parameterTransformer),
+ handler.dispenseWETHOrderAsync.bind(handler),
+);
+app.get(
+ '/order/zrx/:recipient',
+ parameterTransformer.transform.bind(parameterTransformer),
+ handler.dispenseZRXOrderAsync.bind(handler),
+);
// Log to rollbar any errors unhandled by handlers
app.use(errorReporter.errorHandler());
diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json
index 356499f6b..b136b7e4a 100644
--- a/packages/tslint-config/package.json
+++ b/packages/tslint-config/package.json
@@ -43,7 +43,7 @@
},
"dependencies": {
"lodash": "^4.17.4",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"tslint-eslint-rules": "^4.1.1",
"tslint-react": "^3.2.0",
"tsutils": "2.22.2"
diff --git a/packages/tslint-config/rules/customNoMagicNumbersRule.ts b/packages/tslint-config/rules/customNoMagicNumbersRule.ts
index 0a565b2e6..cb124f738 100644
--- a/packages/tslint-config/rules/customNoMagicNumbersRule.ts
+++ b/packages/tslint-config/rules/customNoMagicNumbersRule.ts
@@ -29,6 +29,7 @@ export class Rule extends Lint.Rules.AbstractRule {
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
const allowedNumbers = this.ruleArguments.length > 0 ? this.ruleArguments : Rule.DEFAULT_ALLOWED;
return this.applyWithWalker(
+ // tslint:disable-next-line:no-inferred-empty-object-type
new CustomNoMagicNumbersWalker(sourceFile, this.ruleName, new Set(allowedNumbers.map(String))),
);
}
diff --git a/packages/tslint-config/tslint.json b/packages/tslint-config/tslint.json
index 05efd158a..374419b69 100644
--- a/packages/tslint-config/tslint.json
+++ b/packages/tslint-config/tslint.json
@@ -5,54 +5,83 @@
"arrow-parens": [true, "ban-single-arg-parens"],
"arrow-return-shorthand": true,
"async-suffix": true,
- "boolean-naming": true,
- "no-switch-case-fall-through": true,
- "switch-default": true,
"await-promise": true,
- "custom-no-magic-numbers": [true, 0, 1, 2, 3, -1],
"binary-expression-operand-order": true,
+ "boolean-naming": true,
"callable-types": true,
"class-name": true,
"completed-docs": [
true,
{
- "functions": { "visibilities": ["exported"] },
- "methods": { "locations": "instance", "privacies": ["public", "protected"] }
+ "functions": {
+ "visibilities": ["exported"]
+ },
+ "methods": {
+ "locations": "instance",
+ "privacies": ["public", "protected"]
+ }
}
],
"curly": true,
- "eofline": true,
- "typedef": [true, "call-signature", "parameter", "property-declaration"],
+ "custom-no-magic-numbers": [true, 0, 1, 2, 3, -1],
"encoding": true,
+ "eofline": true,
"import-spacing": true,
"indent": [true, "spaces", 4],
"interface-name": false,
"interface-over-type-literal": true,
+ "jsx-alignment": true,
+ "jsx-boolean-value": true,
+ "jsx-curly-spacing": [true, "never"],
+ "jsx-no-bind": false,
+ "jsx-no-lambda": true,
+ "jsx-no-multiline-js": false,
+ "jsx-no-string-ref": true,
+ "jsx-self-close": true,
+ "jsx-wrap-multiline": false,
"linebreak-style": [true, "LF"],
"max-classes-per-file": [true, 1],
- "max-line-length": false,
"max-file-line-count": [true, 500],
+ "max-line-length": false,
"member-access": true,
"member-ordering": [true, "public-before-private", "static-before-instance", "variables-before-functions"],
- "newline-before-return": false,
"new-parens": true,
+ "newline-before-return": false,
"no-angle-bracket-type-assertion": true,
"no-boolean-literal-compare": true,
+ "no-debugger": true,
"no-default-export": true,
+ "no-duplicate-super": true,
+ "no-duplicate-switch-case": true,
+ "no-duplicate-variable": true,
"no-empty-interface": false,
+ "no-eval": true,
"no-floating-promises": true,
+ "no-implicit-dependencies": [true, "dev"],
+ "no-inferred-empty-object-type": true,
+ "no-invalid-template-strings": true,
+ "no-invalid-this": true,
+ "no-misused-new": true,
"no-non-null-assertion": true,
+ "no-redundant-jsdoc": true,
"no-parameter-reassignment": true,
"no-redundant-jsdoc": true,
"no-return-await": true,
- "no-unused-variable": [true, "check-parameters"],
+ "no-shadowed-variable": true,
+ "no-sparse-arrays": true,
+ "no-string-literal": true,
"no-string-throw": true,
"no-submodule-imports": false,
+ "no-switch-case-fall-through": true,
+ "no-this-assignment": false,
+ "no-unbound-method": true,
+ "no-unnecessary-class": true,
"no-unnecessary-type-assertion": true,
- "no-implicit-dependencies": [true, "dev"],
+ "no-unsafe-finally": true,
+ "no-unused-variable": [true, "check-parameters"],
"number-literal-format": true,
- "object-literal-sort-keys": false,
"object-literal-key-quotes": false,
+ "object-literal-sort-keys": false,
"ordered-imports": [
true,
{
@@ -62,6 +91,8 @@
"prefer-const": true,
"prefer-for-of": true,
"prefer-function-over-method": true,
+ "prefer-object-spread": true,
+ "prefer-readonly": true,
"promise-function-async": true,
"quotemark": [true, "single", "avoid-escape", "jsx-double"],
"restrict-plus-operands": true,
@@ -70,14 +101,16 @@
true,
{
"anonymous": "never",
- "named": "never",
- "method": "never",
+ "asyncArrow": "always",
"constructor": "never",
- "asyncArrow": "always"
+ "method": "never",
+ "named": "never"
}
],
"space-within-parens": false,
+ "switch-default": true,
"type-literal-delimiter": true,
+ "typedef": [true, "call-signature", "parameter", "property-declaration"],
"underscore-private-and-protected": true,
"variable-name": [true, "ban-keywords", "allow-pascal-case"],
"whitespace": [
@@ -90,16 +123,7 @@
"check-type",
"check-typecast",
"check-preblock"
- ],
- "jsx-alignment": true,
- "jsx-boolean-value": true,
- "jsx-curly-spacing": [true, "never"],
- "jsx-no-lambda": true,
- "jsx-no-multiline-js": false,
- "jsx-no-string-ref": true,
- "jsx-self-close": true,
- "jsx-wrap-multiline": false,
- "jsx-no-bind": false
+ ]
},
"rulesDirectory": "lib/rules"
}
diff --git a/packages/types/package.json b/packages/types/package.json
index b5e09d42e..fee9d847f 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -29,7 +29,7 @@
"copyfiles": "^1.2.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/utils/package.json b/packages/utils/package.json
index a454b35ee..b2658f491 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -31,7 +31,7 @@
"make-promises-safe": "^1.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts
index b75387e3e..7f93e746e 100644
--- a/packages/utils/src/abi_decoder.ts
+++ b/packages/utils/src/abi_decoder.ts
@@ -16,7 +16,7 @@ import { addressUtils } from './address_utils';
import { BigNumber } from './configured_bignumber';
export class AbiDecoder {
- private _methodIds: { [signatureHash: string]: EventAbi } = {};
+ private readonly _methodIds: { [signatureHash: string]: EventAbi } = {};
constructor(abiArrays: AbiDefinition[][]) {
_.forEach(abiArrays, this.addABI.bind(this));
}
diff --git a/packages/utils/src/abi_utils.ts b/packages/utils/src/abi_utils.ts
index 413c2f481..421dd405c 100644
--- a/packages/utils/src/abi_utils.ts
+++ b/packages/utils/src/abi_utils.ts
@@ -6,7 +6,7 @@ export const abiUtils = {
if (param.type === 'tuple') {
// Parse out tuple types into {type_1, type_2, ..., type_N}
const tupleComponents = param.components;
- const paramString = _.map(tupleComponents, component => this.parseFunctionParam(component));
+ const paramString = _.map(tupleComponents, component => abiUtils.parseFunctionParam(component));
const tupleParamString = `{${paramString}}`;
return tupleParamString;
}
@@ -14,7 +14,7 @@ export const abiUtils = {
},
getFunctionSignature(methodAbi: MethodAbi): string {
const functionName = methodAbi.name;
- const parameterTypeList = _.map(methodAbi.inputs, (param: DataItem) => this.parseFunctionParam(param));
+ const parameterTypeList = _.map(methodAbi.inputs, (param: DataItem) => abiUtils.parseFunctionParam(param));
const functionSignature = `${functionName}(${parameterTypeList})`;
return functionSignature;
},
@@ -37,7 +37,7 @@ export const abiUtils = {
// Sort method Abis into alphabetical order, by function signature
const methodAbisOrdered = _.sortBy(methodAbis, [
(methodAbi: MethodAbi) => {
- const functionSignature = this.getFunctionSignature(methodAbi);
+ const functionSignature = abiUtils.getFunctionSignature(methodAbi);
return functionSignature;
},
]);
diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json
index 9716be5bf..1f4854baa 100644
--- a/packages/web3-wrapper/package.json
+++ b/packages/web3-wrapper/package.json
@@ -59,7 +59,7 @@
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"shx": "^0.2.2",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"typedoc": "0xProject/typedoc",
"typescript": "2.7.1"
},
diff --git a/packages/web3-wrapper/src/marshaller.ts b/packages/web3-wrapper/src/marshaller.ts
index 15384417e..fed197822 100644
--- a/packages/web3-wrapper/src/marshaller.ts
+++ b/packages/web3-wrapper/src/marshaller.ts
@@ -54,7 +54,7 @@ export const marshaller = {
transactions: [] as Transaction[],
};
block.transactions = _.map(blockWithHexValues.transactions, (tx: TransactionRPC) => {
- const transaction = this.unmarshalTransaction(tx);
+ const transaction = marshaller.unmarshalTransaction(tx);
return transaction;
});
return block;
@@ -94,10 +94,10 @@ export const marshaller = {
...txData,
};
delete callTxDataBase.from;
- const callTxDataBaseRPC = this._marshalCallTxDataBase(callTxDataBase);
+ const callTxDataBaseRPC = marshaller._marshalCallTxDataBase(callTxDataBase);
const txDataRPC = {
...callTxDataBaseRPC,
- from: this.marshalAddress(txData.from),
+ from: marshaller.marshalAddress(txData.from),
};
const prunableIfUndefined = ['gasPrice', 'gas', 'value', 'nonce'];
_.each(txDataRPC, (value: any, key: string) => {
@@ -112,10 +112,10 @@ export const marshaller = {
...callData,
};
delete callTxDataBase.from;
- const callTxDataBaseRPC = this._marshalCallTxDataBase(callTxDataBase);
+ const callTxDataBaseRPC = marshaller._marshalCallTxDataBase(callTxDataBase);
const callDataRPC = {
...callTxDataBaseRPC,
- from: _.isUndefined(callData.from) ? undefined : this.marshalAddress(callData.from),
+ from: _.isUndefined(callData.from) ? undefined : marshaller.marshalAddress(callData.from),
};
return callDataRPC;
},
@@ -144,7 +144,7 @@ export const marshaller = {
_marshalCallTxDataBase(callTxDataBase: Partial<CallTxDataBase>): Partial<CallTxDataBaseRPC> {
const callTxDataBaseRPC = {
...callTxDataBase,
- to: _.isUndefined(callTxDataBase.to) ? undefined : this.marshalAddress(callTxDataBase.to),
+ to: _.isUndefined(callTxDataBase.to) ? undefined : marshaller.marshalAddress(callTxDataBase.to),
gasPrice: _.isUndefined(callTxDataBase.gasPrice)
? undefined
: utils.encodeAmountAsHexString(callTxDataBase.gasPrice),
diff --git a/packages/web3-wrapper/src/utils.ts b/packages/web3-wrapper/src/utils.ts
index d13eb9404..01605dc9a 100644
--- a/packages/web3-wrapper/src/utils.ts
+++ b/packages/web3-wrapper/src/utils.ts
@@ -15,7 +15,7 @@ export const utils = {
if (_.isNull(hex)) {
return null;
}
- const decimal = this.convertHexToNumber(hex);
+ const decimal = utils.convertHexToNumber(hex);
return decimal;
},
convertAmountToBigNumber(value: string | number | BigNumber): BigNumber {
@@ -40,7 +40,7 @@ export const utils = {
return valueBigNumber.lessThan(0) ? '-0x' + valueHex.substr(1) : '0x' + valueHex;
},
numberToHex(value: number): string {
- if (!isFinite(value) && !this.isHexStrict(value)) {
+ if (!isFinite(value) && !utils.isHexStrict(value)) {
throw new Error(`Given input ${value} is not a number.`);
}
diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts
index 495523e44..e828708f0 100644
--- a/packages/web3-wrapper/src/web3_wrapper.ts
+++ b/packages/web3-wrapper/src/web3_wrapper.ts
@@ -50,7 +50,7 @@ export class Web3Wrapper {
public isZeroExWeb3Wrapper = true;
public abiDecoder: AbiDecoder;
private _provider: Provider;
- private _txDefaults: Partial<TxData>;
+ private readonly _txDefaults: Partial<TxData>;
private _jsonRpcRequestId: number;
/**
* Check if an address is a valid Ethereum address
diff --git a/packages/website/package.json b/packages/website/package.json
index ef314ba2d..80e49cd70 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -97,7 +97,7 @@
"shx": "^0.2.2",
"source-map-loader": "^0.1.6",
"style-loader": "0.13.x",
- "tslint": "5.8.0",
+ "tslint": "5.11.0",
"tslint-config-0xproject": "^0.0.2",
"typescript": "2.7.1",
"uglifyjs-webpack-plugin": "^1.2.5",
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index e8168d975..88461f8a9 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -83,11 +83,11 @@ export class Blockchain {
public networkId: number;
public nodeVersion: string;
private _contractWrappers: ContractWrappers;
- private _dispatcher: Dispatcher;
+ private readonly _dispatcher: Dispatcher;
private _web3Wrapper?: Web3Wrapper;
private _blockchainWatcher?: BlockchainWatcher;
private _injectedProviderObservable?: InjectedProviderObservable;
- private _injectedProviderUpdateHandler: (update: InjectedProviderUpdate) => Promise<void>;
+ private readonly _injectedProviderUpdateHandler: (update: InjectedProviderUpdate) => Promise<void>;
private _userAddressIfExists: string;
private _ledgerSubprovider: LedgerSubprovider;
private _defaultGasPrice: BigNumber;
@@ -125,7 +125,11 @@ export class Blockchain {
let networkIdIfExists: number;
if (!_.isUndefined(injectedWeb3IfExists)) {
try {
- networkIdIfExists = _.parseInt(await promisify<string>(injectedWeb3IfExists.version.getNetwork)());
+ networkIdIfExists = _.parseInt(
+ await promisify<string>(
+ injectedWeb3IfExists.version.getNetwork.bind(injectedWeb3IfExists.version),
+ )(),
+ );
} catch (err) {
// Ignore error and proceed with networkId undefined
}
diff --git a/packages/website/ts/blockchain_watcher.ts b/packages/website/ts/blockchain_watcher.ts
index 4b23aa98a..39ed8b08b 100644
--- a/packages/website/ts/blockchain_watcher.ts
+++ b/packages/website/ts/blockchain_watcher.ts
@@ -4,9 +4,9 @@ import * as _ from 'lodash';
import { Dispatcher } from 'ts/redux/dispatcher';
export class BlockchainWatcher {
- private _dispatcher: Dispatcher;
- private _web3Wrapper: Web3Wrapper;
- private _shouldPollUserAddress: boolean;
+ private readonly _dispatcher: Dispatcher;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _shouldPollUserAddress: boolean;
private _watchBalanceIntervalId: NodeJS.Timer;
private _prevUserEtherBalanceInWei?: BigNumber;
private _prevUserAddressIfExists: string;
diff --git a/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx b/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx
index ce86df856..3ebab03ef 100644
--- a/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx
+++ b/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx
@@ -14,9 +14,9 @@ export const U2fNotSupportedDialog = (props: U2fNotSupportedDialogProps) => {
<Dialog
title="U2F Not Supported"
titleStyle={{ fontWeight: 100 }}
- actions={[<FlatButton key="u2fNo" label="Ok" onTouchTap={props.onToggleDialog.bind(this)} />]}
+ actions={[<FlatButton key="u2fNo" label="Ok" onTouchTap={props.onToggleDialog} />]}
open={props.isOpen}
- onRequestClose={props.onToggleDialog.bind(this)}
+ onRequestClose={props.onToggleDialog}
autoScrollBodyContent={true}
>
<div className="pt2" style={{ color: colors.grey700 }}>
diff --git a/packages/website/ts/components/eth_weth_conversion_button.tsx b/packages/website/ts/components/eth_weth_conversion_button.tsx
index d547a4e6a..b0091a1c1 100644
--- a/packages/website/ts/components/eth_weth_conversion_button.tsx
+++ b/packages/website/ts/components/eth_weth_conversion_button.tsx
@@ -37,7 +37,7 @@ export class EthWethConversionButton extends React.Component<
> {
public static defaultProps: Partial<EthWethConversionButtonProps> = {
isDisabled: false,
- onConversionSuccessful: _.noop,
+ onConversionSuccessful: _.noop.bind(_),
};
public constructor(props: EthWethConversionButtonProps) {
super(props);
diff --git a/packages/website/ts/components/fill_warning_dialog.tsx b/packages/website/ts/components/fill_warning_dialog.tsx
index 83095b1d3..45c492221 100644
--- a/packages/website/ts/components/fill_warning_dialog.tsx
+++ b/packages/website/ts/components/fill_warning_dialog.tsx
@@ -18,16 +18,16 @@ export const FillWarningDialog = (props: FillWarningDialogProps) => {
<FlatButton
key="fillWarningCancel"
label="Cancel"
- onTouchTap={props.onToggleDialog.bind(this, didCancel)}
+ onTouchTap={() => props.onToggleDialog(didCancel)} // tslint:disable-line:jsx-no-lambda
/>,
<FlatButton
key="fillWarningContinue"
label="Fill Order"
- onTouchTap={props.onToggleDialog.bind(this, !didCancel)}
+ onTouchTap={() => props.onToggleDialog(!didCancel)} // tslint:disable-line:jsx-no-lambda
/>,
]}
open={props.isOpen}
- onRequestClose={props.onToggleDialog.bind(this)}
+ onRequestClose={() => props.onToggleDialog(didCancel)} // tslint:disable-line:jsx-no-lambda
autoScrollBodyContent={true}
modal={true}
>
diff --git a/packages/website/ts/components/generate_order/asset_picker.tsx b/packages/website/ts/components/generate_order/asset_picker.tsx
index 5eada37b6..2dca3483f 100644
--- a/packages/website/ts/components/generate_order/asset_picker.tsx
+++ b/packages/website/ts/components/generate_order/asset_picker.tsx
@@ -46,7 +46,7 @@ export class AssetPicker extends React.Component<AssetPickerProps, AssetPickerSt
public static defaultProps: Partial<AssetPickerProps> = {
tokenVisibility: TokenVisibility.ALL,
};
- private _dialogConfigsByAssetView: { [assetView: string]: DialogConfigs };
+ private readonly _dialogConfigsByAssetView: { [assetView: string]: DialogConfigs };
constructor(props: AssetPickerProps) {
super(props);
this.state = {
diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx
index 297617bef..05dce134a 100644
--- a/packages/website/ts/components/inputs/allowance_toggle.tsx
+++ b/packages/website/ts/components/inputs/allowance_toggle.tsx
@@ -57,7 +57,7 @@ const styles: Styles = {
export class AllowanceToggle extends React.Component<AllowanceToggleProps, AllowanceToggleState> {
public static defaultProps = {
- onErrorOccurred: _.noop,
+ onErrorOccurred: _.noop.bind(_),
isDisabled: false,
};
constructor(props: AllowanceToggleProps) {
diff --git a/packages/website/ts/components/inputs/balance_bounded_input.tsx b/packages/website/ts/components/inputs/balance_bounded_input.tsx
index f23beb436..eb01e3ea6 100644
--- a/packages/website/ts/components/inputs/balance_bounded_input.tsx
+++ b/packages/website/ts/components/inputs/balance_bounded_input.tsx
@@ -35,7 +35,7 @@ export class BalanceBoundedInput extends React.Component<BalanceBoundedInputProp
isDisabled: false,
shouldShowErrs: true,
hintText: 'amount',
- onErrorMsgChange: _.noop,
+ onErrorMsgChange: _.noop.bind(_),
shouldShowUnderline: true,
};
constructor(props: BalanceBoundedInputProps) {
@@ -125,7 +125,7 @@ export class BalanceBoundedInput extends React.Component<BalanceBoundedInputProp
const errMsg = _.isUndefined(this.props.validate) ? undefined : this.props.validate(amount);
return errMsg;
}
- private _setAmountState(amount: string, balance: BigNumber, callback: () => void = _.noop): void {
+ private _setAmountState(amount: string, balance: BigNumber, callback: () => void = _.noop.bind(_)): void {
const errorMsg = this._validate(amount, balance);
this.props.onErrorMsgChange(errorMsg);
this.setState(
diff --git a/packages/website/ts/components/inputs/expiration_input.tsx b/packages/website/ts/components/inputs/expiration_input.tsx
index 79dd2f568..5417ce715 100644
--- a/packages/website/ts/components/inputs/expiration_input.tsx
+++ b/packages/website/ts/components/inputs/expiration_input.tsx
@@ -17,7 +17,7 @@ interface ExpirationInputState {
}
export class ExpirationInput extends React.Component<ExpirationInputProps, ExpirationInputState> {
- private _earliestPickableMoment: moment.Moment;
+ private readonly _earliestPickableMoment: moment.Moment;
constructor(props: ExpirationInputProps) {
super(props);
// Set the earliest pickable date to today at 00:00, so users can only pick the current or later dates
diff --git a/packages/website/ts/components/order_json.tsx b/packages/website/ts/components/order_json.tsx
index c2606bd56..cf06f10c8 100644
--- a/packages/website/ts/components/order_json.tsx
+++ b/packages/website/ts/components/order_json.tsx
@@ -127,7 +127,7 @@ export class OrderJSON extends React.Component<OrderJSONProps, OrderJSONState> {
href: this.state.shareLink,
method: 'share',
},
- _.noop,
+ _.noop.bind(_),
);
}
private _shareViaEmailAsync(): void {
diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx
index ea821d038..1790a9678 100644
--- a/packages/website/ts/components/portal/portal.tsx
+++ b/packages/website/ts/components/portal/portal.tsx
@@ -110,8 +110,8 @@ const SIDE_PADDING = 20;
export class Portal extends React.Component<PortalProps, PortalState> {
private _blockchain: Blockchain;
- private _sharedOrderIfExists: Order;
- private _throttledScreenWidthUpdate: () => void;
+ private readonly _sharedOrderIfExists: Order;
+ private readonly _throttledScreenWidthUpdate: () => void;
constructor(props: PortalProps) {
super(props);
this._sharedOrderIfExists = orderParser.parse(window.location.search);
diff --git a/packages/website/ts/components/ui/menu_item.tsx b/packages/website/ts/components/ui/menu_item.tsx
index 64c0dc49d..0cb4b387c 100644
--- a/packages/website/ts/components/ui/menu_item.tsx
+++ b/packages/website/ts/components/ui/menu_item.tsx
@@ -15,7 +15,7 @@ interface MenuItemState {
export class MenuItem extends React.Component<MenuItemProps, MenuItemState> {
public static defaultProps: Partial<MenuItemProps> = {
- onClick: _.noop,
+ onClick: _.noop.bind(_),
className: '',
};
public constructor(props: MenuItemProps) {
diff --git a/packages/website/ts/components/ui/overlay.tsx b/packages/website/ts/components/ui/overlay.tsx
index da26317de..fc7507475 100644
--- a/packages/website/ts/components/ui/overlay.tsx
+++ b/packages/website/ts/components/ui/overlay.tsx
@@ -26,7 +26,7 @@ export const Overlay: React.StatelessComponent<OverlayProps> = props => (
Overlay.defaultProps = {
style: {},
- onClick: _.noop,
+ onClick: _.noop.bind(_),
};
Overlay.displayName = 'Overlay';
diff --git a/packages/website/ts/components/ui/simple_menu.tsx b/packages/website/ts/components/ui/simple_menu.tsx
index dcbc6946b..8a9349c6d 100644
--- a/packages/website/ts/components/ui/simple_menu.tsx
+++ b/packages/website/ts/components/ui/simple_menu.tsx
@@ -41,7 +41,7 @@ export const SimpleMenuItem: React.StatelessComponent<SimpleMenuItemProps> = ({
<Text
fontSize="14px"
fontColor={colors.darkGrey}
- onClick={onClick || _.noop}
+ onClick={onClick || _.noop.bind(_)}
hoverColor={colors.mediumBlue}
>
{displayText}
diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx
index e462ab3e0..40a8a23ea 100644
--- a/packages/website/ts/components/wallet/wallet.tsx
+++ b/packages/website/ts/components/wallet/wallet.tsx
@@ -204,7 +204,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> {
<AccountConnection accountState={accountState} injectedProviderName={this.props.injectedProviderName} />
</div>
);
- const onClick = _.noop;
+ const onClick = _.noop.bind(_);
const accessory = (
<DropDown
activeNode={
diff --git a/packages/website/ts/local_storage/local_storage.ts b/packages/website/ts/local_storage/local_storage.ts
index 1e3258ce0..13d9ca401 100644
--- a/packages/website/ts/local_storage/local_storage.ts
+++ b/packages/website/ts/local_storage/local_storage.ts
@@ -5,7 +5,7 @@ export const localStorage = {
return !!window.localStorage;
},
getItemIfExists(key: string): string {
- if (!this.doesExist) {
+ if (!localStorage.doesExist) {
return undefined;
}
const item = window.localStorage.getItem(key);
@@ -15,13 +15,13 @@ export const localStorage = {
return item;
},
setItem(key: string, value: string): void {
- if (!this.doesExist || _.isUndefined(value)) {
+ if (!localStorage.doesExist || _.isUndefined(value)) {
return;
}
window.localStorage.setItem(key, value);
},
removeItem(key: string): void {
- if (!this.doesExist) {
+ if (!localStorage.doesExist) {
return;
}
window.localStorage.removeItem(key);
@@ -37,7 +37,7 @@ export const localStorage = {
localStorage.setItem(key, JSON.stringify(value));
},
getAllKeys(): string[] {
- if (!this.doesExist) {
+ if (!localStorage.doesExist) {
return [];
}
return _.keys(window.localStorage);
diff --git a/packages/website/ts/local_storage/tracked_token_storage.ts b/packages/website/ts/local_storage/tracked_token_storage.ts
index f865f8109..b1b579aef 100644
--- a/packages/website/ts/local_storage/tracked_token_storage.ts
+++ b/packages/website/ts/local_storage/tracked_token_storage.ts
@@ -17,7 +17,7 @@ export const trackedTokenStorage = {
localStorage.setItem(TRACKED_TOKENS_CLEAR_KEY, configs.LAST_LOCAL_STORAGE_TRACKED_TOKEN_CLEARANCE_DATE);
},
addTrackedTokenToUser(userAddress: string, networkId: number, token: Token): void {
- const trackedTokensByUserAddress = this.getTrackedTokensByUserAddress();
+ const trackedTokensByUserAddress = trackedTokenStorage.getTrackedTokensByUserAddress();
let trackedTokensByNetworkId = trackedTokensByUserAddress[userAddress];
if (_.isUndefined(trackedTokensByNetworkId)) {
trackedTokensByNetworkId = {};
@@ -57,7 +57,7 @@ export const trackedTokenStorage = {
return trackedTokensByAddress;
},
removeTrackedToken(userAddress: string, networkId: number, tokenAddress: string): void {
- const trackedTokensByUserAddress = this.getTrackedTokensByUserAddress();
+ const trackedTokensByUserAddress = trackedTokenStorage.getTrackedTokensByUserAddress();
const trackedTokensByNetworkId = trackedTokensByUserAddress[userAddress];
const trackedTokens = trackedTokensByNetworkId[networkId];
const remainingTrackedTokens = _.filter(trackedTokens, (token: Token) => {
diff --git a/packages/website/ts/local_storage/trade_history_storage.tsx b/packages/website/ts/local_storage/trade_history_storage.tsx
index 2e2f4e64e..a9b042820 100644
--- a/packages/website/ts/local_storage/trade_history_storage.tsx
+++ b/packages/website/ts/local_storage/trade_history_storage.tsx
@@ -27,31 +27,31 @@ export const tradeHistoryStorage = {
localStorage.setItem(FILL_CLEAR_KEY, configs.LAST_LOCAL_STORAGE_FILL_CLEARANCE_DATE);
},
addFillToUser(userAddress: string, networkId: number, fill: Fill): void {
- const fillsByHash = this.getUserFillsByHash(userAddress, networkId);
- const fillHash = this._getFillHash(fill);
+ const fillsByHash = tradeHistoryStorage.getUserFillsByHash(userAddress, networkId);
+ const fillHash = tradeHistoryStorage._getFillHash(fill);
const doesFillExist = !_.isUndefined(fillsByHash[fillHash]);
if (doesFillExist) {
return; // noop
}
fillsByHash[fillHash] = fill;
const userFillsJSONString = JSON.stringify(fillsByHash);
- const userFillsKey = this._getUserFillsKey(userAddress, networkId);
+ const userFillsKey = tradeHistoryStorage._getUserFillsKey(userAddress, networkId);
localStorage.setItem(userFillsKey, userFillsJSONString);
},
removeFillFromUser(userAddress: string, networkId: number, fill: Fill): void {
- const fillsByHash = this.getUserFillsByHash(userAddress, networkId);
- const fillHash = this._getFillHash(fill);
+ const fillsByHash = tradeHistoryStorage.getUserFillsByHash(userAddress, networkId);
+ const fillHash = tradeHistoryStorage._getFillHash(fill);
const doesFillExist = !_.isUndefined(fillsByHash[fillHash]);
if (!doesFillExist) {
return; // noop
}
delete fillsByHash[fillHash];
const userFillsJSONString = JSON.stringify(fillsByHash);
- const userFillsKey = this._getUserFillsKey(userAddress, networkId);
+ const userFillsKey = tradeHistoryStorage._getUserFillsKey(userAddress, networkId);
localStorage.setItem(userFillsKey, userFillsJSONString);
},
getUserFillsByHash(userAddress: string, networkId: number): { [fillHash: string]: Fill } {
- const userFillsKey = this._getUserFillsKey(userAddress, networkId);
+ const userFillsKey = tradeHistoryStorage._getUserFillsKey(userAddress, networkId);
const userFillsJSONString = localStorage.getItemIfExists(userFillsKey);
if (_.isEmpty(userFillsJSONString)) {
return {};
@@ -66,7 +66,7 @@ export const tradeHistoryStorage = {
return userFillsByHash;
},
getFillsLatestBlock(userAddress: string, networkId: number): number {
- const userFillsLatestBlockKey = this._getFillsLatestBlockKey(userAddress, networkId);
+ const userFillsLatestBlockKey = tradeHistoryStorage._getFillsLatestBlockKey(userAddress, networkId);
const blockNumberStr = localStorage.getItemIfExists(userFillsLatestBlockKey);
if (_.isEmpty(blockNumberStr)) {
return constants.GENESIS_ORDER_BLOCK_BY_NETWORK_ID[networkId];
@@ -75,7 +75,7 @@ export const tradeHistoryStorage = {
return blockNumber;
},
setFillsLatestBlock(userAddress: string, networkId: number, blockNumber: number): void {
- const userFillsLatestBlockKey = this._getFillsLatestBlockKey(userAddress, networkId);
+ const userFillsLatestBlockKey = tradeHistoryStorage._getFillsLatestBlockKey(userAddress, networkId);
localStorage.setItem(userFillsLatestBlockKey, `${blockNumber}`);
},
_getUserFillsKey(userAddress: string, networkId: number): string {
diff --git a/packages/website/ts/pages/jobs/jobs.tsx b/packages/website/ts/pages/jobs/jobs.tsx
index 314669ee9..38cefa832 100644
--- a/packages/website/ts/pages/jobs/jobs.tsx
+++ b/packages/website/ts/pages/jobs/jobs.tsx
@@ -33,7 +33,7 @@ export interface JobsState {}
export class Jobs extends React.Component<JobsProps, JobsState> {
// TODO: consolidate this small screen scaffolding into one place (its being used in portal and docs as well)
- private _throttledScreenWidthUpdate: () => void;
+ private readonly _throttledScreenWidthUpdate: () => void;
public constructor(props: JobsProps) {
super(props);
this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT);
diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx
index b2cf4d979..2a51ee3c0 100644
--- a/packages/website/ts/pages/landing/landing.tsx
+++ b/packages/website/ts/pages/landing/landing.tsx
@@ -171,7 +171,7 @@ interface LandingState {
}
export class Landing extends React.Component<LandingProps, LandingState> {
- private _throttledScreenWidthUpdate: () => void;
+ private readonly _throttledScreenWidthUpdate: () => void;
constructor(props: LandingProps) {
super(props);
this.state = {
diff --git a/packages/website/ts/redux/dispatcher.ts b/packages/website/ts/redux/dispatcher.ts
index e0ce43ae5..db008d319 100644
--- a/packages/website/ts/redux/dispatcher.ts
+++ b/packages/website/ts/redux/dispatcher.ts
@@ -17,7 +17,7 @@ import {
} from 'ts/types';
export class Dispatcher {
- private _dispatch: Dispatch<State>;
+ private readonly _dispatch: Dispatch<State>;
constructor(dispatch: Dispatch<State>) {
this._dispatch = dispatch;
}
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index 739bb7b66..e656d5963 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -59,7 +59,7 @@ export const utils = {
return moment.unix(unixTimestampSec.toNumber());
},
convertToReadableDateTimeFromUnixTimestamp(unixTimestampSec: BigNumber): string {
- const m = this.convertToMomentFromUnixTimestamp(unixTimestampSec);
+ const m = utils.convertToMomentFromUnixTimestamp(unixTimestampSec);
const formattedDate: string = m.format('h:MMa MMMM D YYYY');
return formattedDate;
},
@@ -299,12 +299,12 @@ export const utils = {
const baseUrl = `https://${window.location.hostname}${hasPort ? `:${port}` : ''}`;
return baseUrl;
},
- onPageLoadPromise: new Promise((resolve, _reject) => {
+ onPageLoadPromise: new Promise<void>((resolve, _reject) => {
if (document.readyState === 'complete') {
resolve();
return;
}
- window.onload = resolve;
+ window.onload = () => resolve();
}),
getProviderType(provider: Provider): Providers | string {
const constructorName = provider.constructor.name;
@@ -364,7 +364,7 @@ export const utils = {
return Environments.UNKNOWN;
},
shouldShowJobsPage(): boolean {
- return this.isDevelopment() || this.isStaging() || this.isDogfood();
+ return utils.isDevelopment() || utils.isStaging() || utils.isDogfood();
},
getEthToken(tokenByAddress: TokenByAddress): Token {
return utils.getTokenBySymbol(constants.ETHER_TOKEN_SYMBOL, tokenByAddress);
@@ -379,7 +379,7 @@ export const utils = {
},
getTrackedTokens(tokenByAddress: TokenByAddress): Token[] {
const allTokens = _.values(tokenByAddress);
- const trackedTokens = _.filter(allTokens, t => this.isTokenTracked(t));
+ const trackedTokens = _.filter(allTokens, t => utils.isTokenTracked(t));
return trackedTokens;
},
getFormattedAmountFromToken(token: Token, tokenState: TokenState): string {
diff --git a/yarn.lock b/yarn.lock
index 4659a7e30..1e40a8459 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2778,7 +2778,7 @@ commander@2.13.0, commander@~2.13.0:
version "2.13.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
-commander@2.15.1, commander@^2.12.1, commander@^2.8.1, commander@^2.9.0:
+commander@2.15.1, commander@^2.12.1, commander@^2.8.1:
version "2.15.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f"
@@ -12124,7 +12124,7 @@ truffle-contract@2.0.1:
truffle-contract-schema "0.0.5"
web3 "^0.18.0"
-tslib@^1.0.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1:
+tslib@^1.0.0, tslib@^1.8.0, tslib@^1.8.1:
version "1.9.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
@@ -12148,21 +12148,22 @@ tslint-react@^3.0.0, tslint-react@^3.2.0:
dependencies:
tsutils "^2.13.1"
-tslint@5.8.0:
- version "5.8.0"
- resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.8.0.tgz#1f49ad5b2e77c76c3af4ddcae552ae4e3612eb13"
+tslint@5.11.0:
+ version "5.11.0"
+ resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.11.0.tgz#98f30c02eae3cde7006201e4c33cb08b48581eed"
dependencies:
babel-code-frame "^6.22.0"
builtin-modules "^1.1.1"
- chalk "^2.1.0"
- commander "^2.9.0"
+ chalk "^2.3.0"
+ commander "^2.12.1"
diff "^3.2.0"
glob "^7.1.1"
+ js-yaml "^3.7.0"
minimatch "^3.0.4"
resolve "^1.3.2"
semver "^5.3.0"
- tslib "^1.7.1"
- tsutils "^2.12.1"
+ tslib "^1.8.0"
+ tsutils "^2.27.2"
tslint@^5.9.1:
version "5.9.1"
@@ -12197,6 +12198,12 @@ tsutils@^2.12.1, tsutils@^2.13.1:
dependencies:
tslib "^1.8.1"
+tsutils@^2.27.2:
+ version "2.27.2"
+ resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.27.2.tgz#60ba88a23d6f785ec4b89c6e8179cac9b431f1c7"
+ dependencies:
+ tslib "^1.8.1"
+
tty-browserify@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"