From 5a94775b3fa22517a71232ebe229ee83e9debcf1 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 2 Nov 2017 00:00:33 -0230 Subject: Lint fixes for NewUI-flat. --- ui/app/components/send/currency-display.js | 3 -- ui/app/components/send/from-dropdown.js | 3 -- ui/app/components/send/gas-fee-display-v2.js | 2 +- ui/app/components/send/memo-textarea.js | 50 ++++++++++++++-------------- ui/app/components/send/send-constants.js | 1 - ui/app/components/send/send-utils.js | 1 - ui/app/components/send/send-v2-container.js | 6 ---- ui/app/components/send/to-autocomplete.js | 5 --- 8 files changed, 26 insertions(+), 45 deletions(-) (limited to 'ui/app/components/send') diff --git a/ui/app/components/send/currency-display.js b/ui/app/components/send/currency-display.js index 5dba6a8dd..34939c767 100644 --- a/ui/app/components/send/currency-display.js +++ b/ui/app/components/send/currency-display.js @@ -1,7 +1,6 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits -const Identicon = require('../identicon') const { conversionUtil, multiplyCurrencies } = require('../../conversion-util') module.exports = CurrencyDisplay @@ -48,8 +47,6 @@ CurrencyDisplay.prototype.render = function () { conversionRate, primaryCurrency, convertedCurrency, - convertedPrefix = '', - placeholder = '0', readOnly = false, inError = false, value: initValue, diff --git a/ui/app/components/send/from-dropdown.js b/ui/app/components/send/from-dropdown.js index 6f2b9da68..b404dde14 100644 --- a/ui/app/components/send/from-dropdown.js +++ b/ui/app/components/send/from-dropdown.js @@ -1,7 +1,6 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits -const Identicon = require('../identicon') const AccountListItem = require('./account-list-item') module.exports = FromDropdown @@ -51,10 +50,8 @@ FromDropdown.prototype.renderDropdown = function () { FromDropdown.prototype.render = function () { const { - accounts, selectedAccount, openDropdown, - closeDropdown, dropdownOpen, } = this.props diff --git a/ui/app/components/send/gas-fee-display-v2.js b/ui/app/components/send/gas-fee-display-v2.js index 0e23b63ac..0b4377d29 100644 --- a/ui/app/components/send/gas-fee-display-v2.js +++ b/ui/app/components/send/gas-fee-display-v2.js @@ -23,7 +23,7 @@ GasFeeDisplay.prototype.render = function () { gasTotal ? h(CurrencyDisplay, { - primaryCurrency: 'ETH', + primaryCurrency, convertedCurrency, value: gasTotal, conversionRate, diff --git a/ui/app/components/send/memo-textarea.js b/ui/app/components/send/memo-textarea.js index 4005b9493..f5fe5e790 100644 --- a/ui/app/components/send/memo-textarea.js +++ b/ui/app/components/send/memo-textarea.js @@ -1,33 +1,33 @@ -const Component = require('react').Component -const h = require('react-hyperscript') -const inherits = require('util').inherits -const Identicon = require('../identicon') +// const Component = require('react').Component +// const h = require('react-hyperscript') +// const inherits = require('util').inherits +// const Identicon = require('../identicon') -module.exports = MemoTextArea +// module.exports = MemoTextArea -inherits(MemoTextArea, Component) -function MemoTextArea () { - Component.call(this) -} +// inherits(MemoTextArea, Component) +// function MemoTextArea () { +// Component.call(this) +// } -MemoTextArea.prototype.render = function () { - const { memo, identities, onChange } = this.props +// MemoTextArea.prototype.render = function () { +// const { memo, identities, onChange } = this.props - return h('div.send-v2__memo-text-area', [ +// return h('div.send-v2__memo-text-area', [ - h('textarea.send-v2__memo-text-area__input', { - placeholder: 'Optional', - value: memo, - onChange, - // onBlur: () => { - // this.setErrorsFor('memo') - // }, - onFocus: event => { - // this.clearErrorsFor('memo') - }, - }), +// h('textarea.send-v2__memo-text-area__input', { +// placeholder: 'Optional', +// value: memo, +// onChange, +// // onBlur: () => { +// // this.setErrorsFor('memo') +// // }, +// onFocus: event => { +// // this.clearErrorsFor('memo') +// }, +// }), - ]) +// ]) -} +// } diff --git a/ui/app/components/send/send-constants.js b/ui/app/components/send/send-constants.js index 471e01e2a..0a4f85bc9 100644 --- a/ui/app/components/send/send-constants.js +++ b/ui/app/components/send/send-constants.js @@ -1,5 +1,4 @@ const ethUtil = require('ethereumjs-util') -const Identicon = require('../identicon') const { conversionUtil, multiplyCurrencies } = require('../../conversion-util') const MIN_GAS_PRICE_HEX = (100000000).toString(16) diff --git a/ui/app/components/send/send-utils.js b/ui/app/components/send/send-utils.js index bf096d610..2def62842 100644 --- a/ui/app/components/send/send-utils.js +++ b/ui/app/components/send/send-utils.js @@ -27,7 +27,6 @@ function isBalanceSufficient({ fromNumericBase: 'hex', conversionRate: amountConversionRate, fromCurrency: selectedToken || primaryCurrency, - conversionRate: amountConversionRate, }, ) diff --git a/ui/app/components/send/send-v2-container.js b/ui/app/components/send/send-v2-container.js index fb2634de2..efdf69795 100644 --- a/ui/app/components/send/send-v2-container.js +++ b/ui/app/components/send/send-v2-container.js @@ -3,17 +3,12 @@ const actions = require('../../actions') const abi = require('ethereumjs-abi') const SendEther = require('../../send-v2') -const { multiplyCurrencies } = require('../../conversion-util') - const { accountsWithSendEtherInfoSelector, getCurrentAccountWithSendEtherInfo, conversionRateSelector, getSelectedToken, - getSelectedTokenExchangeRate, getSelectedAddress, - getGasPrice, - getGasLimit, getAddressBook, getSendFrom, getCurrentCurrency, @@ -26,7 +21,6 @@ function mapStateToProps (state) { const fromAccounts = accountsWithSendEtherInfoSelector(state) const selectedAddress = getSelectedAddress(state) const selectedToken = getSelectedToken(state) - const tokenExchangeRates = state.metamask.tokenExchangeRates const conversionRate = conversionRateSelector(state) let data; diff --git a/ui/app/components/send/to-autocomplete.js b/ui/app/components/send/to-autocomplete.js index ab490155b..ebc63a7c5 100644 --- a/ui/app/components/send/to-autocomplete.js +++ b/ui/app/components/send/to-autocomplete.js @@ -1,7 +1,6 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits -const Identicon = require('../identicon') const AccountListItem = require('./account-list-item') module.exports = ToAutoComplete @@ -23,7 +22,6 @@ ToAutoComplete.prototype.getListItemIcon = function (listItemAddress, toAddress) ToAutoComplete.prototype.renderDropdown = function () { const { - accounts, closeDropdown, onChange, to, @@ -86,9 +84,6 @@ ToAutoComplete.prototype.componentDidUpdate = function (nextProps, nextState) { ToAutoComplete.prototype.render = function () { const { to, - accounts, - openDropdown, - closeDropdown, dropdownOpen, onChange, inError, -- cgit From 56e9f98bd05de8ae26f653d15eec4304f0c72155 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 2 Nov 2017 09:45:59 -0230 Subject: More lint fixes --- ui/app/components/send/account-list-item.js | 2 +- ui/app/components/send/currency-display.js | 10 ++++------ ui/app/components/send/eth-fee-display.js | 4 ++-- ui/app/components/send/from-dropdown.js | 10 +++++----- ui/app/components/send/gas-fee-display-v2.js | 5 ++--- ui/app/components/send/memo-textarea.js | 2 +- ui/app/components/send/send-utils.js | 4 ++-- ui/app/components/send/send-v2-container.js | 8 ++++---- ui/app/components/send/to-autocomplete.js | 13 ++++++------- ui/app/components/send/usd-fee-display.js | 4 ++-- 10 files changed, 29 insertions(+), 33 deletions(-) (limited to 'ui/app/components/send') diff --git a/ui/app/components/send/account-list-item.js b/ui/app/components/send/account-list-item.js index cc514cbd4..2378a4671 100644 --- a/ui/app/components/send/account-list-item.js +++ b/ui/app/components/send/account-list-item.js @@ -68,4 +68,4 @@ AccountListItem.prototype.render = function () { }, name), ]) -} \ No newline at end of file +} diff --git a/ui/app/components/send/currency-display.js b/ui/app/components/send/currency-display.js index 34939c767..45986e371 100644 --- a/ui/app/components/send/currency-display.js +++ b/ui/app/components/send/currency-display.js @@ -71,7 +71,7 @@ CurrencyDisplay.prototype.render = function () { conversionRate, }) - const inputSizeMultiplier = readOnly ? 1 : 1.2; + const inputSizeMultiplier = readOnly ? 1 : 1.2 return h('div', { className, @@ -95,15 +95,13 @@ CurrencyDisplay.prototype.render = function () { if (newValue === '') { newValue = '0' - } - else if (newValue.match(/^0[1-9]$/)) { + } else if (newValue.match(/^0[1-9]$/)) { newValue = newValue.match(/[1-9]/)[0] } if (newValue && !isValidInput(newValue)) { event.preventDefault() - } - else { + } else { validate(this.getAmount(newValue)) this.setState({ value: newValue }) } @@ -122,6 +120,6 @@ CurrencyDisplay.prototype.render = function () { }, `${convertedValue} ${convertedCurrency.toUpperCase()}`), ]) - + } diff --git a/ui/app/components/send/eth-fee-display.js b/ui/app/components/send/eth-fee-display.js index 8b4cec16c..9eda5ec62 100644 --- a/ui/app/components/send/eth-fee-display.js +++ b/ui/app/components/send/eth-fee-display.js @@ -30,8 +30,8 @@ EthFeeDisplay.prototype.render = function () { color: '#5d5d5d', fontSize: '16px', fontFamily: 'DIN OT', - lineHeight: '22.4px' - } + lineHeight: '22.4px', + }, }) } diff --git a/ui/app/components/send/from-dropdown.js b/ui/app/components/send/from-dropdown.js index b404dde14..bcae5ede8 100644 --- a/ui/app/components/send/from-dropdown.js +++ b/ui/app/components/send/from-dropdown.js @@ -35,13 +35,13 @@ FromDropdown.prototype.renderDropdown = function () { h('div.send-v2__from-dropdown__list', {}, [ ...accounts.map(account => h(AccountListItem, { - account, + account, handleClick: () => { onSelect(account) closeDropdown() - }, + }, icon: this.getListItemIcon(account, selectedAccount), - })) + })), ]), @@ -60,12 +60,12 @@ FromDropdown.prototype.render = function () { h(AccountListItem, { account: selectedAccount, handleClick: openDropdown, - icon: h(`i.fa.fa-caret-down.fa-lg`, { style: { color: '#dedede' } }) + icon: h(`i.fa.fa-caret-down.fa-lg`, { style: { color: '#dedede' } }), }), dropdownOpen && this.renderDropdown(), ]) - + } diff --git a/ui/app/components/send/gas-fee-display-v2.js b/ui/app/components/send/gas-fee-display-v2.js index 0b4377d29..806c33f0a 100644 --- a/ui/app/components/send/gas-fee-display-v2.js +++ b/ui/app/components/send/gas-fee-display-v2.js @@ -30,14 +30,13 @@ GasFeeDisplay.prototype.render = function () { convertedPrefix: '$', readOnly: true, }) - : h('div.currency-display', 'Loading...') - , + : h('div.currency-display', 'Loading...'), h('div.send-v2__sliders-icon-container', { onClick, }, [ h('i.fa.fa-sliders.send-v2__sliders-icon'), - ]) + ]), ]) } diff --git a/ui/app/components/send/memo-textarea.js b/ui/app/components/send/memo-textarea.js index f5fe5e790..f4bb24bf8 100644 --- a/ui/app/components/send/memo-textarea.js +++ b/ui/app/components/send/memo-textarea.js @@ -28,6 +28,6 @@ // }), // ]) - + // } diff --git a/ui/app/components/send/send-utils.js b/ui/app/components/send/send-utils.js index 2def62842..6ec04a223 100644 --- a/ui/app/components/send/send-utils.js +++ b/ui/app/components/send/send-utils.js @@ -1,6 +1,6 @@ const { addCurrencies, conversionGreaterThan } = require('../../conversion-util') -function isBalanceSufficient({ +function isBalanceSufficient ({ amount, gasTotal, balance, @@ -35,4 +35,4 @@ function isBalanceSufficient({ module.exports = { isBalanceSufficient, -} \ No newline at end of file +} diff --git a/ui/app/components/send/send-v2-container.js b/ui/app/components/send/send-v2-container.js index efdf69795..5a6e83ae6 100644 --- a/ui/app/components/send/send-v2-container.js +++ b/ui/app/components/send/send-v2-container.js @@ -23,9 +23,9 @@ function mapStateToProps (state) { const selectedToken = getSelectedToken(state) const conversionRate = conversionRateSelector(state) - let data; - let primaryCurrency; - let tokenToFiatRate; + let data + let primaryCurrency + let tokenToFiatRate if (selectedToken) { data = Array.prototype.map.call( abi.rawEncode(['address', 'uint256'], [selectedAddress, '0x0']), @@ -70,6 +70,6 @@ function mapDispatchToProps (dispatch) { updateSendMemo: newMemo => dispatch(actions.updateSendMemo(newMemo)), updateSendErrors: newError => dispatch(actions.updateSendErrors(newError)), goHome: () => dispatch(actions.goHome()), - clearSend: () => dispatch(actions.clearSend()) + clearSend: () => dispatch(actions.clearSend()), } } diff --git a/ui/app/components/send/to-autocomplete.js b/ui/app/components/send/to-autocomplete.js index ebc63a7c5..df43fcc4a 100644 --- a/ui/app/components/send/to-autocomplete.js +++ b/ui/app/components/send/to-autocomplete.js @@ -37,15 +37,15 @@ ToAutoComplete.prototype.renderDropdown = function () { h('div.send-v2__from-dropdown__list', {}, [ ...accountsToRender.map(account => h(AccountListItem, { - account, + account, handleClick: () => { onChange(account.address) closeDropdown() - }, + }, icon: this.getListItemIcon(account.address, to), displayBalance: false, displayAddress: true, - })) + })), ]), @@ -67,8 +67,7 @@ ToAutoComplete.prototype.handleInputEvent = function (event = {}, cb) { this.setState({ accountsToRender: [] }) event.target && event.target.select() closeDropdown() - } - else { + } else { this.setState({ accountsToRender: matchingAccounts }) openDropdown() } @@ -93,13 +92,13 @@ ToAutoComplete.prototype.render = function () { h('input.send-v2__to-autocomplete__input', { placeholder: 'Recipient Address', - className: inError ? `send-v2__error-border` : '', + className: inError ? `send-v2__error-border` : '', value: to, onChange: event => onChange(event.target.value), onFocus: event => this.handleInputEvent(event), style: { borderColor: inError ? 'red' : null, - } + }, }), !to && h(`i.fa.fa-caret-down.fa-lg.send-v2__to-autocomplete__down-caret`, { diff --git a/ui/app/components/send/usd-fee-display.js b/ui/app/components/send/usd-fee-display.js index 6ee38f1b5..4cf31a493 100644 --- a/ui/app/components/send/usd-fee-display.js +++ b/ui/app/components/send/usd-fee-display.js @@ -28,8 +28,8 @@ USDFeeDisplay.prototype.render = function () { color: '#5d5d5d', fontSize: '16px', fontFamily: 'DIN OT', - lineHeight: '22.4px' - } + lineHeight: '22.4px', + }, }) } -- cgit