Enable arrow-parens ESLint rule

feature/default_network_editable
Whymarrh Whitby 5 years ago
parent b63b848ed4
commit a78cf0ef3a
  1. 1
      .eslintrc.js
  2. 6
      app/scripts/background.js
  3. 2
      app/scripts/contentscript.js
  4. 2
      app/scripts/controllers/app-state.js
  5. 2
      app/scripts/controllers/cached-balances.js
  6. 4
      app/scripts/controllers/incoming-transactions.js
  7. 2
      app/scripts/controllers/network/createLocalhostClient.js
  8. 2
      app/scripts/controllers/network/util.js
  9. 10
      app/scripts/controllers/permissions/index.js
  10. 4
      app/scripts/controllers/permissions/permissionsLog.js
  11. 6
      app/scripts/controllers/preferences.js
  12. 4
      app/scripts/controllers/token-rates.js
  13. 2
      app/scripts/controllers/transactions/index.js
  14. 10
      app/scripts/controllers/transactions/lib/util.js
  15. 2
      app/scripts/controllers/transactions/tx-state-manager.js
  16. 6
      app/scripts/lib/account-tracker.js
  17. 2
      app/scripts/lib/createDnodeRemoteGetter.js
  18. 2
      app/scripts/lib/ens-ipfs/setup.js
  19. 6
      app/scripts/lib/get-first-preferred-lang-code.js
  20. 4
      app/scripts/lib/message-manager.js
  21. 4
      app/scripts/lib/personal-message-manager.js
  22. 8
      app/scripts/lib/setupSentry.js
  23. 4
      app/scripts/lib/typed-message-manager.js
  24. 4
      app/scripts/lib/util.js
  25. 26
      app/scripts/metamask-controller.js
  26. 12
      app/scripts/migrations/025.js
  27. 2
      app/scripts/platforms/extension.js
  28. 8
      development/metamaskbot-build-announce.js
  29. 4
      development/mock-3box.js
  30. 2
      development/show-deps-install-scripts.js
  31. 2
      development/sourcemap-validator.js
  32. 12
      development/verify-locale-strings.js
  33. 34
      gulpfile.js
  34. 2
      test/e2e/address-book.spec.js
  35. 20
      test/e2e/benchmark.js
  36. 4
      test/e2e/ethereum-on.spec.js
  37. 2
      test/e2e/from-import-ui.spec.js
  38. 2
      test/e2e/incremental-security.spec.js
  39. 2
      test/e2e/metamask-responsive-ui.spec.js
  40. 6
      test/e2e/metamask-ui.spec.js
  41. 2
      test/e2e/mock-3box/server.js
  42. 4
      test/e2e/permissions.spec.js
  43. 2
      test/e2e/send-edit.spec.js
  44. 4
      test/e2e/signature-request.spec.js
  45. 2
      test/e2e/threebox.spec.js
  46. 4
      test/e2e/web3.spec.js
  47. 8
      test/e2e/webdriver/driver.js
  48. 4
      test/lib/render-helpers.js
  49. 2
      test/setup.js
  50. 2
      test/unit/app/controllers/metamask-controller-test.js
  51. 2
      test/unit/app/controllers/transactions/pending-tx-test.js
  52. 2
      test/unit/app/controllers/transactions/tx-controller-test.js
  53. 4
      test/unit/app/fetch-with-timeout.test.js
  54. 4
      test/unit/migrations/031-test.js
  55. 2
      test/unit/migrations/033-test.js
  56. 2
      test/unit/migrations/migrator-test.js
  57. 14
      test/unit/ui/app/actions.spec.js
  58. 4
      test/web3/web3.js
  59. 12
      ui/app/components/app/account-menu/account-menu.component.js
  60. 4
      ui/app/components/app/account-menu/account-menu.container.js
  61. 2
      ui/app/components/app/app-header/app-header.component.js
  62. 4
      ui/app/components/app/app-header/app-header.container.js
  63. 2
      ui/app/components/app/app-header/tests/app-header.test.js
  64. 2
      ui/app/components/app/confirm-page-container/confirm-detail-row/confirm-detail-row.component.js
  65. 2
      ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js
  66. 2
      ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-warning/confirm-page-container-warning.component.js
  67. 2
      ui/app/components/app/confirm-page-container/confirm-page-container-navigation/confirm-page-container-navigation.component.js
  68. 4
      ui/app/components/app/connected-sites-list/connected-sites-list.container.js
  69. 4
      ui/app/components/app/dropdowns/network-dropdown.js
  70. 4
      ui/app/components/app/dropdowns/simple-dropdown.js
  71. 2
      ui/app/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js
  72. 2
      ui/app/components/app/gas-customization/advanced-gas-inputs/tests/advanced-gas-input-component.test.js
  73. 2
      ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js
  74. 4
      ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js
  75. 6
      ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js
  76. 2
      ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js
  77. 2
      ui/app/components/app/gas-customization/gas-slider/gas-slider.component.js
  78. 4
      ui/app/components/app/loading-network-screen/loading-network-screen.container.js
  79. 4
      ui/app/components/app/menu-bar/menu-bar.container.js
  80. 2
      ui/app/components/app/modals/account-details-modal/account-details-modal.component.js
  81. 4
      ui/app/components/app/modals/add-to-addressbook-modal/add-to-addressbook-modal.component.js
  82. 2
      ui/app/components/app/modals/cancel-transaction/cancel-transaction.container.js
  83. 2
      ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js
  84. 2
      ui/app/components/app/modals/confirm-delete-network/confirm-delete-network.container.js
  85. 2
      ui/app/components/app/modals/confirm-delete-network/tests/confirm-delete-network.test.js
  86. 4
      ui/app/components/app/modals/confirm-remove-account/confirm-remove-account.container.js
  87. 2
      ui/app/components/app/modals/confirm-remove-account/tests/confirm-remove-account.test.js
  88. 2
      ui/app/components/app/modals/confirm-reset-account/confirm-reset-account.container.js
  89. 2
      ui/app/components/app/modals/confirm-reset-account/tests/confirm-reset-account.test.js
  90. 2
      ui/app/components/app/modals/deposit-ether-modal/deposit-ether-modal.component.js
  91. 2
      ui/app/components/app/modals/deposit-ether-modal/deposit-ether-modal.container.js
  92. 6
      ui/app/components/app/modals/disconnect-account/disconnect-account.container.js
  93. 2
      ui/app/components/app/modals/disconnect-all/disconnect-all.container.js
  94. 4
      ui/app/components/app/modals/export-private-key-modal/export-private-key-modal.component.js
  95. 6
      ui/app/components/app/modals/fade-modal.js
  96. 2
      ui/app/components/app/modals/hide-token-confirmation-modal.js
  97. 2
      ui/app/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.container.js
  98. 4
      ui/app/components/app/modals/new-account-modal/new-account-modal.component.js
  99. 6
      ui/app/components/app/modals/new-account-modal/new-account-modal.container.js
  100. 2
      ui/app/components/app/modals/notification-modal.js
  101. Some files were not shown because too many files have changed in this diff Show More

@ -44,6 +44,7 @@ module.exports = {
},
rules: {
'arrow-parens': 'error',
'import/default': 'error',
'import/export': 'error',
'import/named': 'error',

@ -389,7 +389,7 @@ function setupController (initState, initLangCode) {
const url = new URL(remotePort.sender.url)
const origin = url.hostname
remotePort.onMessage.addListener(msg => {
remotePort.onMessage.addListener((msg) => {
if (msg.data && msg.data.method === 'eth_requestAccounts') {
requestAccountTabIds[origin] = tabId
}
@ -446,8 +446,8 @@ function setupController (initState, initLangCode) {
* Opens the browser popup for user confirmation
*/
function triggerUi () {
extension.tabs.query({ active: true }, tabs => {
const currentlyActiveMetamaskTab = Boolean(tabs.find(tab => openMetamaskTabsIDs[tab.id]))
extension.tabs.query({ active: true }, (tabs) => {
const currentlyActiveMetamaskTab = Boolean(tabs.find((tab) => openMetamaskTabsIDs[tab.id]))
if (!popupIsOpen && !currentlyActiveMetamaskTab && !notificationIsOpen) {
notificationManager.showPopup()
notificationIsOpen = true

@ -231,5 +231,5 @@ async function domIsReady () {
return
}
// wait for load
return new Promise(resolve => window.addEventListener('DOMContentLoaded', resolve, { once: true }))
return new Promise((resolve) => window.addEventListener('DOMContentLoaded', resolve, { once: true }))
}

@ -16,7 +16,7 @@ class AppStateController {
}, initState))
this.timer = null
preferencesStore.subscribe(state => {
preferencesStore.subscribe((state) => {
this._setInactiveTimeout(state.preferences.autoLockTimeLimit)
})

@ -50,7 +50,7 @@ class CachedBalancesController {
const { cachedBalances } = this.store.getState()
const currentNetworkBalancesToCache = { ...cachedBalances[currentNetwork] }
Object.keys(newAccounts).forEach(accountID => {
Object.keys(newAccounts).forEach((accountID) => {
const account = newAccounts[accountID]
if (account.balance) {

@ -165,7 +165,7 @@ class IncomingTransactionsController {
const newIncomingTransactions = {
...currentIncomingTxs,
}
newTxs.forEach(tx => {
newTxs.forEach((tx) => {
newIncomingTransactions[tx.hash] = tx
})
@ -222,7 +222,7 @@ class IncomingTransactionsController {
}
})
const incomingTxs = remoteTxs.filter(tx => tx.txParams.to && tx.txParams.to.toLowerCase() === address.toLowerCase())
const incomingTxs = remoteTxs.filter((tx) => tx.txParams.to && tx.txParams.to.toLowerCase() === address.toLowerCase())
incomingTxs.sort((a, b) => (a.time < b.time ? -1 : 1))
let latestIncomingTxBlockNumber = null

@ -25,7 +25,7 @@ function createLocalhostClient () {
}
function delay (time) {
return new Promise(resolve => setTimeout(resolve, time))
return new Promise((resolve) => setTimeout(resolve, time))
}

@ -27,7 +27,7 @@ const networkToNameMap = {
[GOERLI_CODE]: GOERLI_DISPLAY_NAME,
}
export const getNetworkDisplayName = key => networkToNameMap[key]
export const getNetworkDisplayName = (key) => networkToNameMap[key]
export function formatTxMetaForRpcResult (txMeta) {
return {

@ -197,7 +197,7 @@ export class PermissionsController {
let error
try {
await new Promise((resolve, reject) => {
this.permissions.grantNewPermissions(origin, permissions, {}, err => (err ? resolve() : reject(err)))
this.permissions.grantNewPermissions(origin, permissions, {}, (err) => (err ? resolve() : reject(err)))
})
} catch (err) {
error = err
@ -263,7 +263,7 @@ export class PermissionsController {
}
// caveat names are unique, and we will only construct this caveat here
ethAccounts.caveats = ethAccounts.caveats.filter(c => (
ethAccounts.caveats = ethAccounts.caveats.filter((c) => (
c.name !== CAVEAT_NAMES.exposedAccounts
))
@ -291,7 +291,7 @@ export class PermissionsController {
// assert accounts exist
const allAccounts = await this.getKeyringAccounts()
accounts.forEach(acc => {
accounts.forEach((acc) => {
if (!allAccounts.includes(acc)) {
throw new Error(`Unknown account: ${acc}`)
}
@ -331,7 +331,7 @@ export class PermissionsController {
this.permissions.removePermissionsFor(
origin,
perms.map(methodName => {
perms.map((methodName) => {
if (methodName === 'eth_accounts') {
this.notifyDomain(
@ -366,7 +366,7 @@ export class PermissionsController {
}
const newPermittedAccounts = [account].concat(
permittedAccounts.filter(_account => _account !== account)
permittedAccounts.filter((_account) => _account !== account)
)
// update permitted accounts to ensure that accounts are returned

@ -116,7 +116,7 @@ export default class PermissionsLogController {
}
// call next with a return handler for capturing the response
next(cb => {
next((cb) => {
const time = Date.now()
this.logActivityResponse(requestId, res, time)
@ -234,7 +234,7 @@ export default class PermissionsLogController {
// accounts were last seen or approved by the origin.
newEntries = result
? result
.map(perm => {
.map((perm) => {
if (perm.parentCapability === 'eth_accounts') {
accounts = this.getAccountsFromPermission(perm)

@ -408,7 +408,7 @@ class PreferencesController {
const { lastSelectedAddressByOrigin } = this.store.getState()
origins.forEach(origin => {
origins.forEach((origin) => {
delete lastSelectedAddressByOrigin[origin]
})
this.store.updateState({ lastSelectedAddressByOrigin })
@ -472,7 +472,7 @@ class PreferencesController {
removeToken (rawAddress) {
const tokens = this.store.getState().tokens
const assetImages = this.getAssetImages()
const updatedTokens = tokens.filter(token => token.address !== rawAddress)
const updatedTokens = tokens.filter((token) => token.address !== rawAddress)
delete assetImages[rawAddress]
this._updateAccountTokens(updatedTokens, assetImages)
return Promise.resolve(updatedTokens)
@ -758,7 +758,7 @@ class PreferencesController {
const tokenOpts = { rawAddress, decimals, symbol, image }
this.addSuggestedERC20Asset(tokenOpts)
return this.openPopup().then(() => {
const tokenAddresses = this.getTokens().filter(token => token.address === normalizeAddress(rawAddress))
const tokenAddresses = this.getTokens().filter((token) => token.address === normalizeAddress(rawAddress))
return tokenAddresses.length > 0
})
}

@ -33,13 +33,13 @@ class TokenRatesController {
}
const contractExchangeRates = {}
const nativeCurrency = this.currency ? this.currency.state.nativeCurrency.toLowerCase() : 'eth'
const pairs = this._tokens.map(token => token.address).join(',')
const pairs = this._tokens.map((token) => token.address).join(',')
const query = `contract_addresses=${pairs}&vs_currencies=${nativeCurrency}`
if (this._tokens.length > 0) {
try {
const response = await fetch(`https://api.coingecko.com/api/v3/simple/token_price/ethereum?${query}`)
const prices = await response.json()
this._tokens.forEach(token => {
this._tokens.forEach((token) => {
const price = prices[token.address.toLowerCase()] || prices[ethUtil.toChecksumAddress(token.address)]
contractExchangeRates[normalizeAddress(token.address)] = price ? price[nativeCurrency] : 0
})

@ -657,7 +657,7 @@ class TransactionController extends EventEmitter {
TOKEN_METHOD_APPROVE,
TOKEN_METHOD_TRANSFER,
TOKEN_METHOD_TRANSFER_FROM,
].find(tokenMethodName => tokenMethodName === name && name.toLowerCase())
].find((tokenMethodName) => tokenMethodName === name && name.toLowerCase())
let result
if (txParams.data && tokenMethodName) {

@ -5,11 +5,11 @@ import { addHexPrefix, isValidAddress } from 'ethereumjs-util'
const normalizers = {
from: (from, LowerCase = true) => (LowerCase ? addHexPrefix(from).toLowerCase() : addHexPrefix(from)),
to: (to, LowerCase = true) => (LowerCase ? addHexPrefix(to).toLowerCase() : addHexPrefix(to)),
nonce: nonce => addHexPrefix(nonce),
value: value => addHexPrefix(value),
data: data => addHexPrefix(data),
gas: gas => addHexPrefix(gas),
gasPrice: gasPrice => addHexPrefix(gasPrice),
nonce: (nonce) => addHexPrefix(nonce),
value: (value) => addHexPrefix(value),
data: (data) => addHexPrefix(data),
gas: (gas) => addHexPrefix(gas),
gasPrice: (gasPrice) => addHexPrefix(gasPrice),
}
/**

@ -207,7 +207,7 @@ class TransactionStateManager extends EventEmitter {
// commit txMeta to state
const txId = txMeta.id
const txList = this.getFullTxList()
const index = txList.findIndex(txData => txData.id === txId)
const index = txList.findIndex((txData) => txData.id === txId)
txList[index] = txMeta
this._saveTxList(txList)
}

@ -57,7 +57,7 @@ class AccountTracker {
this._blockTracker = opts.blockTracker
// blockTracker.currentBlock may be null
this._currentBlockNumber = this._blockTracker.getCurrentBlock()
this._blockTracker.once('latest', blockNumber => {
this._blockTracker.once('latest', (blockNumber) => {
this._currentBlockNumber = blockNumber
})
// bind function for easier listener syntax
@ -124,7 +124,7 @@ class AccountTracker {
addAccounts (addresses) {
const accounts = this.store.getState().accounts
// add initial state for addresses
addresses.forEach(address => {
addresses.forEach((address) => {
accounts[address] = {}
})
// save accounts state
@ -145,7 +145,7 @@ class AccountTracker {
removeAccount (addresses) {
const accounts = this.store.getState().accounts
// remove each state object
addresses.forEach(address => {
addresses.forEach((address) => {
delete accounts[address]
})
// save accounts state

@ -11,7 +11,7 @@ function createDnodeRemoteGetter (dnode) {
if (remote) {
return remote
}
return await new Promise(resolve => dnode.once('remote', resolve))
return await new Promise((resolve) => dnode.once('remote', resolve))
}
return getRemote

@ -9,7 +9,7 @@ export default setupEnsIpfsResolver
function setupEnsIpfsResolver ({ provider, getCurrentNetwork, getIpfsGateway }) {
// install listener
const urlPatterns = supportedTopLevelDomains.map(tld => `*://*.${tld}/*`)
const urlPatterns = supportedTopLevelDomains.map((tld) => `*://*.${tld}/*`)
extension.webRequest.onErrorOccurred.addListener(webRequestDidFail, { urls: urlPatterns, types: ['main_frame'] })
// return api object

@ -9,7 +9,7 @@ const getPreferredLocales = extension.i18n ? promisify(
// mapping some browsers return hyphen instead underscore in locale codes (e.g. zh_TW -> zh-tw)
const existingLocaleCodes = {}
allLocales.forEach(locale => {
allLocales.forEach((locale) => {
if (locale && locale.code) {
existingLocaleCodes[locale.code.toLowerCase().replace('_', '-')] = locale.code
}
@ -39,8 +39,8 @@ async function getFirstPreferredLangCode () {
}
const firstPreferredLangCode = userPreferredLocaleCodes
.map(code => code.toLowerCase().replace('_', '-'))
.find(code => existingLocaleCodes.hasOwnProperty(code))
.map((code) => code.toLowerCase().replace('_', '-'))
.find((code) => existingLocaleCodes.hasOwnProperty(code))
return existingLocaleCodes[firstPreferredLangCode] || 'en'
}

@ -61,7 +61,7 @@ export default class MessageManager extends EventEmitter {
*
*/
getUnapprovedMsgs () {
return this.messages.filter(msg => msg.status === 'unapproved')
return this.messages.filter((msg) => msg.status === 'unapproved')
.reduce((result, msg) => {
result[msg.id] = msg; return result
}, {})
@ -145,7 +145,7 @@ export default class MessageManager extends EventEmitter {
*
*/
getMsg (msgId) {
return this.messages.find(msg => msg.id === msgId)
return this.messages.find((msg) => msg.id === msgId)
}
/**

@ -65,7 +65,7 @@ export default class PersonalMessageManager extends EventEmitter {
*
*/
getUnapprovedMsgs () {
return this.messages.filter(msg => msg.status === 'unapproved')
return this.messages.filter((msg) => msg.status === 'unapproved')
.reduce((result, msg) => {
result[msg.id] = msg; return result
}, {})
@ -155,7 +155,7 @@ export default class PersonalMessageManager extends EventEmitter {
*
*/
getMsg (msgId) {
return this.messages.find(msg => msg.id === msgId)
return this.messages.find((msg) => msg.id === msgId)
}
/**

@ -37,7 +37,7 @@ function setupSentry (opts) {
beforeSend: (report) => rewriteReport(report),
})
Sentry.configureScope(scope => {
Sentry.configureScope((scope) => {
scope.setExtra('isBrave', isBrave)
})
@ -81,7 +81,7 @@ function rewriteErrorMessages (report, rewriteFn) {
}
// rewrite each exception message
if (report.exception && report.exception.values) {
report.exception.values.forEach(item => {
report.exception.values.forEach((item) => {
if (typeof item.value === 'string') {
item.value = rewriteFn(item.value)
}
@ -94,8 +94,8 @@ function rewriteReportUrls (report) {
report.request.url = toMetamaskUrl(report.request.url)
// update exception stack trace
if (report.exception && report.exception.values) {
report.exception.values.forEach(item => {
item.stacktrace.frames.forEach(frame => {
report.exception.values.forEach((item) => {
item.stacktrace.frames.forEach((frame) => {
frame.filename = toMetamaskUrl(frame.filename)
})
})

@ -57,7 +57,7 @@ export default class TypedMessageManager extends EventEmitter {
*
*/
getUnapprovedMsgs () {
return this.messages.filter(msg => msg.status === 'unapproved')
return this.messages.filter((msg) => msg.status === 'unapproved')
.reduce((result, msg) => {
result[msg.id] = msg; return result
}, {})
@ -189,7 +189,7 @@ export default class TypedMessageManager extends EventEmitter {
*
*/
getMsg (msgId) {
return this.messages.find(msg => msg.id === msgId)
return this.messages.find((msg) => msg.id === msgId)
}
/**

@ -44,7 +44,7 @@ const getEnvironmentType = (url = window.location.href) => {
* @returns {string} - the platform ENUM
*
*/
const getPlatform = _ => {
const getPlatform = (_) => {
const ua = navigator.userAgent
if (ua.search('Firefox') !== -1) {
return PLATFORM_FIREFOX
@ -135,7 +135,7 @@ function getRandomArrayItem (array) {
function mapObjectValues (object, cb) {
const mappedObject = {}
Object.keys(object).forEach(key => {
Object.keys(object).forEach((key) => {
mappedObject[key] = cb(key, object[key])
})
return mappedObject

@ -697,11 +697,11 @@ export default class MetamaskController extends EventEmitter {
// Filter ERC20 tokens
const filteredAccountTokens = {}
Object.keys(accountTokens).forEach(address => {
Object.keys(accountTokens).forEach((address) => {
const checksummedAddress = ethUtil.toChecksumAddress(address)
filteredAccountTokens[checksummedAddress] = {}
Object.keys(accountTokens[address]).forEach(
networkType => (filteredAccountTokens[checksummedAddress][networkType] = networkType !== 'mainnet' ?
(networkType) => (filteredAccountTokens[checksummedAddress][networkType] = networkType !== 'mainnet' ?
accountTokens[address][networkType] :
accountTokens[address][networkType].filter(({ address }) => {
const tokenAddress = ethUtil.toChecksumAddress(address)
@ -724,7 +724,7 @@ export default class MetamaskController extends EventEmitter {
const hdKeyring = this.keyringController.getKeyringsByType('HD Key Tree')[0]
const hdAccounts = await hdKeyring.getAccounts()
const accounts = {
hd: hdAccounts.filter((item, pos) => (hdAccounts.indexOf(item) === pos)).map(address => ethUtil.toChecksumAddress(address)),
hd: hdAccounts.filter((item, pos) => (hdAccounts.indexOf(item) === pos)).map((address) => ethUtil.toChecksumAddress(address)),
simpleKeyPair: [],
ledger: [],
trezor: [],
@ -734,7 +734,7 @@ export default class MetamaskController extends EventEmitter {
let transactions = this.txController.store.getState().transactions
// delete tx for other accounts that we're not importing
transactions = transactions.filter(tx => {
transactions = transactions.filter((tx) => {
const checksummedTxFrom = ethUtil.toChecksumAddress(tx.txParams.from)
return (
accounts.hd.includes(checksummedTxFrom)
@ -762,7 +762,7 @@ export default class MetamaskController extends EventEmitter {
const accounts = await this.keyringController.getAccounts()
// verify keyrings
const nonSimpleKeyrings = this.keyringController.keyrings.filter(keyring => keyring.type !== 'Simple Key Pair')
const nonSimpleKeyrings = this.keyringController.keyrings.filter((keyring) => keyring.type !== 'Simple Key Pair')
if (nonSimpleKeyrings.length > 1 && this.diagnostics) {
await this.diagnostics.reportMultipleKeyrings(nonSimpleKeyrings)
}
@ -855,7 +855,7 @@ export default class MetamaskController extends EventEmitter {
// Merge with existing accounts
// and make sure addresses are not repeated
const oldAccounts = await this.keyringController.getAccounts()
const accountsToTrack = [...new Set(oldAccounts.concat(accounts.map(a => a.address.toLowerCase())))]
const accountsToTrack = [...new Set(oldAccounts.concat(accounts.map((a) => a.address.toLowerCase())))]
this.accountTracker.syncWithAddresses(accountsToTrack)
return accounts
}
@ -895,7 +895,7 @@ export default class MetamaskController extends EventEmitter {
const keyState = await this.keyringController.addNewAccount(keyring)
const newAccounts = await this.keyringController.getAccounts()
this.preferencesController.setAddresses(newAccounts)
newAccounts.forEach(address => {
newAccounts.forEach((address) => {
if (!oldAccounts.includes(address)) {
// Set the account label to Trezor 1 / Ledger 1, etc
this.preferencesController.setAccountLabel(address, `${deviceName[0].toUpperCase()}${deviceName.slice(1)} ${parseInt(index, 10) + 1}`)
@ -1580,7 +1580,7 @@ export default class MetamaskController extends EventEmitter {
return
}
Object.values(connections).forEach(conn => {
Object.values(connections).forEach((conn) => {
conn.engine && conn.engine.emit('notification', payload)
})
}
@ -1599,8 +1599,8 @@ export default class MetamaskController extends EventEmitter {
return
}
Object.values(this.connections).forEach(origin => {
Object.values(origin).forEach(conn => {
Object.values(this.connections).forEach((origin) => {
Object.values(origin).forEach((conn) => {
conn.engine && conn.engine.emit('notification', payload)
})
})
@ -1671,13 +1671,13 @@ export default class MetamaskController extends EventEmitter {
return GWEI_BN
}
return block.gasPrices
.map(hexPrefix => hexPrefix.substr(2))
.map(hex => new BN(hex, 16))
.map((hexPrefix) => hexPrefix.substr(2))
.map((hex) => new BN(hex, 16))
.sort((a, b) => {
return a.gt(b) ? 1 : -1
})[0]
})
.map(number => number.div(GWEI_BN).toNumber())
.map((number) => number.div(GWEI_BN).toNumber())
const percentileNum = percentile(65, lowestPrices)
const percentileNumBn = new BN(percentileNum)

@ -45,13 +45,13 @@ function transformState (state) {
function normalizeTxParams (txParams) {
// functions that handle normalizing of that key in txParams
const whiteList = {
from: from => ethUtil.addHexPrefix(from).toLowerCase(),
from: (from) => ethUtil.addHexPrefix(from).toLowerCase(),
to: () => ethUtil.addHexPrefix(txParams.to).toLowerCase(),
nonce: nonce => ethUtil.addHexPrefix(nonce),
value: value => ethUtil.addHexPrefix(value),
data: data => ethUtil.addHexPrefix(data),
gas: gas => ethUtil.addHexPrefix(gas),
gasPrice: gasPrice => ethUtil.addHexPrefix(gasPrice),
nonce: (nonce) => ethUtil.addHexPrefix(nonce),
value: (value) => ethUtil.addHexPrefix(value),
data: (data) => ethUtil.addHexPrefix(data),
gas: (gas) => ethUtil.addHexPrefix(gas),
gasPrice: (gasPrice) => ethUtil.addHexPrefix(gasPrice),
}
// apply only keys in the whiteList

@ -67,7 +67,7 @@ class ExtensionPlatform {
currentTab () {
return new Promise((resolve, reject) => {
extension.tabs.getCurrent(tab => {
extension.tabs.getCurrent((tab) => {
const err = checkForError()
if (err) {
reject(err)

@ -33,14 +33,14 @@ async function start () {
// links to extension builds
const platforms = ['chrome', 'firefox', 'opera']
const buildLinks = platforms.map(platform => {
const buildLinks = platforms.map((platform) => {
const url = `${BUILD_LINK_BASE}/builds/metamask-${platform}-${VERSION}.zip`
return `<a href="${url}">${platform}</a>`
}).join(', ')
// links to bundle browser builds
const bundles = ['background', 'ui', 'inpage', 'contentscript', 'ui-libs', 'bg-libs', 'phishing-detect']
const bundleLinks = bundles.map(bundle => {
const bundleLinks = bundles.map((bundle) => {
const url = `${BUILD_LINK_BASE}/build-artifacts/source-map-explorer/${bundle}.html`
return `<a href="${url}">${bundle}</a>`
}).join(', ')
@ -58,7 +58,7 @@ async function start () {
`dep viz: ${depVizLink}`,
`<a href="${allArtifactsUrl}">all artifacts</a>`,
]
const hiddenContent = `<ul>` + contentRows.map(row => `<li>${row}</li>`).join('\n') + `</ul>`
const hiddenContent = `<ul>` + contentRows.map((row) => `<li>${row}</li>`).join('\n') + `</ul>`
const exposedContent = `Builds ready [${SHORT_SHA1}]`
const artifactsBody = `<details><summary>${exposedContent}</summary>${hiddenContent}</details>`
@ -136,7 +136,7 @@ async function start () {
for (const measure of allMeasures) {
benchmarkTableHeaders.push(`${capitalizeFirstLetter(measure)} (ms)`)
}
const benchmarkTableHeader = `<thead><tr>${benchmarkTableHeaders.map(header => `<th>${header}</th>`).join('')}</tr></thead>`
const benchmarkTableHeader = `<thead><tr>${benchmarkTableHeaders.map((header) => `<th>${header}</th>`).join('')}</tr></thead>`
const benchmarkTableBody = `<tbody>${tableRows.join('')}</tbody>`
const benchmarkTable = `<table>${benchmarkTableHeader}${benchmarkTableBody}</table>`
const benchmarkBody = `<details><summary>${benchmarkSummary}</summary>${benchmarkTable}</details>`

@ -1,5 +1,5 @@
function delay (time) {
return new Promise(resolve => setTimeout(resolve, time))
return new Promise((resolve) => setTimeout(resolve, time))
}
async function loadFromMock3Box (key) {
@ -24,7 +24,7 @@ class Mock3Box {
static openBox (address) {
this.address = address
return Promise.resolve({
onSyncDone: cb => {
onSyncDone: (cb) => {
setTimeout(cb, 200)
},
openSpace: async (spaceName, config) => {

@ -14,7 +14,7 @@ readInstalled('./', { dev: true }, function (err, data) {
const packageScripts = packageData.scripts || {}
const scriptKeys = Reflect.ownKeys(packageScripts)
const hasInstallScript = installScripts.some(installKey => scriptKeys.includes(installKey))
const hasInstallScript = installScripts.some((installKey) => scriptKeys.includes(installKey))
if (!hasInstallScript) {
return
}

@ -63,7 +63,7 @@ async function validateSourcemapForFile ({ buildName }) {
const buildLines = rawBuild.split('\n')
const targetString = 'new Error'
// const targetString = 'null'
const matchesPerLine = buildLines.map(line => indicesOf(targetString, line))
const matchesPerLine = buildLines.map((line) => indicesOf(targetString, line))
matchesPerLine.forEach((matchIndices, lineIndex) => {
matchIndices.forEach((matchColumn) => {
sampleCount++

@ -47,7 +47,7 @@ for (const arg of process.argv.slice(2)) {
}
main(specifiedLocale, fix)
.catch(error => {
.catch((error) => {
log.error(error)
process.exit(1)
})
@ -55,7 +55,7 @@ main(specifiedLocale, fix)
async function main (specifiedLocale, fix) {
if (specifiedLocale) {
log.info(`Verifying selected locale "${specifiedLocale}":\n`)
const locale = localeIndex.find(localeMeta => localeMeta.code === specifiedLocale)
const locale = localeIndex.find((localeMeta) => localeMeta.code === specifiedLocale)
const failed = locale.code === 'en' ?
await verifyEnglishLocale(fix) :
await verifyLocale(locale, fix)
@ -66,8 +66,8 @@ async function main (specifiedLocale, fix) {
log.info('Verifying all locales:\n')
let failed = await verifyEnglishLocale(fix)
const localeCodes = localeIndex
.filter(localeMeta => localeMeta.code !== 'en')
.map(localeMeta => localeMeta.code)
.filter((localeMeta) => localeMeta.code !== 'en')
.map((localeMeta) => localeMeta.code)
for (const code of localeCodes) {
log.info() // Separate each locale report by a newline when not in '--quiet' mode
@ -179,7 +179,7 @@ async function verifyEnglishLocale (fix = false) {
const templateMatches = fileContents.match(templateStringRegex)
if (templateMatches) {
// concat doesn't work here for some reason
templateMatches.forEach(match => templateUsage.push(match))
templateMatches.forEach((match) => templateUsage.push(match))
}
}
@ -188,7 +188,7 @@ async function verifyEnglishLocale (fix = false) {
const englishMessages = Object.keys(englishLocale)
const unusedMessages = englishMessages
.filter(message => !messageExceptions.includes(message) && !usedMessages.has(message))
.filter((message) => !messageExceptions.includes(message) && !usedMessages.has(message))
if (unusedMessages.length) {
console.log(`**en**: ${unusedMessages.length} unused messages`)

@ -33,7 +33,7 @@ sass.compiler = require('node-sass')
const dependencies = Object.keys(packageJSON && packageJSON.dependencies || {})
const materialUIDependencies = ['@material-ui/core']
const reactDepenendencies = dependencies.filter(dep => dep.match(/react/))
const reactDepenendencies = dependencies.filter((dep) => dep.match(/react/))
const d3Dependencies = ['c3', 'd3']
const externalDependenciesMap = {
@ -77,38 +77,38 @@ const copyDevTaskNames = []
createCopyTasks('locales', {
source: './app/_locales/',
destinations: commonPlatforms.map(platform => `./dist/${platform}/_locales`),
destinations: commonPlatforms.map((platform) => `./dist/${platform}/_locales`),
})
createCopyTasks('images', {
source: './app/images/',
destinations: commonPlatforms.map(platform => `./dist/${platform}/images`),
destinations: commonPlatforms.map((platform) => `./dist/${platform}/images`),
})
createCopyTasks('contractImages', {
source: './node_modules/eth-contract-metadata/images/',
destinations: commonPlatforms.map(platform => `./dist/${platform}/images/contract`),
destinations: commonPlatforms.map((platform) => `./dist/${platform}/images/contract`),
})
createCopyTasks('fonts', {
source: './app/fonts/',
destinations: commonPlatforms.map(platform => `./dist/${platform}/fonts`),
destinations: commonPlatforms.map((platform) => `./dist/${platform}/fonts`),
})
createCopyTasks('vendor', {
source: './app/vendor/',
destinations: commonPlatforms.map(platform => `./dist/${platform}/vendor`),
destinations: commonPlatforms.map((platform) => `./dist/${platform}/vendor`),
})
createCopyTasks('css', {
source: './ui/app/css/output/',
destinations: commonPlatforms.map(platform => `./dist/${platform}`),
destinations: commonPlatforms.map((platform) => `./dist/${platform}`),
})
createCopyTasks('reload', {
devOnly: true,
source: './app/scripts/',
pattern: '/chromereload.js',
destinations: commonPlatforms.map(platform => `./dist/${platform}`),
destinations: commonPlatforms.map((platform) => `./dist/${platform}`),
})
createCopyTasks('html', {
source: './app/',
pattern: '/*.html',
destinations: commonPlatforms.map(platform => `./dist/${platform}`),
destinations: commonPlatforms.map((platform) => `./dist/${platform}`),
})
// copy extension
@ -116,7 +116,7 @@ createCopyTasks('html', {
createCopyTasks('manifest', {
source: './app/',
pattern: '/*.json',
destinations: browserPlatforms.map(platform => `./dist/${platform}`),
destinations: browserPlatforms.map((platform) => `./dist/${platform}`),
})
function createCopyTasks (label, opts) {
@ -235,7 +235,7 @@ gulp.task('manifest:testing-local', function () {
.pipe(jsoneditor(function (json) {
json.background = {
...json.background,
scripts: json.background.scripts.filter(scriptName => !scriptsToExcludeFromBackgroundDevBuild[scriptName]),
scripts: json.background.scripts.filter((scriptName) => !scriptsToExcludeFromBackgroundDevBuild[scriptName]),
}
json.permissions = [...json.permissions, 'webRequestBlocking', 'http://localhost/*']
return json
@ -254,7 +254,7 @@ gulp.task('manifest:dev', function () {
.pipe(jsoneditor(function (json) {
json.background = {
...json.background,
scripts: json.background.scripts.filter(scriptName => !scriptsToExcludeFromBackgroundDevBuild[scriptName]),
scripts: json.background.scripts.filter((scriptName) => !scriptsToExcludeFromBackgroundDevBuild[scriptName]),
}
json.permissions = [...json.permissions, 'webRequestBlocking']
return json
@ -378,7 +378,7 @@ createTasksForBuildJsExtension({ buildJsFiles, taskPrefix: 'build:extension:js'
createTasksForBuildJsExtension({ buildJsFiles, taskPrefix: 'build:test:extension:js', testing: 'true' })
function createTasksForBuildJsDeps ({ key, filename }) {
const destinations = browserPlatforms.map(platform => `./dist/${platform}`)
const destinations = browserPlatforms.map((platform) => `./dist/${platform}`)
const bundleTaskOpts = Object.assign({
buildSourceMaps: true,
@ -400,10 +400,10 @@ function createTasksForBuildJsDeps ({ key, filename }) {
function createTasksForBuildJsExtension ({ buildJsFiles, taskPrefix, devMode, testing, bundleTaskOpts = {} }) {
// inpage must be built before all other scripts:
const rootDir = './app/scripts'
const nonInpageFiles = buildJsFiles.filter(file => file !== 'inpage')
const nonInpageFiles = buildJsFiles.filter((file) => file !== 'inpage')
const buildPhase1 = ['inpage']
const buildPhase2 = nonInpageFiles
const destinations = browserPlatforms.map(platform => `./dist/${platform}`)
const destinations = browserPlatforms.map((platform) => `./dist/${platform}`)
bundleTaskOpts = Object.assign({
buildSourceMaps: true,
sourceMapDir: '../sourcemaps',
@ -430,9 +430,9 @@ function createTasksForBuildJs ({ rootDir, taskPrefix, bundleTaskOpts, destinati
})
// compose into larger task
const subtasks = []
subtasks.push(gulp.parallel(buildPhase1.map(file => `${taskPrefix}:${file}`)))
subtasks.push(gulp.parallel(buildPhase1.map((file) => `${taskPrefix}:${file}`)))
if (buildPhase2.length) {
subtasks.push(gulp.parallel(buildPhase2.map(file => `${taskPrefix}:${file}`)))
subtasks.push(gulp.parallel(buildPhase2.map((file) => `${taskPrefix}:${file}`)))
}
gulp.task(taskPrefix, gulp.series(subtasks))

@ -37,7 +37,7 @@ describe('MetaMask', function () {
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors()
if (errors.length) {
const errorReports = errors.map(err => err.message)
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
console.error(new Error(errorMessage))
}

@ -37,10 +37,10 @@ const calculateSum = (array) => array.reduce((sum, val) => sum + val)
const calculateAverage = (array) => calculateSum(array) / array.length
const minResult = calculateResult((array) => Math.min(...array))
const maxResult = calculateResult((array) => Math.max(...array))
const averageResult = calculateResult(array => calculateAverage(array))
const averageResult = calculateResult((array) => calculateAverage(array))
const standardDeviationResult = calculateResult((array) => {
const average = calculateAverage(array)
const squareDiffs = array.map(value => Math.pow(value - average, 2))
const squareDiffs = array.map((value) => Math.pow(value - average, 2))
return Math.sqrt(calculateAverage(squareDiffs))
})
// 95% margin of error calculated using Student's t-distrbution
@ -55,17 +55,17 @@ async function profilePageLoad (pages, numSamples) {
runResults.push(await measurePage(pageName))
}
if (runResults.some(result => result.navigation.lenth > 1)) {
if (runResults.some((result) => result.navigation.lenth > 1)) {
throw new Error(`Multiple navigations not supported`)
} else if (runResults.some(result => result.navigation[0].type !== 'navigate')) {
throw new Error(`Navigation type ${runResults.find(result => result.navigation[0].type !== 'navigate').navigation[0].type} not supported`)
} else if (runResults.some((result) => result.navigation[0].type !== 'navigate')) {
throw new Error(`Navigation type ${runResults.find((result) => result.navigation[0].type !== 'navigate').navigation[0].type} not supported`)
}
const result = {
firstPaint: runResults.map(result => result.paint['first-paint']),
domContentLoaded: runResults.map(result => result.navigation[0] && result.navigation[0].domContentLoaded),
load: runResults.map(result => result.navigation[0] && result.navigation[0].load),
domInteractive: runResults.map(result => result.navigation[0] && result.navigation[0].domInteractive),
firstPaint: runResults.map((result) => result.paint['first-paint']),
domContentLoaded: runResults.map((result) => result.navigation[0] && result.navigation[0].domContentLoaded),
load: runResults.map((result) => result.navigation[0] && result.navigation[0].load),
domInteractive: runResults.map((result) => result.navigation[0] && result.navigation[0].domInteractive),
}
results[pageName] = {
@ -166,7 +166,7 @@ async function main () {
}
main()
.catch(e => {
.catch((e) => {
console.error(e)
process.exit(1)
})

@ -36,7 +36,7 @@ describe('MetaMask', function () {
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors(driver)
if (errors.length) {
const errorReports = errors.map(err => err.message)
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
console.error(new Error(errorMessage))
}
@ -119,7 +119,7 @@ describe('MetaMask', function () {
extension = windowHandles[0]
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
popup = windowHandles.find(handle => handle !== extension && handle !== dapp)
popup = windowHandles.find((handle) => handle !== extension && handle !== dapp)
await driver.switchToWindow(popup)

@ -41,7 +41,7 @@ describe('Using MetaMask with an existing account', function () {
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors(driver)
if (errors.length) {
const errorReports = errors.map(err => err.message)
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
console.error(new Error(errorMessage))
}

@ -41,7 +41,7 @@ describe('MetaMask', function () {
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors(driver)
if (errors.length) {
const errorReports = errors.map(err => err.message)
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
console.error(new Error(errorMessage))
}

@ -31,7 +31,7 @@ describe('MetaMask', function () {
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors(driver)
if (errors.length) {
const errorReports = errors.map(err => err.message)
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
console.error(new Error(errorMessage))
}

@ -32,7 +32,7 @@ describe('MetaMask', function () {
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors(driver)
if (errors.length) {
const errorReports = errors.map(err => err.message)
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
console.error(new Error(errorMessage))
}
@ -407,7 +407,7 @@ describe('MetaMask', function () {
extension = windowHandles[0]
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
popup = windowHandles.find(handle => handle !== extension && handle !== dapp)
popup = windowHandles.find((handle) => handle !== extension && handle !== dapp)
await driver.switchToWindow(popup)
@ -1273,7 +1273,7 @@ describe('MetaMask', function () {
'http://127.0.0.1:8545/4',
]
customRpcUrls.forEach(customRpcUrl => {
customRpcUrls.forEach((customRpcUrl) => {
it(`creates custom RPC: ${customRpcUrl}`, async function () {
await driver.clickElement(By.css('.network-name'))
await driver.delay(regularDelayMs)

@ -9,7 +9,7 @@ const requestHandler = (request, response) => {
response.setHeader('Content-Type', 'application/json')
if (request.method === 'POST') {
let body = ''
request.on('data', chunk => {
request.on('data', (chunk) => {
body += chunk.toString() // convert Buffer to string
})
request.on('end', () => {

@ -36,7 +36,7 @@ describe('MetaMask', function () {
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors(driver)
if (errors.length) {
const errorReports = errors.map(err => err.message)
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
console.error(new Error(errorMessage))
}
@ -117,7 +117,7 @@ describe('MetaMask', function () {
extension = windowHandles[0]
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
popup = windowHandles.find(handle => handle !== extension && handle !== dapp)
popup = windowHandles.find((handle) => handle !== extension && handle !== dapp)
await driver.switchToWindow(popup)

@ -38,7 +38,7 @@ describe('Using MetaMask with an existing account', function () {
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors(driver)
if (errors.length) {
const errorReports = errors.map(err => err.message)
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
console.error(new Error(errorMessage))
}

@ -35,7 +35,7 @@ describe('MetaMask', function () {
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors(driver)
if (errors.length) {
const errorReports = errors.map(err => err.message)
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
console.error(new Error(errorMessage))
}
@ -78,7 +78,7 @@ describe('MetaMask', function () {
extension = windowHandles[0]
dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles)
popup = windowHandles.find(handle => handle !== extension && handle !== dapp)
popup = windowHandles.find((handle) => handle !== extension && handle !== dapp)
await driver.switchToWindow(popup)

@ -39,7 +39,7 @@ describe('MetaMask', function () {
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors(driver)
if (errors.length) {
const errorReports = errors.map(err => err.message)
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
console.error(new Error(errorMessage))
}

@ -38,7 +38,7 @@ describe('Using MetaMask with an existing account', function () {
if (process.env.SELENIUM_BROWSER === 'chrome') {
const errors = await driver.checkBrowserForConsoleErrors(driver)
if (errors.length) {
const errorReports = errors.map(err => err.message)
const errorReports = errors.map((err) => err.message)
const errorMessage = `Errors found in browser console:\n${errorReports.join('\n')}`
console.error(new Error(errorMessage))
}
@ -116,7 +116,7 @@ describe('Using MetaMask with an existing account', function () {
const extension = windowHandles[0]
const popup = await driver.switchToWindowWithTitle('MetaMask Notification', windowHandles)
const dapp = windowHandles.find(handle => handle !== extension && handle !== popup)
const dapp = windowHandles.find((handle) => handle !== extension && handle !== popup)
await driver.delay(regularDelayMs)
await driver.clickElement(By.xpath(`//button[contains(text(), 'Connect')]`))

@ -16,7 +16,7 @@ class Driver {
}
async delay (time) {
await new Promise(resolve => setTimeout(resolve, time))
await new Promise((resolve) => setTimeout(resolve, time))
}
async wait (condition, timeout = this.timeout) {
@ -180,9 +180,9 @@ class Driver {
'favicon.ico - Failed to load resource: the server responded with a status of 404 (Not Found)',
]
const browserLogs = await this.driver.manage().logs().get('browser')
const errorEntries = browserLogs.filter(entry => !ignoredLogTypes.includes(entry.level.toString()))
const errorObjects = errorEntries.map(entry => entry.toJSON())
return errorObjects.filter(entry => !ignoredErrorMessages.some(message => entry.message.includes(message)))
const errorEntries = browserLogs.filter((entry) => !ignoredLogTypes.includes(entry.level.toString()))
const errorObjects = errorEntries.map((entry) => entry.toJSON())
return errorObjects.filter((entry) => !ignoredErrorMessages.some((message) => entry.message.includes(message)))
}
}

@ -26,8 +26,8 @@ export function mountWithRouter (component, store = {}, pathname = '/') {
const createContext = () => ({
context: {
router,
t: str => str,
tOrKey: str => str,
t: (str) => str,
tOrKey: (str) => str,
metricsEvent: () => {},
store,
},

@ -1,5 +1,5 @@
require('@babel/register')({
ignore: [name => name.includes('node_modules') && !name.includes('obs-store')],
ignore: [(name) => name.includes('node_modules') && !name.includes('obs-store')],
})
require('./helper')

@ -903,7 +903,7 @@ describe('MetaMaskController', function () {
function deferredPromise () {
let resolve
const promise = new Promise(_resolve => {
const promise = new Promise((_resolve) => {
resolve = _resolve
})
return { promise, resolve }

@ -226,7 +226,7 @@ describe('PendingTransactionTracker', function () {
it('should emit \'tx:warning\' if it encountered a real error', function (done) {
pendingTxTracker.once('tx:warning', (txMeta, err) => {
if (err.message === 'im some real error') {
const matchingTx = txList.find(tx => tx.id === txMeta.id)
const matchingTx = txList.find((tx) => tx.id === txMeta.id)
matchingTx.resolve()
} else {
done(err)

@ -683,7 +683,7 @@ describe('Transaction Controller', function () {
])
assert(txController.pendingTxTracker.getPendingTransactions().length, 2)
const states = txController.pendingTxTracker.getPendingTransactions().map(tx => tx.status)
const states = txController.pendingTxTracker.getPendingTransactions().map((tx) => tx.status)
assert(states.includes('approved'), 'includes approved')
assert(states.includes('submitted'), 'includes submitted')
})

@ -27,7 +27,7 @@ describe('fetchWithTimeout', function () {
})
try {
await fetch('https://api.infura.io/moon').then(r => r.json())
await fetch('https://api.infura.io/moon').then((r) => r.json())
assert.fail('Request should throw')
} catch (e) {
assert.ok(e)
@ -45,7 +45,7 @@ describe('fetchWithTimeout', function () {
})
try {
await fetch('https://api.infura.io/moon').then(r => r.json())
await fetch('https://api.infura.io/moon').then((r) => r.json())
assert.fail('Request should be aborted')
} catch (e) {
assert.deepEqual(e.message, 'Aborted')

@ -24,7 +24,7 @@ describe('migration #31', function () {
}
migration31.migrate(oldStorage)
.then(newStorage => {
.then((newStorage) => {
assert.equal(newStorage.data.PreferencesController.completedOnboarding, true)
done()
})
@ -47,7 +47,7 @@ describe('migration #31', function () {
}
migration31.migrate(oldStorage)
.then(newStorage => {
.then((newStorage) => {
assert.equal(newStorage.data.PreferencesController.completedOnboarding, false)
done()
})

@ -33,7 +33,7 @@ describe('Migration to delete notice controller', function () {
it('removes notice controller from state', function () {
migration33.migrate(oldStorage)
.then(newStorage => {
.then((newStorage) => {
assert.equal(newStorage.data.NoticeController, undefined)
})
})

@ -44,7 +44,7 @@ const firstTimeState = {
describe('migrations', function () {
describe('liveMigrations require list', function () {
it('should include all the migrations', async function () {
const fileNames = await pify(cb => fs.readdir('./app/scripts/migrations/', cb))()
const fileNames = await pify((cb) => fs.readdir('./app/scripts/migrations/', cb))()
const migrationNumbers = fileNames.reduce((agg, filename) => {
const name = filename.split('.')[0]
if (/^\d+$/.test(name)) {

@ -119,7 +119,7 @@ describe('Actions', function () {
const unlockFailedError = [ { type: 'UNLOCK_FAILED', value: 'error' } ]
verifySeedPhraseSpy = sinon.stub(background, 'verifySeedPhrase')
verifySeedPhraseSpy.callsFake(callback => {
verifySeedPhraseSpy.callsFake((callback) => {
callback(new Error('error'))
})
@ -128,8 +128,8 @@ describe('Actions', function () {
assert.fail('Should have thrown error')
} catch (_) {
const actions1 = store.getActions()
const warning = actions1.filter(action => action.type === 'DISPLAY_WARNING')
const unlockFailed = actions1.filter(action => action.type === 'UNLOCK_FAILED')
const warning = actions1.filter((action) => action.type === 'DISPLAY_WARNING')
const unlockFailed = actions1.filter((action) => action.type === 'UNLOCK_FAILED')
assert.deepEqual(warning, displayWarningError)
assert.deepEqual(unlockFailed, unlockFailedError)
}
@ -245,7 +245,7 @@ describe('Actions', function () {
assert(removeAccountSpy.calledOnce)
const actionTypes = store
.getActions()
.map(action => action.type)
.map((action) => action.type)
assert.deepEqual(actionTypes, expectedActions)
})
@ -269,7 +269,7 @@ describe('Actions', function () {
} catch (_) {
const actionTypes = store
.getActions()
.map(action => action.type)
.map((action) => action.type)
assert.deepEqual(actionTypes, expectedActions)
}
@ -995,7 +995,7 @@ describe('Actions', function () {
{ type: 'LOCK_METAMASK' },
]
backgroundSetLockedSpy = sinon.stub(background, 'setLocked')
backgroundSetLockedSpy.callsFake(callback => {
backgroundSetLockedSpy.callsFake((callback) => {
callback(new Error('error'))
})
@ -1375,7 +1375,7 @@ describe('Actions', function () {
describe('#setCompletedOnboarding', function () {
it('completes onboarding', async function () {
const completeOnboardingSpy = sinon.stub(background, 'completeOnboarding')
completeOnboardingSpy.callsFake(cb => cb())
completeOnboardingSpy.callsFake((cb) => cb())
const store = mockStore()
await store.dispatch(actions.setCompletedOnboarding())
assert.equal(completeOnboardingSpy.callCount, 1)

@ -4,12 +4,12 @@ const json = methods
web3.currentProvider.enable().then(() => {
Object.keys(json).forEach(methodGroupKey => {
Object.keys(json).forEach((methodGroupKey) => {
console.log(methodGroupKey)
const methodGroup = json[methodGroupKey]
console.log(methodGroup)
Object.keys(methodGroup).forEach(methodKey => {
Object.keys(methodGroup).forEach((methodKey) => {
const methodButton = document.getElementById(methodKey)
methodButton.addEventListener('click', () => {

@ -103,7 +103,7 @@ export default class AccountMenu extends Component {
placeholder={this.context.t('searchAccounts')}
type="text"
value={this.state.searchQuery}
onChange={e => this.setSearchQuery(e.target.value)}
onChange={(e) => this.setSearchQuery(e.target.value)}
startAdornment={inputAdornment}
fullWidth
theme="material-white-padded"
@ -133,12 +133,12 @@ export default class AccountMenu extends Component {
return <p className="account-menu__no-accounts">{this.context.t('noAccountsFound')}</p>
}
return filteredIdentities.map(identity => {
return filteredIdentities.map((identity) => {
const isSelected = identity.address === selectedAddress
const simpleAddress = identity.address.substring(2).toLowerCase()
const keyring = keyrings.find(kr => {
const keyring = keyrings.find((kr) => {
return kr.accounts.includes(simpleAddress) || kr.accounts.includes(identity.address)
})
const addressDomains = addressConnectedDomainMap[identity.address] || {}
@ -210,7 +210,7 @@ export default class AccountMenu extends Component {
>
<a
className="remove-account-icon"
onClick={e => this.removeAccount(e, identity)}
onClick={(e) => this.removeAccount(e, identity)}
/>
</Tooltip>
)
@ -275,7 +275,7 @@ export default class AccountMenu extends Component {
onScroll = debounce(this.setShouldShowScrollButton, 25)
handleScrollDown = e => {
handleScrollDown = (e) => {
e.stopPropagation()
const { scrollHeight } = this.accountsRef
@ -336,7 +336,7 @@ export default class AccountMenu extends Component {
<div
className="account-menu__accounts"
onScroll={this.onScroll}
ref={ref => {
ref={(ref) => {
this.accountsRef = ref
}}
>

@ -53,7 +53,7 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch) {
return {
toggleAccountMenu: () => dispatch(toggleAccountMenu()),
showAccountDetail: address => {
showAccountDetail: (address) => {
dispatch(showAccountDetail(address))
dispatch(hideSidebar())
dispatch(toggleAccountMenu())
@ -64,7 +64,7 @@ function mapDispatchToProps (dispatch) {
dispatch(hideSidebar())
dispatch(toggleAccountMenu())
},
showRemoveAccountConfirmationModal: identity => {
showRemoveAccountConfirmationModal: (identity) => {
return dispatch(showModal({ name: 'CONFIRM_REMOVE_ACCOUNT', identity }))
},
}

@ -103,7 +103,7 @@ export default class AppHeader extends PureComponent {
<NetworkIndicator
network={network}
provider={provider}
onClick={event => this.handleNetworkIndicatorClick(event)}
onClick={(event) => this.handleNetworkIndicatorClick(event)}
disabled={disabled}
/>
</div>

@ -5,7 +5,7 @@ import { compose } from 'recompose'
import AppHeader from './app-header.component'
import * as actions from '../../../store/actions'
const mapStateToProps = state => {
const mapStateToProps = (state) => {
const { appState, metamask } = state
const { networkDropdownOpen } = appState
const {
@ -26,7 +26,7 @@ const mapStateToProps = state => {
}
}
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()),
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),

@ -29,7 +29,7 @@ describe('App Header', function () {
wrapper = shallow(
<AppHeader.WrappedComponent {...props} />, {
context: {
t: str => str,
t: (str) => str,
metricsEvent: () => {},
},
}

@ -4,7 +4,7 @@ import classnames from 'classnames'
import UserPreferencedCurrencyDisplay from '../../user-preferenced-currency-display'
import { PRIMARY, SECONDARY } from '../../../../helpers/constants/common'
const ConfirmDetailRow = props => {
const ConfirmDetailRow = (props) => {
const {
label,
primaryText,

@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import classnames from 'classnames'
import Identicon from '../../../../ui/identicon'
const ConfirmPageContainerSummary = props => {
const ConfirmPageContainerSummary = (props) => {
const {
action,
title,

@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
const ConfirmPageContainerWarning = props => {
const ConfirmPageContainerWarning = (props) => {
return (
<div className="confirm-page-container-warning">
<img

@ -1,7 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
const ConfirmPageContainerNavigation = props => {
const ConfirmPageContainerNavigation = (props) => {
const { onNextTx, totalTx, positionOfCurrentTx, nextTxId, prevTxId, showNavigation, firstTx, lastTx, ofText, requestsWaitingText } = props
return (

@ -14,7 +14,7 @@ import {
} from '../../../selectors/selectors'
import { getOriginFromUrl } from '../../../helpers/utils/util'
const mapStateToProps = state => {
const mapStateToProps = (state) => {
const addressConnectedToCurrentTab = getAddressConnectedToCurrentTab(state)
const { openMetaMaskTabs } = state.appState
const { title, url, id } = state.activeTab
@ -36,7 +36,7 @@ const mapStateToProps = state => {
}
}
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
showDisconnectAccountModal: (domainKey, domain) => {
dispatch(showModal({ name: 'DISCONNECT_ACCOUNT', domainKey, domain }))

@ -39,7 +39,7 @@ function mapDispatchToProps (dispatch) {
dispatch(actions.delRpcTarget(target))
},
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
setNetworksTabAddMode: isInAddMode => dispatch(actions.setNetworksTabAddMode(isInAddMode)),
setNetworksTabAddMode: (isInAddMode) => dispatch(actions.setNetworksTabAddMode(isInAddMode)),
}
}
@ -216,7 +216,7 @@ class NetworkDropdown extends Component {
isOpen={isOpen}
onClickOutside={(event) => {
const { classList } = event.target
const isInClassList = className => classList.contains(className)
const isInClassList = (className) => classList.contains(className)
const notToggleElementIndex = R.findIndex(isInClassList)(notToggleElementClassnames)
if (notToggleElementIndex === -1) {

@ -17,7 +17,7 @@ class SimpleDropdown extends Component {
getDisplayValue () {
const { selectedOption, options } = this.props
const matchesOption = option => option.value === selectedOption
const matchesOption = (option) => option.value === selectedOption
const matchingOption = R.find(matchesOption)(options)
return matchingOption
? matchingOption.displayValue || matchingOption.value
@ -41,7 +41,7 @@ class SimpleDropdown extends Component {
<div>
<div
className="simple-dropdown__close-area"
onClick={event => {
onClick={(event) => {
event.stopPropagation()
this.handleClose()
}}

@ -15,7 +15,7 @@ function convertGasLimitForInputs (gasLimitInHexWEI) {
return parseInt(gasLimitInHexWEI, 16) || 0
}
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
showGasPriceInfoModal: () => dispatch(showModal({ name: 'GAS_PRICE_INFO_MODAL' })),
showGasLimitInfoModal: () => dispatch(showModal({ name: 'GAS_LIMIT_INFO_MODAL' })),

@ -27,7 +27,7 @@ describe('Advanced Gas Inputs', function () {
{...props}
/>, {
context: {
t: str => str,
t: (str) => str,
},
})
})

@ -32,7 +32,7 @@ const mockGasPriceButtonGroupProps = {
gasEstimateType: GAS_ESTIMATE_TYPES.AVERAGE,
},
],
handleGasPriceSelection: newPrice => console.log('NewPrice: ', newPrice),
handleGasPriceSelection: (newPrice) => console.log('NewPrice: ', newPrice),
noButtonActiveByDefault: true,
showCheck: true,
}

@ -49,10 +49,10 @@ export default class GasModalPageContainer extends Component {
const promise = this.props.hideBasic
? Promise.resolve(this.props.blockTime)
: this.props.fetchBasicGasAndTimeEstimates()
.then(basicEstimates => basicEstimates.blockTime)
.then((basicEstimates) => basicEstimates.blockTime)
promise
.then(blockTime => {
.then((blockTime) => {
this.props.fetchGasEstimates(blockTime)
})
}

@ -165,8 +165,8 @@ const mapStateToProps = (state, ownProps) => {
}
}
const mapDispatchToProps = dispatch => {
const updateCustomGasPrice = newPrice => dispatch(setCustomGasPrice(addHexPrefix(newPrice)))
const mapDispatchToProps = (dispatch) => {
const updateCustomGasPrice = (newPrice) => dispatch(setCustomGasPrice(addHexPrefix(newPrice)))
return {
cancelAndClose: () => {
@ -175,7 +175,7 @@ const mapDispatchToProps = dispatch => {
},
hideModal: () => dispatch(hideModal()),
updateCustomGasPrice,
updateCustomGasLimit: newLimit => dispatch(setCustomGasLimit(addHexPrefix(newLimit))),
updateCustomGasLimit: (newLimit) => dispatch(setCustomGasLimit(addHexPrefix(newLimit))),
setGasData: (newLimit, newPrice) => {
dispatch(setGasLimit(newLimit))
dispatch(setGasPrice(newPrice))

@ -261,7 +261,7 @@ export function generateChart (gasPrices, estimatedTimes, gasPricesMax, estimate
contents: function (d) {
const titleFormat = this.config.tooltip_format_title
let text
d.forEach(el => {
d.forEach((el) => {
if (el && (el.value || el.value === 0) && !text) {
text = "<table class='" + 'custom-tooltip' + "'>" + "<tr><th colspan='2'>" + titleFormat(el.x) + '</th></tr>'
}

@ -33,7 +33,7 @@ export default class GasSlider extends Component {
min={min}
value={value}
id="gasSlider"
onChange={event => onChange(event.target.value)}
onChange={(event) => onChange(event.target.value)}
/>
<div className="gas-slider__bar">
<div className="gas-slider__colored" />

@ -3,7 +3,7 @@ import LoadingNetworkScreen from './loading-network-screen.component'
import * as actions from '../../../store/actions'
import { getNetworkIdentifier } from '../../../selectors/selectors'
const mapStateToProps = state => {
const mapStateToProps = (state) => {
const {
loadingMessage,
} = state.appState
@ -28,7 +28,7 @@ const mapStateToProps = state => {
}
}
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
setProviderType: (type) => {
dispatch(actions.setProviderType(type))

@ -3,7 +3,7 @@ import { WALLET_VIEW_SIDEBAR } from '../sidebars/sidebar.constants'
import MenuBar from './menu-bar.component'
import { showSidebar, hideSidebar } from '../../../store/actions'
const mapStateToProps = state => {
const mapStateToProps = (state) => {
const { appState: { sidebar: { isOpen } } } = state
return {
@ -11,7 +11,7 @@ const mapStateToProps = state => {
}
}
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
showSidebar: () => {
dispatch(showSidebar({

@ -46,7 +46,7 @@ export default class AccountDetailsModal extends Component {
<EditableLabel
className="account-modal__name"
defaultValue={name}
onSubmit={label => setAccountLabel(address, label)}
onSubmit={(label) => setAccountLabel(address, label)}
/>
<QrView

@ -24,13 +24,13 @@ export default class AddToAddressBookModal extends Component {
hideModal()
}
onChange = e => {
onChange = (e) => {
this.setState({
alias: e.target.value,
})
}
onKeyPress = e => {
onKeyPress = (e) => {
if (e.key === 'Enter' && this.state.alias) {
this.onSave()
}

@ -33,7 +33,7 @@ const mapStateToProps = (state, ownProps) => {
}
}
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
createCancelTransaction: (txId, customGasPrice) => {
return dispatch(createCancelTransaction(txId, customGasPrice))

@ -7,7 +7,7 @@ import CancelTransactionGasFee from '../cancel-transaction-gas-fee'
import Modal from '../../../modal'
describe('CancelTransaction Component', function () {
const t = key => key
const t = (key) => key
it('should render a CancelTransaction modal', function () {
const wrapper = shallow(

@ -4,7 +4,7 @@ import withModalProps from '../../../../helpers/higher-order-components/with-mod
import ConfirmDeleteNetwork from './confirm-delete-network.component'
import { delRpcTarget } from '../../../../store/actions'
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
delRpcTarget: (target) => dispatch(delRpcTarget(target)),
}

@ -18,7 +18,7 @@ describe('Confirm Delete Network', function () {
wrapper = mount(
<ConfirmDeleteNetwork.WrappedComponent {...props} />, {
context: {
t: str => str,
t: (str) => str,
},
}
)

@ -4,13 +4,13 @@ import ConfirmRemoveAccount from './confirm-remove-account.component'
import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'
import { removeAccount } from '../../../../store/actions'
const mapStateToProps = state => {
const mapStateToProps = (state) => {
return {
network: state.metamask.network,
}
}
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
removeAccount: (address) => dispatch(removeAccount(address)),
}

@ -37,7 +37,7 @@ describe('Confirm Remove Account', function () {
<ConfirmRemoveAccount.WrappedComponent {...props} />
</Provider>, {
context: {
t: str => str,
t: (str) => str,
store,
},
childContextTypes: {

@ -4,7 +4,7 @@ import withModalProps from '../../../../helpers/higher-order-components/with-mod
import ConfirmResetAccount from './confirm-reset-account.component'
import { resetAccount } from '../../../../store/actions'
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
resetAccount: () => dispatch(resetAccount()),
}

@ -16,7 +16,7 @@ describe('Confirm Reset Account', function () {
wrapper = mount(
<ConfirmResetAccount.WrappedComponent {...props} />, {
context: {
t: str => str,
t: (str) => str,
},
}
)

@ -79,7 +79,7 @@ export default class DepositEtherModal extends Component {
render () {
const { network, toWyre, toCoinSwitch, address, toFaucet } = this.props
const isTestNetwork = ['3', '4', '5', '42'].find(n => n === network)
const isTestNetwork = ['3', '4', '5', '42'].find((n) => n === network)
const networkName = getNetworkDisplayName(network)
return (

@ -26,7 +26,7 @@ function mapDispatchToProps (dispatch) {
showAccountDetailModal: () => {
dispatch(showModal({ name: 'ACCOUNT_DETAILS' }))
},
toFaucet: network => dispatch(buyEth({ network })),
toFaucet: (network) => dispatch(buyEth({ network })),
}
}

@ -5,17 +5,17 @@ import DisconnectAccount from './disconnect-account.component'
import { getCurrentAccountWithSendEtherInfo } from '../../../../selectors/selectors'
import { removePermissionsFor } from '../../../../store/actions'
const mapStateToProps = state => {
const mapStateToProps = (state) => {
return {
...(state.appState.modal.modalState.props || {}),
accountLabel: getCurrentAccountWithSendEtherInfo(state).name,
}
}
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
disconnectAccount: (domainKey, domain) => {
const permissionMethodNames = domain.permissions.map(perm => perm.parentCapability)
const permissionMethodNames = domain.permissions.map((perm) => perm.parentCapability)
dispatch(removePermissionsFor({ [domainKey]: permissionMethodNames }))
},
}

@ -5,7 +5,7 @@ import withModalProps from '../../../../helpers/higher-order-components/with-mod
import DisconnectAll from './disconnect-all.component'
import { clearPermissions } from '../../../../store/actions'
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
disconnectAll: () => {
dispatch(clearPermissions())

@ -38,7 +38,7 @@ export default class ExportPrivateKeyModal extends Component {
const { exportAccount } = this.props
exportAccount(password, address)
.then(privateKey => this.setState({
.then((privateKey) => this.setState({
privateKey,
showWarning: false,
}))
@ -65,7 +65,7 @@ export default class ExportPrivateKeyModal extends Component {
<input
type="password"
className="private-key-password-input"
onChange={event => this.setState({ password: event.target.value })}
onChange={(event) => this.setState({ password: event.target.value })}
/>
)
}

@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
let index = 0
let extraSheet
const insertRule = css => {
const insertRule = (css) => {
if (!extraSheet) {
// First time, create an extra stylesheet for adding rules
@ -20,7 +20,7 @@ const insertRule = css => {
return extraSheet
}
const insertKeyframesRule = keyframes => {
const insertKeyframesRule = (keyframes) => {
// random name
const name = 'anim_' + (++index) + (+new Date())
let css = '@' + 'keyframes ' + name + ' {'
@ -212,7 +212,7 @@ class FadeModal extends Component {
<div className="modal" style={modalStyle}>
<div
className="content"
ref={el => (this.content = el)}
ref={(el) => (this.content = el)}
tabIndex="-1"
style={contentStyle}
>

@ -15,7 +15,7 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch) {
return {
hideModal: () => dispatch(actions.hideModal()),
hideToken: address => {
hideToken: (address) => {
dispatch(actions.removeToken(address))
.then(() => {
dispatch(actions.hideModal())

@ -12,7 +12,7 @@ const mapStateToProps = (_, ownProps) => {
}
}
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
setParticipateInMetaMetrics: (val) => dispatch(setParticipateInMetaMetrics(val)),
}

@ -18,7 +18,7 @@ export default class NewAccountModal extends Component {
alias: '',
}
onChange = e => {
onChange = (e) => {
this.setState({
alias: e.target.value,
})
@ -29,7 +29,7 @@ export default class NewAccountModal extends Component {
.then(this.props.hideModal)
}
onKeyPress = e => {
onKeyPress = (e) => {
if (e.key === 'Enter' && this.state.alias) {
this.onSubmit()
}

@ -11,9 +11,9 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch) {
return {
hideModal: () => dispatch(actions.hideModal()),
createAccount: newAccountName => {
createAccount: (newAccountName) => {
return dispatch(actions.addNewAccount())
.then(newAccountAddress => {
.then((newAccountAddress) => {
if (newAccountName) {
dispatch(actions.setAccountLabel(newAccountAddress, newAccountName))
}
@ -36,7 +36,7 @@ function mergeProps (stateProps, dispatchProps) {
...dispatchProps,
onSave: (newAccountName) => {
return createAccount(newAccountName)
.then(newAccountAddress => onCreateNewAccount(newAccountAddress))
.then((newAccountAddress) => onCreateNewAccount(newAccountAddress))
},
}
}

@ -72,7 +72,7 @@ NotificationModal.propTypes = {
onConfirm: PropTypes.func,
}
const mapDispatchToProps = dispatch => {
const mapDispatchToProps = (dispatch) => {
return {
hideModal: () => {
dispatch(hideModal())

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save