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 = `
{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 {" + titleFormat(el.x) + ' |
---|