From cb11aec84df346d5180c7d5874859c1c34f0bf1c Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 20 Dec 2017 00:44:08 -0500 Subject: Add new underscore-privates rule to @0xproject/tslint-config and fix lint errors --- .../ts/components/trade_history/trade_history.tsx | 32 +++++++++++----------- .../trade_history/trade_history_item.tsx | 14 +++++----- 2 files changed, 23 insertions(+), 23 deletions(-) (limited to 'packages/website/ts/components/trade_history') diff --git a/packages/website/ts/components/trade_history/trade_history.tsx b/packages/website/ts/components/trade_history/trade_history.tsx index 59f85a03d..aa41b9392 100644 --- a/packages/website/ts/components/trade_history/trade_history.tsx +++ b/packages/website/ts/components/trade_history/trade_history.tsx @@ -20,19 +20,19 @@ interface TradeHistoryState { } export class TradeHistory extends React.Component { - private fillPollingIntervalId: number; + private _fillPollingIntervalId: number; public constructor(props: TradeHistoryProps) { super(props); - const sortedFills = this.getSortedFills(); + const sortedFills = this._getSortedFills(); this.state = { sortedFills, }; } public componentWillMount() { - this.startPollingForFills(); + this._startPollingForFills(); } public componentWillUnmount() { - this.stopPollingForFills(); + this._stopPollingForFills(); } public componentDidMount() { window.scrollTo(0, 0); @@ -43,15 +43,15 @@ export class TradeHistory extends React.ComponentTrade history
- {this.renderTrades()} + {this._renderTrades()}
); } - private renderTrades() { - const numNonCustomFills = this.numFillsWithoutCustomERC20Tokens(); + private _renderTrades() { + const numNonCustomFills = this._numFillsWithoutCustomERC20Tokens(); if (numNonCustomFills === 0) { - return this.renderEmptyNotice(); + return this._renderEmptyNotice(); } return _.map(this.state.sortedFills, (fill, index) => { @@ -66,14 +66,14 @@ export class TradeHistory extends React.Component No filled orders yet. ); } - private numFillsWithoutCustomERC20Tokens() { + private _numFillsWithoutCustomERC20Tokens() { let numNonCustomFills = 0; const tokens = _.values(this.props.tokenByAddress); _.each(this.state.sortedFills, fill => { @@ -93,9 +93,9 @@ export class TradeHistory extends React.Component { - const sortedFills = this.getSortedFills(); + private _startPollingForFills() { + this._fillPollingIntervalId = window.setInterval(() => { + const sortedFills = this._getSortedFills(); if (!utils.deepEqual(sortedFills, this.state.sortedFills)) { this.setState({ sortedFills, @@ -103,10 +103,10 @@ export class TradeHistory extends React.Component fill.blockTimestamp * -1]); 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 d2a334df9..3586a96a5 100644 --- a/packages/website/ts/components/trade_history/trade_history_item.tsx +++ b/packages/website/ts/components/trade_history/trade_history_item.tsx @@ -54,7 +54,7 @@ export class TradeHistoryItem extends React.Component
- {this.renderDate()} + {this._renderDate()}
- {this.renderAmounts(makerToken, takerToken)} + {this._renderAmounts(makerToken, takerToken)}
@@ -95,7 +95,7 @@ export class TradeHistoryItem extends React.Component ); } - private renderAmounts(makerToken: Token, takerToken: Token) { + private _renderAmounts(makerToken: Token, takerToken: Token) { const fill = this.props.fill; const filledTakerTokenAmountInUnits = ZeroEx.toUnitAmount(fill.filledTakerTokenAmount, takerToken.decimals); const filledMakerTokenAmountInUnits = ZeroEx.toUnitAmount(fill.filledMakerTokenAmount, takerToken.decimals); @@ -133,14 +133,14 @@ export class TradeHistoryItem extends React.Component +{' '} - {this.renderAmount(receiveAmount, receiveToken.symbol, receiveToken.decimals)} + {this._renderAmount(receiveAmount, receiveToken.symbol, receiveToken.decimals)}
-{' '} - {this.renderAmount(givenAmount, givenToken.symbol, givenToken.decimals)} + {this._renderAmount(givenAmount, givenToken.symbol, givenToken.decimals)}
{exchangeRate.toFixed(PRECISION)} {givenToken.symbol}/{receiveToken.symbol} @@ -148,7 +148,7 @@ export class TradeHistoryItem extends React.Component ); } - private renderDate() { + private _renderDate() { const blockMoment = moment.unix(this.props.fill.blockTimestamp); if (!blockMoment.isValid()) { return null; @@ -170,7 +170,7 @@ export class TradeHistoryItem extends React.Component ); } - private renderAmount(amount: BigNumber, symbol: string, decimals: number) { + private _renderAmount(amount: BigNumber, symbol: string, decimals: number) { const unitAmount = ZeroEx.toUnitAmount(amount, decimals); return ( -- cgit v1.2.3