diff --git a/apps/block_scout_web/assets/js/lib/async_listing_load.js b/apps/block_scout_web/assets/js/lib/async_listing_load.js index 13c4aa7da2..30450c6dde 100644 --- a/apps/block_scout_web/assets/js/lib/async_listing_load.js +++ b/apps/block_scout_web/assets/js/lib/async_listing_load.js @@ -271,7 +271,7 @@ export function createAsyncLoadStore (reducer, initialState, itemKey) { }) } - connectElements({store, elements}) + connectElements({ store, elements }) firstPageLoad(store) return store } @@ -280,20 +280,20 @@ function firstPageLoad (store) { const $element = $('[data-async-listing]') function loadItemsNext () { const path = store.getState().nextPagePath - store.dispatch({type: 'START_REQUEST'}) - $.getJSON(path, {type: 'JSON'}) - .done(response => store.dispatch(Object.assign({type: 'ITEMS_FETCHED'}, humps.camelizeKeys(response)))) - .fail(() => store.dispatch({type: 'REQUEST_ERROR'})) - .always(() => store.dispatch({type: 'FINISH_REQUEST'})) + store.dispatch({ type: 'START_REQUEST' }) + $.getJSON(path, { type: 'JSON' }) + .done(response => store.dispatch(Object.assign({ type: 'ITEMS_FETCHED' }, humps.camelizeKeys(response)))) + .fail(() => store.dispatch({ type: 'REQUEST_ERROR' })) + .always(() => store.dispatch({ type: 'FINISH_REQUEST' })) } function loadItemsPrev () { const path = store.getState().prevPagePath - store.dispatch({type: 'START_REQUEST'}) - $.getJSON(path, {type: 'JSON'}) - .done(response => store.dispatch(Object.assign({type: 'ITEMS_FETCHED'}, humps.camelizeKeys(response)))) - .fail(() => store.dispatch({type: 'REQUEST_ERROR'})) - .always(() => store.dispatch({type: 'FINISH_REQUEST'})) + store.dispatch({ type: 'START_REQUEST' }) + $.getJSON(path, { type: 'JSON' }) + .done(response => store.dispatch(Object.assign({ type: 'ITEMS_FETCHED' }, humps.camelizeKeys(response)))) + .fail(() => store.dispatch({ type: 'REQUEST_ERROR' })) + .always(() => store.dispatch({ type: 'FINISH_REQUEST' })) } loadItemsNext() @@ -305,14 +305,14 @@ function firstPageLoad (store) { $element.on('click', '[data-next-page-button]', (event) => { event.preventDefault() loadItemsNext() - store.dispatch({type: 'NAVIGATE_TO_OLDER'}) + store.dispatch({ type: 'NAVIGATE_TO_OLDER' }) event.stopImmediatePropagation() }) $element.on('click', '[data-prev-page-button]', (event) => { event.preventDefault() loadItemsPrev() - store.dispatch({type: 'NAVIGATE_TO_NEWER'}) + store.dispatch({ type: 'NAVIGATE_TO_NEWER' }) event.stopImmediatePropagation() }) } @@ -320,6 +320,6 @@ function firstPageLoad (store) { const $element = $('[data-async-load]') if ($element.length) { const store = createStore(asyncReducer) - connectElements({store, elements}) + connectElements({ store, elements }) firstPageLoad(store) } diff --git a/apps/block_scout_web/assets/js/lib/awesomplete-util.js b/apps/block_scout_web/assets/js/lib/awesomplete-util.js index 5b37e1dd2f..bb13499228 100644 --- a/apps/block_scout_web/assets/js/lib/awesomplete-util.js +++ b/apps/block_scout_web/assets/js/lib/awesomplete-util.js @@ -38,13 +38,13 @@ window.AwesompleteUtil = (function () { var lv = Array.isArray(data) ? { label: data[0], value: data[1] } : typeof data === 'object' && 'label' in data && 'value' in data ? data : { label: data, value: data } - return {label: lv.label || lv.value, value: lv.value} + return { label: lv.label || lv.value, value: lv.value } } // Helper to send events with detail property. function _fire (target, name, detail) { // $.fire uses deprecated methods but other methods don't work in IE11. - return $.fire(target, name, {detail: detail}) + return $.fire(target, name, { detail: detail }) } // Look if there is an exact match or a mismatch, set awe-found, awe-not-found css class and send match events. @@ -74,7 +74,7 @@ window.AwesompleteUtil = (function () { } } // Don't want to change the real input field, emulate a fake one. - fake = {input: {value: ''}} + fake = { input: { value: '' } } // Determine how this suggestion would look like if it is replaced in the input field, // it is an exact match if somebody types exactly that. // Use the fake input here. fake.input.value will contain the result of the replace function. @@ -222,7 +222,7 @@ window.AwesompleteUtil = (function () { awe.utilprops.url, awe.utilprops.urlEnd, awe.utilprops.loadall ? '' : val, - _onLoad.bind({awe: awe, xhr: xhr, queryVal: val}), + _onLoad.bind({ awe: awe, xhr: xhr, queryVal: val }), xhr ) } else { @@ -401,15 +401,15 @@ window.AwesompleteUtil = (function () { // for arrays at top and subtop level if (level < 2 && prop) { // if a 'value' is specified and found a mathing property, create extra 'value' property. - if (value && (prop + '.').lastIndexOf(value + '.', 0) === 0) { result['value'] = result[prop] } + if (value && (prop + '.').lastIndexOf(value + '.', 0) === 0) { result.value = result[prop] } // if a 'label' is specified and found a mathing property, create extra 'label' property. - if (label && (prop + '.').lastIndexOf(label + '.', 0) === 0) { result['label'] = result[prop] } + if (label && (prop + '.').lastIndexOf(label + '.', 0) === 0) { result.label = result[prop] } } if (level === 0) { // Make sure that both value and label properties exist, even if they are nil. // This is handy with limit 0 or 1 when the result doesn't have to contain an array. - if (value && !('value' in result)) { result['value'] = null } - if (label && !('label' in result)) { result['label'] = null } + if (value && !('value' in result)) { result.value = null } + if (label && !('label' in result)) { result.label = null } } return result } @@ -506,17 +506,18 @@ window.AwesompleteUtil = (function () { var boundOnKeydown = _onKeydown.bind(awe) var boundOnInput = _onInput.bind(awe) var boundSelect = _select.bind(awe) - var boundDetach = _detach.bind({awe: awe, + var boundDetach = _detach.bind({ + awe: awe, boundMatch: boundMatch, boundOnInput: boundOnInput, boundOnKeydown: boundOnKeydown, boundSelect: boundSelect }) var events = { - 'keydown': boundOnKeydown, - 'input': boundOnInput + keydown: boundOnKeydown, + input: boundOnInput } - events['blur'] = events[_AWE_CLOSE] = events[_AWE_LOAD] = boundMatch + events.blur = events[_AWE_CLOSE] = events[_AWE_LOAD] = boundMatch events[_AWE_SELECT] = boundSelect $.bind(elem, events) @@ -552,7 +553,7 @@ window.AwesompleteUtil = (function () { // Create function to copy a field from the selected autocomplete item to another DOM element. // dataField can be null. createCopyFun: function (sourceId, dataField, targetId) { - return _copyFun.bind({sourceId: sourceId, dataField: dataField, targetId: $(targetId) || targetId}) + return _copyFun.bind({ sourceId: sourceId, dataField: dataField, targetId: $(targetId) || targetId }) }, // attach copy function to event listeners. prepop is optional and by default true. @@ -585,7 +586,7 @@ window.AwesompleteUtil = (function () { // Create function for combobox button (btnId) to toggle dropdown list. createClickFun: function (btnId, awe) { - return _clickFun.bind({btnId: btnId, awe: awe}) + return _clickFun.bind({ btnId: btnId, awe: awe }) }, // Attach click function for combobox to click event. diff --git a/apps/block_scout_web/assets/js/lib/card_tabs.js b/apps/block_scout_web/assets/js/lib/card_tabs.js index 24b08e641e..11812c9223 100644 --- a/apps/block_scout_web/assets/js/lib/card_tabs.js +++ b/apps/block_scout_web/assets/js/lib/card_tabs.js @@ -17,7 +17,7 @@ $(function () { const siblings = $(this).siblings() if (siblings.is(':hidden')) { - siblings.css({ 'display': 'flex' }) + siblings.css({ display: 'flex' }) } else { siblings.hide() } diff --git a/apps/block_scout_web/assets/js/lib/clipboard_buttons.js b/apps/block_scout_web/assets/js/lib/clipboard_buttons.js index e195a68d0b..d59a22ce45 100644 --- a/apps/block_scout_web/assets/js/lib/clipboard_buttons.js +++ b/apps/block_scout_web/assets/js/lib/clipboard_buttons.js @@ -3,7 +3,7 @@ import $ from 'jquery' const clipboard = new ClipboardJS('[data-clipboard-text]') -clipboard.on('success', ({trigger}) => { +clipboard.on('success', ({ trigger }) => { const copyButton = $(trigger) copyButton.tooltip('dispose') diff --git a/apps/block_scout_web/assets/js/lib/coin_balance_history_chart.js b/apps/block_scout_web/assets/js/lib/coin_balance_history_chart.js index db84586c6b..9cd0bd61b0 100644 --- a/apps/block_scout_web/assets/js/lib/coin_balance_history_chart.js +++ b/apps/block_scout_web/assets/js/lib/coin_balance_history_chart.js @@ -8,7 +8,7 @@ export function createCoinBalanceHistoryChart (el) { const $chartError = $('[data-chart-error-message]') const dataPath = el.dataset.coin_balance_history_data_path - $.getJSON(dataPath, {type: 'JSON'}) + $.getJSON(dataPath, { type: 'JSON' }) .done(data => { $chartContainer.show() @@ -53,7 +53,7 @@ export function createCoinBalanceHistoryChart (el) { }, scaleLabel: { display: true, - labelString: window.localized['Ether'] + labelString: window.localized.Ether } }] } diff --git a/apps/block_scout_web/assets/js/lib/currency.js b/apps/block_scout_web/assets/js/lib/currency.js index f0491661c2..6d3022625f 100644 --- a/apps/block_scout_web/assets/js/lib/currency.js +++ b/apps/block_scout_web/assets/js/lib/currency.js @@ -45,6 +45,7 @@ export function formatAllUsdValues (root) { formatAllUsdValues() function tryUpdateCalculatedUsdValues (el, usdExchangeRate = el.dataset.usdExchangeRate) { + // eslint-disable-next-line no-prototype-builtins if (!el.dataset.hasOwnProperty('weiValue')) return const ether = weiToEther(el.dataset.weiValue) const usd = etherToUSD(ether, usdExchangeRate) @@ -63,6 +64,6 @@ export function updateAllCalculatedUsdValues (usdExchangeRate) { } updateAllCalculatedUsdValues() -export const exchangeRateChannel = socket.channel(`exchange_rate:new_rate`) +export const exchangeRateChannel = socket.channel('exchange_rate:new_rate') exchangeRateChannel.join() exchangeRateChannel.on('new_rate', (msg) => updateAllCalculatedUsdValues(humps.camelizeKeys(msg).exchangeRate.usdValue)) diff --git a/apps/block_scout_web/assets/js/lib/indexing.js b/apps/block_scout_web/assets/js/lib/indexing.js index dabd891df0..be410da5b8 100644 --- a/apps/block_scout_web/assets/js/lib/indexing.js +++ b/apps/block_scout_web/assets/js/lib/indexing.js @@ -20,6 +20,6 @@ export function updateIndexStatus (msg = {}) { } updateIndexStatus() -const indexingChannel = socket.channel(`blocks:indexing`) +const indexingChannel = socket.channel('blocks:indexing') indexingChannel.join() indexingChannel.on('index_status', (msg) => updateIndexStatus(humps.camelizeKeys(msg))) diff --git a/apps/block_scout_web/assets/js/lib/market_history_chart.js b/apps/block_scout_web/assets/js/lib/market_history_chart.js index 098faac0a8..568e8eddb4 100644 --- a/apps/block_scout_web/assets/js/lib/market_history_chart.js +++ b/apps/block_scout_web/assets/js/lib/market_history_chart.js @@ -61,7 +61,7 @@ const config = { mode: 'index', intersect: false, callbacks: { - label: ({datasetIndex, yLabel}, {datasets}) => { + label: ({ datasetIndex, yLabel }, { datasets }) => { const label = datasets[datasetIndex].label if (datasets[datasetIndex].yAxisID === 'price') { return `${label}: ${formatUsdValue(yLabel)}` @@ -77,14 +77,14 @@ const config = { } function getPriceData (marketHistoryData) { - return marketHistoryData.map(({ date, closingPrice }) => ({x: date, y: closingPrice})) + return marketHistoryData.map(({ date, closingPrice }) => ({ x: date, y: closingPrice })) } function getMarketCapData (marketHistoryData, availableSupply) { if (availableSupply !== null && typeof availableSupply === 'object') { - return marketHistoryData.map(({ date, closingPrice }) => ({x: date, y: closingPrice * availableSupply[date]})) + return marketHistoryData.map(({ date, closingPrice }) => ({ x: date, y: closingPrice * availableSupply[date] })) } else { - return marketHistoryData.map(({ date, closingPrice }) => ({x: date, y: closingPrice * availableSupply})) + return marketHistoryData.map(({ date, closingPrice }) => ({ x: date, y: closingPrice * availableSupply })) } } @@ -102,7 +102,7 @@ if (localStorage.getItem('current-color-mode') === 'dark') { class MarketHistoryChart { constructor (el, availableSupply, marketHistoryData) { this.price = { - label: window.localized['Price'], + label: window.localized.Price, yAxisID: 'price', data: getPriceData(marketHistoryData), fill: false, @@ -125,6 +125,7 @@ class MarketHistoryChart { config.data.datasets = [this.price, this.marketCap] this.chart = new Chart(el, config) } + update (availableSupply, marketHistoryData) { this.price.data = getPriceData(marketHistoryData) if (this.availableSupply !== null && typeof this.availableSupply === 'object') { @@ -147,7 +148,7 @@ export function createMarketHistoryChart (el) { const $chartError = $('[data-chart-error-message]') const chart = new MarketHistoryChart(el, 0, []) - $.getJSON(dataPath, {type: 'JSON'}) + $.getJSON(dataPath, { type: 'JSON' }) .done(data => { const availableSupply = JSON.parse(data.supply_data) const marketHistoryData = humps.camelizeKeys(JSON.parse(data.history_data)) diff --git a/apps/block_scout_web/assets/js/lib/modals.js b/apps/block_scout_web/assets/js/lib/modals.js index fb19532540..2457452226 100644 --- a/apps/block_scout_web/assets/js/lib/modals.js +++ b/apps/block_scout_web/assets/js/lib/modals.js @@ -52,7 +52,7 @@ $(function () { const progressBackground = total - progress // eslint-disable-next-line no-unused-vars - let myChart = new Chart(stakeProgress, { + const myChart = new Chart(stakeProgress, { type: 'doughnut', data: { datasets: [{ diff --git a/apps/block_scout_web/assets/js/lib/network_selector.js b/apps/block_scout_web/assets/js/lib/network_selector.js index 20c8e3d206..48648753bd 100644 --- a/apps/block_scout_web/assets/js/lib/network_selector.js +++ b/apps/block_scout_web/assets/js/lib/network_selector.js @@ -36,7 +36,7 @@ $(function () { window.location = $(this).attr('network-selector-item-url') }) - let setNetworkTab = (currentTab) => { + const setNetworkTab = (currentTab) => { if (currentTab.hasClass('active')) return networkSelectorTab.removeClass('active') @@ -45,31 +45,31 @@ $(function () { $(`[network-selector-tab="${currentTab.attr('network-selector-tab-filter')}"]`).addClass('active') } - let openNetworkSelector = () => { + const openNetworkSelector = () => { mainBody.addClass('network-selector-visible') networkSelectorOverlay.fadeIn(FADE_IN_DELAY) setNetworkSelectorVisiblePosition() } - let closeNetworkSelector = () => { + const closeNetworkSelector = () => { mainBody.removeClass('network-selector-visible') networkSelectorOverlay.fadeOut(FADE_IN_DELAY) setNetworkSelectorHiddenPosition() } - let getNetworkSelectorWidth = () => { + const getNetworkSelectorWidth = () => { return parseInt(networkSelector.css('width')) || parseInt(networkSelector.css('max-width')) } - let setNetworkSelectorHiddenPosition = () => { - return networkSelector.css({ 'right': `-${getNetworkSelectorWidth()}px` }) + const setNetworkSelectorHiddenPosition = () => { + return networkSelector.css({ right: `-${getNetworkSelectorWidth()}px` }) } - let setNetworkSelectorVisiblePosition = () => { - return networkSelector.css({ 'right': '0' }) + const setNetworkSelectorVisiblePosition = () => { + return networkSelector.css({ right: '0' }) } - let init = () => { + const init = () => { setNetworkSelectorHiddenPosition() } diff --git a/apps/block_scout_web/assets/js/lib/pretty_json.js b/apps/block_scout_web/assets/js/lib/pretty_json.js index 705b179b5a..33a921d743 100644 --- a/apps/block_scout_web/assets/js/lib/pretty_json.js +++ b/apps/block_scout_web/assets/js/lib/pretty_json.js @@ -1,8 +1,8 @@ import $ from 'jquery' function prettyPrint (element) { - let jsonString = element.dataset.json - let pretty = JSON.stringify(JSON.parse(jsonString), undefined, 2) + const jsonString = element.dataset.json + const pretty = JSON.stringify(JSON.parse(jsonString), undefined, 2) element.innerHTML = pretty } diff --git a/apps/block_scout_web/assets/js/pages/address.js b/apps/block_scout_web/assets/js/pages/address.js index 4481408e7c..97f66d2483 100644 --- a/apps/block_scout_web/assets/js/pages/address.js +++ b/apps/block_scout_web/assets/js/pages/address.js @@ -102,7 +102,7 @@ const elements = { }, '[data-selector="fetched-coin-balance-block-number"]': { load ($el) { - return {fetchedCoinBalanceBlockNumber: numeral($el.text()).value()} + return { fetchedCoinBalanceBlockNumber: numeral($el.text()).value() } }, render ($el, state, oldState) { if (oldState.fetchedCoinBalanceBlockNumber === state.fetchedCoinBalanceBlockNumber) return @@ -131,7 +131,7 @@ function loadCounters (store) { function fetchCounters () { $.getJSON(path) - .done(response => store.dispatch(Object.assign({type: 'COUNTERS_FETCHED'}, humps.camelizeKeys(response)))) + .done(response => store.dispatch(Object.assign({ type: 'COUNTERS_FETCHED' }, humps.camelizeKeys(response)))) } fetchCounters() diff --git a/apps/block_scout_web/assets/js/pages/address/coin_balances.js b/apps/block_scout_web/assets/js/pages/address/coin_balances.js index b4523a6c64..9570e8f560 100644 --- a/apps/block_scout_web/assets/js/pages/address/coin_balances.js +++ b/apps/block_scout_web/assets/js/pages/address/coin_balances.js @@ -47,7 +47,7 @@ if ($('[data-page="coin-balance-history"]').length) { const store = createAsyncLoadStore(reducer, initialState, 'dataset.blockNumber') const addressHash = $('[data-page="address-details"]')[0].dataset.pageAddressHash - store.dispatch({type: 'PAGE_LOAD', addressHash}) + store.dispatch({ type: 'PAGE_LOAD', addressHash }) connectElements({ store, elements }) const addressChannel = socket.channel(`addresses:${addressHash}`, {}) diff --git a/apps/block_scout_web/assets/js/pages/address/internal_transactions.js b/apps/block_scout_web/assets/js/pages/address/internal_transactions.js index 6c3d503256..5d4c65dd5e 100644 --- a/apps/block_scout_web/assets/js/pages/address/internal_transactions.js +++ b/apps/block_scout_web/assets/js/pages/address/internal_transactions.js @@ -34,7 +34,7 @@ export function reducer (state, action) { if (state.channelDisconnected || state.beyondPageOne) return state const incomingInternalTransactions = action.msgs - .filter(({toAddressHash, fromAddressHash}) => ( + .filter(({ toAddressHash, fromAddressHash }) => ( !state.filter || (state.filter === 'to' && toAddressHash === state.addressHash) || (state.filter === 'from' && fromAddressHash === state.addressHash) @@ -81,7 +81,7 @@ if ($('[data-page="address-internal-transactions"]').length) { const store = createAsyncLoadStore(reducer, initialState, 'dataset.key') const addressHash = $('[data-page="address-details"]')[0].dataset.pageAddressHash - store.dispatch({type: 'PAGE_LOAD', addressHash}) + store.dispatch({ type: 'PAGE_LOAD', addressHash }) connectElements({ store, elements }) const addressChannel = socket.channel(`addresses:${addressHash}`, {}) diff --git a/apps/block_scout_web/assets/js/pages/address/logs.js b/apps/block_scout_web/assets/js/pages/address/logs.js index bf0c041b39..380d20b26e 100644 --- a/apps/block_scout_web/assets/js/pages/address/logs.js +++ b/apps/block_scout_web/assets/js/pages/address/logs.js @@ -16,7 +16,7 @@ export function reducer (state, action) { return Object.assign({}, state, omit(action, 'type')) } case 'START_SEARCH': { - return Object.assign({}, state, {pagesStack: [], isSearch: true}) + return Object.assign({}, state, { pagesStack: [], isSearch: true }) } default: return state @@ -63,19 +63,21 @@ if ($('[data-page="address-logs"]').length) { store.dispatch({ type: 'PAGE_LOAD', - addressHash: addressHash}) + addressHash: addressHash + }) $element.on('click', '[data-search-button]', (event) => { store.dispatch({ type: 'START_SEARCH', - addressHash: addressHash}) + addressHash: addressHash + }) var topic = $('[data-search-field]').val() var path = '/search_logs?topic=' + topic + '&address_id=' + store.getState().addressHash - store.dispatch({type: 'START_REQUEST'}) - $.getJSON(path, {type: 'JSON'}) - .done(response => store.dispatch(Object.assign({type: 'ITEMS_FETCHED'}, humps.camelizeKeys(response)))) - .fail(() => store.dispatch({type: 'REQUEST_ERROR'})) - .always(() => store.dispatch({type: 'FINISH_REQUEST'})) + store.dispatch({ type: 'START_REQUEST' }) + $.getJSON(path, { type: 'JSON' }) + .done(response => store.dispatch(Object.assign({ type: 'ITEMS_FETCHED' }, humps.camelizeKeys(response)))) + .fail(() => store.dispatch({ type: 'REQUEST_ERROR' })) + .always(() => store.dispatch({ type: 'FINISH_REQUEST' })) }) $element.on('click', '[data-cancel-search-button]', (event) => { diff --git a/apps/block_scout_web/assets/js/pages/address/transactions.js b/apps/block_scout_web/assets/js/pages/address/transactions.js index ecd604e2d5..268e821a16 100644 --- a/apps/block_scout_web/assets/js/pages/address/transactions.js +++ b/apps/block_scout_web/assets/js/pages/address/transactions.js @@ -32,12 +32,12 @@ export function reducer (state, action) { return state } - return Object.assign({}, state, { items: [ action.msg.transactionHtml, ...state.items ] }) + return Object.assign({}, state, { items: [action.msg.transactionHtml, ...state.items] }) } case 'RECEIVED_NEW_REWARD': { if (state.channelDisconnected) return state - return Object.assign({}, state, { items: [ action.msg.rewardHtml, ...state.items ] }) + return Object.assign({}, state, { items: [action.msg.rewardHtml, ...state.items] }) } default: return state diff --git a/apps/block_scout_web/assets/js/pages/blocks.js b/apps/block_scout_web/assets/js/pages/blocks.js index 4d9bdc05d9..fee805bbbb 100644 --- a/apps/block_scout_web/assets/js/pages/blocks.js +++ b/apps/block_scout_web/assets/js/pages/blocks.js @@ -91,7 +91,7 @@ if ($blockListPage.length || $uncleListPage.length || $reorgListPage.length) { ) connectElements({ store, elements }) - const blocksChannel = socket.channel(`blocks:new_block`, {}) + const blocksChannel = socket.channel('blocks:new_block', {}) blocksChannel.join() blocksChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' diff --git a/apps/block_scout_web/assets/js/pages/chain.js b/apps/block_scout_web/assets/js/pages/chain.js index 30e982553c..f1bd651332 100644 --- a/apps/block_scout_web/assets/js/pages/chain.js +++ b/apps/block_scout_web/assets/js/pages/chain.js @@ -264,21 +264,21 @@ if ($chainDetailsPage.length) { msg: humps.camelizeKeys(msg) })) - const addressesChannel = socket.channel(`addresses:new_address`) + const addressesChannel = socket.channel('addresses:new_address') addressesChannel.join() addressesChannel.on('count', msg => store.dispatch({ type: 'RECEIVED_NEW_ADDRESS_COUNT', msg: humps.camelizeKeys(msg) })) - const blocksChannel = socket.channel(`blocks:new_block`) + const blocksChannel = socket.channel('blocks:new_block') blocksChannel.join() blocksChannel.on('new_block', msg => store.dispatch({ type: 'RECEIVED_NEW_BLOCK', msg: humps.camelizeKeys(msg) })) - const transactionsChannel = socket.channel(`transactions:new_transaction`) + const transactionsChannel = socket.channel('transactions:new_transaction') transactionsChannel.join() transactionsChannel.on('transaction', batchChannel((msgs) => store.dispatch({ type: 'RECEIVED_NEW_TRANSACTION_BATCH', @@ -288,11 +288,11 @@ if ($chainDetailsPage.length) { function loadTransactions (store) { const path = store.getState().transactionsPath - store.dispatch({type: 'START_TRANSACTIONS_FETCH'}) + store.dispatch({ type: 'START_TRANSACTIONS_FETCH' }) $.getJSON(path) - .done(response => store.dispatch({type: 'TRANSACTIONS_FETCHED', msg: humps.camelizeKeys(response)})) - .fail(() => store.dispatch({type: 'TRANSACTIONS_FETCH_ERROR'})) - .always(() => store.dispatch({type: 'FINISH_TRANSACTIONS_FETCH'})) + .done(response => store.dispatch({ type: 'TRANSACTIONS_FETCHED', msg: humps.camelizeKeys(response) })) + .fail(() => store.dispatch({ type: 'TRANSACTIONS_FETCH_ERROR' })) + .always(() => store.dispatch({ type: 'FINISH_TRANSACTIONS_FETCH' })) } function bindTransactionErrorMessage (store) { @@ -325,14 +325,14 @@ export function placeHolderBlock (blockNumber) { function loadBlocks (store) { const url = store.getState().blocksPath - store.dispatch({type: 'START_BLOCKS_FETCH'}) + store.dispatch({ type: 'START_BLOCKS_FETCH' }) $.getJSON(url) .done(response => { - store.dispatch({type: 'BLOCKS_FETCHED', msg: humps.camelizeKeys(response)}) + store.dispatch({ type: 'BLOCKS_FETCHED', msg: humps.camelizeKeys(response) }) }) - .fail(() => store.dispatch({type: 'BLOCKS_REQUEST_ERROR'})) - .always(() => store.dispatch({type: 'BLOCKS_FINISH_REQUEST'})) + .fail(() => store.dispatch({ type: 'BLOCKS_REQUEST_ERROR' })) + .always(() => store.dispatch({ type: 'BLOCKS_FINISH_REQUEST' })) } function bindBlockErrorMessage (store) { diff --git a/apps/block_scout_web/assets/js/pages/pending_transactions.js b/apps/block_scout_web/assets/js/pages/pending_transactions.js index 711f7c4343..d7cf76de43 100644 --- a/apps/block_scout_web/assets/js/pages/pending_transactions.js +++ b/apps/block_scout_web/assets/js/pages/pending_transactions.js @@ -102,7 +102,7 @@ if ($transactionPendingListPage.length) { const store = createAsyncLoadStore(reducer, initialState, 'dataset.identifierHash') connectElements({ store, elements }) - const transactionsChannel = socket.channel(`transactions:new_transaction`) + const transactionsChannel = socket.channel('transactions:new_transaction') transactionsChannel.join() transactionsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' @@ -118,7 +118,7 @@ if ($transactionPendingListPage.length) { }), 1000) }) - const pendingTransactionsChannel = socket.channel(`transactions:new_pending_transaction`) + const pendingTransactionsChannel = socket.channel('transactions:new_pending_transaction') pendingTransactionsChannel.join() pendingTransactionsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' diff --git a/apps/block_scout_web/assets/js/pages/token_counters.js b/apps/block_scout_web/assets/js/pages/token_counters.js index 42f8b38792..2aeadd3f67 100644 --- a/apps/block_scout_web/assets/js/pages/token_counters.js +++ b/apps/block_scout_web/assets/js/pages/token_counters.js @@ -68,11 +68,11 @@ function loadCounters (store) { const $element = $('[data-async-counters]') const path = $element.data() && $element.data().asyncCounters function fetchCounters () { - store.dispatch({type: 'START_REQUEST'}) + store.dispatch({ type: 'START_REQUEST' }) $.getJSON(path) - .done(response => store.dispatch(Object.assign({type: 'COUNTERS_FETCHED'}, humps.camelizeKeys(response)))) - .fail(() => store.dispatch({type: 'REQUEST_ERROR'})) - .always(() => store.dispatch({type: 'FINISH_REQUEST'})) + .done(response => store.dispatch(Object.assign({ type: 'COUNTERS_FETCHED' }, humps.camelizeKeys(response)))) + .fail(() => store.dispatch({ type: 'REQUEST_ERROR' })) + .always(() => store.dispatch({ type: 'FINISH_REQUEST' })) } fetchCounters() diff --git a/apps/block_scout_web/assets/js/pages/transaction.js b/apps/block_scout_web/assets/js/pages/transaction.js index 139d1f527c..144b613022 100644 --- a/apps/block_scout_web/assets/js/pages/transaction.js +++ b/apps/block_scout_web/assets/js/pages/transaction.js @@ -47,7 +47,7 @@ if ($transactionDetailsPage.length) { const store = createStore(reducer) connectElements({ store, elements }) - const blocksChannel = socket.channel(`blocks:new_block`, {}) + const blocksChannel = socket.channel('blocks:new_block', {}) blocksChannel.join() blocksChannel.on('new_block', (msg) => store.dispatch({ type: 'RECEIVED_NEW_BLOCK', diff --git a/apps/block_scout_web/assets/js/pages/transactions.js b/apps/block_scout_web/assets/js/pages/transactions.js index f528f760c4..61db30e147 100644 --- a/apps/block_scout_web/assets/js/pages/transactions.js +++ b/apps/block_scout_web/assets/js/pages/transactions.js @@ -85,7 +85,7 @@ if ($transactionListPage.length) { connectElements({ store, elements }) - const transactionsChannel = socket.channel(`transactions:new_transaction`) + const transactionsChannel = socket.channel('transactions:new_transaction') transactionsChannel.join() transactionsChannel.onError(() => store.dispatch({ type: 'CHANNEL_DISCONNECTED' diff --git a/apps/block_scout_web/assets/js/pages/verification_form.js b/apps/block_scout_web/assets/js/pages/verification_form.js index 10504c144c..1e10a289e8 100644 --- a/apps/block_scout_web/assets/js/pages/verification_form.js +++ b/apps/block_scout_web/assets/js/pages/verification_form.js @@ -67,7 +67,7 @@ const elements = { }) $('.js-btn-add-contract-library').on('click', function () { - let nextContractLibrary = $('.js-contract-library-form-group.active').next('.js-contract-library-form-group') + const nextContractLibrary = $('.js-contract-library-form-group.active').next('.js-contract-library-form-group') if (nextContractLibrary) { nextContractLibrary.addClass('active') @@ -130,7 +130,7 @@ if ($contractVerificationPage.length) { }) $('.js-btn-add-contract-library').on('click', function () { - let nextContractLibrary = $('.js-contract-library-form-group.active').next('.js-contract-library-form-group') + const nextContractLibrary = $('.js-contract-library-form-group.active').next('.js-contract-library-form-group') if (nextContractLibrary) { nextContractLibrary.addClass('active') diff --git a/apps/block_scout_web/assets/js/socket.js b/apps/block_scout_web/assets/js/socket.js index 956345930d..3490157a8b 100644 --- a/apps/block_scout_web/assets/js/socket.js +++ b/apps/block_scout_web/assets/js/socket.js @@ -1,7 +1,7 @@ -import {Socket} from 'phoenix' -import {locale} from './locale' +import { Socket } from 'phoenix' +import { locale } from './locale' -const socket = new Socket('/socket', {params: {locale: locale}}) +const socket = new Socket('/socket', { params: { locale: locale } }) socket.connect() export default socket