mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
More lint fixes
This commit is contained in:
parent
5a94775b3f
commit
56e9f98bd0
@ -190,6 +190,7 @@
|
||||
"enzyme": "^2.8.2",
|
||||
"eslint-plugin-chai": "0.0.1",
|
||||
"eslint-plugin-mocha": "^4.9.0",
|
||||
"eslint-plugin-react": "^7.4.0",
|
||||
"eth-json-rpc-middleware": "^1.2.7",
|
||||
"fs-promise": "^2.0.3",
|
||||
"gulp": "github:gulpjs/gulp#4.0",
|
||||
|
@ -430,7 +430,7 @@ function addNewAccount () {
|
||||
forceUpdateMetamaskState(dispatch)
|
||||
return resolve(newAccountAddress)
|
||||
})
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -621,7 +621,7 @@ function updateSendErrors (error) {
|
||||
|
||||
function clearSend () {
|
||||
return {
|
||||
type: actions.CLEAR_SEND
|
||||
type: actions.CLEAR_SEND,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1004,10 +1004,10 @@ function addTokens (tokens) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateTokens(newTokens) {
|
||||
function updateTokens (newTokens) {
|
||||
return {
|
||||
type: actions.UPDATE_TOKENS,
|
||||
newTokens
|
||||
newTokens,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1081,7 +1081,7 @@ function setProviderType (type) {
|
||||
}
|
||||
}
|
||||
|
||||
function updateProviderType(type) {
|
||||
function updateProviderType (type) {
|
||||
return {
|
||||
type: actions.SET_PROVIDER_TYPE,
|
||||
value: type,
|
||||
@ -1239,7 +1239,7 @@ function exportAccount (password, address) {
|
||||
}
|
||||
}
|
||||
|
||||
function exportAccountComplete() {
|
||||
function exportAccountComplete () {
|
||||
return {
|
||||
type: actions.EXPORT_ACCOUNT,
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ GasModalCard.prototype.render = function () {
|
||||
// max,
|
||||
step,
|
||||
title,
|
||||
copy
|
||||
copy,
|
||||
} = this.props
|
||||
|
||||
return h('div.send-v2__gas-modal-card', [
|
||||
|
@ -58,7 +58,7 @@ function mapDispatchToProps (dispatch) {
|
||||
}
|
||||
}
|
||||
|
||||
function getOriginalState(props) {
|
||||
function getOriginalState (props) {
|
||||
const gasPrice = props.gasPrice || MIN_GAS_PRICE_DEC
|
||||
const gasLimit = props.gasLimit || MIN_GAS_LIMIT_DEC
|
||||
|
||||
@ -90,7 +90,7 @@ CustomizeGasModal.prototype.save = function (gasPrice, gasLimit, gasTotal) {
|
||||
updateGasPrice,
|
||||
updateGasLimit,
|
||||
hideModal,
|
||||
updateGasTotal
|
||||
updateGasTotal,
|
||||
} = this.props
|
||||
|
||||
updateGasPrice(gasPrice)
|
||||
@ -260,7 +260,7 @@ CustomizeGasModal.prototype.render = function () {
|
||||
h(`div.send-v2__customize-gas__save${error ? '__error' : ''}`, {
|
||||
onClick: () => !error && this.save(gasPrice, gasLimit, gasTotal),
|
||||
}, ['SAVE']),
|
||||
])
|
||||
]),
|
||||
|
||||
]),
|
||||
|
||||
|
@ -43,7 +43,7 @@ AccountDropdownMini.prototype.renderDropdown = function () {
|
||||
closeDropdown()
|
||||
},
|
||||
icon: this.getListItemIcon(account, selectedAccount),
|
||||
}))
|
||||
})),
|
||||
|
||||
]),
|
||||
|
||||
@ -64,7 +64,7 @@ AccountDropdownMini.prototype.render = function () {
|
||||
handleClick: openDropdown,
|
||||
displayBalance: false,
|
||||
displayAddress: false,
|
||||
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(),
|
||||
|
@ -10,7 +10,7 @@ function mapDispatchToProps (dispatch) {
|
||||
return {
|
||||
showHideTokenConfirmationModal: (token) => {
|
||||
dispatch(actions.showModal({ name: 'HIDE_TOKEN_CONFIRMATION', token }))
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ TokenMenuDropdown.prototype.render = function () {
|
||||
showHideTokenConfirmationModal(this.props.token)
|
||||
this.props.onClose()
|
||||
},
|
||||
}, 'Hide Token')
|
||||
}, 'Hide Token'),
|
||||
|
||||
]),
|
||||
]),
|
||||
|
@ -220,7 +220,7 @@ Modal.prototype.render = function () {
|
||||
|
||||
const children = modal.contents
|
||||
const modalStyle = modal[isMobileView() ? 'mobileModalStyle' : 'laptopModalStyle']
|
||||
const contentStyle = modal.contentStyle || {};
|
||||
const contentStyle = modal.contentStyle || {}
|
||||
|
||||
return h(FadeModal,
|
||||
{
|
||||
|
@ -35,6 +35,6 @@ ShapeshiftDepositTxModal.prototype.render = function () {
|
||||
}, [
|
||||
h('div', {}, [
|
||||
h(QrView, {key: 'qr', Qr}),
|
||||
])
|
||||
]),
|
||||
])
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
const Component = require('react').Component
|
||||
const h = require('react-hyperscript')
|
||||
const classnames = require('classnames');
|
||||
const classnames = require('classnames')
|
||||
const inherits = require('util').inherits
|
||||
const NetworkDropdownIcon = require('./dropdowns/components/network-dropdown-icon')
|
||||
|
||||
|
@ -148,11 +148,11 @@ SendTokenScreen.prototype.setErrorsFor = function (field) {
|
||||
|
||||
const {
|
||||
isValid,
|
||||
errors: newErrors
|
||||
errors: newErrors,
|
||||
} = this.validate()
|
||||
|
||||
const nextErrors = Object.assign({}, previousErrors, {
|
||||
[field]: newErrors[field] || null
|
||||
[field]: newErrors[field] || null,
|
||||
})
|
||||
|
||||
if (!isValid) {
|
||||
@ -166,7 +166,7 @@ SendTokenScreen.prototype.setErrorsFor = function (field) {
|
||||
SendTokenScreen.prototype.clearErrorsFor = function (field) {
|
||||
const { errors: previousErrors } = this.state
|
||||
const nextErrors = Object.assign({}, previousErrors, {
|
||||
[field]: null
|
||||
[field]: null,
|
||||
})
|
||||
|
||||
this.setState({
|
||||
|
@ -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 })
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ EthFeeDisplay.prototype.render = function () {
|
||||
color: '#5d5d5d',
|
||||
fontSize: '16px',
|
||||
fontFamily: 'DIN OT',
|
||||
lineHeight: '22.4px'
|
||||
}
|
||||
lineHeight: '22.4px',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ FromDropdown.prototype.renderDropdown = function () {
|
||||
closeDropdown()
|
||||
},
|
||||
icon: this.getListItemIcon(account, selectedAccount),
|
||||
}))
|
||||
})),
|
||||
|
||||
]),
|
||||
|
||||
@ -60,7 +60,7 @@ 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(),
|
||||
|
@ -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'),
|
||||
])
|
||||
]),
|
||||
|
||||
])
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
const { addCurrencies, conversionGreaterThan } = require('../../conversion-util')
|
||||
|
||||
function isBalanceSufficient({
|
||||
function isBalanceSufficient ({
|
||||
amount,
|
||||
gasTotal,
|
||||
balance,
|
||||
|
@ -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()),
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ ToAutoComplete.prototype.renderDropdown = function () {
|
||||
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()
|
||||
}
|
||||
@ -99,7 +98,7 @@ ToAutoComplete.prototype.render = function () {
|
||||
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`, {
|
||||
|
@ -28,8 +28,8 @@ USDFeeDisplay.prototype.render = function () {
|
||||
color: '#5d5d5d',
|
||||
fontSize: '16px',
|
||||
fontFamily: 'DIN OT',
|
||||
lineHeight: '22.4px'
|
||||
}
|
||||
lineHeight: '22.4px',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -27,13 +27,13 @@ function mapStateToProps (state) {
|
||||
requester: null,
|
||||
requesterAddress: null,
|
||||
accounts: accountsWithSendEtherInfoSelector(state),
|
||||
conversionRate: conversionRateSelector(state)
|
||||
conversionRate: conversionRateSelector(state),
|
||||
}
|
||||
}
|
||||
|
||||
function mapDispatchToProps (dispatch) {
|
||||
return {
|
||||
goHome: () => dispatch(actions.goHome())
|
||||
goHome: () => dispatch(actions.goHome()),
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ SignatureRequest.prototype.renderAccountDropdown = function () {
|
||||
dropdownOpen: accountDropdownOpen,
|
||||
openDropdown: () => this.setState({ accountDropdownOpen: true }),
|
||||
closeDropdown: () => this.setState({ accountDropdownOpen: false }),
|
||||
})
|
||||
}),
|
||||
|
||||
])
|
||||
}
|
||||
@ -128,7 +128,7 @@ SignatureRequest.prototype.renderRequestIcon = function () {
|
||||
h(Identicon, {
|
||||
diameter: 40,
|
||||
address: requesterAddress,
|
||||
})
|
||||
}),
|
||||
])
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ SignatureRequest.prototype.renderRequestInfo = function () {
|
||||
|
||||
h('div.request-signature__headline', [
|
||||
`Your signature is being requested`,
|
||||
])
|
||||
]),
|
||||
|
||||
])
|
||||
}
|
||||
@ -161,11 +161,9 @@ SignatureRequest.prototype.renderBody = function () {
|
||||
|
||||
if (type === 'personal_sign') {
|
||||
rows = [{ name: 'Message', value: this.msgHexToText(data) }]
|
||||
}
|
||||
else if (type === 'eth_signTypedData') {
|
||||
} else if (type === 'eth_signTypedData') {
|
||||
rows = data
|
||||
}
|
||||
else if (type === 'eth_sign') {
|
||||
} else if (type === 'eth_sign') {
|
||||
rows = [{ name: 'Message', value: data }]
|
||||
notice = `Signing this message can have
|
||||
dangerous side effects. Only sign messages from
|
||||
@ -183,7 +181,7 @@ SignatureRequest.prototype.renderBody = function () {
|
||||
className: classnames({
|
||||
'request-signature__notice': type === 'personal_sign' || type === 'eth_signTypedData',
|
||||
'request-signature__warning': type === 'eth_sign',
|
||||
})
|
||||
}),
|
||||
}, [notice]),
|
||||
|
||||
h('div.request-signature__rows', [
|
||||
@ -218,12 +216,10 @@ SignatureRequest.prototype.renderFooter = function () {
|
||||
if (type === 'personal_sign') {
|
||||
cancel = cancelPersonalMessage
|
||||
sign = signPersonalMessage
|
||||
}
|
||||
else if (type === 'eth_signTypedData') {
|
||||
} else if (type === 'eth_signTypedData') {
|
||||
cancel = cancelTypedMessage
|
||||
sign = signTypedMessage
|
||||
}
|
||||
else if (type === 'eth_sign') {
|
||||
} else if (type === 'eth_sign') {
|
||||
cancel = cancelMessage
|
||||
sign = signMessage
|
||||
}
|
||||
|
@ -68,10 +68,10 @@ TokenCell.prototype.render = function () {
|
||||
// userAddress,
|
||||
} = props
|
||||
|
||||
const pair = `${symbol.toLowerCase()}_eth`;
|
||||
const pair = `${symbol.toLowerCase()}_eth`
|
||||
|
||||
let currentTokenToFiatRate;
|
||||
let currentTokenInFiat;
|
||||
let currentTokenToFiatRate
|
||||
let currentTokenInFiat
|
||||
let formattedFiat = ''
|
||||
|
||||
if (tokenExchangeRates[pair]) {
|
||||
@ -86,7 +86,7 @@ TokenCell.prototype.render = function () {
|
||||
numberOfDecimals: 2,
|
||||
conversionRate: currentTokenToFiatRate,
|
||||
})
|
||||
formattedFiat = `${currentTokenInFiat} ${currentCurrency.toUpperCase()}`;
|
||||
formattedFiat = `${currentTokenInFiat} ${currentCurrency.toUpperCase()}`
|
||||
}
|
||||
|
||||
const showFiat = Boolean(currentTokenInFiat) && currentCurrency.toUpperCase() !== symbol
|
||||
|
@ -138,7 +138,7 @@ TxListItem.prototype.getSendTokenTotal = async function () {
|
||||
const multiplier = Math.pow(10, Number(decimals || 0))
|
||||
const total = Number(value / multiplier)
|
||||
|
||||
const pair = symbol && `${symbol.toLowerCase()}_eth`;
|
||||
const pair = symbol && `${symbol.toLowerCase()}_eth`
|
||||
|
||||
let tokenToFiatRate
|
||||
let totalInFiat
|
||||
@ -242,6 +242,6 @@ TxListItem.prototype.render = function () {
|
||||
|
||||
]),
|
||||
]),
|
||||
]) // holding on icon from design
|
||||
]), // holding on icon from design
|
||||
])
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ function mapStateToProps (state) {
|
||||
|
||||
function mapDispatchToProps (dispatch) {
|
||||
return {
|
||||
showConfTxPage: ({ id }) => dispatch(showConfTxPage({ id }))
|
||||
showConfTxPage: ({ id }) => dispatch(showConfTxPage({ id })),
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
|
||||
tokenInfoGetter: this.tokenInfoGetter,
|
||||
}
|
||||
|
||||
const isUnapproved = transactionStatus === 'unapproved';
|
||||
const isUnapproved = transactionStatus === 'unapproved'
|
||||
|
||||
if (isUnapproved) {
|
||||
opts.onClick = () => showConfTxPage({id: transActionId})
|
||||
|
@ -106,7 +106,7 @@ const converter = R.pipe(
|
||||
whenPredSetWithPropAndSetter(R.prop('numberOfDecimals'), 'numberOfDecimals', round),
|
||||
whenPropApplySetterMap('toNumericBase', baseChange),
|
||||
R.view(R.lensProp('value'))
|
||||
);
|
||||
)
|
||||
|
||||
const conversionUtil = (value, {
|
||||
fromCurrency = null,
|
||||
@ -129,7 +129,7 @@ const conversionUtil = (value, {
|
||||
conversionRate,
|
||||
invertConversionRate,
|
||||
value: value || '0',
|
||||
});
|
||||
})
|
||||
|
||||
const addCurrencies = (a, b, options = {}) => {
|
||||
const {
|
||||
@ -137,7 +137,7 @@ const addCurrencies = (a, b, options = {}) => {
|
||||
bBase,
|
||||
...conversionOptions
|
||||
} = options
|
||||
const value = (new BigNumber(a, aBase)).add(b, bBase);
|
||||
const value = (new BigNumber(a, aBase)).add(b, bBase)
|
||||
|
||||
return converter({
|
||||
value,
|
||||
@ -155,17 +155,17 @@ const multiplyCurrencies = (a, b, options = {}) => {
|
||||
const bigNumberA = new BigNumber(String(a), multiplicandBase)
|
||||
const bigNumberB = new BigNumber(String(b), multiplierBase)
|
||||
|
||||
const value = bigNumberA.times(bigNumberB);
|
||||
const value = bigNumberA.times(bigNumberB)
|
||||
|
||||
return converter({
|
||||
value,
|
||||
...conversionOptions
|
||||
...conversionOptions,
|
||||
})
|
||||
}
|
||||
|
||||
const conversionGreaterThan = (
|
||||
{ ...firstProps },
|
||||
{ ...secondProps },
|
||||
{ ...secondProps },
|
||||
) => {
|
||||
const firstValue = converter({ ...firstProps })
|
||||
const secondValue = converter({ ...secondProps })
|
||||
@ -174,7 +174,7 @@ const conversionGreaterThan = (
|
||||
|
||||
const conversionGTE = (
|
||||
{ ...firstProps },
|
||||
{ ...secondProps },
|
||||
{ ...secondProps },
|
||||
) => {
|
||||
const firstValue = converter({ ...firstProps })
|
||||
const secondValue = converter({ ...secondProps })
|
||||
@ -183,7 +183,7 @@ const conversionGTE = (
|
||||
|
||||
const conversionLTE = (
|
||||
{ ...firstProps },
|
||||
{ ...secondProps },
|
||||
{ ...secondProps },
|
||||
) => {
|
||||
const firstValue = converter({ ...firstProps })
|
||||
const secondValue = converter({ ...secondProps })
|
||||
|
@ -44,7 +44,7 @@ function reduceApp (state, action) {
|
||||
},
|
||||
previousModalState: {
|
||||
name: null,
|
||||
}
|
||||
},
|
||||
},
|
||||
sidebarOpen: false,
|
||||
networkDropdownOpen: false,
|
||||
|
@ -235,7 +235,7 @@ function reduceMetamask (state, action) {
|
||||
errors: {
|
||||
...metamaskState.send.errors,
|
||||
...action.value,
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -94,7 +94,7 @@ SendTransactionScreen.prototype.renderHeaderIcon = function () {
|
||||
diameter: 40,
|
||||
address: selectedToken.address,
|
||||
})
|
||||
: h('img.send-v2__send-header-icon', { src: '../images/eth_logo.svg' })
|
||||
: h('img.send-v2__send-header-icon', { src: '../images/eth_logo.svg' }),
|
||||
])
|
||||
}
|
||||
|
||||
@ -135,12 +135,12 @@ SendTransactionScreen.prototype.renderHeader = function () {
|
||||
])
|
||||
}
|
||||
|
||||
SendTransactionScreen.prototype.renderErrorMessage = function(errorType) {
|
||||
SendTransactionScreen.prototype.renderErrorMessage = function (errorType) {
|
||||
const { errors } = this.props
|
||||
const errorMessage = errors[errorType];
|
||||
const errorMessage = errors[errorType]
|
||||
|
||||
return errorMessage
|
||||
? h('div.send-v2__error', [ errorMessage ] )
|
||||
? h('div.send-v2__error', [ errorMessage ])
|
||||
: null
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user