diff --git a/.eslintrc.js b/.eslintrc.js index d40917334..6741ed60b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -44,6 +44,7 @@ module.exports = { }, rules: { + 'arrow-parens': 'error', 'import/default': 'error', 'import/export': 'error', 'import/named': 'error', diff --git a/app/scripts/background.js b/app/scripts/background.js index 774d04691..ed2070d9b 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -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 diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index 8cb4ab5c7..2a8307c10 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -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 })) } diff --git a/app/scripts/controllers/app-state.js b/app/scripts/controllers/app-state.js index f80fb1198..27e3a1acb 100644 --- a/app/scripts/controllers/app-state.js +++ b/app/scripts/controllers/app-state.js @@ -16,7 +16,7 @@ class AppStateController { }, initState)) this.timer = null - preferencesStore.subscribe(state => { + preferencesStore.subscribe((state) => { this._setInactiveTimeout(state.preferences.autoLockTimeLimit) }) diff --git a/app/scripts/controllers/cached-balances.js b/app/scripts/controllers/cached-balances.js index 936bda85b..af7862ffd 100644 --- a/app/scripts/controllers/cached-balances.js +++ b/app/scripts/controllers/cached-balances.js @@ -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) { diff --git a/app/scripts/controllers/incoming-transactions.js b/app/scripts/controllers/incoming-transactions.js index 45e572ef2..dfd79e95b 100644 --- a/app/scripts/controllers/incoming-transactions.js +++ b/app/scripts/controllers/incoming-transactions.js @@ -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 diff --git a/app/scripts/controllers/network/createLocalhostClient.js b/app/scripts/controllers/network/createLocalhostClient.js index 15238716b..b4429f86d 100644 --- a/app/scripts/controllers/network/createLocalhostClient.js +++ b/app/scripts/controllers/network/createLocalhostClient.js @@ -25,7 +25,7 @@ function createLocalhostClient () { } function delay (time) { - return new Promise(resolve => setTimeout(resolve, time)) + return new Promise((resolve) => setTimeout(resolve, time)) } diff --git a/app/scripts/controllers/network/util.js b/app/scripts/controllers/network/util.js index 570651d61..d4243a851 100644 --- a/app/scripts/controllers/network/util.js +++ b/app/scripts/controllers/network/util.js @@ -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 { diff --git a/app/scripts/controllers/permissions/index.js b/app/scripts/controllers/permissions/index.js index ec45d9b2e..2e468af07 100644 --- a/app/scripts/controllers/permissions/index.js +++ b/app/scripts/controllers/permissions/index.js @@ -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 diff --git a/app/scripts/controllers/permissions/permissionsLog.js b/app/scripts/controllers/permissions/permissionsLog.js index 2d3b86823..e574b6cc3 100644 --- a/app/scripts/controllers/permissions/permissionsLog.js +++ b/app/scripts/controllers/permissions/permissionsLog.js @@ -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) diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index e9a10ebce..b3de6a3e5 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -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 }) } diff --git a/app/scripts/controllers/token-rates.js b/app/scripts/controllers/token-rates.js index 5abe9d122..1854a31c8 100644 --- a/app/scripts/controllers/token-rates.js +++ b/app/scripts/controllers/token-rates.js @@ -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 }) diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 4b5ad2e9a..9560f2235 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -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) { diff --git a/app/scripts/controllers/transactions/lib/util.js b/app/scripts/controllers/transactions/lib/util.js index 7df8e4764..589e26635 100644 --- a/app/scripts/controllers/transactions/lib/util.js +++ b/app/scripts/controllers/transactions/lib/util.js @@ -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), } /** diff --git a/app/scripts/controllers/transactions/tx-state-manager.js b/app/scripts/controllers/transactions/tx-state-manager.js index e8255841f..cbb57e0ed 100644 --- a/app/scripts/controllers/transactions/tx-state-manager.js +++ b/app/scripts/controllers/transactions/tx-state-manager.js @@ -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) } diff --git a/app/scripts/lib/account-tracker.js b/app/scripts/lib/account-tracker.js index c18807479..57c2d6f63 100644 --- a/app/scripts/lib/account-tracker.js +++ b/app/scripts/lib/account-tracker.js @@ -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 diff --git a/app/scripts/lib/createDnodeRemoteGetter.js b/app/scripts/lib/createDnodeRemoteGetter.js index 8f06a40a8..038ae412d 100644 --- a/app/scripts/lib/createDnodeRemoteGetter.js +++ b/app/scripts/lib/createDnodeRemoteGetter.js @@ -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 diff --git a/app/scripts/lib/ens-ipfs/setup.js b/app/scripts/lib/ens-ipfs/setup.js index ee04b9340..351418754 100644 --- a/app/scripts/lib/ens-ipfs/setup.js +++ b/app/scripts/lib/ens-ipfs/setup.js @@ -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 diff --git a/app/scripts/lib/get-first-preferred-lang-code.js b/app/scripts/lib/get-first-preferred-lang-code.js index 3e052bd09..806a4a70e 100644 --- a/app/scripts/lib/get-first-preferred-lang-code.js +++ b/app/scripts/lib/get-first-preferred-lang-code.js @@ -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' } diff --git a/app/scripts/lib/message-manager.js b/app/scripts/lib/message-manager.js index 9af28663e..387ccce47 100644 --- a/app/scripts/lib/message-manager.js +++ b/app/scripts/lib/message-manager.js @@ -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) } /** diff --git a/app/scripts/lib/personal-message-manager.js b/app/scripts/lib/personal-message-manager.js index e708ed1c8..88cdee44b 100644 --- a/app/scripts/lib/personal-message-manager.js +++ b/app/scripts/lib/personal-message-manager.js @@ -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) } /** diff --git a/app/scripts/lib/setupSentry.js b/app/scripts/lib/setupSentry.js index 18c3507ea..b1f65246b 100644 --- a/app/scripts/lib/setupSentry.js +++ b/app/scripts/lib/setupSentry.js @@ -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) }) }) diff --git a/app/scripts/lib/typed-message-manager.js b/app/scripts/lib/typed-message-manager.js index 84c1864a4..346051e30 100644 --- a/app/scripts/lib/typed-message-manager.js +++ b/app/scripts/lib/typed-message-manager.js @@ -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) } /** diff --git a/app/scripts/lib/util.js b/app/scripts/lib/util.js index 119470250..05ea98518 100644 --- a/app/scripts/lib/util.js +++ b/app/scripts/lib/util.js @@ -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 diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 4fe9903ea..5448a74b3 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -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) diff --git a/app/scripts/migrations/025.js b/app/scripts/migrations/025.js index d338f265f..1f3721d27 100644 --- a/app/scripts/migrations/025.js +++ b/app/scripts/migrations/025.js @@ -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 diff --git a/app/scripts/platforms/extension.js b/app/scripts/platforms/extension.js index 85119b054..2d40e087e 100644 --- a/app/scripts/platforms/extension.js +++ b/app/scripts/platforms/extension.js @@ -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) diff --git a/development/metamaskbot-build-announce.js b/development/metamaskbot-build-announce.js index baf82a0f1..dc0dab936 100755 --- a/development/metamaskbot-build-announce.js +++ b/development/metamaskbot-build-announce.js @@ -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 `${platform}` }).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 `${bundle}` }).join(', ') @@ -58,7 +58,7 @@ async function start () { `dep viz: ${depVizLink}`, `all artifacts`, ] - const hiddenContent = `` + const hiddenContent = `` const exposedContent = `Builds ready [${SHORT_SHA1}]` const artifactsBody = `
${exposedContent}${hiddenContent}
` @@ -136,7 +136,7 @@ async function start () { for (const measure of allMeasures) { benchmarkTableHeaders.push(`${capitalizeFirstLetter(measure)} (ms)`) } - const benchmarkTableHeader = `${benchmarkTableHeaders.map(header => `${header}`).join('')}` + const benchmarkTableHeader = `${benchmarkTableHeaders.map((header) => `${header}`).join('')}` const benchmarkTableBody = `${tableRows.join('')}` const benchmarkTable = `${benchmarkTableHeader}${benchmarkTableBody}
` const benchmarkBody = `
${benchmarkSummary}${benchmarkTable}
` diff --git a/development/mock-3box.js b/development/mock-3box.js index af95a74bb..44307dd99 100644 --- a/development/mock-3box.js +++ b/development/mock-3box.js @@ -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) => { diff --git a/development/show-deps-install-scripts.js b/development/show-deps-install-scripts.js index 419c9d25f..12301fe0d 100644 --- a/development/show-deps-install-scripts.js +++ b/development/show-deps-install-scripts.js @@ -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 } diff --git a/development/sourcemap-validator.js b/development/sourcemap-validator.js index 797f84656..e87c0604f 100644 --- a/development/sourcemap-validator.js +++ b/development/sourcemap-validator.js @@ -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++ diff --git a/development/verify-locale-strings.js b/development/verify-locale-strings.js index 3b114a1e8..990ed95f4 100644 --- a/development/verify-locale-strings.js +++ b/development/verify-locale-strings.js @@ -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`) diff --git a/gulpfile.js b/gulpfile.js index fb37c457b..c1e65ea12 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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)) diff --git a/test/e2e/address-book.spec.js b/test/e2e/address-book.spec.js index 95c78b27d..6171dc222 100644 --- a/test/e2e/address-book.spec.js +++ b/test/e2e/address-book.spec.js @@ -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)) } diff --git a/test/e2e/benchmark.js b/test/e2e/benchmark.js index 825382559..6917005c9 100644 --- a/test/e2e/benchmark.js +++ b/test/e2e/benchmark.js @@ -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) }) diff --git a/test/e2e/ethereum-on.spec.js b/test/e2e/ethereum-on.spec.js index 8fce9c45b..deb7c16f1 100644 --- a/test/e2e/ethereum-on.spec.js +++ b/test/e2e/ethereum-on.spec.js @@ -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) diff --git a/test/e2e/from-import-ui.spec.js b/test/e2e/from-import-ui.spec.js index 666981bc3..ab8832392 100644 --- a/test/e2e/from-import-ui.spec.js +++ b/test/e2e/from-import-ui.spec.js @@ -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)) } diff --git a/test/e2e/incremental-security.spec.js b/test/e2e/incremental-security.spec.js index 57b38cb65..4964dfb0f 100644 --- a/test/e2e/incremental-security.spec.js +++ b/test/e2e/incremental-security.spec.js @@ -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)) } diff --git a/test/e2e/metamask-responsive-ui.spec.js b/test/e2e/metamask-responsive-ui.spec.js index 41eee8efd..e4d18f01d 100644 --- a/test/e2e/metamask-responsive-ui.spec.js +++ b/test/e2e/metamask-responsive-ui.spec.js @@ -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)) } diff --git a/test/e2e/metamask-ui.spec.js b/test/e2e/metamask-ui.spec.js index ad86c1ec1..d2a1472da 100644 --- a/test/e2e/metamask-ui.spec.js +++ b/test/e2e/metamask-ui.spec.js @@ -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) diff --git a/test/e2e/mock-3box/server.js b/test/e2e/mock-3box/server.js index afbfa8031..9d6bc7372 100644 --- a/test/e2e/mock-3box/server.js +++ b/test/e2e/mock-3box/server.js @@ -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', () => { diff --git a/test/e2e/permissions.spec.js b/test/e2e/permissions.spec.js index a34b11a8d..d287cff6d 100644 --- a/test/e2e/permissions.spec.js +++ b/test/e2e/permissions.spec.js @@ -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) diff --git a/test/e2e/send-edit.spec.js b/test/e2e/send-edit.spec.js index 8af966a20..9cb39b5e6 100644 --- a/test/e2e/send-edit.spec.js +++ b/test/e2e/send-edit.spec.js @@ -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)) } diff --git a/test/e2e/signature-request.spec.js b/test/e2e/signature-request.spec.js index 738ea262c..b17bf48c5 100644 --- a/test/e2e/signature-request.spec.js +++ b/test/e2e/signature-request.spec.js @@ -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) diff --git a/test/e2e/threebox.spec.js b/test/e2e/threebox.spec.js index d55e9419a..85ba75834 100644 --- a/test/e2e/threebox.spec.js +++ b/test/e2e/threebox.spec.js @@ -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)) } diff --git a/test/e2e/web3.spec.js b/test/e2e/web3.spec.js index 9769459f8..108fdc8c5 100644 --- a/test/e2e/web3.spec.js +++ b/test/e2e/web3.spec.js @@ -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')]`)) diff --git a/test/e2e/webdriver/driver.js b/test/e2e/webdriver/driver.js index 4369f88cd..169e09a23 100644 --- a/test/e2e/webdriver/driver.js +++ b/test/e2e/webdriver/driver.js @@ -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))) } } diff --git a/test/lib/render-helpers.js b/test/lib/render-helpers.js index 45bcb1656..874c80846 100644 --- a/test/lib/render-helpers.js +++ b/test/lib/render-helpers.js @@ -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, }, diff --git a/test/setup.js b/test/setup.js index 5aa6e59dd..0e4ebe248 100644 --- a/test/setup.js +++ b/test/setup.js @@ -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') diff --git a/test/unit/app/controllers/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js index e0d805961..9d01c1549 100644 --- a/test/unit/app/controllers/metamask-controller-test.js +++ b/test/unit/app/controllers/metamask-controller-test.js @@ -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 } diff --git a/test/unit/app/controllers/transactions/pending-tx-test.js b/test/unit/app/controllers/transactions/pending-tx-test.js index 3dfd852c2..7bbc5c58c 100644 --- a/test/unit/app/controllers/transactions/pending-tx-test.js +++ b/test/unit/app/controllers/transactions/pending-tx-test.js @@ -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) diff --git a/test/unit/app/controllers/transactions/tx-controller-test.js b/test/unit/app/controllers/transactions/tx-controller-test.js index a973a6093..0284fb376 100644 --- a/test/unit/app/controllers/transactions/tx-controller-test.js +++ b/test/unit/app/controllers/transactions/tx-controller-test.js @@ -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') }) diff --git a/test/unit/app/fetch-with-timeout.test.js b/test/unit/app/fetch-with-timeout.test.js index 52b79c338..af25a329c 100644 --- a/test/unit/app/fetch-with-timeout.test.js +++ b/test/unit/app/fetch-with-timeout.test.js @@ -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') diff --git a/test/unit/migrations/031-test.js b/test/unit/migrations/031-test.js index 8b040aed9..5c9f7d20b 100644 --- a/test/unit/migrations/031-test.js +++ b/test/unit/migrations/031-test.js @@ -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() }) diff --git a/test/unit/migrations/033-test.js b/test/unit/migrations/033-test.js index 3e6065724..4456a7e4a 100644 --- a/test/unit/migrations/033-test.js +++ b/test/unit/migrations/033-test.js @@ -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) }) }) diff --git a/test/unit/migrations/migrator-test.js b/test/unit/migrations/migrator-test.js index 959ad60be..4823234f4 100644 --- a/test/unit/migrations/migrator-test.js +++ b/test/unit/migrations/migrator-test.js @@ -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)) { diff --git a/test/unit/ui/app/actions.spec.js b/test/unit/ui/app/actions.spec.js index b2d8ba26a..22fc53b6e 100644 --- a/test/unit/ui/app/actions.spec.js +++ b/test/unit/ui/app/actions.spec.js @@ -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) diff --git a/test/web3/web3.js b/test/web3/web3.js index 590a5d990..49898044d 100644 --- a/test/web3/web3.js +++ b/test/web3/web3.js @@ -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', () => { diff --git a/ui/app/components/app/account-menu/account-menu.component.js b/ui/app/components/app/account-menu/account-menu.component.js index b249ee179..fb9ac9ac6 100644 --- a/ui/app/components/app/account-menu/account-menu.component.js +++ b/ui/app/components/app/account-menu/account-menu.component.js @@ -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

{this.context.t('noAccountsFound')}

} - 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 { > this.removeAccount(e, identity)} + onClick={(e) => this.removeAccount(e, identity)} /> ) @@ -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 {
{ + ref={(ref) => { this.accountsRef = ref }} > diff --git a/ui/app/components/app/account-menu/account-menu.container.js b/ui/app/components/app/account-menu/account-menu.container.js index 7bc62603e..68f330972 100644 --- a/ui/app/components/app/account-menu/account-menu.container.js +++ b/ui/app/components/app/account-menu/account-menu.container.js @@ -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 })) }, } diff --git a/ui/app/components/app/app-header/app-header.component.js b/ui/app/components/app/app-header/app-header.component.js index 533cb09f4..b4c4fa992 100644 --- a/ui/app/components/app/app-header/app-header.component.js +++ b/ui/app/components/app/app-header/app-header.component.js @@ -103,7 +103,7 @@ export default class AppHeader extends PureComponent { this.handleNetworkIndicatorClick(event)} + onClick={(event) => this.handleNetworkIndicatorClick(event)} disabled={disabled} />
diff --git a/ui/app/components/app/app-header/app-header.container.js b/ui/app/components/app/app-header/app-header.container.js index 861d30989..28d9a796d 100644 --- a/ui/app/components/app/app-header/app-header.container.js +++ b/ui/app/components/app/app-header/app-header.container.js @@ -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()), diff --git a/ui/app/components/app/app-header/tests/app-header.test.js b/ui/app/components/app/app-header/tests/app-header.test.js index f63567e95..a788e1053 100644 --- a/ui/app/components/app/app-header/tests/app-header.test.js +++ b/ui/app/components/app/app-header/tests/app-header.test.js @@ -29,7 +29,7 @@ describe('App Header', function () { wrapper = shallow( , { context: { - t: str => str, + t: (str) => str, metricsEvent: () => {}, }, } diff --git a/ui/app/components/app/confirm-page-container/confirm-detail-row/confirm-detail-row.component.js b/ui/app/components/app/confirm-page-container/confirm-detail-row/confirm-detail-row.component.js index 18571eccb..d4b6cee68 100644 --- a/ui/app/components/app/confirm-page-container/confirm-detail-row/confirm-detail-row.component.js +++ b/ui/app/components/app/confirm-page-container/confirm-detail-row/confirm-detail-row.component.js @@ -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, diff --git a/ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js b/ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js index b973ad84d..85cbc0076 100644 --- a/ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js +++ b/ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js @@ -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, diff --git a/ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-warning/confirm-page-container-warning.component.js b/ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-warning/confirm-page-container-warning.component.js index 79901c8fc..8865fb976 100644 --- a/ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-warning/confirm-page-container-warning.component.js +++ b/ui/app/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-warning/confirm-page-container-warning.component.js @@ -1,7 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' -const ConfirmPageContainerWarning = props => { +const ConfirmPageContainerWarning = (props) => { return (
{ +const ConfirmPageContainerNavigation = (props) => { const { onNextTx, totalTx, positionOfCurrentTx, nextTxId, prevTxId, showNavigation, firstTx, lastTx, ofText, requestsWaitingText } = props return ( diff --git a/ui/app/components/app/connected-sites-list/connected-sites-list.container.js b/ui/app/components/app/connected-sites-list/connected-sites-list.container.js index 1058152e1..6bbc5be5b 100644 --- a/ui/app/components/app/connected-sites-list/connected-sites-list.container.js +++ b/ui/app/components/app/connected-sites-list/connected-sites-list.container.js @@ -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 })) diff --git a/ui/app/components/app/dropdowns/network-dropdown.js b/ui/app/components/app/dropdowns/network-dropdown.js index 99c9a7ec4..6825c8a16 100644 --- a/ui/app/components/app/dropdowns/network-dropdown.js +++ b/ui/app/components/app/dropdowns/network-dropdown.js @@ -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) { diff --git a/ui/app/components/app/dropdowns/simple-dropdown.js b/ui/app/components/app/dropdowns/simple-dropdown.js index 5d764b374..06cf3c631 100644 --- a/ui/app/components/app/dropdowns/simple-dropdown.js +++ b/ui/app/components/app/dropdowns/simple-dropdown.js @@ -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 {
{ + onClick={(event) => { event.stopPropagation() this.handleClose() }} diff --git a/ui/app/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js b/ui/app/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js index 6b547abc6..61c73bcf1 100644 --- a/ui/app/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js +++ b/ui/app/components/app/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js @@ -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' })), diff --git a/ui/app/components/app/gas-customization/advanced-gas-inputs/tests/advanced-gas-input-component.test.js b/ui/app/components/app/gas-customization/advanced-gas-inputs/tests/advanced-gas-input-component.test.js index 2da1911ea..b28da6615 100644 --- a/ui/app/components/app/gas-customization/advanced-gas-inputs/tests/advanced-gas-input-component.test.js +++ b/ui/app/components/app/gas-customization/advanced-gas-inputs/tests/advanced-gas-input-component.test.js @@ -27,7 +27,7 @@ describe('Advanced Gas Inputs', function () { {...props} />, { context: { - t: str => str, + t: (str) => str, }, }) }) diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js b/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js index 87dbf73a7..2e2e8dab5 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/tests/basic-tab-content-component.test.js @@ -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, } diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js index b02778754..65a35101d 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js @@ -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) }) } diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js index 530996b9d..1b530fe85 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js @@ -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)) diff --git a/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js b/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js index 02f018995..ad98b61a6 100644 --- a/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js +++ b/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js @@ -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 = "" + "' } diff --git a/ui/app/components/app/gas-customization/gas-slider/gas-slider.component.js b/ui/app/components/app/gas-customization/gas-slider/gas-slider.component.js index 629d81f0e..1e072d300 100644 --- a/ui/app/components/app/gas-customization/gas-slider/gas-slider.component.js +++ b/ui/app/components/app/gas-customization/gas-slider/gas-slider.component.js @@ -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)} />
diff --git a/ui/app/components/app/loading-network-screen/loading-network-screen.container.js b/ui/app/components/app/loading-network-screen/loading-network-screen.container.js index f33a12e56..d17ce67a8 100644 --- a/ui/app/components/app/loading-network-screen/loading-network-screen.container.js +++ b/ui/app/components/app/loading-network-screen/loading-network-screen.container.js @@ -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)) diff --git a/ui/app/components/app/menu-bar/menu-bar.container.js b/ui/app/components/app/menu-bar/menu-bar.container.js index 059263ff3..30455e28c 100644 --- a/ui/app/components/app/menu-bar/menu-bar.container.js +++ b/ui/app/components/app/menu-bar/menu-bar.container.js @@ -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({ diff --git a/ui/app/components/app/modals/account-details-modal/account-details-modal.component.js b/ui/app/components/app/modals/account-details-modal/account-details-modal.component.js index d47401fb6..1c46d792b 100644 --- a/ui/app/components/app/modals/account-details-modal/account-details-modal.component.js +++ b/ui/app/components/app/modals/account-details-modal/account-details-modal.component.js @@ -46,7 +46,7 @@ export default class AccountDetailsModal extends Component { setAccountLabel(address, label)} + onSubmit={(label) => setAccountLabel(address, label)} /> { + onChange = (e) => { this.setState({ alias: e.target.value, }) } - onKeyPress = e => { + onKeyPress = (e) => { if (e.key === 'Enter' && this.state.alias) { this.onSave() } diff --git a/ui/app/components/app/modals/cancel-transaction/cancel-transaction.container.js b/ui/app/components/app/modals/cancel-transaction/cancel-transaction.container.js index 6959889d9..bed72119a 100644 --- a/ui/app/components/app/modals/cancel-transaction/cancel-transaction.container.js +++ b/ui/app/components/app/modals/cancel-transaction/cancel-transaction.container.js @@ -33,7 +33,7 @@ const mapStateToProps = (state, ownProps) => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { createCancelTransaction: (txId, customGasPrice) => { return dispatch(createCancelTransaction(txId, customGasPrice)) diff --git a/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js b/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js index 5991c6ca0..faa917db3 100644 --- a/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js +++ b/ui/app/components/app/modals/cancel-transaction/tests/cancel-transaction.component.test.js @@ -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( diff --git a/ui/app/components/app/modals/confirm-delete-network/confirm-delete-network.container.js b/ui/app/components/app/modals/confirm-delete-network/confirm-delete-network.container.js index 4c9bb279f..6df902572 100644 --- a/ui/app/components/app/modals/confirm-delete-network/confirm-delete-network.container.js +++ b/ui/app/components/app/modals/confirm-delete-network/confirm-delete-network.container.js @@ -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)), } diff --git a/ui/app/components/app/modals/confirm-delete-network/tests/confirm-delete-network.test.js b/ui/app/components/app/modals/confirm-delete-network/tests/confirm-delete-network.test.js index 390d5bb53..77e8b3faa 100644 --- a/ui/app/components/app/modals/confirm-delete-network/tests/confirm-delete-network.test.js +++ b/ui/app/components/app/modals/confirm-delete-network/tests/confirm-delete-network.test.js @@ -18,7 +18,7 @@ describe('Confirm Delete Network', function () { wrapper = mount( , { context: { - t: str => str, + t: (str) => str, }, } ) diff --git a/ui/app/components/app/modals/confirm-remove-account/confirm-remove-account.container.js b/ui/app/components/app/modals/confirm-remove-account/confirm-remove-account.container.js index 0a3cda5b6..6434899a2 100644 --- a/ui/app/components/app/modals/confirm-remove-account/confirm-remove-account.container.js +++ b/ui/app/components/app/modals/confirm-remove-account/confirm-remove-account.container.js @@ -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)), } diff --git a/ui/app/components/app/modals/confirm-remove-account/tests/confirm-remove-account.test.js b/ui/app/components/app/modals/confirm-remove-account/tests/confirm-remove-account.test.js index 8be07d0d1..417923628 100644 --- a/ui/app/components/app/modals/confirm-remove-account/tests/confirm-remove-account.test.js +++ b/ui/app/components/app/modals/confirm-remove-account/tests/confirm-remove-account.test.js @@ -37,7 +37,7 @@ describe('Confirm Remove Account', function () { , { context: { - t: str => str, + t: (str) => str, store, }, childContextTypes: { diff --git a/ui/app/components/app/modals/confirm-reset-account/confirm-reset-account.container.js b/ui/app/components/app/modals/confirm-reset-account/confirm-reset-account.container.js index ffbd40d9d..b870f191c 100644 --- a/ui/app/components/app/modals/confirm-reset-account/confirm-reset-account.container.js +++ b/ui/app/components/app/modals/confirm-reset-account/confirm-reset-account.container.js @@ -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()), } diff --git a/ui/app/components/app/modals/confirm-reset-account/tests/confirm-reset-account.test.js b/ui/app/components/app/modals/confirm-reset-account/tests/confirm-reset-account.test.js index 46ec14050..fdb268e63 100644 --- a/ui/app/components/app/modals/confirm-reset-account/tests/confirm-reset-account.test.js +++ b/ui/app/components/app/modals/confirm-reset-account/tests/confirm-reset-account.test.js @@ -16,7 +16,7 @@ describe('Confirm Reset Account', function () { wrapper = mount( , { context: { - t: str => str, + t: (str) => str, }, } ) diff --git a/ui/app/components/app/modals/deposit-ether-modal/deposit-ether-modal.component.js b/ui/app/components/app/modals/deposit-ether-modal/deposit-ether-modal.component.js index 1e6715ef8..5e074e56f 100644 --- a/ui/app/components/app/modals/deposit-ether-modal/deposit-ether-modal.component.js +++ b/ui/app/components/app/modals/deposit-ether-modal/deposit-ether-modal.component.js @@ -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 ( diff --git a/ui/app/components/app/modals/deposit-ether-modal/deposit-ether-modal.container.js b/ui/app/components/app/modals/deposit-ether-modal/deposit-ether-modal.container.js index cccbe7667..31f10eff9 100644 --- a/ui/app/components/app/modals/deposit-ether-modal/deposit-ether-modal.container.js +++ b/ui/app/components/app/modals/deposit-ether-modal/deposit-ether-modal.container.js @@ -26,7 +26,7 @@ function mapDispatchToProps (dispatch) { showAccountDetailModal: () => { dispatch(showModal({ name: 'ACCOUNT_DETAILS' })) }, - toFaucet: network => dispatch(buyEth({ network })), + toFaucet: (network) => dispatch(buyEth({ network })), } } diff --git a/ui/app/components/app/modals/disconnect-account/disconnect-account.container.js b/ui/app/components/app/modals/disconnect-account/disconnect-account.container.js index ca26bd95f..c0b406d8e 100644 --- a/ui/app/components/app/modals/disconnect-account/disconnect-account.container.js +++ b/ui/app/components/app/modals/disconnect-account/disconnect-account.container.js @@ -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 })) }, } diff --git a/ui/app/components/app/modals/disconnect-all/disconnect-all.container.js b/ui/app/components/app/modals/disconnect-all/disconnect-all.container.js index 2415c3fa9..fe733a5b1 100644 --- a/ui/app/components/app/modals/disconnect-all/disconnect-all.container.js +++ b/ui/app/components/app/modals/disconnect-all/disconnect-all.container.js @@ -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()) diff --git a/ui/app/components/app/modals/export-private-key-modal/export-private-key-modal.component.js b/ui/app/components/app/modals/export-private-key-modal/export-private-key-modal.component.js index 76dbb92dd..695762b73 100644 --- a/ui/app/components/app/modals/export-private-key-modal/export-private-key-modal.component.js +++ b/ui/app/components/app/modals/export-private-key-modal/export-private-key-modal.component.js @@ -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 { this.setState({ password: event.target.value })} + onChange={(event) => this.setState({ password: event.target.value })} /> ) } diff --git a/ui/app/components/app/modals/fade-modal.js b/ui/app/components/app/modals/fade-modal.js index 3f9269a2f..d4cad7615 100644 --- a/ui/app/components/app/modals/fade-modal.js +++ b/ui/app/components/app/modals/fade-modal.js @@ -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 {
(this.content = el)} + ref={(el) => (this.content = el)} tabIndex="-1" style={contentStyle} > diff --git a/ui/app/components/app/modals/hide-token-confirmation-modal.js b/ui/app/components/app/modals/hide-token-confirmation-modal.js index e70e0c877..fdd452b35 100644 --- a/ui/app/components/app/modals/hide-token-confirmation-modal.js +++ b/ui/app/components/app/modals/hide-token-confirmation-modal.js @@ -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()) diff --git a/ui/app/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.container.js b/ui/app/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.container.js index ea7d71a73..6ac78ff56 100644 --- a/ui/app/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.container.js +++ b/ui/app/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.container.js @@ -12,7 +12,7 @@ const mapStateToProps = (_, ownProps) => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { setParticipateInMetaMetrics: (val) => dispatch(setParticipateInMetaMetrics(val)), } diff --git a/ui/app/components/app/modals/new-account-modal/new-account-modal.component.js b/ui/app/components/app/modals/new-account-modal/new-account-modal.component.js index 26224ae63..01940cbc0 100644 --- a/ui/app/components/app/modals/new-account-modal/new-account-modal.component.js +++ b/ui/app/components/app/modals/new-account-modal/new-account-modal.component.js @@ -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() } diff --git a/ui/app/components/app/modals/new-account-modal/new-account-modal.container.js b/ui/app/components/app/modals/new-account-modal/new-account-modal.container.js index f4ebac86c..adda14d37 100644 --- a/ui/app/components/app/modals/new-account-modal/new-account-modal.container.js +++ b/ui/app/components/app/modals/new-account-modal/new-account-modal.container.js @@ -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)) }, } } diff --git a/ui/app/components/app/modals/notification-modal.js b/ui/app/components/app/modals/notification-modal.js index b31367636..7fe776934 100644 --- a/ui/app/components/app/modals/notification-modal.js +++ b/ui/app/components/app/modals/notification-modal.js @@ -72,7 +72,7 @@ NotificationModal.propTypes = { onConfirm: PropTypes.func, } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { hideModal: () => { dispatch(hideModal()) diff --git a/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js b/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js index 0bd4ac79a..63ca45b88 100644 --- a/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js +++ b/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js @@ -85,7 +85,7 @@ export default class QrScanner extends Component { const { permissions } = await WebcamUtils.checkStatus() if (permissions) { // Let the video stream load first... - await new Promise(resolve => setTimeout(resolve, 2000)) + await new Promise((resolve) => setTimeout(resolve, 2000)) if (!this.mounted) { return } diff --git a/ui/app/components/app/modals/qr-scanner/qr-scanner.container.js b/ui/app/components/app/modals/qr-scanner/qr-scanner.container.js index 2de4aeb73..b7fce7523 100644 --- a/ui/app/components/app/modals/qr-scanner/qr-scanner.container.js +++ b/ui/app/components/app/modals/qr-scanner/qr-scanner.container.js @@ -3,7 +3,7 @@ import QrScanner from './qr-scanner.component' import { hideModal, qrCodeDetected } from '../../../../store/actions' -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { hideModal: () => dispatch(hideModal()), qrCodeDetected: (data) => dispatch(qrCodeDetected(data)), diff --git a/ui/app/components/app/modals/reject-transactions/tests/reject-transactions.test.js b/ui/app/components/app/modals/reject-transactions/tests/reject-transactions.test.js index eac74c474..fb8deb65d 100644 --- a/ui/app/components/app/modals/reject-transactions/tests/reject-transactions.test.js +++ b/ui/app/components/app/modals/reject-transactions/tests/reject-transactions.test.js @@ -17,7 +17,7 @@ describe('Reject Transactions Model', function () { wrapper = mount( , { context: { - t: str => str, + t: (str) => str, }, } ) diff --git a/ui/app/components/app/modals/tests/account-details-modal.test.js b/ui/app/components/app/modals/tests/account-details-modal.test.js index b00b1418e..db0e4094f 100644 --- a/ui/app/components/app/modals/tests/account-details-modal.test.js +++ b/ui/app/components/app/modals/tests/account-details-modal.test.js @@ -40,7 +40,7 @@ describe('Account Details Modal', function () { wrapper = shallow( , { context: { - t: str => str, + t: (str) => str, }, } ) diff --git a/ui/app/components/app/modals/transaction-confirmed/tests/transaction-confirmed.test.js b/ui/app/components/app/modals/transaction-confirmed/tests/transaction-confirmed.test.js index 529e0cdbc..222fff8f4 100644 --- a/ui/app/components/app/modals/transaction-confirmed/tests/transaction-confirmed.test.js +++ b/ui/app/components/app/modals/transaction-confirmed/tests/transaction-confirmed.test.js @@ -13,7 +13,7 @@ describe('Transaction Confirmed', function () { const wrapper = mount( , { context: { - t: str => str, + t: (str) => str, }, } ) diff --git a/ui/app/components/app/multiple-notifications/multiple-notifications.component.js b/ui/app/components/app/multiple-notifications/multiple-notifications.component.js index 59f540045..410bef6a9 100644 --- a/ui/app/components/app/multiple-notifications/multiple-notifications.component.js +++ b/ui/app/components/app/multiple-notifications/multiple-notifications.component.js @@ -21,7 +21,7 @@ export default class MultipleNotifications extends PureComponent { const { showAll } = this.state const { children, classNames } = this.props - const childrenToRender = children.filter(child => child) + const childrenToRender = children.filter((child) => child) if (childrenToRender.length === 0) { return null } diff --git a/ui/app/components/app/permission-page-container/permission-page-container.component.js b/ui/app/components/app/permission-page-container/permission-page-container.component.js index bb5afac9e..35e111ba2 100644 --- a/ui/app/components/app/permission-page-container/permission-page-container.component.js +++ b/ui/app/components/app/permission-page-container/permission-page-container.component.js @@ -62,7 +62,7 @@ export default class PermissionPageContainer extends Component { return Object.keys(props.request.permissions || {}) } - onPermissionToggle = methodName => { + onPermissionToggle = (methodName) => { this.setState({ selectedPermissions: { ...this.state.selectedPermissions, @@ -96,7 +96,7 @@ export default class PermissionPageContainer extends Component { permissions: { ..._request.permissions }, } - Object.keys(this.state.selectedPermissions).forEach(key => { + Object.keys(this.state.selectedPermissions).forEach((key) => { if (!this.state.selectedPermissions[key]) { delete request.permissions[key] } diff --git a/ui/app/components/app/selected-account/selected-account.container.js b/ui/app/components/app/selected-account/selected-account.container.js index afa113117..4ec23f5e6 100644 --- a/ui/app/components/app/selected-account/selected-account.container.js +++ b/ui/app/components/app/selected-account/selected-account.container.js @@ -3,7 +3,7 @@ import SelectedAccount from './selected-account.component' import { getSelectedAddress, getSelectedIdentity } from '../../../selectors/selectors' -const mapStateToProps = state => { +const mapStateToProps = (state) => { return { selectedAddress: getSelectedAddress(state), selectedIdentity: getSelectedIdentity(state), diff --git a/ui/app/components/app/signature-request-original/signature-request-original.component.js b/ui/app/components/app/signature-request-original/signature-request-original.component.js index 775245539..7a08e36a1 100644 --- a/ui/app/components/app/signature-request-original/signature-request-original.component.js +++ b/ui/app/components/app/signature-request-original/signature-request-original.component.js @@ -272,7 +272,7 @@ export default class SignatureRequestOriginal extends Component { type="default" large className="request-signature__footer__cancel-button" - onClick={async event => { + onClick={async (event) => { this._removeBeforeUnload() await cancel(event) this.context.metricsEvent({ @@ -292,7 +292,7 @@ export default class SignatureRequestOriginal extends Component { type="secondary" large className="request-signature__footer__sign-button" - onClick={async event => { + onClick={async (event) => { this._removeBeforeUnload() await sign(event) this.context.metricsEvent({ diff --git a/ui/app/components/app/tab-bar.js b/ui/app/components/app/tab-bar.js index e39e80d55..6abd56936 100644 --- a/ui/app/components/app/tab-bar.js +++ b/ui/app/components/app/tab-bar.js @@ -2,7 +2,7 @@ import React from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' -const TabBar = props => { +const TabBar = (props) => { const { tabs = [], onSelect, isActive } = props return ( diff --git a/ui/app/components/app/token-cell/token-cell.container.js b/ui/app/components/app/token-cell/token-cell.container.js index 176e93008..0cc8f106f 100644 --- a/ui/app/components/app/token-cell/token-cell.container.js +++ b/ui/app/components/app/token-cell/token-cell.container.js @@ -17,7 +17,7 @@ function mapStateToProps (state) { function mapDispatchToProps (dispatch) { return { - setSelectedToken: address => dispatch(setSelectedToken(address)), + setSelectedToken: (address) => dispatch(setSelectedToken(address)), hideSidebar: () => dispatch(hideSidebar()), } } diff --git a/ui/app/components/app/transaction-action/tests/transaction-action.component.test.js b/ui/app/components/app/transaction-action/tests/transaction-action.component.test.js index 2f99ca0cb..5bd0fddfc 100644 --- a/ui/app/components/app/transaction-action/tests/transaction-action.component.test.js +++ b/ui/app/components/app/transaction-action/tests/transaction-action.component.test.js @@ -5,13 +5,13 @@ import sinon from 'sinon' import TransactionAction from '../transaction-action.component' describe('TransactionAction Component', function () { - const t = key => key + const t = (key) => key describe('Outgoing transaction', function () { beforeEach(function () { global.eth = { - getCode: sinon.stub().callsFake(address => { + getCode: sinon.stub().callsFake((address) => { const code = address === 'approveAddress' ? 'contract' : '0x' return Promise.resolve(code) }), diff --git a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.container.test.js b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.container.test.js index f071ea96a..6d72794f3 100644 --- a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.container.test.js +++ b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.container.test.js @@ -5,7 +5,7 @@ let mapStateToProps proxyquire('../transaction-activity-log.container.js', { 'react-redux': { - connect: ms => { + connect: (ms) => { mapStateToProps = ms return () => ({}) }, diff --git a/ui/app/components/app/transaction-activity-log/transaction-activity-log.component.js b/ui/app/components/app/transaction-activity-log/transaction-activity-log.component.js index b37d5efa0..24b057b64 100644 --- a/ui/app/components/app/transaction-activity-log/transaction-activity-log.component.js +++ b/ui/app/components/app/transaction-activity-log/transaction-activity-log.component.js @@ -26,7 +26,7 @@ export default class TransactionActivityLog extends PureComponent { isEarliestNonce: PropTypes.bool, } - handleActivityClick = hash => { + handleActivityClick = (hash) => { const { primaryTransaction } = this.props const { metamaskNetworkId } = primaryTransaction diff --git a/ui/app/components/app/transaction-activity-log/transaction-activity-log.container.js b/ui/app/components/app/transaction-activity-log/transaction-activity-log.container.js index 11b20f245..a6ecb3617 100644 --- a/ui/app/components/app/transaction-activity-log/transaction-activity-log.container.js +++ b/ui/app/components/app/transaction-activity-log/transaction-activity-log.container.js @@ -8,9 +8,9 @@ import { TRANSACTION_CANCEL_ATTEMPTED_EVENT, } from './transaction-activity-log.constants' -const matchesEventKey = matchEventKey => ({ eventKey }) => eventKey === matchEventKey +const matchesEventKey = (matchEventKey) => ({ eventKey }) => eventKey === matchEventKey -const mapStateToProps = state => { +const mapStateToProps = (state) => { return { conversionRate: conversionRateSelector(state), nativeCurrency: getNativeCurrency(state), diff --git a/ui/app/components/app/transaction-activity-log/transaction-activity-log.util.js b/ui/app/components/app/transaction-activity-log/transaction-activity-log.util.js index b1ab275ed..3cd1bb785 100644 --- a/ui/app/components/app/transaction-activity-log/transaction-activity-log.util.js +++ b/ui/app/components/app/transaction-activity-log/transaction-activity-log.util.js @@ -86,7 +86,7 @@ export function getActivities (transaction, isFirstTransaction = false) { } else if (Array.isArray(base)) { const events = [] - base.forEach(entry => { + base.forEach((entry) => { const { op, path, value, timestamp: entryTimestamp } = entry // Not all sub-entries in a history entry have a timestamp. If the sub-entry does not have a // timestamp, the first sub-entry in a history entry should. @@ -194,7 +194,7 @@ function filterSortedActivities (activities) { ))) let addedDroppedActivity = false - activities.forEach(activity => { + activities.forEach((activity) => { if (activity.eventKey === TRANSACTION_DROPPED_EVENT) { if (!hasConfirmedActivity && !addedDroppedActivity) { filteredActivities.push(activity) diff --git a/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js b/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js index d193f9fb9..2fece12dc 100644 --- a/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js +++ b/ui/app/components/app/transaction-list-item-details/transaction-list-item-details.component.js @@ -58,14 +58,14 @@ export default class TransactionListItemDetails extends PureComponent { global.platform.openWindow({ url: getBlockExplorerUrlForTx(metamaskNetworkId, hash, rpcPrefs) }) } - handleCancel = event => { + handleCancel = (event) => { const { transactionGroup: { initialTransaction: { id } = {} } = {}, onCancel } = this.props event.stopPropagation() onCancel(id) } - handleRetry = event => { + handleRetry = (event) => { const { transactionGroup: { initialTransaction: { id } = {} } = {}, onRetry } = this.props event.stopPropagation() diff --git a/ui/app/components/app/transaction-list-item/transaction-list-item.component.js b/ui/app/components/app/transaction-list-item/transaction-list-item.component.js index 8ab08ccad..d89ba1dcb 100644 --- a/ui/app/components/app/transaction-list-item/transaction-list-item.component.js +++ b/ui/app/components/app/transaction-list-item/transaction-list-item.component.js @@ -90,7 +90,7 @@ export default class TransactionListItem extends PureComponent { this.setState({ showTransactionDetails: !showTransactionDetails }) } - handleCancel = id => { + handleCancel = (id) => { const { primaryTransaction: { txParams: { gasPrice } } = {}, transaction: { id: initialTransactionId }, @@ -108,7 +108,7 @@ export default class TransactionListItem extends PureComponent { * transaction. * @param {number} id - Transaction id */ - handleRetry = id => { + handleRetry = (id) => { const { primaryTransaction: { txParams: { gasPrice } } = {}, transaction: { txParams: { to } = {}, id: initialTransactionId }, @@ -134,7 +134,7 @@ export default class TransactionListItem extends PureComponent { }) return fetchBasicGasAndTimeEstimates() - .then(basicEstimates => fetchGasEstimates(basicEstimates.blockTime)) + .then((basicEstimates) => fetchGasEstimates(basicEstimates.blockTime)) .then(retryTransaction(retryId, gasPrice)) } diff --git a/ui/app/components/app/transaction-list-item/transaction-list-item.container.js b/ui/app/components/app/transaction-list-item/transaction-list-item.container.js index 26ccec1f7..9569040bb 100644 --- a/ui/app/components/app/transaction-list-item/transaction-list-item.container.js +++ b/ui/app/components/app/transaction-list-item/transaction-list-item.container.js @@ -32,7 +32,7 @@ const mapStateToProps = (state, ownProps) => { const selectedAddress = getSelectedAddress(state) const selectedAccountBalance = accounts[selectedAddress].balance const isDeposit = transactionCategory === 'incoming' - const selectRpcInfo = frequentRpcListDetail.find(rpcInfo => rpcInfo.rpcUrl === provider.rpcTarget) + const selectRpcInfo = frequentRpcListDetail.find((rpcInfo) => rpcInfo.rpcUrl === provider.rpcTarget) const { rpcPrefs } = selectRpcInfo || {} const hasEnoughCancelGas = primaryTransaction.txParams && isBalanceSufficient({ @@ -58,12 +58,12 @@ const mapStateToProps = (state, ownProps) => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { fetchBasicGasAndTimeEstimates: () => dispatch(fetchBasicGasAndTimeEstimates()), fetchGasEstimates: (blockTime) => dispatch(fetchGasEstimates(blockTime)), - setSelectedToken: tokenAddress => dispatch(setSelectedToken(tokenAddress)), - getContractMethodData: methodData => dispatch(getContractMethodData(methodData)), + setSelectedToken: (tokenAddress) => dispatch(setSelectedToken(tokenAddress)), + getContractMethodData: (methodData) => dispatch(getContractMethodData(methodData)), retryTransaction: (transaction, gasPrice) => { dispatch(setCustomGasPriceForRetry(gasPrice || transaction.txParams.gasPrice)) dispatch(setCustomGasLimit(transaction.txParams.gas)) @@ -100,7 +100,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { primaryTransaction, retryTransaction: (transactionId, gasPrice) => { const { transactionGroup: { transactions = [] } } = ownProps - const transaction = transactions.find(tx => tx.id === transactionId) || {} + const transaction = transactions.find((tx) => tx.id === transactionId) || {} const increasedGasPrice = increaseLastGasPrice(gasPrice) retryTransaction(transaction, increasedGasPrice) }, diff --git a/ui/app/components/app/transaction-list/transaction-list.container.js b/ui/app/components/app/transaction-list/transaction-list.container.js index 0695c28c2..a6f08603f 100644 --- a/ui/app/components/app/transaction-list/transaction-list.container.js +++ b/ui/app/components/app/transaction-list/transaction-list.container.js @@ -23,9 +23,9 @@ const mapStateToProps = (state) => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { - updateNetworkNonce: address => dispatch(updateNetworkNonce(address)), + updateNetworkNonce: (address) => dispatch(updateNetworkNonce(address)), fetchGasEstimates: (blockTime) => dispatch(fetchGasEstimates(blockTime)), fetchBasicGasAndTimeEstimates: () => dispatch(fetchBasicGasAndTimeEstimates()), } diff --git a/ui/app/components/app/transaction-status/tests/transaction-status.component.test.js b/ui/app/components/app/transaction-status/tests/transaction-status.component.test.js index f37bebb6f..510950248 100644 --- a/ui/app/components/app/transaction-status/tests/transaction-status.component.test.js +++ b/ui/app/components/app/transaction-status/tests/transaction-status.component.test.js @@ -11,7 +11,7 @@ describe('TransactionStatus Component', function () { statusKey="approved" title="test-title" />, - { context: { t: str => str.toUpperCase() } } + { context: { t: (str) => str.toUpperCase() } } ) assert.ok(wrapper) @@ -24,7 +24,7 @@ describe('TransactionStatus Component', function () { , - { context: { t: str => str.toUpperCase() } } + { context: { t: (str) => str.toUpperCase() } } ) assert.ok(wrapper) diff --git a/ui/app/components/app/transaction-view-balance/transaction-view-balance.container.js b/ui/app/components/app/transaction-view-balance/transaction-view-balance.container.js index 41a4525dc..b85e9d0fe 100644 --- a/ui/app/components/app/transaction-view-balance/transaction-view-balance.container.js +++ b/ui/app/components/app/transaction-view-balance/transaction-view-balance.container.js @@ -14,7 +14,7 @@ import { } from '../../../selectors/selectors' import { showModal } from '../../../store/actions' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { showFiatInTestnets } = preferencesSelector(state) const isMainnet = getIsMainnet(state) const selectedAddress = getSelectedAddress(state) @@ -34,7 +34,7 @@ const mapStateToProps = state => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { showDepositModal: () => dispatch(showModal({ name: 'DEPOSIT_ETHER' })), } diff --git a/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.container.test.js b/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.container.test.js index b4bbdf109..84c67f453 100644 --- a/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.container.test.js +++ b/ui/app/components/app/user-preferenced-currency-input/tests/user-preferenced-currency-input.container.test.js @@ -5,7 +5,7 @@ let mapStateToProps proxyquire('../user-preferenced-currency-input.container.js', { 'react-redux': { - connect: ms => { + connect: (ms) => { mapStateToProps = ms return () => ({}) }, diff --git a/ui/app/components/app/user-preferenced-currency-input/user-preferenced-currency-input.container.js b/ui/app/components/app/user-preferenced-currency-input/user-preferenced-currency-input.container.js index 72f17fde4..4f3795c6d 100644 --- a/ui/app/components/app/user-preferenced-currency-input/user-preferenced-currency-input.container.js +++ b/ui/app/components/app/user-preferenced-currency-input/user-preferenced-currency-input.container.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux' import UserPreferencedCurrencyInput from './user-preferenced-currency-input.component' import { preferencesSelector } from '../../../selectors/selectors' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { useNativeCurrencyAsPrimaryCurrency } = preferencesSelector(state) return { diff --git a/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.container.test.js b/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.container.test.js index fac111fd8..f7bef30e4 100644 --- a/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.container.test.js +++ b/ui/app/components/app/user-preferenced-token-input/tests/user-preferenced-token-input.container.test.js @@ -5,7 +5,7 @@ let mapStateToProps proxyquire('../user-preferenced-token-input.container.js', { 'react-redux': { - connect: ms => { + connect: (ms) => { mapStateToProps = ms return () => ({}) }, diff --git a/ui/app/components/app/user-preferenced-token-input/user-preferenced-token-input.container.js b/ui/app/components/app/user-preferenced-token-input/user-preferenced-token-input.container.js index 4a20b20d9..6263928ba 100644 --- a/ui/app/components/app/user-preferenced-token-input/user-preferenced-token-input.container.js +++ b/ui/app/components/app/user-preferenced-token-input/user-preferenced-token-input.container.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux' import UserPreferencedTokenInput from './user-preferenced-token-input.component' import { preferencesSelector } from '../../../selectors/selectors' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { useNativeCurrencyAsPrimaryCurrency } = preferencesSelector(state) return { diff --git a/ui/app/components/ui/alert/index.js b/ui/app/components/ui/alert/index.js index 707ac7a3a..3bc1b4581 100644 --- a/ui/app/components/ui/alert/index.js +++ b/ui/app/components/ui/alert/index.js @@ -31,7 +31,7 @@ class Alert extends Component { className: 'hidden', }) - setTimeout(_ => { + setTimeout((_) => { this.setState({ visible: false }) }, 500) diff --git a/ui/app/components/ui/balance/balance.container.js b/ui/app/components/ui/balance/balance.container.js index 2ad5c5ad8..997935ee7 100644 --- a/ui/app/components/ui/balance/balance.container.js +++ b/ui/app/components/ui/balance/balance.container.js @@ -10,7 +10,7 @@ import { preferencesSelector, } from '../../../selectors/selectors' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { showFiatInTestnets } = preferencesSelector(state) const isMainnet = getIsMainnet(state) const accounts = getMetaMaskAccounts(state) diff --git a/ui/app/components/ui/button-group/tests/button-group-component.test.js b/ui/app/components/ui/button-group/tests/button-group-component.test.js index 5e304bc7c..755b0789d 100644 --- a/ui/app/components/ui/button-group/tests/button-group-component.test.js +++ b/ui/app/components/ui/button-group/tests/button-group-component.test.js @@ -92,7 +92,7 @@ describe('ButtonGroup Component', function () { it('should render all child buttons as disabled if props.disabled is true', function () { const childButtons = wrapper.find('.button-group__button') - childButtons.forEach(button => { + childButtons.forEach((button) => { assert.equal(button.props().disabled, undefined) }) wrapper.setProps({ disabled: true }) diff --git a/ui/app/components/ui/currency-display/currency-display.container.js b/ui/app/components/ui/currency-display/currency-display.container.js index 803c11f68..30055e31b 100644 --- a/ui/app/components/ui/currency-display/currency-display.container.js +++ b/ui/app/components/ui/currency-display/currency-display.container.js @@ -4,7 +4,7 @@ import CurrencyDisplay from './currency-display.component' import { getValueFromWeiHex, formatCurrency } from '../../../helpers/utils/confirm-tx.util' import { GWEI } from '../../../helpers/constants/common' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { metamask: { nativeCurrency, currentCurrency, conversionRate } } = state return { diff --git a/ui/app/components/ui/currency-input/currency-input.component.js b/ui/app/components/ui/currency-input/currency-input.component.js index 398b49884..f17fb5792 100644 --- a/ui/app/components/ui/currency-input/currency-input.component.js +++ b/ui/app/components/ui/currency-input/currency-input.component.js @@ -83,7 +83,7 @@ export default class CurrencyInput extends PureComponent { }) } - handleChange = decimalValue => { + handleChange = (decimalValue) => { const { currentCurrency: fromCurrency, conversionRate, onChange } = this.props const hexValue = this.shouldUseFiat() diff --git a/ui/app/components/ui/currency-input/currency-input.container.js b/ui/app/components/ui/currency-input/currency-input.container.js index 0c76d6ce5..64a8d96b4 100644 --- a/ui/app/components/ui/currency-input/currency-input.container.js +++ b/ui/app/components/ui/currency-input/currency-input.container.js @@ -4,7 +4,7 @@ import { ETH } from '../../../helpers/constants/common' import { getMaxModeOn } from '../../../pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.selectors' import { getIsMainnet, preferencesSelector } from '../../../selectors/selectors' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { metamask: { nativeCurrency, currentCurrency, conversionRate } } = state const { showFiatInTestnets } = preferencesSelector(state) const isMainnet = getIsMainnet(state) diff --git a/ui/app/components/ui/currency-input/tests/currency-input.component.test.js b/ui/app/components/ui/currency-input/tests/currency-input.component.test.js index 471cb9f6b..7f8e54dbe 100644 --- a/ui/app/components/ui/currency-input/tests/currency-input.component.test.js +++ b/ui/app/components/ui/currency-input/tests/currency-input.component.test.js @@ -137,7 +137,7 @@ describe('CurrencyInput Component', function () { /> , { - context: { t: str => str + '_t' }, + context: { t: (str) => str + '_t' }, childContextTypes: { t: PropTypes.func }, } ) diff --git a/ui/app/components/ui/editable-label.js b/ui/app/components/ui/editable-label.js index bf1f290d0..553965b1c 100644 --- a/ui/app/components/ui/editable-label.js +++ b/ui/app/components/ui/editable-label.js @@ -40,7 +40,7 @@ class EditableLabel extends Component { this.handleSubmit() } }} - onChange={event => this.setState({ value: event.target.value })} + onChange={(event) => this.setState({ value: event.target.value })} className={classnames('large-input', 'editable-label__input', { 'editable-label__input--error': value === '', })} diff --git a/ui/app/components/ui/error-message/tests/error-message.component.test.js b/ui/app/components/ui/error-message/tests/error-message.component.test.js index 40e77161b..2f13b24eb 100644 --- a/ui/app/components/ui/error-message/tests/error-message.component.test.js +++ b/ui/app/components/ui/error-message/tests/error-message.component.test.js @@ -4,7 +4,7 @@ import { shallow } from 'enzyme' import ErrorMessage from '../error-message.component' describe('ErrorMessage Component', function () { - const t = key => `translate ${key}` + const t = (key) => `translate ${key}` it('should render a message from props.errorMessage', function () { const wrapper = shallow( diff --git a/ui/app/components/ui/identicon/identicon.component.js b/ui/app/components/ui/identicon/identicon.component.js index 913b8d493..5fed06304 100644 --- a/ui/app/components/ui/identicon/identicon.component.js +++ b/ui/app/components/ui/identicon/identicon.component.js @@ -7,7 +7,7 @@ import BlockieIdenticon from './blockieIdenticon' import { checksumAddress } from '../../../helpers/utils/util' import Jazzicon from '../jazzicon' -const getStyles = diameter => ( +const getStyles = (diameter) => ( { height: diameter, width: diameter, diff --git a/ui/app/components/ui/identicon/identicon.container.js b/ui/app/components/ui/identicon/identicon.container.js index bc49bc18e..8565a2df2 100644 --- a/ui/app/components/ui/identicon/identicon.container.js +++ b/ui/app/components/ui/identicon/identicon.container.js @@ -1,7 +1,7 @@ import { connect } from 'react-redux' import Identicon from './identicon.component' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { metamask: { useBlockie } } = state return { diff --git a/ui/app/components/ui/page-container/page-container-footer/page-container-footer.component.js b/ui/app/components/ui/page-container/page-container-footer/page-container-footer.component.js index 7927c20d8..b9c0b554a 100644 --- a/ui/app/components/ui/page-container/page-container-footer/page-container-footer.component.js +++ b/ui/app/components/ui/page-container/page-container-footer/page-container-footer.component.js @@ -44,7 +44,7 @@ export default class PageContainerFooter extends Component { type={cancelButtonType || 'default'} large={buttonSizeLarge} className="page-container__footer-button" - onClick={e => onCancel(e)} + onClick={(e) => onCancel(e)} data-testid="page-container-footer-cancel" > { cancelText || this.context.t('cancel') } @@ -56,7 +56,7 @@ export default class PageContainerFooter extends Component { large={buttonSizeLarge} className="page-container__footer-button" disabled={disabled} - onClick={e => onSubmit(e)} + onClick={(e) => onSubmit(e)} data-testid="page-container-footer-next" > { submitText || this.context.t('next') } diff --git a/ui/app/components/ui/page-container/page-container.component.js b/ui/app/components/ui/page-container/page-container.component.js index 45dfff517..8ea9aa6b0 100644 --- a/ui/app/components/ui/page-container/page-container.component.js +++ b/ui/app/components/ui/page-container/page-container.component.js @@ -48,7 +48,7 @@ export default class PageContainer extends PureComponent { return React.Children.map(tabsComponent.props.children, (child, tabIndex) => { return child && React.cloneElement(child, { - onClick: index => this.handleTabClick(index), + onClick: (index) => this.handleTabClick(index), tabIndex, isActive: numberOfTabs > 1 && tabIndex === this.state.activeTabIndex, key: tabIndex, @@ -61,7 +61,7 @@ export default class PageContainer extends PureComponent { renderActiveTabContent () { const { tabsComponent } = this.props let { children } = tabsComponent.props - children = children.filter(child => child) + children = children.filter((child) => child) const { activeTabIndex } = this.state return children[activeTabIndex] diff --git a/ui/app/components/ui/readonly-input.js b/ui/app/components/ui/readonly-input.js index f78c48027..b884da1bc 100644 --- a/ui/app/components/ui/readonly-input.js +++ b/ui/app/components/ui/readonly-input.js @@ -18,7 +18,7 @@ export default function ReadOnlyInput (props) { className={inputClass} value={value} readOnly - onFocus={event => event.target.select()} + onFocus={(event) => event.target.select()} onClick={onClick} />
diff --git a/ui/app/components/ui/tabs/tab/tab.component.js b/ui/app/components/ui/tabs/tab/tab.component.js index 9e590391c..d01f3a591 100644 --- a/ui/app/components/ui/tabs/tab/tab.component.js +++ b/ui/app/components/ui/tabs/tab/tab.component.js @@ -2,7 +2,7 @@ import React from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' -const Tab = props => { +const Tab = (props) => { const { name, onClick, isActive, tabIndex, className, activeClassName } = props return ( @@ -11,7 +11,7 @@ const Tab = props => { className, { [activeClassName]: isActive }, )} - onClick={event => { + onClick={(event) => { event.preventDefault() onClick(tabIndex) }} diff --git a/ui/app/components/ui/tabs/tabs.component.js b/ui/app/components/ui/tabs/tabs.component.js index 7d8230189..383332ac9 100644 --- a/ui/app/components/ui/tabs/tabs.component.js +++ b/ui/app/components/ui/tabs/tabs.component.js @@ -30,7 +30,7 @@ export default class Tabs extends Component { return React.Children.map(this.props.children, (child, index) => { return child && React.cloneElement(child, { - onClick: index => this.handleTabClick(index), + onClick: (index) => this.handleTabClick(index), tabIndex: index, isActive: numberOfTabs > 1 && index === this.state.activeTabIndex, key: index, diff --git a/ui/app/components/ui/toggle-button/toggle-button.component.js b/ui/app/components/ui/toggle-button/toggle-button.component.js index 3f13203a5..38ffb27fd 100644 --- a/ui/app/components/ui/toggle-button/toggle-button.component.js +++ b/ui/app/components/ui/toggle-button/toggle-button.component.js @@ -45,7 +45,7 @@ const colors = { }, } -const ToggleButton = props => { +const ToggleButton = (props) => { const { value, onToggle, offLabel, onLabel } = props return ( diff --git a/ui/app/components/ui/token-balance/token-balance.container.js b/ui/app/components/ui/token-balance/token-balance.container.js index 6425f89d9..6198bcc5c 100644 --- a/ui/app/components/ui/token-balance/token-balance.container.js +++ b/ui/app/components/ui/token-balance/token-balance.container.js @@ -4,7 +4,7 @@ import withTokenTracker from '../../../helpers/higher-order-components/with-toke import TokenBalance from './token-balance.component' import { getSelectedAddress } from '../../../selectors/selectors' -const mapStateToProps = state => { +const mapStateToProps = (state) => { return { userAddress: getSelectedAddress(state), } diff --git a/ui/app/components/ui/token-input/tests/token-input.component.test.js b/ui/app/components/ui/token-input/tests/token-input.component.test.js index 75f400c90..3cf121bdb 100644 --- a/ui/app/components/ui/token-input/tests/token-input.component.test.js +++ b/ui/app/components/ui/token-input/tests/token-input.component.test.js @@ -10,7 +10,7 @@ import UnitInput from '../../unit-input' import CurrencyDisplay from '../../currency-display' describe('TokenInput Component', function () { - const t = key => `translate ${key}` + const t = (key) => `translate ${key}` describe('rendering', function () { it('should render properly without a token', function () { diff --git a/ui/app/components/ui/token-input/token-input.component.js b/ui/app/components/ui/token-input/token-input.component.js index aed6c7d3f..c7c025658 100644 --- a/ui/app/components/ui/token-input/token-input.component.js +++ b/ui/app/components/ui/token-input/token-input.component.js @@ -66,7 +66,7 @@ export default class TokenInput extends PureComponent { return Number(decimalValueString) ? decimalValueString : '' } - handleChange = decimalValue => { + handleChange = (decimalValue) => { const { selectedToken: { decimals } = {}, onChange } = this.props const multiplier = Math.pow(10, Number(decimals || 0)) diff --git a/ui/app/components/ui/token-input/token-input.container.js b/ui/app/components/ui/token-input/token-input.container.js index 8c867e8e6..7d614f7c4 100644 --- a/ui/app/components/ui/token-input/token-input.container.js +++ b/ui/app/components/ui/token-input/token-input.container.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux' import TokenInput from './token-input.component' import { getIsMainnet, getSelectedToken, getSelectedTokenExchangeRate, preferencesSelector } from '../../../selectors/selectors' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { metamask: { currentCurrency } } = state const { showFiatInTestnets } = preferencesSelector(state) const isMainnet = getIsMainnet(state) diff --git a/ui/app/components/ui/unit-input/unit-input.component.js b/ui/app/components/ui/unit-input/unit-input.component.js index 83170ec24..d2368291f 100644 --- a/ui/app/components/ui/unit-input/unit-input.component.js +++ b/ui/app/components/ui/unit-input/unit-input.component.js @@ -43,7 +43,7 @@ export default class UnitInput extends PureComponent { this.unitInput.focus() } - handleChange = event => { + handleChange = (event) => { const { value: userInput } = event.target let value = userInput @@ -81,7 +81,7 @@ export default class UnitInput extends PureComponent { placeholder={placeholder} onChange={this.handleChange} style={{ width: this.getInputWidth(value) }} - ref={ref => { + ref={(ref) => { this.unitInput = ref }} disabled={maxModeOn} diff --git a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js index e05445441..150ac1d06 100644 --- a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js +++ b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.js @@ -24,7 +24,7 @@ import { conversionUtil } from '../../helpers/utils/conversion-util' import { addHexPrefix } from 'ethereumjs-util' // Actions -const createActionType = action => `metamask/confirm-transaction/${action}` +const createActionType = (action) => `metamask/confirm-transaction/${action}` const UPDATE_TX_DATA = createActionType('UPDATE_TX_DATA') const CLEAR_TX_DATA = createActionType('CLEAR_TX_DATA') diff --git a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js index ca59ca14c..606e989d6 100644 --- a/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js +++ b/ui/app/ducks/confirm-transaction/confirm-transaction.duck.test.js @@ -482,7 +482,7 @@ describe('Confirm Transaction Duck', function () { beforeEach(function () { global.eth = { getCode: sinon.stub().callsFake( - address => Promise.resolve(address && address.match(/isContract/) ? 'not-0x' : '0x') + (address) => Promise.resolve(address && address.match(/isContract/) ? 'not-0x' : '0x') ), } }) diff --git a/ui/app/ducks/gas/gas-duck.test.js b/ui/app/ducks/gas/gas-duck.test.js index 8583d61db..87db1e423 100644 --- a/ui/app/ducks/gas/gas-duck.test.js +++ b/ui/app/ducks/gas/gas-duck.test.js @@ -66,12 +66,12 @@ describe('Gas Duck', function () { { expectedTime: 1.1, expectedWait: 0.6, gasprice: 19.9, somethingElse: 'foobar' }, { expectedTime: 1, expectedWait: 0.5, gasprice: 20, somethingElse: 'foobar' }, ] - const fakeFetch = (url) => new Promise(resolve => { + const fakeFetch = (url) => new Promise((resolve) => { const dataToResolve = url.match(/ethgasAPI/) ? mockEthGasApiResponse : mockPredictTableResponse resolve({ - json: () => new Promise(resolve => resolve(dataToResolve)), + json: () => new Promise((resolve) => resolve(dataToResolve)), }) }) @@ -648,7 +648,7 @@ describe('Gas Duck', function () { const { type: thirdDispatchCallType, value: priceAndTimeEstimateResult } = mockDistpatch.getCall(2).args[0] assert.equal(thirdDispatchCallType, SET_PRICE_AND_TIME_ESTIMATES) assert(priceAndTimeEstimateResult.length < mockPredictTableResponse.length * 3 - 2) - assert(!priceAndTimeEstimateResult.find(d => d.expectedTime > 100)) + assert(!priceAndTimeEstimateResult.find((d) => d.expectedTime > 100)) assert(!priceAndTimeEstimateResult.find((d, _, a) => a[a + 1] && d.expectedTime > a[a + 1].expectedTime)) assert(!priceAndTimeEstimateResult.find((d, _, a) => a[a + 1] && d.gasprice > a[a + 1].gasprice)) diff --git a/ui/app/ducks/gas/gas.duck.js b/ui/app/ducks/gas/gas.duck.js index 13a0fc5a1..36148ecc0 100644 --- a/ui/app/ducks/gas/gas.duck.js +++ b/ui/app/ducks/gas/gas.duck.js @@ -218,7 +218,7 @@ async function fetchExternalBasicGasEstimates (dispatch) { fastTimes10, fastestTimes10, safeLowTimes10, - ].map(price => (new BigNumber(price)).div(10).toNumber()) + ].map((price) => (new BigNumber(price)).div(10).toNumber()) const basicEstimates = { safeLow, @@ -286,7 +286,7 @@ async function fetchExternalBasicGasAndTimeEstimates (dispatch) { fastTimes10, fastestTimes10, safeLowTimes10, - ].map(price => (new BigNumber(price)).div(10).toNumber()) + ].map((price) => (new BigNumber(price)).div(10).toNumber()) const basicEstimates = { average, @@ -350,11 +350,11 @@ function quartiles (data) { } function inliersByIQR (data, prop) { - const { lowerQuartile, upperQuartile } = quartiles(data.map(d => (prop ? d[prop] : d))) + const { lowerQuartile, upperQuartile } = quartiles(data.map((d) => (prop ? d[prop] : d))) const IQR = upperQuartile - lowerQuartile const lowerBound = lowerQuartile - 1.5 * IQR const upperBound = upperQuartile + 1.5 * IQR - return data.filter(d => { + return data.filter((d) => { const value = prop ? d[prop] : d return value >= lowerBound && value <= upperBound }) @@ -385,8 +385,8 @@ export function fetchGasEstimates (blockTime) { 'method': 'GET', 'mode': 'cors' } ) - .then(r => r.json()) - .then(r => { + .then((r) => r.json()) + .then((r) => { const estimatedPricesAndTimes = r.map(({ expectedTime, expectedWait, gasprice }) => ({ expectedTime, expectedWait, gasprice })) const estimatedTimeWithUniquePrices = uniqBy(({ expectedTime }) => expectedTime, estimatedPricesAndTimes) @@ -439,7 +439,7 @@ export function fetchGasEstimates (blockTime) { : loadLocalStorageData('GAS_API_ESTIMATES') ) - return promiseToFetch.then(estimates => { + return promiseToFetch.then((estimates) => { dispatch(setPricesAndTimeEstimates(estimates)) dispatch(gasEstimatesLoadingFinished()) }) diff --git a/ui/app/ducks/metamask/metamask.js b/ui/app/ducks/metamask/metamask.js index ce2b52a85..26ebb8761 100644 --- a/ui/app/ducks/metamask/metamask.js +++ b/ui/app/ducks/metamask/metamask.js @@ -280,7 +280,7 @@ export default function reduceMetamask (state = {}, action) { case actions.UPDATE_TRANSACTION_PARAMS: const { id: txId, value } = action let { selectedAddressTxList } = metamaskState - selectedAddressTxList = selectedAddressTxList.map(tx => { + selectedAddressTxList = selectedAddressTxList.map((tx) => { if (tx.id === txId) { const newTx = Object.assign({}, tx) newTx.txParams = value diff --git a/ui/app/helpers/higher-order-components/authenticated/authenticated.container.js b/ui/app/helpers/higher-order-components/authenticated/authenticated.container.js index 8fc637332..3b67b2cfe 100644 --- a/ui/app/helpers/higher-order-components/authenticated/authenticated.container.js +++ b/ui/app/helpers/higher-order-components/authenticated/authenticated.container.js @@ -1,7 +1,7 @@ import { connect } from 'react-redux' import Authenticated from './authenticated.component' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { metamask: { isUnlocked, completedOnboarding } } = state return { diff --git a/ui/app/helpers/higher-order-components/i18n-provider.js b/ui/app/helpers/higher-order-components/i18n-provider.js index 3add2ad85..56a55d95b 100644 --- a/ui/app/helpers/higher-order-components/i18n-provider.js +++ b/ui/app/helpers/higher-order-components/i18n-provider.js @@ -49,7 +49,7 @@ I18nProvider.childContextTypes = { tOrKey: PropTypes.func, } -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { localeMessages, metamask: { currentLocale } } = state return { currentLocale, diff --git a/ui/app/helpers/higher-order-components/initialized/initialized.container.js b/ui/app/helpers/higher-order-components/initialized/initialized.container.js index 0e7f72bcb..245655962 100644 --- a/ui/app/helpers/higher-order-components/initialized/initialized.container.js +++ b/ui/app/helpers/higher-order-components/initialized/initialized.container.js @@ -1,7 +1,7 @@ import { connect } from 'react-redux' import Initialized from './initialized.component' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { metamask: { completedOnboarding } } = state return { diff --git a/ui/app/helpers/higher-order-components/metametrics/metametrics.provider.js b/ui/app/helpers/higher-order-components/metametrics/metametrics.provider.js index 5383b9a28..1cc0cfdcb 100644 --- a/ui/app/helpers/higher-order-components/metametrics/metametrics.provider.js +++ b/ui/app/helpers/higher-order-components/metametrics/metametrics.provider.js @@ -103,7 +103,7 @@ class MetaMetricsProvider extends Component { } } -const mapStateToProps = state => { +const mapStateToProps = (state) => { const txData = txDataSelector(state) || {} return { diff --git a/ui/app/helpers/higher-order-components/with-modal-props/with-modal-props.js b/ui/app/helpers/higher-order-components/with-modal-props/with-modal-props.js index aac6b5a61..b702ff24f 100644 --- a/ui/app/helpers/higher-order-components/with-modal-props/with-modal-props.js +++ b/ui/app/helpers/higher-order-components/with-modal-props/with-modal-props.js @@ -1,7 +1,7 @@ import { connect } from 'react-redux' import { hideModal } from '../../../store/actions' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { appState } = state const { props: modalProps } = appState.modal.modalState @@ -10,7 +10,7 @@ const mapStateToProps = state => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { hideModal: () => dispatch(hideModal()), } diff --git a/ui/app/helpers/higher-order-components/with-token-tracker/with-token-tracker.component.js b/ui/app/helpers/higher-order-components/with-token-tracker/with-token-tracker.component.js index 838401421..06c5006c8 100644 --- a/ui/app/helpers/higher-order-components/with-token-tracker/with-token-tracker.component.js +++ b/ui/app/helpers/higher-order-components/with-token-tracker/with-token-tracker.component.js @@ -62,10 +62,10 @@ export default function withTokenTracker (WrappedComponent) { this.tracker.updateBalances() .then(() => this.updateBalance(this.tracker.serialize())) - .catch(error => this.setState({ error: error.message })) + .catch((error) => this.setState({ error: error.message })) } - setError = error => { + setError = (error) => { this.setState({ error }) } diff --git a/ui/app/helpers/utils/common.util.js b/ui/app/helpers/utils/common.util.js index 0c02481e6..a45fdc407 100644 --- a/ui/app/helpers/utils/common.util.js +++ b/ui/app/helpers/utils/common.util.js @@ -1,5 +1,5 @@ export function camelCaseToCapitalize (str = '') { return str .replace(/([A-Z])/g, ' $1') - .replace(/^./, str => str.toUpperCase()) + .replace(/^./, (str) => str.toUpperCase()) } diff --git a/ui/app/helpers/utils/confirm-tx.util.js b/ui/app/helpers/utils/confirm-tx.util.js index 853427b31..0895cf7b0 100644 --- a/ui/app/helpers/utils/confirm-tx.util.js +++ b/ui/app/helpers/utils/confirm-tx.util.js @@ -94,7 +94,7 @@ export function getTransactionFee ({ export function formatCurrency (value, currencyCode) { const upperCaseCurrencyCode = currencyCode.toUpperCase() - return currencies.find(currency => currency.code === upperCaseCurrencyCode) + return currencies.find((currency) => currency.code === upperCaseCurrencyCode) ? currencyFormatter.format(Number(value), { code: upperCaseCurrencyCode, style: 'currency' }) : value } diff --git a/ui/app/helpers/utils/conversion-util.js b/ui/app/helpers/utils/conversion-util.js index 0c3e42a5d..b65c831af 100644 --- a/ui/app/helpers/utils/conversion-util.js +++ b/ui/app/helpers/utils/conversion-util.js @@ -40,31 +40,31 @@ const BIG_NUMBER_ETH_MULTIPLIER = new BigNumber('1') // Setter Maps const toBigNumber = { - hex: n => new BigNumber(stripHexPrefix(n), 16), - dec: n => new BigNumber(String(n), 10), - BN: n => new BigNumber(n.toString(16), 16), + hex: (n) => new BigNumber(stripHexPrefix(n), 16), + dec: (n) => new BigNumber(String(n), 10), + BN: (n) => new BigNumber(n.toString(16), 16), } const toNormalizedDenomination = { - WEI: bigNumber => bigNumber.div(BIG_NUMBER_WEI_MULTIPLIER), - GWEI: bigNumber => bigNumber.div(BIG_NUMBER_GWEI_MULTIPLIER), - ETH: bigNumber => bigNumber.div(BIG_NUMBER_ETH_MULTIPLIER), + WEI: (bigNumber) => bigNumber.div(BIG_NUMBER_WEI_MULTIPLIER), + GWEI: (bigNumber) => bigNumber.div(BIG_NUMBER_GWEI_MULTIPLIER), + ETH: (bigNumber) => bigNumber.div(BIG_NUMBER_ETH_MULTIPLIER), } const toSpecifiedDenomination = { - WEI: bigNumber => bigNumber.times(BIG_NUMBER_WEI_MULTIPLIER).round(), - GWEI: bigNumber => bigNumber.times(BIG_NUMBER_GWEI_MULTIPLIER).round(9), - ETH: bigNumber => bigNumber.times(BIG_NUMBER_ETH_MULTIPLIER).round(9), + WEI: (bigNumber) => bigNumber.times(BIG_NUMBER_WEI_MULTIPLIER).round(), + GWEI: (bigNumber) => bigNumber.times(BIG_NUMBER_GWEI_MULTIPLIER).round(9), + ETH: (bigNumber) => bigNumber.times(BIG_NUMBER_ETH_MULTIPLIER).round(9), } const baseChange = { - hex: n => n.toString(16), - dec: n => (new BigNumber(n)).toString(10), - BN: n => new BN(n.toString(16)), + hex: (n) => n.toString(16), + dec: (n) => (new BigNumber(n)).toString(10), + BN: (n) => new BN(n.toString(16)), } // Individual Setters const convert = R.invoker(1, 'times') const round = R.invoker(2, 'round')(R.__, BigNumber.ROUND_HALF_DOWN) const roundDown = R.invoker(2, 'round')(R.__, BigNumber.ROUND_DOWN) -const invertConversionRate = conversionRate => () => new BigNumber(1.0).div(conversionRate) +const invertConversionRate = (conversionRate) => () => new BigNumber(1.0).div(conversionRate) const decToBigNumberViaString = () => R.pipe(String, toBigNumber['dec']) // Predicates diff --git a/ui/app/helpers/utils/switch-direction.js b/ui/app/helpers/utils/switch-direction.js index 171ead675..2ccbfbaf0 100644 --- a/ui/app/helpers/utils/switch-direction.js +++ b/ui/app/helpers/utils/switch-direction.js @@ -8,8 +8,8 @@ const switchDirection = async (direction) => { } let updatedLink Array.from(document.getElementsByTagName('link')) - .filter(link => link.rel === 'stylesheet') - .forEach(link => { + .filter((link) => link.rel === 'stylesheet') + .forEach((link) => { if (link.title === direction && link.disabled) { link.disabled = false updatedLink = link diff --git a/ui/app/helpers/utils/token-util.js b/ui/app/helpers/utils/token-util.js index 48e76a5c5..ac34b0882 100644 --- a/ui/app/helpers/utils/token-util.js +++ b/ui/app/helpers/utils/token-util.js @@ -134,11 +134,11 @@ export function calcTokenValue (value, decimals) { } export function getTokenValue (tokenParams = []) { - const valueData = tokenParams.find(param => param.name === '_value') + const valueData = tokenParams.find((param) => param.name === '_value') return valueData && valueData.value } export function getTokenToAddress (tokenParams = []) { - const toAddressData = tokenParams.find(param => param.name === '_to') + const toAddressData = tokenParams.find((param) => param.name === '_to') return toAddressData ? toAddressData.value : tokenParams[0].value } diff --git a/ui/app/pages/add-token/add-token.component.js b/ui/app/pages/add-token/add-token.component.js index 1fa9db909..fcfb4cf8b 100644 --- a/ui/app/pages/add-token/add-token.component.js +++ b/ui/app/pages/add-token/add-token.component.js @@ -49,7 +49,7 @@ class AddToken extends Component { let selectedTokens = {} let customToken = {} - pendingTokenKeys.forEach(tokenAddress => { + pendingTokenKeys.forEach((tokenAddress) => { const token = pendingTokens[tokenAddress] const { isCustom } = token @@ -228,7 +228,7 @@ class AddToken extends Component { label={this.context.t('tokenContractAddress')} type="text" value={customAddress} - onChange={e => this.handleCustomAddressChange(e.target.value)} + onChange={(e) => this.handleCustomAddressChange(e.target.value)} error={customAddressError} fullWidth margin="normal" @@ -252,7 +252,7 @@ class AddToken extends Component { )} type="text" value={customSymbol} - onChange={e => this.handleCustomSymbolChange(e.target.value)} + onChange={(e) => this.handleCustomSymbolChange(e.target.value)} error={customSymbolError} fullWidth margin="normal" @@ -263,7 +263,7 @@ class AddToken extends Component { label={this.context.t('decimal')} type="number" value={customDecimals} - onChange={e => this.handleCustomDecimalsChange(e.target.value)} + onChange={(e) => this.handleCustomDecimalsChange(e.target.value)} error={customDecimalsError} fullWidth margin="normal" @@ -286,7 +286,7 @@ class AddToken extends Component { this.handleToggleToken(token)} + onToggleToken={(token) => this.handleToggleToken(token)} />
diff --git a/ui/app/pages/add-token/add-token.container.js b/ui/app/pages/add-token/add-token.container.js index 779dcf451..af9334106 100644 --- a/ui/app/pages/add-token/add-token.container.js +++ b/ui/app/pages/add-token/add-token.container.js @@ -12,9 +12,9 @@ const mapStateToProps = ({ metamask }) => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { - setPendingTokens: tokens => dispatch(setPendingTokens(tokens)), + setPendingTokens: (tokens) => dispatch(setPendingTokens(tokens)), clearPendingTokens: () => dispatch(clearPendingTokens()), } } diff --git a/ui/app/pages/add-token/token-search/token-search.component.js b/ui/app/pages/add-token/token-search/token-search.component.js index eee841654..9cb3425b3 100644 --- a/ui/app/pages/add-token/token-search/token-search.component.js +++ b/ui/app/pages/add-token/token-search/token-search.component.js @@ -7,7 +7,7 @@ import TextField from '../../../components/ui/text-field' const contractList = Object.entries(contractMap) .map(([ _, tokenData]) => tokenData) - .filter(tokenData => Boolean(tokenData.erc20)) + .filter((tokenData) => Boolean(tokenData.erc20)) const fuse = new Fuse(contractList, { shouldSort: true, @@ -43,7 +43,7 @@ export default class TokenSearch extends Component { handleSearch (searchQuery) { this.setState({ searchQuery }) const fuseSearchResult = fuse.search(searchQuery) - const addressSearchResult = contractList.filter(token => { + const addressSearchResult = contractList.filter((token) => { return token.address.toLowerCase() === searchQuery.toLowerCase() }) const results = [...addressSearchResult, ...fuseSearchResult] @@ -71,7 +71,7 @@ export default class TokenSearch extends Component { placeholder={this.context.t('searchTokens')} type="text" value={searchQuery} - onChange={e => this.handleSearch(e.target.value)} + onChange={(e) => this.handleSearch(e.target.value)} error={error} fullWidth startAdornment={this.renderAdornment()} diff --git a/ui/app/pages/add-token/util.js b/ui/app/pages/add-token/util.js index 579c56cc0..b0f3bbd4c 100644 --- a/ui/app/pages/add-token/util.js +++ b/ui/app/pages/add-token/util.js @@ -5,7 +5,7 @@ export function checkExistingAddresses (address, tokenList = []) { return false } - const matchesAddress = existingToken => { + const matchesAddress = (existingToken) => { return existingToken.address.toLowerCase() === address.toLowerCase() } diff --git a/ui/app/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js b/ui/app/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js index 9abf5edd3..59b2a7637 100644 --- a/ui/app/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js +++ b/ui/app/pages/confirm-add-suggested-token/confirm-add-suggested-token.container.js @@ -14,7 +14,7 @@ const mapStateToProps = ({ metamask }) => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { addToken: ({ address, symbol, decimals, image }) => dispatch(addToken(address, symbol, Number(decimals), image)), removeSuggestedTokens: () => dispatch(removeSuggestedTokens()), diff --git a/ui/app/pages/confirm-add-token/confirm-add-token.container.js b/ui/app/pages/confirm-add-token/confirm-add-token.container.js index 43ffd06f6..707d259e2 100644 --- a/ui/app/pages/confirm-add-token/confirm-add-token.container.js +++ b/ui/app/pages/confirm-add-token/confirm-add-token.container.js @@ -10,9 +10,9 @@ const mapStateToProps = ({ metamask }) => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { - addTokens: tokens => dispatch(addTokens(tokens)), + addTokens: (tokens) => dispatch(addTokens(tokens)), clearPendingTokens: () => dispatch(clearPendingTokens()), } } diff --git a/ui/app/pages/confirm-deploy-contract/confirm-deploy-contract.container.js b/ui/app/pages/confirm-deploy-contract/confirm-deploy-contract.container.js index 336ee83ea..e66dd3b60 100644 --- a/ui/app/pages/confirm-deploy-contract/confirm-deploy-contract.container.js +++ b/ui/app/pages/confirm-deploy-contract/confirm-deploy-contract.container.js @@ -1,7 +1,7 @@ import { connect } from 'react-redux' import ConfirmDeployContract from './confirm-deploy-contract.component' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { confirmTransaction: { txData } = {} } = state return { diff --git a/ui/app/pages/confirm-send-ether/confirm-send-ether.component.js b/ui/app/pages/confirm-send-ether/confirm-send-ether.component.js index 6bc252dbb..2fd23f45f 100644 --- a/ui/app/pages/confirm-send-ether/confirm-send-ether.component.js +++ b/ui/app/pages/confirm-send-ether/confirm-send-ether.component.js @@ -32,7 +32,7 @@ export default class ConfirmSendEther extends Component { this.handleEdit(confirmTransactionData)} + onEdit={(confirmTransactionData) => this.handleEdit(confirmTransactionData)} /> ) } diff --git a/ui/app/pages/confirm-send-ether/confirm-send-ether.container.js b/ui/app/pages/confirm-send-ether/confirm-send-ether.container.js index 713da702d..45e830d5d 100644 --- a/ui/app/pages/confirm-send-ether/confirm-send-ether.container.js +++ b/ui/app/pages/confirm-send-ether/confirm-send-ether.container.js @@ -5,7 +5,7 @@ import { updateSend } from '../../store/actions' import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck' import ConfirmSendEther from './confirm-send-ether.component' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { confirmTransaction: { txData: { txParams } = {} } } = state return { @@ -13,9 +13,9 @@ const mapStateToProps = state => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { - editTransaction: txData => { + editTransaction: (txData) => { const { id, txParams } = txData const { gas: gasLimit, diff --git a/ui/app/pages/confirm-send-token/confirm-send-token.component.js b/ui/app/pages/confirm-send-token/confirm-send-token.component.js index 361a35540..bde21a41c 100644 --- a/ui/app/pages/confirm-send-token/confirm-send-token.component.js +++ b/ui/app/pages/confirm-send-token/confirm-send-token.component.js @@ -21,7 +21,7 @@ export default class ConfirmSendToken extends Component { return ( this.handleEdit(confirmTransactionData)} + onEdit={(confirmTransactionData) => this.handleEdit(confirmTransactionData)} tokenAmount={tokenAmount} /> ) diff --git a/ui/app/pages/confirm-send-token/confirm-send-token.container.js b/ui/app/pages/confirm-send-token/confirm-send-token.container.js index db9b08c48..4673297b3 100644 --- a/ui/app/pages/confirm-send-token/confirm-send-token.container.js +++ b/ui/app/pages/confirm-send-token/confirm-send-token.container.js @@ -7,7 +7,7 @@ import { setSelectedToken, updateSend, showSendTokenPage } from '../../store/act import { conversionUtil } from '../../helpers/utils/conversion-util' import { sendTokenTokenAmountAndToAddressSelector } from '../../selectors/confirm-transaction' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { tokenAmount } = sendTokenTokenAmountAndToAddressSelector(state) return { @@ -15,7 +15,7 @@ const mapStateToProps = state => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { editTransaction: ({ txData, tokenData, tokenProps }) => { const { txParams: { to: tokenAddress, gas: gasLimit, gasPrice } = {}, id } = txData diff --git a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js index 2d6fb7249..3be76e990 100644 --- a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js +++ b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js @@ -247,8 +247,8 @@ export default class ConfirmTransactionBase extends Component { {advancedInlineGasShown ? ( updateGasAndCalculate({ ...customGas, gasPrice: newGasPrice })} - updateCustomGasLimit={newGasLimit => updateGasAndCalculate({ ...customGas, gasLimit: newGasLimit })} + updateCustomGasPrice={(newGasPrice) => updateGasAndCalculate({ ...customGas, gasPrice: newGasPrice })} + updateCustomGasLimit={(newGasLimit) => updateGasAndCalculate({ ...customGas, gasLimit: newGasLimit })} customGasPrice={customGas.gasPrice} customGasLimit={customGas.gasLimit} insufficientBalance={insufficientBalance} @@ -491,7 +491,7 @@ export default class ConfirmTransactionBase extends Component { updateCustomNonce('') }) }) - .catch(error => { + .catch((error) => { this.setState({ submitting: false, submitError: error.message, diff --git a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.container.js b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.container.js index eb6a8d9c4..4ee38635e 100644 --- a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.container.js +++ b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.container.js @@ -38,7 +38,7 @@ const casedContractMap = Object.keys(contractMap).reduce((acc, base) => { }, {}) let customNonceValue = '' -const customNonceMerge = txData => (customNonceValue ? ({ +const customNonceMerge = (txData) => (customNonceValue ? ({ ...txData, customNonceValue, }) : txData) @@ -110,7 +110,7 @@ const mapStateToProps = (state, ownProps) => { } const currentNetworkUnapprovedTxs = Object.keys(unapprovedTxs) - .filter(key => unapprovedTxs[key].metamaskNetworkId === network) + .filter((key) => unapprovedTxs[key].metamaskNetworkId === network) .reduce((acc, key) => ({ ...acc, [key]: unapprovedTxs[key] }), {}) const unapprovedTxCount = valuesFor(currentNetworkUnapprovedTxs).length @@ -173,12 +173,12 @@ const mapStateToProps = (state, ownProps) => { } } -export const mapDispatchToProps = dispatch => { +export const mapDispatchToProps = (dispatch) => { return { tryReverseResolveAddress: (address) => { return dispatch(tryReverseResolveAddress(address)) }, - updateCustomNonce: value => { + updateCustomNonce: (value) => { customNonceValue = value dispatch(updateCustomNonce(value)) }, @@ -197,8 +197,8 @@ export const mapDispatchToProps = dispatch => { }, cancelTransaction: ({ id }) => dispatch(cancelTx({ id })), cancelAllTransactions: (txList) => dispatch(cancelTxs(txList)), - sendTransaction: txData => dispatch(updateAndApproveTx(customNonceMerge(txData))), - setMetaMetricsSendCount: val => dispatch(setMetaMetricsSendCount(val)), + sendTransaction: (txData) => dispatch(updateAndApproveTx(customNonceMerge(txData))), + setMetaMetricsSendCount: (val) => dispatch(setMetaMetricsSendCount(val)), getNextNonce: () => dispatch(getNextNonce()), } } @@ -264,7 +264,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { ...ownProps, showCustomizeGasModal: () => dispatchShowCustomizeGasModal({ txData, - onSubmit: customGas => dispatchUpdateGasAndCalculate(customGas), + onSubmit: (customGas) => dispatchUpdateGasAndCalculate(customGas), validate: validateEditGas, }), cancelAllTransactions: () => dispatchCancelAllTransactions(valuesFor(unapprovedTxs)), diff --git a/ui/app/pages/confirm-transaction/confirm-transaction.container.js b/ui/app/pages/confirm-transaction/confirm-transaction.container.js index d59a9d14e..402ea8a28 100644 --- a/ui/app/pages/confirm-transaction/confirm-transaction.container.js +++ b/ui/app/pages/confirm-transaction/confirm-transaction.container.js @@ -53,9 +53,9 @@ const mapStateToProps = (state, ownProps) => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { - setTransactionToConfirm: transactionId => { + setTransactionToConfirm: (transactionId) => { dispatch(setTransactionToConfirm(transactionId)) }, clearConfirmTransaction: () => dispatch(clearConfirmTransaction()), diff --git a/ui/app/pages/create-account/connect-hardware/connect-screen.js b/ui/app/pages/create-account/connect-hardware/connect-screen.js index 9edad9000..3464c43eb 100644 --- a/ui/app/pages/create-account/connect-hardware/connect-screen.js +++ b/ui/app/pages/create-account/connect-hardware/connect-screen.js @@ -30,7 +30,7 @@ class ConnectScreen extends Component { className={classnames('hw-connect__btn', { 'selected': this.state.selectedDevice === 'trezor', })} - onClick={_ => this.setState({ selectedDevice: 'trezor' })} + onClick={(_) => this.setState({ selectedDevice: 'trezor' })} > this.setState({ selectedDevice: 'ledger' })} + onClick={(_) => this.setState({ selectedDevice: 'ledger' })} > { + ref={(node) => { this.referenceNode = node }} > diff --git a/ui/app/pages/create-account/connect-hardware/index.js b/ui/app/pages/create-account/connect-hardware/index.js index 85c95d8d0..e5bf531fb 100644 --- a/ui/app/pages/create-account/connect-hardware/index.js +++ b/ui/app/pages/create-account/connect-hardware/index.js @@ -20,7 +20,7 @@ class ConnectHardwareForm extends Component { UNSAFE_componentWillReceiveProps (nextProps) { const { accounts } = nextProps - const newAccounts = this.state.accounts.map(a => { + const newAccounts = this.state.accounts.map((a) => { const normalizedAddress = a.address.toLowerCase() const balanceValue = accounts[normalizedAddress] && accounts[normalizedAddress].balance || null a.balance = balanceValue ? formatBalance(balanceValue, 6) : '...' @@ -35,7 +35,7 @@ class ConnectHardwareForm extends Component { } async checkIfUnlocked () { - ['trezor', 'ledger'].forEach(async device => { + ['trezor', 'ledger'].forEach(async (device) => { const unlocked = await this.props.checkHardwareStatus(device, this.props.defaultHdPaths[device]) if (unlocked) { this.setState({ unlocked: true }) @@ -69,7 +69,7 @@ class ConnectHardwareForm extends Component { showTemporaryAlert () { this.props.showAlert(this.context.t('hardwareWalletConnected')) // Autohide the alert after 5 seconds - setTimeout(_ => { + setTimeout((_) => { this.props.hideAlert() }, 5000) } @@ -77,7 +77,7 @@ class ConnectHardwareForm extends Component { getPage = (device, page, hdPath) => { this.props .connectHardware(device, page, hdPath) - .then(accounts => { + .then((accounts) => { if (accounts.length) { // If we just loaded the accounts for the first time @@ -95,13 +95,13 @@ class ConnectHardwareForm extends Component { } }) // If the page doesn't contain the selected account, let's deselect it - } else if (!accounts.filter(a => a.index.toString() === this.state.selectedAccount).length) { + } else if (!accounts.filter((a) => a.index.toString() === this.state.selectedAccount).length) { newState.selectedAccount = null } // Map accounts with balances - newState.accounts = accounts.map(account => { + newState.accounts = accounts.map((account) => { const normalizedAddress = account.address.toLowerCase() const balanceValue = this.props.accounts[normalizedAddress] && this.props.accounts[normalizedAddress].balance || null account.balance = balanceValue ? formatBalance(balanceValue, 6) : '...' @@ -111,7 +111,7 @@ class ConnectHardwareForm extends Component { this.setState(newState) } }) - .catch(e => { + .catch((e) => { const errorMessage = e.message if (errorMessage === 'Window blocked') { this.setState({ browserSupported: false, error: null }) @@ -123,14 +123,14 @@ class ConnectHardwareForm extends Component { onForgetDevice = (device) => { this.props.forgetDevice(device) - .then(_ => { + .then((_) => { this.setState({ error: null, selectedAccount: null, accounts: [], unlocked: false, }) - }).catch(e => { + }).catch((e) => { this.setState({ error: e.message }) }) } @@ -142,7 +142,7 @@ class ConnectHardwareForm extends Component { } this.props.unlockHardwareWalletAccount(this.state.selectedAccount, device) - .then(_ => { + .then((_) => { this.context.metricsEvent({ eventOpts: { category: 'Accounts', @@ -151,7 +151,7 @@ class ConnectHardwareForm extends Component { }, }) this.props.history.push(DEFAULT_ROUTE) - }).catch(e => { + }).catch((e) => { this.context.metricsEvent({ eventOpts: { category: 'Accounts', @@ -236,7 +236,7 @@ ConnectHardwareForm.propTypes = { defaultHdPaths: PropTypes.object, } -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { metamask: { network, selectedAddress }, } = state @@ -253,7 +253,7 @@ const mapStateToProps = state => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { setHardwareWalletDefaultHdPath: ({ device, path }) => { return dispatch(actions.setHardwareWalletDefaultHdPath({ device, path })) diff --git a/ui/app/pages/create-account/create-account.component.js b/ui/app/pages/create-account/create-account.component.js index a1617daa3..d532a78eb 100644 --- a/ui/app/pages/create-account/create-account.component.js +++ b/ui/app/pages/create-account/create-account.component.js @@ -14,7 +14,7 @@ import { export default class CreateAccountPage extends Component { renderTabs () { const { history, location: { pathname } } = this.props - const getClassNames = path => classnames('new-account__tabs__tab', { + const getClassNames = (path) => classnames('new-account__tabs__tab', { 'new-account__tabs__selected': matchPath(pathname, { path, exact: true, diff --git a/ui/app/pages/create-account/import-account/json.js b/ui/app/pages/create-account/import-account/json.js index 11af1b17d..c072fa563 100644 --- a/ui/app/pages/create-account/import-account/json.js +++ b/ui/app/pages/create-account/import-account/json.js @@ -123,7 +123,7 @@ class JsonImportSubview extends Component { setSelectedAddress(firstAddress) } }) - .catch(err => err && displayWarning(err.message || err)) + .catch((err) => err && displayWarning(err.message || err)) } checkInputEmpty () { @@ -145,17 +145,17 @@ JsonImportSubview.propTypes = { setSelectedAddress: PropTypes.func, } -const mapStateToProps = state => { +const mapStateToProps = (state) => { return { error: state.appState.warning, firstAddress: Object.keys(getMetaMaskAccounts(state))[0], } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { - displayWarning: warning => dispatch(actions.displayWarning(warning)), - importNewJsonAccount: options => dispatch(actions.importNewAccount('JSON File', options)), + displayWarning: (warning) => dispatch(actions.displayWarning(warning)), + importNewJsonAccount: (options) => dispatch(actions.importNewAccount('JSON File', options)), setSelectedAddress: (address) => dispatch(actions.setSelectedAddress(address)), } } diff --git a/ui/app/pages/create-account/import-account/private-key.js b/ui/app/pages/create-account/import-account/private-key.js index c42755621..403f8e2e0 100644 --- a/ui/app/pages/create-account/import-account/private-key.js +++ b/ui/app/pages/create-account/import-account/private-key.js @@ -55,7 +55,7 @@ class PrivateKeyImportView extends Component { setSelectedAddress(firstAddress) } }) - .catch(err => err && displayWarning(err.message || err)) + .catch((err) => err && displayWarning(err.message || err)) } createKeyringOnEnter = (event) => { @@ -87,7 +87,7 @@ class PrivateKeyImportView extends Component { className="new-account-import-form__input-password" type="password" id="private-key-box" - onKeyPress={e => this.createKeyringOnEnter(e)} + onKeyPress={(e) => this.createKeyringOnEnter(e)} onChange={() => this.checkInputEmpty()} ref={this.inputRef} /> diff --git a/ui/app/pages/create-account/new-account.component.js b/ui/app/pages/create-account/new-account.component.js index a9c2b5aef..d1c749f19 100644 --- a/ui/app/pages/create-account/new-account.component.js +++ b/ui/app/pages/create-account/new-account.component.js @@ -18,7 +18,7 @@ export default class NewAccountCreateForm extends Component { render () { const { newAccountName, defaultAccountName } = this.state const { history, createAccount } = this.props - const createClick = _ => { + const createClick = (_) => { createAccount(newAccountName || defaultAccountName) .then(() => { this.context.metricsEvent({ @@ -54,7 +54,7 @@ export default class NewAccountCreateForm extends Component { className="new-account-create-form__input" value={newAccountName} placeholder={defaultAccountName} - onChange={event => this.setState({ newAccountName: event.target.value })} + onChange={(event) => this.setState({ newAccountName: event.target.value })} />
diff --git a/ui/app/pages/create-account/new-account.container.js b/ui/app/pages/create-account/new-account.container.js index 5935f81ac..93a89fe31 100644 --- a/ui/app/pages/create-account/new-account.container.js +++ b/ui/app/pages/create-account/new-account.container.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux' import * as actions from '../../store/actions' import NewAccountCreateForm from './new-account.component' -const mapStateToProps = state => { +const mapStateToProps = (state) => { const { metamask: { network, selectedAddress, identities = {} } } = state const numberOfExistingAccounts = Object.keys(identities).length const newAccountNumber = numberOfExistingAccounts + 1 @@ -14,12 +14,12 @@ const mapStateToProps = state => { } } -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { - toCoinbase: address => dispatch(actions.buyEth({ network: '1', address, amount: 0 })), - createAccount: newAccountName => { + toCoinbase: (address) => dispatch(actions.buyEth({ network: '1', address, amount: 0 })), + createAccount: (newAccountName) => { return dispatch(actions.addNewAccount()) - .then(newAccountAddress => { + .then((newAccountAddress) => { if (newAccountName) { dispatch(actions.setAccountLabel(newAccountAddress, newAccountName)) } diff --git a/ui/app/pages/first-time-flow/create-password/create-password.component.js b/ui/app/pages/first-time-flow/create-password/create-password.component.js index 514e8d3b9..5a746d89e 100644 --- a/ui/app/pages/first-time-flow/create-password/create-password.component.js +++ b/ui/app/pages/first-time-flow/create-password/create-password.component.js @@ -36,7 +36,7 @@ export default class CreatePassword extends PureComponent { ( + render={(routeProps) => ( ( + render={(routeProps) => ( { +const mapStateToProps = (state) => { const { metamask: { isInitialized } } = state return { diff --git a/ui/app/pages/first-time-flow/create-password/import-with-seed-phrase/import-with-seed-phrase.component.js b/ui/app/pages/first-time-flow/create-password/import-with-seed-phrase/import-with-seed-phrase.component.js index 2ea69f832..7ce6fcf2e 100644 --- a/ui/app/pages/first-time-flow/create-password/import-with-seed-phrase/import-with-seed-phrase.component.js +++ b/ui/app/pages/first-time-flow/create-password/import-with-seed-phrase/import-with-seed-phrase.component.js @@ -87,7 +87,7 @@ export default class ImportWithSeedPhrase extends PureComponent { handlePasswordChange (password) { const { t } = this.context - this.setState(state => { + this.setState((state) => { const { confirmPassword } = state let confirmPasswordError = '' let passwordError = '' @@ -111,7 +111,7 @@ export default class ImportWithSeedPhrase extends PureComponent { handleConfirmPasswordChange (confirmPassword) { const { t } = this.context - this.setState(state => { + this.setState((state) => { const { password } = state let confirmPasswordError = '' @@ -126,7 +126,7 @@ export default class ImportWithSeedPhrase extends PureComponent { }) } - handleImport = async event => { + handleImport = async (event) => { event.preventDefault() if (!this.isValid()) { @@ -206,7 +206,7 @@ export default class ImportWithSeedPhrase extends PureComponent { >
{ + onClick={(e) => { e.preventDefault() this.context.metricsEvent({ eventOpts: { @@ -236,7 +236,7 @@ export default class ImportWithSeedPhrase extends PureComponent {
" + titleFormat(el.x) + '