eslint fixes

pull/2854/head
Victor Baranov 5 years ago
parent 6521204b9a
commit b9695ef85e
  1. 17
      apps/block_scout_web/assets/js/lib/awesomplete-util.js
  2. 2
      apps/block_scout_web/assets/js/lib/card_tabs.js
  3. 2
      apps/block_scout_web/assets/js/lib/coin_balance_history_chart.js
  4. 3
      apps/block_scout_web/assets/js/lib/currency.js
  5. 2
      apps/block_scout_web/assets/js/lib/indexing.js
  6. 3
      apps/block_scout_web/assets/js/lib/market_history_chart.js
  7. 2
      apps/block_scout_web/assets/js/lib/modals.js
  8. 18
      apps/block_scout_web/assets/js/lib/network_selector.js
  9. 4
      apps/block_scout_web/assets/js/lib/pretty_json.js
  10. 6
      apps/block_scout_web/assets/js/pages/address/logs.js
  11. 2
      apps/block_scout_web/assets/js/pages/blocks.js
  12. 6
      apps/block_scout_web/assets/js/pages/chain.js
  13. 4
      apps/block_scout_web/assets/js/pages/pending_transactions.js
  14. 2
      apps/block_scout_web/assets/js/pages/transaction.js
  15. 2
      apps/block_scout_web/assets/js/pages/transactions.js
  16. 4
      apps/block_scout_web/assets/js/pages/verification_form.js

@ -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)

@ -17,7 +17,7 @@ $(function () {
const siblings = $(this).siblings()
if (siblings.is(':hidden')) {
siblings.css({ 'display': 'flex' })
siblings.css({ display: 'flex' })
} else {
siblings.hide()
}

@ -53,7 +53,7 @@ export function createCoinBalanceHistoryChart (el) {
},
scaleLabel: {
display: true,
labelString: window.localized['Ether']
labelString: window.localized.Ether
}
}]
}

@ -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))

@ -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)))

@ -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') {

@ -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: [{

@ -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()
}

@ -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
}

@ -63,12 +63,14 @@ 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' })

@ -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'

@ -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',

@ -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'

@ -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',

@ -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'

@ -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')

Loading…
Cancel
Save