diff options
author | Fabio Berger <me@fabioberger.com> | 2017-11-28 12:08:08 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-11-28 12:08:08 +0800 |
commit | 5a59ac4c6b9068fa55168bb072ee782cf3c7cd91 (patch) | |
tree | 89f29601440e401dace6a4ab9886fa608aa1bf20 | |
parent | 0a19ba3014ac68c1c94fcb376bc1ddb5081db757 (diff) | |
download | dexon-sol-tools-5a59ac4c6b9068fa55168bb072ee782cf3c7cd91.tar.gz dexon-sol-tools-5a59ac4c6b9068fa55168bb072ee782cf3c7cd91.tar.zst dexon-sol-tools-5a59ac4c6b9068fa55168bb072ee782cf3c7cd91.zip |
fix remaining tslint errors
87 files changed, 496 insertions, 469 deletions
diff --git a/packages/website/package.json b/packages/website/package.json index 134f8c794..b8588a31f 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -5,7 +5,7 @@ "scripts": { "build": "NODE_ENV=production webpack; exit 0;", "clean": "shx rm -f public/bundle*", - "lint": "tslint --project . 'ts/**/*.ts'", + "lint": "tslint --project . 'ts/**/*.ts' 'ts/**/*.tsx'", "dev": "webpack-dev-server --content-base public --https", "update_contracts": "for i in ${npm_package_config_artifacts}; do copyfiles -u 4 ../contracts/build/contracts/$i.json ../website/contracts; done;", "deploy_staging": "npm run build; aws s3 sync ./public/. s3://staging-0xproject --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers", diff --git a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx index 2e12fc889..963bd4388 100644 --- a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx +++ b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx @@ -1,12 +1,12 @@ import * as _ from 'lodash'; -import * as React from 'react'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; import {colors} from 'material-ui/styles'; -import {constants} from 'ts/utils/constants'; -import {configs} from 'ts/utils/configs'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; import {BlockchainErrs} from 'ts/types'; +import {configs} from 'ts/utils/configs'; +import {constants} from 'ts/utils/constants'; interface BlockchainErrDialogProps { blockchain: Blockchain; @@ -21,6 +21,7 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp public render() { const dialogActions = [ <FlatButton + key="blockchainErrOk" label="Ok" primary={true} onTouchTap={this.props.toggleDialogFn.bind(this.props.toggleDialogFn, false)} diff --git a/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx b/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx index 1db85e375..aba5b9faf 100644 --- a/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx +++ b/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx @@ -1,12 +1,12 @@ -import * as React from 'react'; +import BigNumber from 'bignumber.js'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; -import RadioButtonGroup from 'material-ui/RadioButton/RadioButtonGroup'; import RadioButton from 'material-ui/RadioButton'; -import {Side, Token, TokenState} from 'ts/types'; -import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; +import RadioButtonGroup from 'material-ui/RadioButton/RadioButtonGroup'; +import * as React from 'react'; import {EthAmountInput} from 'ts/components/inputs/eth_amount_input'; -import BigNumber from 'bignumber.js'; +import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; +import {Side, Token, TokenState} from 'ts/types'; interface EthWethConversionDialogProps { onComplete: (direction: Side, value: BigNumber) => void; diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx index f89935500..d3c95a011 100644 --- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx +++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx @@ -1,24 +1,24 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; -import {colors} from 'material-ui/styles'; +import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; -import TextField from 'material-ui/TextField'; +import {colors} from 'material-ui/styles'; import { Table, TableBody, TableHeader, - TableRow, TableHeaderColumn, + TableRow, TableRowColumn, } from 'material-ui/Table'; +import TextField from 'material-ui/TextField'; +import * as React from 'react'; import ReactTooltip = require('react-tooltip'); -import {utils} from 'ts/utils/utils'; -import {constants} from 'ts/utils/constants'; import {Blockchain} from 'ts/blockchain'; -import {Dispatcher} from 'ts/redux/dispatcher'; import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {constants} from 'ts/utils/constants'; +import {utils} from 'ts/utils/utils'; const VALID_ETHEREUM_DERIVATION_PATH_PREFIX = `44'/60'`; @@ -59,6 +59,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, public render() { const dialogActions = [ <FlatButton + key="ledgerConnectCancel" label="Cancel" onTouchTap={this.onClose.bind(this)} />, diff --git a/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx b/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx index 8f870b42f..1d90624ee 100644 --- a/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx +++ b/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; -import {colors} from 'material-ui/styles'; -import FlatButton from 'material-ui/FlatButton'; import Dialog from 'material-ui/Dialog'; +import FlatButton from 'material-ui/FlatButton'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {constants} from 'ts/utils/constants'; interface PortalDisclaimerDialogProps { @@ -16,6 +16,7 @@ export function PortalDisclaimerDialog(props: PortalDisclaimerDialogProps) { titleStyle={{fontWeight: 100}} actions={[ <FlatButton + key="portalAgree" label="I Agree" onTouchTap={props.onToggleDialog.bind(this)} />, diff --git a/packages/website/ts/components/dialogs/send_dialog.tsx b/packages/website/ts/components/dialogs/send_dialog.tsx index 10417a326..31afc3386 100644 --- a/packages/website/ts/components/dialogs/send_dialog.tsx +++ b/packages/website/ts/components/dialogs/send_dialog.tsx @@ -1,14 +1,14 @@ -import * as React from 'react'; +import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; -import RadioButtonGroup from 'material-ui/RadioButton/RadioButtonGroup'; import RadioButton from 'material-ui/RadioButton'; -import {Side, Token, TokenState} from 'ts/types'; -import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; -import {EthAmountInput} from 'ts/components/inputs/eth_amount_input'; +import RadioButtonGroup from 'material-ui/RadioButton/RadioButtonGroup'; +import * as React from 'react'; import {AddressInput} from 'ts/components/inputs/address_input'; -import BigNumber from 'bignumber.js'; +import {EthAmountInput} from 'ts/components/inputs/eth_amount_input'; +import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; +import {Side, Token, TokenState} from 'ts/types'; interface SendDialogProps { onComplete: (recipient: string, value: BigNumber) => void; diff --git a/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx b/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx index 97c654656..70c7d1ab6 100644 --- a/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx +++ b/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx @@ -1,14 +1,14 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import {colors} from 'material-ui/styles'; -import FlatButton from 'material-ui/FlatButton'; import Dialog from 'material-ui/Dialog'; -import {constants} from 'ts/utils/constants'; +import FlatButton from 'material-ui/FlatButton'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; -import {Dispatcher} from 'ts/redux/dispatcher'; import {TrackTokenConfirmation} from 'ts/components/track_token_confirmation'; import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; +import {Dispatcher} from 'ts/redux/dispatcher'; import {Token, TokenByAddress} from 'ts/types'; +import {constants} from 'ts/utils/constants'; interface TrackTokenConfirmationDialogProps { tokens: Token[]; @@ -41,10 +41,12 @@ export class TrackTokenConfirmationDialog extends titleStyle={{fontWeight: 100}} actions={[ <FlatButton + key="trackNo" label="No" onTouchTap={this.onTrackConfirmationRespondedAsync.bind(this, false)} />, <FlatButton + key="trackYes" label="Yes" onTouchTap={this.onTrackConfirmationRespondedAsync.bind(this, true)} />, 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 28c24cdbe..09c32c997 100644 --- a/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx +++ b/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; -import {colors} from 'material-ui/styles'; -import FlatButton from 'material-ui/FlatButton'; import Dialog from 'material-ui/Dialog'; +import FlatButton from 'material-ui/FlatButton'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {constants} from 'ts/utils/constants'; interface U2fNotSupportedDialogProps { @@ -16,6 +16,7 @@ export function U2fNotSupportedDialog(props: U2fNotSupportedDialogProps) { titleStyle={{fontWeight: 100}} actions={[ <FlatButton + key="u2fNo" label="Ok" onTouchTap={props.onToggleDialog.bind(this)} />, diff --git a/packages/website/ts/components/eth_weth_conversion_button.tsx b/packages/website/ts/components/eth_weth_conversion_button.tsx index fd8b713f4..a83b1543f 100644 --- a/packages/website/ts/components/eth_weth_conversion_button.tsx +++ b/packages/website/ts/components/eth_weth_conversion_button.tsx @@ -1,16 +1,15 @@ -import * as _ from 'lodash'; import {ZeroEx} from '0x.js'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; import RaisedButton from 'material-ui/RaisedButton'; -import {BlockchainCallErrs, TokenState} from 'ts/types'; +import * as React from 'react'; +import {Blockchain} from 'ts/blockchain'; import {EthWethConversionDialog} from 'ts/components/dialogs/eth_weth_conversion_dialog'; -import {Side, Token} from 'ts/types'; -import {constants} from 'ts/utils/constants'; -import {utils} from 'ts/utils/utils'; import {Dispatcher} from 'ts/redux/dispatcher'; +import {BlockchainCallErrs, Side, Token, TokenState} from 'ts/types'; +import {constants} from 'ts/utils/constants'; import {errorReporter} from 'ts/utils/error_reporter'; -import {Blockchain} from 'ts/blockchain'; +import {utils} from 'ts/utils/utils'; interface EthWethConversionButtonProps { ethToken: Token; diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx index 0d652d33f..388c72d8e 100644 --- a/packages/website/ts/components/fill_order.tsx +++ b/packages/website/ts/components/fill_order.tsx @@ -1,44 +1,44 @@ -import * as _ from 'lodash'; -import * as React from 'react'; +import {Order as ZeroExOrder, ZeroEx} from '0x.js'; import * as accounting from 'accounting'; -import {Link} from 'react-router-dom'; -import {ZeroEx, Order as ZeroExOrder} from '0x.js'; -import * as moment from 'moment'; import BigNumber from 'bignumber.js'; -import Paper from 'material-ui/Paper'; -import {Card, CardText, CardHeader} from 'material-ui/Card'; +import * as _ from 'lodash'; +import {Card, CardHeader, CardText} from 'material-ui/Card'; import Divider from 'material-ui/Divider'; -import TextField from 'material-ui/TextField'; +import Paper from 'material-ui/Paper'; import RaisedButton from 'material-ui/RaisedButton'; -import {utils} from 'ts/utils/utils'; -import {constants} from 'ts/utils/constants'; +import TextField from 'material-ui/TextField'; +import * as moment from 'moment'; +import * as React from 'react'; +import {Link} from 'react-router-dom'; +import {Blockchain} from 'ts/blockchain'; +import {TrackTokenConfirmationDialog} from 'ts/components/dialogs/track_token_confirmation_dialog'; +import {FillOrderJSON} from 'ts/components/fill_order_json'; +import {FillWarningDialog} from 'ts/components/fill_warning_dialog'; +import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; +import {Alert} from 'ts/components/ui/alert'; +import {EthereumAddress} from 'ts/components/ui/ethereum_address'; +import {Identicon} from 'ts/components/ui/identicon'; +import {VisualOrder} from 'ts/components/visual_order'; +import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {orderSchema} from 'ts/schemas/order_schema'; +import {SchemaValidator} from 'ts/schemas/validator'; import { - Side, - TokenByAddress, - TokenStateByAddress, - Order, + AlertTypes, BlockchainErrs, + ContractResponse, + ExchangeContractErrs, + Order, OrderToken, + Side, Token, - ExchangeContractErrs, - AlertTypes, - ContractResponse, + TokenByAddress, + TokenStateByAddress, WebsitePaths, } from 'ts/types'; -import {Alert} from 'ts/components/ui/alert'; -import {Identicon} from 'ts/components/ui/identicon'; -import {EthereumAddress} from 'ts/components/ui/ethereum_address'; -import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; -import {FillWarningDialog} from 'ts/components/fill_warning_dialog'; -import {FillOrderJSON} from 'ts/components/fill_order_json'; -import {VisualOrder} from 'ts/components/visual_order'; -import {SchemaValidator} from 'ts/schemas/validator'; -import {orderSchema} from 'ts/schemas/order_schema'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import {Blockchain} from 'ts/blockchain'; +import {constants} from 'ts/utils/constants'; import {errorReporter} from 'ts/utils/error_reporter'; -import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; -import {TrackTokenConfirmationDialog} from 'ts/components/dialogs/track_token_confirmation_dialog'; +import {utils} from 'ts/utils/utils'; const CUSTOM_LIGHT_GRAY = '#BBBBBB'; @@ -100,6 +100,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { } public componentWillMount() { if (!_.isEmpty(this.state.orderJSON)) { + // tslint:disable-next-line:no-floating-promises this.validateFillOrderFireAndForgetAsync(this.state.orderJSON); } } @@ -351,6 +352,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { isFillWarningDialogOpen: true, }); } else { + // tslint:disable-next-line:no-floating-promises this.onFillOrderClickFireAndForgetAsync(); } } @@ -359,6 +361,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { isFillWarningDialogOpen: false, }); if (!didUserCancel) { + // tslint:disable-next-line:no-floating-promises this.onFillOrderClickFireAndForgetAsync(); } } @@ -371,6 +374,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { didOrderValidationRun: _.isEmpty(orderJSON) && _.isEmpty(this.state.orderJSONErrMsg), didFillOrderSucceed: false, }); + // tslint:disable-next-line:no-floating-promises this.validateFillOrderFireAndForgetAsync(orderJSON); } private async checkForUntrackedTokensAndAskToAdd() { @@ -563,7 +567,9 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { await this.props.blockchain.validateFillOrderThrowIfInvalidAsync( signedOrder, takerFillAmount, this.props.userAddress); } catch (err) { - globalErrMsg = this.props.blockchain.zeroExErrToHumanReadableErrMsg(err.message, parsedOrder.taker.address); + globalErrMsg = utils.zeroExErrToHumanReadableErrMsg( + err.message, parsedOrder.taker.address, + ); } } if (!_.isEmpty(globalErrMsg)) { @@ -652,7 +658,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { await this.props.blockchain.validateCancelOrderThrowIfInvalidAsync( signedOrder, availableTakerTokenAmount); } catch (err) { - globalErrMsg = this.props.blockchain.zeroExErrToHumanReadableErrMsg(err.message, parsedOrder.taker.address); + globalErrMsg = utils.zeroExErrToHumanReadableErrMsg(err.message, parsedOrder.taker.address); } if (!_.isEmpty(globalErrMsg)) { this.setState({ @@ -711,4 +717,4 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { tokensToTrack: [], }); } -} +} // tslint:disable:max-file-line-count diff --git a/packages/website/ts/components/fill_order_json.tsx b/packages/website/ts/components/fill_order_json.tsx index b355d910b..f4db1f74e 100644 --- a/packages/website/ts/components/fill_order_json.tsx +++ b/packages/website/ts/components/fill_order_json.tsx @@ -1,13 +1,13 @@ -import * as _ from 'lodash'; -import * as React from 'react'; -import BigNumber from 'bignumber.js'; import {ZeroEx} from '0x.js'; +import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; import Paper from 'material-ui/Paper'; import TextField from 'material-ui/TextField'; -import {Side, TokenByAddress} from 'ts/types'; -import {utils} from 'ts/utils/utils'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; +import {Side, TokenByAddress} from 'ts/types'; import {constants} from 'ts/utils/constants'; +import {utils} from 'ts/utils/utils'; interface FillOrderJSONProps { blockchain: Blockchain; diff --git a/packages/website/ts/components/fill_warning_dialog.tsx b/packages/website/ts/components/fill_warning_dialog.tsx index 029fa8b0c..83e46cc8f 100644 --- a/packages/website/ts/components/fill_warning_dialog.tsx +++ b/packages/website/ts/components/fill_warning_dialog.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; -import {colors} from 'material-ui/styles'; -import FlatButton from 'material-ui/FlatButton'; import Dialog from 'material-ui/Dialog'; +import FlatButton from 'material-ui/FlatButton'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; interface FillWarningDialogProps { isOpen: boolean; @@ -16,10 +16,12 @@ export function FillWarningDialog(props: FillWarningDialogProps) { titleStyle={{fontWeight: 100, color: colors.red500}} actions={[ <FlatButton + key="fillWarningCancel" label="Cancel" onTouchTap={props.onToggleDialog.bind(this, didCancel)} />, <FlatButton + key="fillWarningContinue" label="Fill Order" onTouchTap={props.onToggleDialog.bind(this, !didCancel)} />, diff --git a/packages/website/ts/components/flash_messages/token_send_completed.tsx b/packages/website/ts/components/flash_messages/token_send_completed.tsx index c4977d70b..fef7520f6 100644 --- a/packages/website/ts/components/flash_messages/token_send_completed.tsx +++ b/packages/website/ts/components/flash_messages/token_send_completed.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; -import * as _ from 'lodash'; -import BigNumber from 'bignumber.js'; import {ZeroEx} from '0x.js'; +import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; +import * as React from 'react'; import {Token} from 'ts/types'; import {utils} from 'ts/utils/utils'; diff --git a/packages/website/ts/components/flash_messages/transaction_submitted.tsx b/packages/website/ts/components/flash_messages/transaction_submitted.tsx index 7a3cc6e86..cef3e2b1e 100644 --- a/packages/website/ts/components/flash_messages/transaction_submitted.tsx +++ b/packages/website/ts/components/flash_messages/transaction_submitted.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import * as _ from 'lodash'; +import * as React from 'react'; interface TransactionSubmittedProps { etherScanLinkIfExists?: string; diff --git a/packages/website/ts/components/footer.tsx b/packages/website/ts/components/footer.tsx index 99f97292e..f7070e0f8 100644 --- a/packages/website/ts/components/footer.tsx +++ b/packages/website/ts/components/footer.tsx @@ -1,13 +1,13 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {HashLink} from 'react-router-hash-link'; -import {Styles, WebsitePaths} from 'ts/types'; import { Link, } from 'react-router-dom'; +import {HashLink} from 'react-router-hash-link'; import { Link as ScrollLink, } from 'react-scroll'; +import {Styles, WebsitePaths} from 'ts/types'; import {constants} from 'ts/utils/constants'; interface MenuItemsBySection { diff --git a/packages/website/ts/components/generate_order/asset_picker.tsx b/packages/website/ts/components/generate_order/asset_picker.tsx index 410b0440a..633d6a017 100644 --- a/packages/website/ts/components/generate_order/asset_picker.tsx +++ b/packages/website/ts/components/generate_order/asset_picker.tsx @@ -1,26 +1,26 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import {colors} from 'material-ui/styles'; import Dialog from 'material-ui/Dialog'; +import FlatButton from 'material-ui/FlatButton'; import GridList from 'material-ui/GridList/GridList'; import GridTile from 'material-ui/GridList/GridTile'; -import FlatButton from 'material-ui/FlatButton'; -import {utils} from 'ts/utils/utils'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; +import {NewTokenForm} from 'ts/components/generate_order/new_token_form'; +import {TrackTokenConfirmation} from 'ts/components/track_token_confirmation'; +import {TokenIcon} from 'ts/components/ui/token_icon'; +import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; import {Dispatcher} from 'ts/redux/dispatcher'; import { - Token, AssetToken, - TokenByAddress, + DialogConfigs, Styles, + Token, + TokenByAddress, TokenState, - DialogConfigs, TokenVisibility, } from 'ts/types'; -import {NewTokenForm} from 'ts/components/generate_order/new_token_form'; -import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; -import {TrackTokenConfirmation} from 'ts/components/track_token_confirmation'; -import {TokenIcon} from 'ts/components/ui/token_icon'; +import {utils} from 'ts/utils/utils'; const TOKEN_ICON_DIMENSION = 100; const TILE_DIMENSION = 146; diff --git a/packages/website/ts/components/generate_order/generate_order_form.tsx b/packages/website/ts/components/generate_order/generate_order_form.tsx index e9026d9bc..72edf08cf 100644 --- a/packages/website/ts/components/generate_order/generate_order_form.tsx +++ b/packages/website/ts/components/generate_order/generate_order_form.tsx @@ -1,37 +1,37 @@ -import * as _ from 'lodash'; -import * as React from 'react'; -import {ZeroEx, Order} from '0x.js'; +import {Order, ZeroEx} from '0x.js'; import BigNumber from 'bignumber.js'; -import {Blockchain} from 'ts/blockchain'; -import Divider from 'material-ui/Divider'; +import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; +import Divider from 'material-ui/Divider'; import {colors} from 'material-ui/styles'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import {utils} from 'ts/utils/utils'; -import {SchemaValidator} from 'ts/schemas/validator'; -import {orderSchema} from 'ts/schemas/order_schema'; -import {Alert} from 'ts/components/ui/alert'; -import {OrderJSON} from 'ts/components/order_json'; +import * as React from 'react'; +import {Blockchain} from 'ts/blockchain'; +import {ExpirationInput} from 'ts/components/inputs/expiration_input'; +import {HashInput} from 'ts/components/inputs/hash_input'; import {IdenticonAddressInput} from 'ts/components/inputs/identicon_address_input'; -import {TokenInput} from 'ts/components/inputs/token_input'; import {TokenAmountInput} from 'ts/components/inputs/token_amount_input'; -import {HashInput} from 'ts/components/inputs/hash_input'; -import {ExpirationInput} from 'ts/components/inputs/expiration_input'; -import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; -import {errorReporter} from 'ts/utils/error_reporter'; +import {TokenInput} from 'ts/components/inputs/token_input'; +import {OrderJSON} from 'ts/components/order_json'; +import {Alert} from 'ts/components/ui/alert'; import {HelpTooltip} from 'ts/components/ui/help_tooltip'; +import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; import {SwapIcon} from 'ts/components/ui/swap_icon'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {orderSchema} from 'ts/schemas/order_schema'; +import {SchemaValidator} from 'ts/schemas/validator'; import { + AlertTypes, + BlockchainErrs, + HashData, Side, SideToAssetToken, SignatureData, - HashData, + Token, TokenByAddress, TokenStateByAddress, - BlockchainErrs, - Token, - AlertTypes, } from 'ts/types'; +import {errorReporter} from 'ts/utils/error_reporter'; +import {utils} from 'ts/utils/utils'; enum SigningState { UNSIGNED, diff --git a/packages/website/ts/components/generate_order/new_token_form.tsx b/packages/website/ts/components/generate_order/new_token_form.tsx index 95c05f5bb..7e2c61ae8 100644 --- a/packages/website/ts/components/generate_order/new_token_form.tsx +++ b/packages/website/ts/components/generate_order/new_token_form.tsx @@ -1,15 +1,15 @@ +import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; -import * as React from 'react'; import {colors} from 'material-ui/styles'; import TextField from 'material-ui/TextField'; -import {constants} from 'ts/utils/constants'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; -import {Token, TokenState, TokenByAddress, AlertTypes} from 'ts/types'; import {AddressInput} from 'ts/components/inputs/address_input'; import {Alert} from 'ts/components/ui/alert'; import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; import {RequiredLabel} from 'ts/components/ui/required_label'; -import BigNumber from 'bignumber.js'; +import {AlertTypes, Token, TokenByAddress, TokenState} from 'ts/types'; +import {constants} from 'ts/utils/constants'; interface NewTokenFormProps { blockchain: Blockchain; diff --git a/packages/website/ts/components/inputs/address_input.tsx b/packages/website/ts/components/inputs/address_input.tsx index 57ad7a5e2..8b03b8d12 100644 --- a/packages/website/ts/components/inputs/address_input.tsx +++ b/packages/website/ts/components/inputs/address_input.tsx @@ -1,8 +1,8 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import {isAddress} from 'ethereum-address'; -import TextField from 'material-ui/TextField'; +import * as _ from 'lodash'; import {colors} from 'material-ui/styles'; +import TextField from 'material-ui/TextField'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; import {RequiredLabel} from 'ts/components/ui/required_label'; diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx index f02112253..4c15ed4a0 100644 --- a/packages/website/ts/components/inputs/allowance_toggle.tsx +++ b/packages/website/ts/components/inputs/allowance_toggle.tsx @@ -1,12 +1,12 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; import Toggle from 'material-ui/Toggle'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; import {Dispatcher} from 'ts/redux/dispatcher'; -import {Token, TokenState, BalanceErrs} from 'ts/types'; -import {utils} from 'ts/utils/utils'; +import {BalanceErrs, Token, TokenState} from 'ts/types'; import {errorReporter} from 'ts/utils/error_reporter'; +import {utils} from 'ts/utils/utils'; const DEFAULT_ALLOWANCE_AMOUNT_IN_BASE_UNITS = new BigNumber(2).pow(256).minus(1); diff --git a/packages/website/ts/components/inputs/balance_bounded_input.tsx b/packages/website/ts/components/inputs/balance_bounded_input.tsx index 1c8b410a4..7ddefc3b9 100644 --- a/packages/website/ts/components/inputs/balance_bounded_input.tsx +++ b/packages/website/ts/components/inputs/balance_bounded_input.tsx @@ -1,12 +1,12 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; -import {ValidatedBigNumberCallback, InputErrMsg, WebsitePaths} from 'ts/types'; +import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import TextField from 'material-ui/TextField'; +import * as React from 'react'; +import {Link} from 'react-router-dom'; import {RequiredLabel} from 'ts/components/ui/required_label'; -import {colors} from 'material-ui/styles'; +import {InputErrMsg, ValidatedBigNumberCallback, WebsitePaths} from 'ts/types'; import {utils} from 'ts/utils/utils'; -import {Link} from 'react-router-dom'; interface BalanceBoundedInputProps { label?: string; diff --git a/packages/website/ts/components/inputs/eth_amount_input.tsx b/packages/website/ts/components/inputs/eth_amount_input.tsx index ad551e125..5c5e23eef 100644 --- a/packages/website/ts/components/inputs/eth_amount_input.tsx +++ b/packages/website/ts/components/inputs/eth_amount_input.tsx @@ -1,9 +1,9 @@ +import {ZeroEx} from '0x.js'; import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import * as React from 'react'; -import {ZeroEx} from '0x.js'; -import {ValidatedBigNumberCallback} from 'ts/types'; import {BalanceBoundedInput} from 'ts/components/inputs/balance_bounded_input'; +import {ValidatedBigNumberCallback} from 'ts/types'; import {constants} from 'ts/utils/constants'; interface EthAmountInputProps { diff --git a/packages/website/ts/components/inputs/expiration_input.tsx b/packages/website/ts/components/inputs/expiration_input.tsx index 32dcad189..d3d3d258d 100644 --- a/packages/website/ts/components/inputs/expiration_input.tsx +++ b/packages/website/ts/components/inputs/expiration_input.tsx @@ -1,10 +1,10 @@ -import * as React from 'react'; +import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import DatePicker from 'material-ui/DatePicker'; import TimePicker from 'material-ui/TimePicker'; -import {utils} from 'ts/utils/utils'; -import BigNumber from 'bignumber.js'; import * as moment from 'moment'; +import * as React from 'react'; +import {utils} from 'ts/utils/utils'; interface ExpirationInputProps { orderExpiryTimestamp: BigNumber; diff --git a/packages/website/ts/components/inputs/hash_input.tsx b/packages/website/ts/components/inputs/hash_input.tsx index 3e42f1d5f..7fadc3c15 100644 --- a/packages/website/ts/components/inputs/hash_input.tsx +++ b/packages/website/ts/components/inputs/hash_input.tsx @@ -1,8 +1,8 @@ +import {Order, ZeroEx} from '0x.js'; import * as React from 'react'; +import ReactTooltip = require('react-tooltip'); import {Blockchain} from 'ts/blockchain'; -import {ZeroEx, Order} from '0x.js'; import {FakeTextField} from 'ts/components/ui/fake_text_field'; -import ReactTooltip = require('react-tooltip'); import {HashData, Styles} from 'ts/types'; import {constants} from 'ts/utils/constants'; diff --git a/packages/website/ts/components/inputs/identicon_address_input.tsx b/packages/website/ts/components/inputs/identicon_address_input.tsx index 6452f5fe9..692a092d9 100644 --- a/packages/website/ts/components/inputs/identicon_address_input.tsx +++ b/packages/website/ts/components/inputs/identicon_address_input.tsx @@ -1,11 +1,11 @@ import * as _ from 'lodash'; -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; -import {Identicon} from 'ts/components/ui/identicon'; -import {RequiredLabel} from 'ts/components/ui/required_label'; import {AddressInput} from 'ts/components/inputs/address_input'; +import {Identicon} from 'ts/components/ui/identicon'; import {InputLabel} from 'ts/components/ui/input_label'; +import {RequiredLabel} from 'ts/components/ui/required_label'; interface IdenticonAddressInputProps { initialAddress: string; diff --git a/packages/website/ts/components/inputs/token_amount_input.tsx b/packages/website/ts/components/inputs/token_amount_input.tsx index e19af8984..f39341a4f 100644 --- a/packages/website/ts/components/inputs/token_amount_input.tsx +++ b/packages/website/ts/components/inputs/token_amount_input.tsx @@ -1,11 +1,11 @@ -import * as React from 'react'; -import * as _ from 'lodash'; -import BigNumber from 'bignumber.js'; import {ZeroEx} from '0x.js'; -import {Link} from 'react-router-dom'; +import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; import {colors} from 'material-ui/styles'; -import {Token, TokenState, InputErrMsg, ValidatedBigNumberCallback, WebsitePaths} from 'ts/types'; +import * as React from 'react'; +import {Link} from 'react-router-dom'; import {BalanceBoundedInput} from 'ts/components/inputs/balance_bounded_input'; +import {InputErrMsg, Token, TokenState, ValidatedBigNumberCallback, WebsitePaths} from 'ts/types'; interface TokenAmountInputProps { label: string; diff --git a/packages/website/ts/components/inputs/token_input.tsx b/packages/website/ts/components/inputs/token_input.tsx index 2be74d4fd..8daa84650 100644 --- a/packages/website/ts/components/inputs/token_input.tsx +++ b/packages/website/ts/components/inputs/token_input.tsx @@ -1,13 +1,13 @@ import * as _ from 'lodash'; -import * as React from 'react'; import Paper from 'material-ui/Paper'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Blockchain} from 'ts/blockchain'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import {AssetToken, Side, TokenByAddress, BlockchainErrs, Token, TokenState} from 'ts/types'; import {AssetPicker} from 'ts/components/generate_order/asset_picker'; import {InputLabel} from 'ts/components/ui/input_label'; import {TokenIcon} from 'ts/components/ui/token_icon'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {AssetToken, BlockchainErrs, Side, Token, TokenByAddress, TokenState} from 'ts/types'; const TOKEN_ICON_DIMENSION = 80; diff --git a/packages/website/ts/components/order_json.tsx b/packages/website/ts/components/order_json.tsx index 90e3543dd..073abe419 100644 --- a/packages/website/ts/components/order_json.tsx +++ b/packages/website/ts/components/order_json.tsx @@ -1,15 +1,15 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; -import {utils} from 'ts/utils/utils'; +import * as _ from 'lodash'; +import Paper from 'material-ui/Paper'; import {colors} from 'material-ui/styles'; -import {constants} from 'ts/utils/constants'; -import {configs} from 'ts/utils/configs'; import TextField from 'material-ui/TextField'; -import Paper from 'material-ui/Paper'; +import * as React from 'react'; import {CopyIcon} from 'ts/components/ui/copy_icon'; -import {SideToAssetToken, SignatureData, Order, TokenByAddress, WebsitePaths} from 'ts/types'; +import {Order, SideToAssetToken, SignatureData, TokenByAddress, WebsitePaths} from 'ts/types'; +import {configs} from 'ts/utils/configs'; +import {constants} from 'ts/utils/constants'; import {errorReporter} from 'ts/utils/error_reporter'; +import {utils} from 'ts/utils/utils'; interface OrderJSONProps { exchangeContractIfExists: string; @@ -36,6 +36,7 @@ export class OrderJSON extends React.Component<OrderJSONProps, OrderJSONState> { this.state = { shareLink: '', }; + // tslint:disable-next-line:no-floating-promises this.setShareLinkAsync(); } public render() { @@ -149,7 +150,7 @@ You can see and fill it here: ${this.state.shareLink}`); await errorReporter.reportAsync(new Error(`Bitly returned non-200: ${JSON.stringify(response)}`)); return ''; } - return (bodyObj as any).data.url; + return (bodyObj).data.url; } private getOrderUrl() { const order = utils.generateOrder(this.props.networkId, this.props.exchangeContractIfExists, diff --git a/packages/website/ts/components/portal.tsx b/packages/website/ts/components/portal.tsx index 3591a347b..62a5d2eac 100644 --- a/packages/website/ts/components/portal.tsx +++ b/packages/website/ts/components/portal.tsx @@ -1,44 +1,44 @@ +import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; -import * as React from 'react'; -import * as DocumentTitle from 'react-document-title'; -import {Switch, Route} from 'react-router-dom'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import {State} from 'ts/redux/reducer'; -import {utils} from 'ts/utils/utils'; -import {configs} from 'ts/utils/configs'; -import {constants} from 'ts/utils/constants'; import Paper from 'material-ui/Paper'; import RaisedButton from 'material-ui/RaisedButton'; import {colors} from 'material-ui/styles'; -import {GenerateOrderForm} from 'ts/containers/generate_order_form'; -import {TokenBalances} from 'ts/components/token_balances'; +import * as React from 'react'; +import * as DocumentTitle from 'react-document-title'; +import {Route, Switch} from 'react-router-dom'; +import {Blockchain} from 'ts/blockchain'; +import {BlockchainErrDialog} from 'ts/components/dialogs/blockchain_err_dialog'; import {PortalDisclaimerDialog} from 'ts/components/dialogs/portal_disclaimer_dialog'; import {FillOrder} from 'ts/components/fill_order'; -import {Blockchain} from 'ts/blockchain'; -import {SchemaValidator} from 'ts/schemas/validator'; -import {orderSchema} from 'ts/schemas/order_schema'; -import {localStorage} from 'ts/local_storage/local_storage'; +import {Footer} from 'ts/components/footer'; +import {PortalMenu} from 'ts/components/portal_menu'; +import {TokenBalances} from 'ts/components/token_balances'; +import {TopBar} from 'ts/components/top_bar'; import {TradeHistory} from 'ts/components/trade_history/trade_history'; +import {FlashMessage} from 'ts/components/ui/flash_message'; +import {Loading} from 'ts/components/ui/loading'; +import {GenerateOrderForm} from 'ts/containers/generate_order_form'; +import {localStorage} from 'ts/local_storage/local_storage'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {State} from 'ts/redux/reducer'; +import {orderSchema} from 'ts/schemas/order_schema'; +import {SchemaValidator} from 'ts/schemas/validator'; import { - HashData, - TokenByAddress, BlockchainErrs, - Order, Fill, + HashData, + Order, + ScreenWidths, Side, Styles, - ScreenWidths, Token, + TokenByAddress, TokenStateByAddress, WebsitePaths, } from 'ts/types'; -import {TopBar} from 'ts/components/top_bar'; -import {Footer} from 'ts/components/footer'; -import {Loading} from 'ts/components/ui/loading'; -import {PortalMenu} from 'ts/components/portal_menu'; -import {BlockchainErrDialog} from 'ts/components/dialogs/blockchain_err_dialog'; -import BigNumber from 'bignumber.js'; -import {FlashMessage} from 'ts/components/ui/flash_message'; +import {configs} from 'ts/utils/configs'; +import {constants} from 'ts/utils/constants'; +import {utils} from 'ts/utils/utils'; const THROTTLE_TIMEOUT = 100; @@ -131,16 +131,19 @@ export class Portal extends React.Component<PortalAllProps, PortalAllState> { } public componentWillReceiveProps(nextProps: PortalAllProps) { if (nextProps.networkId !== this.state.prevNetworkId) { + // tslint:disable-next-line:no-floating-promises this.blockchain.networkIdUpdatedFireAndForgetAsync(nextProps.networkId); this.setState({ prevNetworkId: nextProps.networkId, }); } if (nextProps.userAddress !== this.state.prevUserAddress) { + // tslint:disable-next-line:no-floating-promises this.blockchain.userAddressUpdatedFireAndForgetAsync(nextProps.userAddress); if (!_.isEmpty(nextProps.userAddress) && nextProps.blockchainIsLoaded) { const tokens = _.values(nextProps.tokenByAddress); + // tslint:disable-next-line:no-floating-promises this.updateBalanceAndAllowanceWithLoadingScreenAsync(tokens); } this.setState({ @@ -148,6 +151,7 @@ export class Portal extends React.Component<PortalAllProps, PortalAllState> { }); } if (nextProps.nodeVersion !== this.state.prevNodeVersion) { + // tslint:disable-next-line:no-floating-promises this.blockchain.nodeVersionUpdatedFireAndForgetAsync(nextProps.nodeVersion); } } diff --git a/packages/website/ts/components/portal_menu.tsx b/packages/website/ts/components/portal_menu.tsx index 3b3641729..869df3e71 100644 --- a/packages/website/ts/components/portal_menu.tsx +++ b/packages/website/ts/components/portal_menu.tsx @@ -1,7 +1,7 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {MenuItem} from 'ts/components/ui/menu_item'; import {Link} from 'react-router-dom'; +import {MenuItem} from 'ts/components/ui/menu_item'; import {WebsitePaths} from 'ts/types'; export interface PortalMenuProps { diff --git a/packages/website/ts/components/send_button.tsx b/packages/website/ts/components/send_button.tsx index 274ba96a7..da8dd2a9b 100644 --- a/packages/website/ts/components/send_button.tsx +++ b/packages/website/ts/components/send_button.tsx @@ -1,15 +1,15 @@ -import * as _ from 'lodash'; import {ZeroEx} from '0x.js'; -import * as React from 'react'; import BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; import RaisedButton from 'material-ui/RaisedButton'; -import {BlockchainCallErrs, Token, TokenState} from 'ts/types'; +import * as React from 'react'; +import {Blockchain} from 'ts/blockchain'; import {SendDialog} from 'ts/components/dialogs/send_dialog'; -import {constants} from 'ts/utils/constants'; -import {utils} from 'ts/utils/utils'; import {Dispatcher} from 'ts/redux/dispatcher'; +import {BlockchainCallErrs, Token, TokenState} from 'ts/types'; +import {constants} from 'ts/utils/constants'; import {errorReporter} from 'ts/utils/error_reporter'; -import {Blockchain} from 'ts/blockchain'; +import {utils} from 'ts/utils/utils'; interface SendButtonProps { token: Token; diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx index 2d533a9f2..ae5ef9222 100644 --- a/packages/website/ts/components/token_balances.tsx +++ b/packages/website/ts/components/token_balances.tsx @@ -1,53 +1,53 @@ -import * as _ from 'lodash'; -import * as React from 'react'; import {ZeroEx} from '0x.js'; +import BigNumber from 'bignumber.js'; import DharmaLoanFrame from 'dharma-loan-frame'; -import {colors} from 'material-ui/styles'; +import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import Divider from 'material-ui/Divider'; import FlatButton from 'material-ui/FlatButton'; -import RaisedButton from 'material-ui/RaisedButton'; import FloatingActionButton from 'material-ui/FloatingActionButton'; +import RaisedButton from 'material-ui/RaisedButton'; +import {colors} from 'material-ui/styles'; import ContentAdd from 'material-ui/svg-icons/content/add'; import ContentRemove from 'material-ui/svg-icons/content/remove'; import { Table, TableBody, TableHeader, - TableRow, TableHeaderColumn, + TableRow, TableRowColumn, } from 'material-ui/Table'; +import QueryString = require('query-string'); +import * as React from 'react'; import ReactTooltip = require('react-tooltip'); -import BigNumber from 'bignumber.js'; import firstBy = require('thenby'); -import QueryString = require('query-string'); +import {Blockchain} from 'ts/blockchain'; +import {EthWethConversionButton} from 'ts/components/eth_weth_conversion_button'; +import {AssetPicker} from 'ts/components/generate_order/asset_picker'; +import {AllowanceToggle} from 'ts/components/inputs/allowance_toggle'; +import {SendButton} from 'ts/components/send_button'; +import {HelpTooltip} from 'ts/components/ui/help_tooltip'; +import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; +import {TokenIcon} from 'ts/components/ui/token_icon'; +import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; import {Dispatcher} from 'ts/redux/dispatcher'; import { - TokenByAddress, - TokenStateByAddress, - Token, - BlockchainErrs, BalanceErrs, - Styles, - ScreenWidths, - EtherscanLinkSuffixes, BlockchainCallErrs, + BlockchainErrs, + EtherscanLinkSuffixes, + ScreenWidths, + Styles, + Token, + TokenByAddress, + TokenStateByAddress, TokenVisibility, } from 'ts/types'; -import {Blockchain} from 'ts/blockchain'; -import {utils} from 'ts/utils/utils'; -import {constants} from 'ts/utils/constants'; import {configs} from 'ts/utils/configs'; -import {LifeCycleRaisedButton} from 'ts/components/ui/lifecycle_raised_button'; -import {HelpTooltip} from 'ts/components/ui/help_tooltip'; +import {constants} from 'ts/utils/constants'; import {errorReporter} from 'ts/utils/error_reporter'; -import {AllowanceToggle} from 'ts/components/inputs/allowance_toggle'; -import {EthWethConversionButton} from 'ts/components/eth_weth_conversion_button'; -import {SendButton} from 'ts/components/send_button'; -import {AssetPicker} from 'ts/components/generate_order/asset_picker'; -import {TokenIcon} from 'ts/components/ui/token_icon'; -import {trackedTokenStorage} from 'ts/local_storage/tracked_token_storage'; +import {utils} from 'ts/utils/utils'; const ETHER_ICON_PATH = '/images/ether.png'; const ETHER_TOKEN_SYMBOL = 'WETH'; @@ -665,6 +665,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala isZRXSpinnerVisible: true, currentZrxBalance: zrxTokenState.balance, }); + // tslint:disable-next-line:no-floating-promises this.props.blockchain.pollTokenBalanceAsync(zrxToken); } return true; @@ -696,4 +697,4 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala isAddingToken: false, }); } -} +} // tslint:disable:max-file-line-count diff --git a/packages/website/ts/components/top_bar.tsx b/packages/website/ts/components/top_bar.tsx index 6248095b3..a84f1324d 100644 --- a/packages/website/ts/components/top_bar.tsx +++ b/packages/website/ts/components/top_bar.tsx @@ -1,25 +1,25 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import { - Link as ScrollLink, - animateScroll, -} from 'react-scroll'; -import {Link} from 'react-router-dom'; -import {HashLink} from 'react-router-hash-link'; import AppBar from 'material-ui/AppBar'; import Drawer from 'material-ui/Drawer'; import MenuItem from 'material-ui/MenuItem'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; +import {Link} from 'react-router-dom'; +import {HashLink} from 'react-router-hash-link'; +import { + animateScroll, + Link as ScrollLink, +} from 'react-scroll'; import ReactTooltip = require('react-tooltip'); -import {configs} from 'ts/utils/configs'; -import {constants} from 'ts/utils/constants'; -import {Identicon} from 'ts/components/ui/identicon'; -import {NestedSidebarMenu} from 'ts/pages/shared/nested_sidebar_menu'; -import {typeDocUtils} from 'ts/utils/typedoc_utils'; import {PortalMenu} from 'ts/components/portal_menu'; -import {Styles, TypeDocNode, MenuSubsectionsBySection, WebsitePaths, Docs} from 'ts/types'; import {TopBarMenuItem} from 'ts/components/top_bar_menu_item'; import {DropDownMenuItem} from 'ts/components/ui/drop_down_menu_item'; +import {Identicon} from 'ts/components/ui/identicon'; +import {NestedSidebarMenu} from 'ts/pages/shared/nested_sidebar_menu'; +import {Docs, MenuSubsectionsBySection, Styles, TypeDocNode, WebsitePaths} from 'ts/types'; +import {configs} from 'ts/utils/configs'; +import {constants} from 'ts/utils/constants'; +import {typeDocUtils} from 'ts/utils/typedoc_utils'; const CUSTOM_DARK_GRAY = '#231F20'; const SECTION_HEADER_COLOR = 'rgb(234, 234, 234)'; @@ -135,8 +135,15 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { </a>, ]; const bottomBorderStyle = this.shouldDisplayBottomBar() ? styles.bottomBar : {}; - const fullWithClassNames = isFullWidthPage ? 'pr4' : ''; + const fullWidthClasses = isFullWidthPage ? 'pr4' : ''; const logoUrl = isNightVersion ? '/images/protocol_logo_white.png' : '/images/protocol_logo_black.png'; + const menuClasses = `col col-${isFullWidthPage ? '4' : '5'} ${fullWidthClasses} lg-pr0 md-pr2 sm-hide xs-hide`; + const menuIconStyle = { + fontSize: 25, + color: isNightVersion ? 'white' : 'black', + cursor: 'pointer', + paddingTop: 16, + }; return ( <div style={{...styles.topBar, ...bottomBorderStyle, ...this.props.style}} className="pb1"> <div className={parentClassNames}> @@ -148,7 +155,9 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { <div className={`col col-${isFullWidthPage ? '8' : '9'} lg-hide md-hide`} /> <div className={`col col-${isFullWidthPage ? '6' : '5'} sm-hide xs-hide`} /> {!this.isViewingPortal() && - <div className={`col col-${isFullWidthPage ? '4' : '5'} ${fullWithClassNames} lg-pr0 md-pr2 sm-hide xs-hide`}> + <div + className={menuClasses} + > <div className="flex justify-between"> <DropDownMenuItem title="Developers" @@ -188,9 +197,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> { <div className={`col ${isFullWidthPage ? 'col-2 pl2' : 'col-1'} md-hide lg-hide`} > - <div - style={{fontSize: 25, color: isNightVersion ? 'white' : 'black', cursor: 'pointer', paddingTop: 16}} - > + <div style={menuIconStyle}> <i className="zmdi zmdi-menu" onClick={this.onMenuButtonClick.bind(this)} diff --git a/packages/website/ts/components/track_token_confirmation.tsx b/packages/website/ts/components/track_token_confirmation.tsx index bc036eae3..b9b2ef18a 100644 --- a/packages/website/ts/components/track_token_confirmation.tsx +++ b/packages/website/ts/components/track_token_confirmation.tsx @@ -1,11 +1,11 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import {colors} from 'material-ui/styles'; -import FlatButton from 'material-ui/FlatButton'; import Dialog from 'material-ui/Dialog'; -import {utils} from 'ts/utils/utils'; +import FlatButton from 'material-ui/FlatButton'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Party} from 'ts/components/ui/party'; import {Token, TokenByAddress} from 'ts/types'; +import {utils} from 'ts/utils/utils'; interface TrackTokenConfirmationProps { tokens: Token[]; diff --git a/packages/website/ts/components/trade_history/trade_history.tsx b/packages/website/ts/components/trade_history/trade_history.tsx index 9deaf8fd8..59f85a03d 100644 --- a/packages/website/ts/components/trade_history/trade_history.tsx +++ b/packages/website/ts/components/trade_history/trade_history.tsx @@ -1,11 +1,11 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import Paper from 'material-ui/Paper'; import Divider from 'material-ui/Divider'; -import {utils} from 'ts/utils/utils'; -import {Fill, TokenByAddress} from 'ts/types'; +import Paper from 'material-ui/Paper'; +import * as React from 'react'; import {TradeHistoryItem} from 'ts/components/trade_history/trade_history_item'; import {tradeHistoryStorage} from 'ts/local_storage/trade_history_storage'; +import {Fill, TokenByAddress} from 'ts/types'; +import {utils} from 'ts/utils/utils'; const FILL_POLLING_INTERVAL = 1000; diff --git a/packages/website/ts/components/trade_history/trade_history_item.tsx b/packages/website/ts/components/trade_history/trade_history_item.tsx index 58bdf84ae..4dcceadb7 100644 --- a/packages/website/ts/components/trade_history/trade_history_item.tsx +++ b/packages/website/ts/components/trade_history/trade_history_item.tsx @@ -1,14 +1,14 @@ -import * as _ from 'lodash'; -import * as React from 'react'; +import {ZeroEx} from '0x.js'; import BigNumber from 'bignumber.js'; -import * as ReactTooltip from 'react-tooltip'; -import * as moment from 'moment'; +import * as _ from 'lodash'; import Paper from 'material-ui/Paper'; import {colors} from 'material-ui/styles'; -import {ZeroEx} from '0x.js'; -import {TokenByAddress, Fill, Token, EtherscanLinkSuffixes} from 'ts/types'; -import {Party} from 'ts/components/ui/party'; +import * as moment from 'moment'; +import * as React from 'react'; +import * as ReactTooltip from 'react-tooltip'; import {EtherScanIcon} from 'ts/components/ui/etherscan_icon'; +import {Party} from 'ts/components/ui/party'; +import {EtherscanLinkSuffixes, Fill, Token, TokenByAddress} from 'ts/types'; const PRECISION = 5; const IDENTICON_DIAMETER = 40; diff --git a/packages/website/ts/components/ui/alert.tsx b/packages/website/ts/components/ui/alert.tsx index bf2f0baf5..71d2388f2 100644 --- a/packages/website/ts/components/ui/alert.tsx +++ b/packages/website/ts/components/ui/alert.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {AlertTypes} from 'ts/types'; const CUSTOM_GREEN = 'rgb(137, 199, 116)'; diff --git a/packages/website/ts/components/ui/badge.tsx b/packages/website/ts/components/ui/badge.tsx index 1e3bbdb99..15d5ea227 100644 --- a/packages/website/ts/components/ui/badge.tsx +++ b/packages/website/ts/components/ui/badge.tsx @@ -1,6 +1,6 @@ import * as _ from 'lodash'; -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Styles} from 'ts/types'; const styles: Styles = { diff --git a/packages/website/ts/components/ui/copy_icon.tsx b/packages/website/ts/components/ui/copy_icon.tsx index f8abaa59e..5f8e6a060 100644 --- a/packages/website/ts/components/ui/copy_icon.tsx +++ b/packages/website/ts/components/ui/copy_icon.tsx @@ -1,8 +1,8 @@ import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; -import * as ReactDOM from 'react-dom'; import * as CopyToClipboard from 'react-copy-to-clipboard'; -import {colors} from 'material-ui/styles'; +import * as ReactDOM from 'react-dom'; import ReactTooltip = require('react-tooltip'); interface CopyIconProps { diff --git a/packages/website/ts/components/ui/drop_down_menu_item.tsx b/packages/website/ts/components/ui/drop_down_menu_item.tsx index b8b7eb167..05b88f7ce 100644 --- a/packages/website/ts/components/ui/drop_down_menu_item.tsx +++ b/packages/website/ts/components/ui/drop_down_menu_item.tsx @@ -1,12 +1,12 @@ import * as _ from 'lodash'; +import Menu from 'material-ui/Menu'; +import MenuItem from 'material-ui/MenuItem'; +import Popover from 'material-ui/Popover'; import * as React from 'react'; +import {Link} from 'react-router-dom'; import { Link as ScrollLink, } from 'react-scroll'; -import {Link} from 'react-router-dom'; -import Popover from 'material-ui/Popover'; -import Menu from 'material-ui/Menu'; -import MenuItem from 'material-ui/MenuItem'; import {Styles, WebsitePaths} from 'ts/types'; const CHECK_CLOSE_POPOVER_INTERVAL_MS = 300; diff --git a/packages/website/ts/components/ui/ethereum_address.tsx b/packages/website/ts/components/ui/ethereum_address.tsx index c3d03b78c..b3bc0bc59 100644 --- a/packages/website/ts/components/ui/ethereum_address.tsx +++ b/packages/website/ts/components/ui/ethereum_address.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import {EtherScanIcon} from 'ts/components/ui/etherscan_icon'; import ReactTooltip = require('react-tooltip'); +import {EtherScanIcon} from 'ts/components/ui/etherscan_icon'; import {EtherscanLinkSuffixes} from 'ts/types'; import {utils} from 'ts/utils/utils'; diff --git a/packages/website/ts/components/ui/etherscan_icon.tsx b/packages/website/ts/components/ui/etherscan_icon.tsx index 12044f44b..9b4d172f1 100644 --- a/packages/website/ts/components/ui/etherscan_icon.tsx +++ b/packages/website/ts/components/ui/etherscan_icon.tsx @@ -1,7 +1,7 @@ import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import ReactTooltip = require('react-tooltip'); -import {colors} from 'material-ui/styles'; import {EtherscanLinkSuffixes} from 'ts/types'; import {utils} from 'ts/utils/utils'; diff --git a/packages/website/ts/components/ui/fake_text_field.tsx b/packages/website/ts/components/ui/fake_text_field.tsx index 372785c2f..90bc47f01 100644 --- a/packages/website/ts/components/ui/fake_text_field.tsx +++ b/packages/website/ts/components/ui/fake_text_field.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {InputLabel} from 'ts/components/ui/input_label'; import {Styles} from 'ts/types'; diff --git a/packages/website/ts/components/ui/flash_message.tsx b/packages/website/ts/components/ui/flash_message.tsx index 684aeef68..ab4edbbb0 100644 --- a/packages/website/ts/components/ui/flash_message.tsx +++ b/packages/website/ts/components/ui/flash_message.tsx @@ -1,6 +1,6 @@ import * as _ from 'lodash'; -import * as React from 'react'; import Snackbar from 'material-ui/Snackbar'; +import * as React from 'react'; import {Dispatcher} from 'ts/redux/dispatcher'; const SHOW_DURATION_MS = 4000; diff --git a/packages/website/ts/components/ui/identicon.tsx b/packages/website/ts/components/ui/identicon.tsx index 814548fb4..a741ae43b 100644 --- a/packages/website/ts/components/ui/identicon.tsx +++ b/packages/website/ts/components/ui/identicon.tsx @@ -1,7 +1,7 @@ +import blockies = require('blockies'); import * as _ from 'lodash'; import * as React from 'react'; import {constants} from 'ts/utils/constants'; -import blockies = require('blockies'); interface IdenticonProps { address: string; diff --git a/packages/website/ts/components/ui/input_label.tsx b/packages/website/ts/components/ui/input_label.tsx index 5866c70b6..852097519 100644 --- a/packages/website/ts/components/ui/input_label.tsx +++ b/packages/website/ts/components/ui/input_label.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; export interface InputLabelProps { text: string | Element | React.ReactNode; diff --git a/packages/website/ts/components/ui/labeled_switcher.tsx b/packages/website/ts/components/ui/labeled_switcher.tsx index 3ed8ba0a4..80a8fbe94 100644 --- a/packages/website/ts/components/ui/labeled_switcher.tsx +++ b/packages/website/ts/components/ui/labeled_switcher.tsx @@ -1,6 +1,6 @@ import * as _ from 'lodash'; -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; const CUSTOM_BLUE = '#63A6F1'; @@ -61,12 +61,9 @@ export class LabeledSwitcher extends React.Component<LabeledSwitcherProps, Label this.setState({ isLeftSelected: isLeft, }); - let didSucceed; - if (isLeft) { - didSucceed = await this.props.onLeftLabelClickAsync(); - } else { - didSucceed = await this.props.onRightLabelClickAsync(); - } + const didSucceed = isLeft ? + await this.props.onLeftLabelClickAsync() : + await this.props.onRightLabelClickAsync(); if (!didSucceed) { this.setState({ isLeftSelected: !isLeft, diff --git a/packages/website/ts/components/ui/lifecycle_raised_button.tsx b/packages/website/ts/components/ui/lifecycle_raised_button.tsx index e93c80ba4..630f71545 100644 --- a/packages/website/ts/components/ui/lifecycle_raised_button.tsx +++ b/packages/website/ts/components/ui/lifecycle_raised_button.tsx @@ -1,9 +1,9 @@ import * as _ from 'lodash'; +import RaisedButton from 'material-ui/RaisedButton'; import * as React from 'react'; -import {utils} from 'ts/utils/utils'; -import {Token} from 'ts/types'; import {Blockchain} from 'ts/blockchain'; -import RaisedButton from 'material-ui/RaisedButton'; +import {Token} from 'ts/types'; +import {utils} from 'ts/utils/utils'; const COMPLETE_STATE_SHOW_LENGTH_MS = 2000; @@ -11,7 +11,7 @@ enum ButtonState { READY, LOADING, COMPLETE, -}; +} interface LifeCycleRaisedButtonProps { isHidden?: boolean; @@ -49,7 +49,7 @@ export class LifeCycleRaisedButton extends this.didUnmount = true; } public render() { - if (this.props.isHidden === true) { + if (this.props.isHidden) { return <span />; } @@ -83,7 +83,7 @@ export class LifeCycleRaisedButton extends this.setState({ buttonState: ButtonState.LOADING, }); - const didSucceed = await this.props.onClickAsyncFn(); + const didSucceed = this.props.onClickAsyncFn(); if (this.didUnmount) { return; // noop since unmount called before async callback returned. } diff --git a/packages/website/ts/components/ui/loading.tsx b/packages/website/ts/components/ui/loading.tsx index 39c119d8f..83636b5ff 100644 --- a/packages/website/ts/components/ui/loading.tsx +++ b/packages/website/ts/components/ui/loading.tsx @@ -1,9 +1,9 @@ import * as _ from 'lodash'; -import * as React from 'react'; import Paper from 'material-ui/Paper'; -import {utils} from 'ts/utils/utils'; +import * as React from 'react'; import {DefaultPlayer as Video} from 'react-html5video'; import 'react-html5video/dist/styles.css'; +import {utils} from 'ts/utils/utils'; interface LoadingProps {} diff --git a/packages/website/ts/components/ui/menu_item.tsx b/packages/website/ts/components/ui/menu_item.tsx index b9caa91fb..862f28457 100644 --- a/packages/website/ts/components/ui/menu_item.tsx +++ b/packages/website/ts/components/ui/menu_item.tsx @@ -1,9 +1,9 @@ import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import {Link} from 'react-router-dom'; import {Styles} from 'ts/types'; import {constants} from 'ts/utils/constants'; -import {colors} from 'material-ui/styles'; interface MenuItemProps { to: string; diff --git a/packages/website/ts/components/ui/party.tsx b/packages/website/ts/components/ui/party.tsx index b72e75181..2927d9d3d 100644 --- a/packages/website/ts/components/ui/party.tsx +++ b/packages/website/ts/components/ui/party.tsx @@ -1,11 +1,11 @@ import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import ReactTooltip = require('react-tooltip'); -import {colors} from 'material-ui/styles'; +import {EthereumAddress} from 'ts/components/ui/ethereum_address'; import {Identicon} from 'ts/components/ui/identicon'; import {EtherscanLinkSuffixes} from 'ts/types'; import {utils} from 'ts/utils/utils'; -import {EthereumAddress} from 'ts/components/ui/ethereum_address'; const MIN_ADDRESS_WIDTH = 60; const IMAGE_DIMENSION = 100; diff --git a/packages/website/ts/components/ui/required_label.tsx b/packages/website/ts/components/ui/required_label.tsx index f9c73157a..db69d7278 100644 --- a/packages/website/ts/components/ui/required_label.tsx +++ b/packages/website/ts/components/ui/required_label.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; export interface RequiredLabelProps { label: string|React.ReactNode; diff --git a/packages/website/ts/components/ui/simple_loading.tsx b/packages/website/ts/components/ui/simple_loading.tsx index 12d09ecc4..d55d7851d 100644 --- a/packages/website/ts/components/ui/simple_loading.tsx +++ b/packages/website/ts/components/ui/simple_loading.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; -import {colors} from 'material-ui/styles'; import CircularProgress from 'material-ui/CircularProgress'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; export interface SimpleLoadingProps { message: string; diff --git a/packages/website/ts/components/ui/swap_icon.tsx b/packages/website/ts/components/ui/swap_icon.tsx index 89bb33d55..2e6ae89bb 100644 --- a/packages/website/ts/components/ui/swap_icon.tsx +++ b/packages/website/ts/components/ui/swap_icon.tsx @@ -1,7 +1,7 @@ import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import {constants} from 'ts/utils/constants'; -import {colors} from 'material-ui/styles'; interface SwapIconProps { swapTokensFn: () => void; diff --git a/packages/website/ts/components/ui/token_icon.tsx b/packages/website/ts/components/ui/token_icon.tsx index 168c09bd4..d3a7c9a8c 100644 --- a/packages/website/ts/components/ui/token_icon.tsx +++ b/packages/website/ts/components/ui/token_icon.tsx @@ -1,7 +1,7 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {Token} from 'ts/types'; import {Identicon} from 'ts/components/ui/identicon'; +import {Token} from 'ts/types'; interface TokenIconProps { token: Token; diff --git a/packages/website/ts/components/visual_order.tsx b/packages/website/ts/components/visual_order.tsx index a7d6d1a9e..037a321ff 100644 --- a/packages/website/ts/components/visual_order.tsx +++ b/packages/website/ts/components/visual_order.tsx @@ -1,10 +1,10 @@ +import {ZeroEx} from '0x.js'; import * as _ from 'lodash'; import * as React from 'react'; -import {ZeroEx} from '0x.js'; -import {AssetToken, Token, TokenByAddress} from 'ts/types'; -import {utils} from 'ts/utils/utils'; import {Party} from 'ts/components/ui/party'; +import {AssetToken, Token, TokenByAddress} from 'ts/types'; import {constants} from 'ts/utils/constants'; +import {utils} from 'ts/utils/utils'; const PRECISION = 5; diff --git a/packages/website/ts/containers/generate_order_form.tsx b/packages/website/ts/containers/generate_order_form.tsx index 97b5172e7..864d2702e 100644 --- a/packages/website/ts/containers/generate_order_form.tsx +++ b/packages/website/ts/containers/generate_order_form.tsx @@ -1,20 +1,20 @@ +import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import * as React from 'react'; import {connect} from 'react-redux'; -import {Store as ReduxStore, Dispatch} from 'redux'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import {State} from 'ts/redux/reducer'; +import {Dispatch, Store as ReduxStore} from 'redux'; import {Blockchain} from 'ts/blockchain'; import {GenerateOrderForm as GenerateOrderFormComponent} from 'ts/components/generate_order/generate_order_form'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {State} from 'ts/redux/reducer'; import { + BlockchainErrs, + HashData, SideToAssetToken, SignatureData, - HashData, TokenByAddress, TokenStateByAddress, - BlockchainErrs, } from 'ts/types'; -import BigNumber from 'bignumber.js'; interface GenerateOrderFormProps { blockchain: Blockchain; diff --git a/packages/website/ts/containers/portal.tsx b/packages/website/ts/containers/portal.tsx index 805058aa3..2987764f4 100644 --- a/packages/website/ts/containers/portal.tsx +++ b/packages/website/ts/containers/portal.tsx @@ -1,26 +1,26 @@ +import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import * as React from 'react'; import {connect} from 'react-redux'; -import {Store as ReduxStore, Dispatch} from 'redux'; -import {State} from 'ts/redux/reducer'; -import {constants} from 'ts/utils/constants'; +import {Dispatch, Store as ReduxStore} from 'redux'; +import { + Portal as PortalComponent, + PortalAllProps as PortalComponentAllProps, + PortalPassedProps as PortalComponentPassedProps, +} from 'ts/components/portal'; import {Dispatcher} from 'ts/redux/dispatcher'; +import {State} from 'ts/redux/reducer'; import { - Side, - HashData, - TokenByAddress, BlockchainErrs, Fill, + HashData, Order, ScreenWidths, + Side, + TokenByAddress, TokenStateByAddress, } from 'ts/types'; -import { - Portal as PortalComponent, - PortalAllProps as PortalComponentAllProps, - PortalPassedProps as PortalComponentPassedProps, -} from 'ts/components/portal'; -import BigNumber from 'bignumber.js'; +import {constants} from 'ts/utils/constants'; interface MapStateToProps { blockchainErr: BlockchainErrs; diff --git a/packages/website/ts/containers/smart_contracts_documentation.tsx b/packages/website/ts/containers/smart_contracts_documentation.tsx index 5d05bdd2f..ccf3c4a65 100644 --- a/packages/website/ts/containers/smart_contracts_documentation.tsx +++ b/packages/website/ts/containers/smart_contracts_documentation.tsx @@ -1,13 +1,13 @@ import * as _ from 'lodash'; import * as React from 'react'; import {connect} from 'react-redux'; -import {Store as ReduxStore, Dispatch} from 'redux'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import {State} from 'ts/redux/reducer'; +import {Dispatch, Store as ReduxStore} from 'redux'; import { SmartContractsDocumentation as SmartContractsDocumentationComponent, SmartContractsDocumentationAllProps, } from 'ts/pages/documentation/smart_contracts_documentation'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {State} from 'ts/redux/reducer'; interface ConnectedState { docsVersion: string; diff --git a/packages/website/ts/containers/zero_ex_js_documentation.tsx b/packages/website/ts/containers/zero_ex_js_documentation.tsx index a5b8298b5..ecf0451c0 100644 --- a/packages/website/ts/containers/zero_ex_js_documentation.tsx +++ b/packages/website/ts/containers/zero_ex_js_documentation.tsx @@ -1,15 +1,15 @@ +import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; import * as React from 'react'; import {connect} from 'react-redux'; -import {Store as ReduxStore, Dispatch} from 'redux'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import {State} from 'ts/redux/reducer'; +import {Dispatch, Store as ReduxStore} from 'redux'; import {Blockchain} from 'ts/blockchain'; import { ZeroExJSDocumentation as ZeroExJSDocumentationComponent, ZeroExJSDocumentationAllProps, } from 'ts/pages/documentation/zero_ex_js_documentation'; -import BigNumber from 'bignumber.js'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import {State} from 'ts/redux/reducer'; interface ConnectedState { docsVersion: string; diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index ed4d09956..67a4e0067 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -1,24 +1,24 @@ // Polyfills import 'whatwg-fetch'; +import BigNumber from 'bignumber.js'; +import {colors, getMuiTheme, MuiThemeProvider} from 'material-ui/styles'; import * as React from 'react'; import {render} from 'react-dom'; import {Provider} from 'react-redux'; +import {BrowserRouter as Router, Link, Redirect, Route, Switch} from 'react-router-dom'; +import * as injectTapEventPlugin from 'react-tap-event-plugin'; import {createStore, Store as ReduxStore} from 'redux'; -import BigNumber from 'bignumber.js'; -import {constants} from 'ts/utils/constants'; -import {Landing} from 'ts/pages/landing/landing'; -import {FAQ} from 'ts/pages/faq/faq'; -import {About} from 'ts/pages/about/about'; -import {Wiki} from 'ts/pages/wiki/wiki'; -import {NotFound} from 'ts/pages/not_found'; import {createLazyComponent} from 'ts/lazy_component'; -import {State, reducer} from 'ts/redux/reducer'; -import {colors, getMuiTheme, MuiThemeProvider} from 'material-ui/styles'; -import {Switch, BrowserRouter as Router, Route, Link, Redirect} from 'react-router-dom'; import {tradeHistoryStorage} from 'ts/local_storage/trade_history_storage'; -import * as injectTapEventPlugin from 'react-tap-event-plugin'; +import {About} from 'ts/pages/about/about'; +import {FAQ} from 'ts/pages/faq/faq'; +import {Landing} from 'ts/pages/landing/landing'; +import {NotFound} from 'ts/pages/not_found'; +import {Wiki} from 'ts/pages/wiki/wiki'; +import {reducer, State} from 'ts/redux/reducer'; import {WebsitePaths} from 'ts/types'; +import {constants} from 'ts/utils/constants'; injectTapEventPlugin(); // By default BigNumber's `toString` method converts to exponential notation if the value has @@ -75,15 +75,17 @@ const muiTheme = getMuiTheme({ // At the same time webpack statically parses for System.import() to determine bundle chunk split points // so each lazy import needs it's own `System.import()` declaration. const LazyPortal = createLazyComponent( - 'Portal', () => System.import<any>(/* webpackChunkName: "portal" */'ts/containers/portal'), + 'Portal', async () => System.import<any>(/* webpackChunkName: "portal" */'ts/containers/portal'), ); const LazyZeroExJSDocumentation = createLazyComponent( 'ZeroExJSDocumentation', - () => System.import<any>(/* webpackChunkName: "zeroExDocs" */'ts/containers/zero_ex_js_documentation'), + async () => System.import<any>(/* webpackChunkName: "zeroExDocs" */'ts/containers/zero_ex_js_documentation'), ); const LazySmartContractsDocumentation = createLazyComponent( 'SmartContractsDocumentation', - () => System.import<any>(/* webpackChunkName: "smartContractDocs" */'ts/containers/smart_contracts_documentation'), + async () => System.import<any>( + /* webpackChunkName: "smartContractDocs" */'ts/containers/smart_contracts_documentation', + ), ); const store: ReduxStore<State> = createStore(reducer); diff --git a/packages/website/ts/lazy_component.tsx b/packages/website/ts/lazy_component.tsx index 7052b7be6..1dfe4db95 100644 --- a/packages/website/ts/lazy_component.tsx +++ b/packages/website/ts/lazy_component.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import * as _ from 'lodash'; +import * as React from 'react'; interface LazyComponentProps { reactComponentPromise: Promise<React.ComponentClass<any>>; @@ -22,10 +22,12 @@ export class LazyComponent extends React.Component<LazyComponentProps, LazyCompo }; } public componentWillMount() { + // tslint:disable-next-line:no-floating-promises this.loadComponentFireAndForgetAsync(this.props); } public componentWillReceiveProps(nextProps: LazyComponentProps) { if (nextProps.reactComponentPromise !== this.props.reactComponentPromise) { + // tslint:disable-next-line:no-floating-promises this.loadComponentFireAndForgetAsync(nextProps); } } diff --git a/packages/website/ts/local_storage/trade_history_storage.tsx b/packages/website/ts/local_storage/trade_history_storage.tsx index dd5872609..0d627e000 100644 --- a/packages/website/ts/local_storage/trade_history_storage.tsx +++ b/packages/website/ts/local_storage/trade_history_storage.tsx @@ -1,10 +1,10 @@ +import BigNumber from 'bignumber.js'; +import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; +import {localStorage} from 'ts/local_storage/local_storage'; import {Fill} from 'ts/types'; import {configs} from 'ts/utils/configs'; import {constants} from 'ts/utils/constants'; -import {localStorage} from 'ts/local_storage/local_storage'; -import ethUtil = require('ethereumjs-util'); -import BigNumber from 'bignumber.js'; const FILLS_KEY = 'fills'; const FILLS_LATEST_BLOCK = 'fillsLatestBlock'; diff --git a/packages/website/ts/pages/about/about.tsx b/packages/website/ts/pages/about/about.tsx index 8859fb00a..3af05e8a4 100644 --- a/packages/website/ts/pages/about/about.tsx +++ b/packages/website/ts/pages/about/about.tsx @@ -1,17 +1,17 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import * as DocumentTitle from 'react-document-title'; import RaisedButton from 'material-ui/RaisedButton'; import {colors} from 'material-ui/styles'; -import {Styles, ProfileInfo} from 'ts/types'; -import {utils} from 'ts/utils/utils'; +import * as React from 'react'; +import * as DocumentTitle from 'react-document-title'; import {Link} from 'react-router-dom'; import {Footer} from 'ts/components/footer'; import {TopBar} from 'ts/components/top_bar'; +import {Profile} from 'ts/pages/about/profile'; import {Question} from 'ts/pages/faq/question'; +import {ProfileInfo, Styles} from 'ts/types'; import {configs} from 'ts/utils/configs'; import {constants} from 'ts/utils/constants'; -import {Profile} from 'ts/pages/about/profile'; +import {utils} from 'ts/utils/utils'; const CUSTOM_BACKGROUND_COLOR = '#F0F0F0'; const CUSTOM_GRAY = '#4C4C4C'; diff --git a/packages/website/ts/pages/about/profile.tsx b/packages/website/ts/pages/about/profile.tsx index 6c48a8553..71dbd09b5 100644 --- a/packages/website/ts/pages/about/profile.tsx +++ b/packages/website/ts/pages/about/profile.tsx @@ -1,9 +1,9 @@ import * as _ from 'lodash'; -import * as React from 'react'; import {colors} from 'material-ui/styles'; -import {utils} from 'ts/utils/utils'; +import * as React from 'react'; import {Element as ScrollElement} from 'react-scroll'; -import {Styles, ProfileInfo} from 'ts/types'; +import {ProfileInfo, Styles} from 'ts/types'; +import {utils} from 'ts/utils/utils'; const IMAGE_DIMENSION = 149; const styles: Styles = { diff --git a/packages/website/ts/pages/documentation/custom_enum.tsx b/packages/website/ts/pages/documentation/custom_enum.tsx index aca8af832..7dced9b60 100644 --- a/packages/website/ts/pages/documentation/custom_enum.tsx +++ b/packages/website/ts/pages/documentation/custom_enum.tsx @@ -1,7 +1,7 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {utils} from 'ts/utils/utils'; import {CustomType} from 'ts/types'; +import {utils} from 'ts/utils/utils'; const STRING_ENUM_CODE_PREFIX = ' strEnum('; diff --git a/packages/website/ts/pages/documentation/enum.tsx b/packages/website/ts/pages/documentation/enum.tsx index 9364a5d31..8fcd2c252 100644 --- a/packages/website/ts/pages/documentation/enum.tsx +++ b/packages/website/ts/pages/documentation/enum.tsx @@ -1,7 +1,7 @@ import * as _ from 'lodash'; import * as React from 'react'; +import {EnumValue, TypeDocNode} from 'ts/types'; import {utils} from 'ts/utils/utils'; -import {TypeDocNode, EnumValue} from 'ts/types'; const STRING_ENUM_CODE_PREFIX = ' strEnum('; diff --git a/packages/website/ts/pages/documentation/event_definition.tsx b/packages/website/ts/pages/documentation/event_definition.tsx index 58271e98f..ea75d78bc 100644 --- a/packages/website/ts/pages/documentation/event_definition.tsx +++ b/packages/website/ts/pages/documentation/event_definition.tsx @@ -1,10 +1,10 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {constants} from 'ts/utils/constants'; -import {utils} from 'ts/utils/utils'; -import {Event, EventArg, HeaderSizes} from 'ts/types'; import {Type} from 'ts/pages/documentation/type'; import {AnchorTitle} from 'ts/pages/shared/anchor_title'; +import {Event, EventArg, HeaderSizes} from 'ts/types'; +import {constants} from 'ts/utils/constants'; +import {utils} from 'ts/utils/utils'; const KEYWORD_COLOR = '#a81ca6'; const CUSTOM_GREEN = 'rgb(77, 162, 75)'; diff --git a/packages/website/ts/pages/documentation/interface.tsx b/packages/website/ts/pages/documentation/interface.tsx index 9e40b8901..d8d4aec32 100644 --- a/packages/website/ts/pages/documentation/interface.tsx +++ b/packages/website/ts/pages/documentation/interface.tsx @@ -1,8 +1,8 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {CustomType, TypeDocTypes} from 'ts/types'; -import {Type} from 'ts/pages/documentation/type'; import {MethodSignature} from 'ts/pages/documentation/method_signature'; +import {Type} from 'ts/pages/documentation/type'; +import {CustomType, TypeDocTypes} from 'ts/types'; interface InterfaceProps { type: CustomType; diff --git a/packages/website/ts/pages/documentation/method_block.tsx b/packages/website/ts/pages/documentation/method_block.tsx index e31c75ffd..026c46918 100644 --- a/packages/website/ts/pages/documentation/method_block.tsx +++ b/packages/website/ts/pages/documentation/method_block.tsx @@ -1,23 +1,23 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import * as ReactMarkdown from 'react-markdown'; import {Chip} from 'material-ui/Chip'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; +import * as ReactMarkdown from 'react-markdown'; +import {Comment} from 'ts/pages/documentation/comment'; +import {MethodSignature} from 'ts/pages/documentation/method_signature'; +import {SourceLink} from 'ts/pages/documentation/source_link'; +import {AnchorTitle} from 'ts/pages/shared/anchor_title'; import { - TypeDocNode, + HeaderSizes, + Parameter, + SolidityMethod, Styles, TypeDefinitionByName, + TypeDocNode, TypescriptMethod, - SolidityMethod, - Parameter, - HeaderSizes, } from 'ts/types'; -import {utils} from 'ts/utils/utils'; -import {SourceLink} from 'ts/pages/documentation/source_link'; -import {MethodSignature} from 'ts/pages/documentation/method_signature'; -import {AnchorTitle} from 'ts/pages/shared/anchor_title'; -import {Comment} from 'ts/pages/documentation/comment'; import {typeDocUtils} from 'ts/utils/typedoc_utils'; +import {utils} from 'ts/utils/utils'; interface MethodBlockProps { method: SolidityMethod|TypescriptMethod; diff --git a/packages/website/ts/pages/documentation/method_signature.tsx b/packages/website/ts/pages/documentation/method_signature.tsx index 3b5d2ce78..e3806b2fa 100644 --- a/packages/website/ts/pages/documentation/method_signature.tsx +++ b/packages/website/ts/pages/documentation/method_signature.tsx @@ -1,7 +1,7 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {TypescriptMethod, SolidityMethod, TypeDefinitionByName, Parameter} from 'ts/types'; import {Type} from 'ts/pages/documentation/type'; +import {Parameter, SolidityMethod, TypeDefinitionByName, TypescriptMethod} from 'ts/types'; interface MethodSignatureProps { method: TypescriptMethod|SolidityMethod; diff --git a/packages/website/ts/pages/documentation/smart_contracts_documentation.tsx b/packages/website/ts/pages/documentation/smart_contracts_documentation.tsx index 3e97829c4..0d5751ffb 100644 --- a/packages/website/ts/pages/documentation/smart_contracts_documentation.tsx +++ b/packages/website/ts/pages/documentation/smart_contracts_documentation.tsx @@ -1,46 +1,46 @@ +import findVersions = require('find-versions'); import * as _ from 'lodash'; +import CircularProgress from 'material-ui/CircularProgress'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import DocumentTitle = require('react-document-title'); -import findVersions = require('find-versions'); -import semverSort = require('semver-sort'); -import {colors} from 'material-ui/styles'; -import CircularProgress from 'material-ui/CircularProgress'; import { scroller, } from 'react-scroll'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import { - SmartContractsDocSections, - Styles, - DoxityDocObj, - TypeDefinitionByName, - DocAgnosticFormat, - SolidityMethod, - Property, - CustomType, - MenuSubsectionsBySection, - Event, - Docs, - AddressByContractName, - Networks, - EtherscanLinkSuffixes, -} from 'ts/types'; +import semverSort = require('semver-sort'); import {TopBar} from 'ts/components/top_bar'; -import {utils} from 'ts/utils/utils'; -import {docUtils} from 'ts/utils/doc_utils'; -import {constants} from 'ts/utils/constants'; +import {Badge} from 'ts/components/ui/badge'; +import {Comment} from 'ts/pages/documentation/comment'; +import {EventDefinition} from 'ts/pages/documentation/event_definition'; import {MethodBlock} from 'ts/pages/documentation/method_block'; import {SourceLink} from 'ts/pages/documentation/source_link'; import {Type} from 'ts/pages/documentation/type'; import {TypeDefinition} from 'ts/pages/documentation/type_definition'; -import {MarkdownSection} from 'ts/pages/shared/markdown_section'; -import {Comment} from 'ts/pages/documentation/comment'; -import {Badge} from 'ts/components/ui/badge'; -import {EventDefinition} from 'ts/pages/documentation/event_definition'; import {AnchorTitle} from 'ts/pages/shared/anchor_title'; -import {SectionHeader} from 'ts/pages/shared/section_header'; +import {MarkdownSection} from 'ts/pages/shared/markdown_section'; import {NestedSidebarMenu} from 'ts/pages/shared/nested_sidebar_menu'; +import {SectionHeader} from 'ts/pages/shared/section_header'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import { + AddressByContractName, + CustomType, + DocAgnosticFormat, + Docs, + DoxityDocObj, + EtherscanLinkSuffixes, + Event, + MenuSubsectionsBySection, + Networks, + Property, + SmartContractsDocSections, + SolidityMethod, + Styles, + TypeDefinitionByName, +} from 'ts/types'; +import {constants} from 'ts/utils/constants'; +import {docUtils} from 'ts/utils/doc_utils'; import {doxityUtils} from 'ts/utils/doxity_utils'; +import {utils} from 'ts/utils/utils'; /* tslint:disable:no-var-requires */ const IntroMarkdown = require('md/docs/smart_contracts/introduction'); /* tslint:enable:no-var-requires */ @@ -104,6 +104,7 @@ export class SmartContractsDocumentation extends const lastSegment = pathName.substr(pathName.lastIndexOf('/') + 1); const versions = findVersions(lastSegment); const preferredVersionIfExists = versions.length > 0 ? versions[0] : undefined; + // tslint:disable-next-line:no-floating-promises this.fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists); } public render() { diff --git a/packages/website/ts/pages/documentation/source_link.tsx b/packages/website/ts/pages/documentation/source_link.tsx index 24009ce8a..0d40a4b7a 100644 --- a/packages/website/ts/pages/documentation/source_link.tsx +++ b/packages/website/ts/pages/documentation/source_link.tsx @@ -1,5 +1,5 @@ -import * as React from 'react'; import {colors} from 'material-ui/styles'; +import * as React from 'react'; import {Source} from 'ts/types'; import {constants} from 'ts/utils/constants'; diff --git a/packages/website/ts/pages/documentation/type.tsx b/packages/website/ts/pages/documentation/type.tsx index 7d02d6804..b7d56f360 100644 --- a/packages/website/ts/pages/documentation/type.tsx +++ b/packages/website/ts/pages/documentation/type.tsx @@ -1,13 +1,13 @@ import * as _ from 'lodash'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import {Link as ScrollLink} from 'react-scroll'; import * as ReactTooltip from 'react-tooltip'; -import {colors} from 'material-ui/styles'; -import {typeDocUtils} from 'ts/utils/typedoc_utils'; +import {TypeDefinition} from 'ts/pages/documentation/type_definition'; +import {Type as TypeDef, TypeDefinitionByName, TypeDocTypes} from 'ts/types'; import {constants} from 'ts/utils/constants'; -import {Type as TypeDef, TypeDocTypes, TypeDefinitionByName} from 'ts/types'; +import {typeDocUtils} from 'ts/utils/typedoc_utils'; import {utils} from 'ts/utils/utils'; -import {TypeDefinition} from 'ts/pages/documentation/type_definition'; const BUILT_IN_TYPE_COLOR = '#e69d00'; const STRING_LITERAL_COLOR = '#4da24b'; diff --git a/packages/website/ts/pages/documentation/type_definition.tsx b/packages/website/ts/pages/documentation/type_definition.tsx index bcb07be8e..984c223b6 100644 --- a/packages/website/ts/pages/documentation/type_definition.tsx +++ b/packages/website/ts/pages/documentation/type_definition.tsx @@ -1,16 +1,16 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {constants} from 'ts/utils/constants'; -import {utils} from 'ts/utils/utils'; -import {KindString, CustomType, TypeDocTypes, CustomTypeChild, HeaderSizes} from 'ts/types'; -import {Type} from 'ts/pages/documentation/type'; -import {Interface} from 'ts/pages/documentation/interface'; +import {Comment} from 'ts/pages/documentation/comment'; import {CustomEnum} from 'ts/pages/documentation/custom_enum'; import {Enum} from 'ts/pages/documentation/enum'; +import {Interface} from 'ts/pages/documentation/interface'; import {MethodSignature} from 'ts/pages/documentation/method_signature'; +import {Type} from 'ts/pages/documentation/type'; import {AnchorTitle} from 'ts/pages/shared/anchor_title'; -import {Comment} from 'ts/pages/documentation/comment'; +import {CustomType, CustomTypeChild, HeaderSizes, KindString, TypeDocTypes} from 'ts/types'; +import {constants} from 'ts/utils/constants'; import {typeDocUtils} from 'ts/utils/typedoc_utils'; +import {utils} from 'ts/utils/utils'; const KEYWORD_COLOR = '#a81ca6'; diff --git a/packages/website/ts/pages/documentation/zero_ex_js_documentation.tsx b/packages/website/ts/pages/documentation/zero_ex_js_documentation.tsx index c26fb7d0a..d64b196ed 100644 --- a/packages/website/ts/pages/documentation/zero_ex_js_documentation.tsx +++ b/packages/website/ts/pages/documentation/zero_ex_js_documentation.tsx @@ -1,47 +1,47 @@ -import * as _ from 'lodash'; -import * as React from 'react'; -import * as ReactMarkdown from 'react-markdown'; -import DocumentTitle = require('react-document-title'); import findVersions = require('find-versions'); -import semverSort = require('semver-sort'); -import {colors} from 'material-ui/styles'; -import MenuItem from 'material-ui/MenuItem'; +import * as _ from 'lodash'; import CircularProgress from 'material-ui/CircularProgress'; +import MenuItem from 'material-ui/MenuItem'; import Paper from 'material-ui/Paper'; +import {colors} from 'material-ui/styles'; +import * as React from 'react'; +import DocumentTitle = require('react-document-title'); +import * as ReactMarkdown from 'react-markdown'; import { - Link as ScrollLink, Element as ScrollElement, + Link as ScrollLink, scroller, } from 'react-scroll'; -import {Dispatcher} from 'ts/redux/dispatcher'; -import { - KindString, - TypeDocNode, - ZeroExJsDocSections, - Styles, - ScreenWidths, - TypeDefinitionByName, - DocAgnosticFormat, - TypescriptMethod, - Property, - CustomType, - Docs, -} from 'ts/types'; +import semverSort = require('semver-sort'); import {TopBar} from 'ts/components/top_bar'; -import {utils} from 'ts/utils/utils'; -import {docUtils} from 'ts/utils/doc_utils'; -import {constants} from 'ts/utils/constants'; import {Loading} from 'ts/components/ui/loading'; +import {Comment} from 'ts/pages/documentation/comment'; import {MethodBlock} from 'ts/pages/documentation/method_block'; import {SourceLink} from 'ts/pages/documentation/source_link'; import {Type} from 'ts/pages/documentation/type'; import {TypeDefinition} from 'ts/pages/documentation/type_definition'; -import {MarkdownSection} from 'ts/pages/shared/markdown_section'; -import {Comment} from 'ts/pages/documentation/comment'; import {AnchorTitle} from 'ts/pages/shared/anchor_title'; -import {SectionHeader} from 'ts/pages/shared/section_header'; +import {MarkdownSection} from 'ts/pages/shared/markdown_section'; import {NestedSidebarMenu} from 'ts/pages/shared/nested_sidebar_menu'; +import {SectionHeader} from 'ts/pages/shared/section_header'; +import {Dispatcher} from 'ts/redux/dispatcher'; +import { + CustomType, + DocAgnosticFormat, + Docs, + KindString, + Property, + ScreenWidths, + Styles, + TypeDefinitionByName, + TypeDocNode, + TypescriptMethod, + ZeroExJsDocSections, +} from 'ts/types'; +import {constants} from 'ts/utils/constants'; +import {docUtils} from 'ts/utils/doc_utils'; import {typeDocUtils} from 'ts/utils/typedoc_utils'; +import {utils} from 'ts/utils/utils'; /* tslint:disable:no-var-requires */ const IntroMarkdown = require('md/docs/0xjs/introduction'); const InstallationMarkdown = require('md/docs/0xjs/installation'); @@ -109,6 +109,7 @@ export class ZeroExJSDocumentation extends React.Component<ZeroExJSDocumentation const lastSegment = pathName.substr(pathName.lastIndexOf('/') + 1); const versions = findVersions(lastSegment); const preferredVersionIfExists = versions.length > 0 ? versions[0] : undefined; + // tslint:disable-next-line:no-floating-promises this.fetchJSONDocsFireAndForgetAsync(preferredVersionIfExists); } public render() { diff --git a/packages/website/ts/pages/faq/faq.tsx b/packages/website/ts/pages/faq/faq.tsx index 3c65d1042..c53ed28b8 100644 --- a/packages/website/ts/pages/faq/faq.tsx +++ b/packages/website/ts/pages/faq/faq.tsx @@ -1,13 +1,13 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import * as DocumentTitle from 'react-document-title'; import RaisedButton from 'material-ui/RaisedButton'; import {colors} from 'material-ui/styles'; -import {Styles, FAQSection, FAQQuestion, WebsitePaths} from 'ts/types'; +import * as React from 'react'; +import * as DocumentTitle from 'react-document-title'; import {Link} from 'react-router-dom'; import {Footer} from 'ts/components/footer'; import {TopBar} from 'ts/components/top_bar'; import {Question} from 'ts/pages/faq/question'; +import {FAQQuestion, FAQSection, Styles, WebsitePaths} from 'ts/types'; import {configs} from 'ts/utils/configs'; import {constants} from 'ts/utils/constants'; diff --git a/packages/website/ts/pages/faq/question.tsx b/packages/website/ts/pages/faq/question.tsx index 4ed198b91..917863e4a 100644 --- a/packages/website/ts/pages/faq/question.tsx +++ b/packages/website/ts/pages/faq/question.tsx @@ -1,6 +1,6 @@ import * as _ from 'lodash'; -import * as React from 'react'; import {Card, CardHeader, CardText} from 'material-ui/Card'; +import * as React from 'react'; export interface QuestionProps { prompt: string; diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 32ea86736..f3c46b8c7 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -1,15 +1,15 @@ import * as _ from 'lodash'; +import RaisedButton from 'material-ui/RaisedButton'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import DocumentTitle = require('react-document-title'); import {Link} from 'react-router-dom'; -import RaisedButton from 'material-ui/RaisedButton'; -import {colors} from 'material-ui/styles'; +import {Footer} from 'ts/components/footer'; +import {TopBar} from 'ts/components/top_bar'; +import {ScreenWidths, Styles, WebsitePaths} from 'ts/types'; import {configs} from 'ts/utils/configs'; import {constants} from 'ts/utils/constants'; -import {Styles, WebsitePaths, ScreenWidths} from 'ts/types'; import {utils} from 'ts/utils/utils'; -import {TopBar} from 'ts/components/top_bar'; -import {Footer} from 'ts/components/footer'; interface BoxContent { title: string; @@ -840,4 +840,4 @@ export class Landing extends React.Component<LandingProps, LandingState> { }); } } -} +} // tslint:disable:max-file-line-count diff --git a/packages/website/ts/pages/not_found.tsx b/packages/website/ts/pages/not_found.tsx index ddd720c97..075bcf91e 100644 --- a/packages/website/ts/pages/not_found.tsx +++ b/packages/website/ts/pages/not_found.tsx @@ -1,9 +1,9 @@ import * as _ from 'lodash'; import * as React from 'react'; -import {Styles} from 'ts/types'; import {Link} from 'react-router-dom'; import {Footer} from 'ts/components/footer'; import {TopBar} from 'ts/components/top_bar'; +import {Styles} from 'ts/types'; export interface NotFoundProps { location: Location; diff --git a/packages/website/ts/pages/shared/anchor_title.tsx b/packages/website/ts/pages/shared/anchor_title.tsx index dfa9401ae..0a3674fd9 100644 --- a/packages/website/ts/pages/shared/anchor_title.tsx +++ b/packages/website/ts/pages/shared/anchor_title.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; -import {Styles, HeaderSizes} from 'ts/types'; -import {utils} from 'ts/utils/utils'; -import {constants} from 'ts/utils/constants'; import {Link as ScrollLink} from 'react-scroll'; +import {HeaderSizes, Styles} from 'ts/types'; +import {constants} from 'ts/utils/constants'; +import {utils} from 'ts/utils/utils'; const headerSizeToScrollOffset: {[headerSize: string]: number} = { h2: -20, @@ -59,11 +59,7 @@ export class AnchorTitle extends React.Component<AnchorTitleProps, AnchorTitleSt public render() { let opacity = 0; if (this.props.shouldShowAnchor) { - if (this.state.isHovering) { - opacity = 0.6; - } else { - opacity = 1; - } + opacity = this.state.isHovering ? 0.6 : 1; } return ( <div className="relative flex" style={{...styles[this.props.headerSize], ...styles.headers}}> diff --git a/packages/website/ts/pages/shared/markdown_section.tsx b/packages/website/ts/pages/shared/markdown_section.tsx index 32b55abc8..8686e80b6 100644 --- a/packages/website/ts/pages/shared/markdown_section.tsx +++ b/packages/website/ts/pages/shared/markdown_section.tsx @@ -1,12 +1,12 @@ import * as _ from 'lodash'; +import RaisedButton from 'material-ui/RaisedButton'; import * as React from 'react'; import * as ReactMarkdown from 'react-markdown'; import {Element as ScrollElement} from 'react-scroll'; import {AnchorTitle} from 'ts/pages/shared/anchor_title'; -import {utils} from 'ts/utils/utils'; import {MarkdownCodeBlock} from 'ts/pages/shared/markdown_code_block'; -import RaisedButton from 'material-ui/RaisedButton'; import {HeaderSizes} from 'ts/types'; +import {utils} from 'ts/utils/utils'; interface MarkdownSectionProps { sectionName: string; diff --git a/packages/website/ts/pages/shared/nested_sidebar_menu.tsx b/packages/website/ts/pages/shared/nested_sidebar_menu.tsx index e69506bb8..69e32aecb 100644 --- a/packages/website/ts/pages/shared/nested_sidebar_menu.tsx +++ b/packages/website/ts/pages/shared/nested_sidebar_menu.tsx @@ -1,13 +1,13 @@ import * as _ from 'lodash'; -import * as React from 'react'; import MenuItem from 'material-ui/MenuItem'; import {colors} from 'material-ui/styles'; -import {utils} from 'ts/utils/utils'; -import {constants} from 'ts/utils/constants'; +import * as React from 'react'; +import {Link as ScrollLink} from 'react-scroll'; import {VersionDropDown} from 'ts/pages/shared/version_drop_down'; -import {ZeroExJsDocSections, Styles, MenuSubsectionsBySection, Docs} from 'ts/types'; +import {Docs, MenuSubsectionsBySection, Styles, ZeroExJsDocSections} from 'ts/types'; +import {constants} from 'ts/utils/constants'; import {typeDocUtils} from 'ts/utils/typedoc_utils'; -import {Link as ScrollLink} from 'react-scroll'; +import {utils} from 'ts/utils/utils'; interface NestedSidebarMenuProps { topLevelMenu: {[topLevel: string]: string[]}; diff --git a/packages/website/ts/pages/shared/section_header.tsx b/packages/website/ts/pages/shared/section_header.tsx index 5937be13b..b5119b128 100644 --- a/packages/website/ts/pages/shared/section_header.tsx +++ b/packages/website/ts/pages/shared/section_header.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; import {Element as ScrollElement} from 'react-scroll'; import {AnchorTitle} from 'ts/pages/shared/anchor_title'; -import {utils} from 'ts/utils/utils'; import {HeaderSizes} from 'ts/types'; +import {utils} from 'ts/utils/utils'; interface SectionHeaderProps { sectionName: string; diff --git a/packages/website/ts/pages/shared/version_drop_down.tsx b/packages/website/ts/pages/shared/version_drop_down.tsx index f29547c9c..8f4f1a35b 100644 --- a/packages/website/ts/pages/shared/version_drop_down.tsx +++ b/packages/website/ts/pages/shared/version_drop_down.tsx @@ -1,9 +1,9 @@ import * as _ from 'lodash'; -import * as React from 'react'; -import MenuItem from 'material-ui/MenuItem'; import DropDownMenu from 'material-ui/DropDownMenu'; -import {constants} from 'ts/utils/constants'; +import MenuItem from 'material-ui/MenuItem'; +import * as React from 'react'; import {Docs} from 'ts/types'; +import {constants} from 'ts/utils/constants'; interface VersionDropDownProps { selectedVersion: string; diff --git a/packages/website/ts/pages/wiki/wiki.tsx b/packages/website/ts/pages/wiki/wiki.tsx index 0e6fc98ab..2447a24a2 100644 --- a/packages/website/ts/pages/wiki/wiki.tsx +++ b/packages/website/ts/pages/wiki/wiki.tsx @@ -1,20 +1,19 @@ import * as _ from 'lodash'; +import CircularProgress from 'material-ui/CircularProgress'; +import {colors} from 'material-ui/styles'; import * as React from 'react'; import DocumentTitle = require('react-document-title'); -import {colors} from 'material-ui/styles'; -import CircularProgress from 'material-ui/CircularProgress'; import { scroller, } from 'react-scroll'; -import {Styles, Article, ArticlesBySection} from 'ts/types'; import {TopBar} from 'ts/components/top_bar'; -import {HeaderSizes, WebsitePaths} from 'ts/types'; -import {utils} from 'ts/utils/utils'; -import {constants} from 'ts/utils/constants'; -import {configs} from 'ts/utils/configs'; +import {MarkdownSection} from 'ts/pages/shared/markdown_section'; import {NestedSidebarMenu} from 'ts/pages/shared/nested_sidebar_menu'; import {SectionHeader} from 'ts/pages/shared/section_header'; -import {MarkdownSection} from 'ts/pages/shared/markdown_section'; +import {Article, ArticlesBySection, HeaderSizes, Styles, WebsitePaths} from 'ts/types'; +import {configs} from 'ts/utils/configs'; +import {constants} from 'ts/utils/constants'; +import {utils} from 'ts/utils/utils'; const WIKI_NOT_READY_BACKOUT_TIMEOUT_MS = 5000; @@ -55,6 +54,7 @@ export class Wiki extends React.Component<WikiProps, WikiState> { }; } public componentWillMount() { + // tslint:disable-next-line:no-floating-promises this.fetchArticlesBySectionAsync(); } public componentWillUnmount() { @@ -180,6 +180,7 @@ export class Wiki extends React.Component<WikiProps, WikiState> { if (response.status === constants.HTTP_NO_CONTENT_STATUS_CODE) { // We need to backoff and try fetching again later this.wikiBackoffTimeoutId = window.setTimeout(() => { + // tslint:disable-next-line:no-floating-promises this.fetchArticlesBySectionAsync(); }, WIKI_NOT_READY_BACKOUT_TIMEOUT_MS); return; diff --git a/packages/website/tslint.json b/packages/website/tslint.json index 0ae97eb07..957c0e11d 100644 --- a/packages/website/tslint.json +++ b/packages/website/tslint.json @@ -5,6 +5,7 @@ "rules": { "no-implicit-dependencies": false, "no-object-literal-type-assertion": false, - "completed-docs": false + "completed-docs": false, + "prefer-function-over-method": false } } |