mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Remove unused expressions (#6839)
Unused expressions are generally a mistake, as they don't do anything. The exceptions to this rule (short-circuit expressions and ternary expressions) have been allowed. The `webrtc-adapter` was previously ignored by eslint because it has a side-effect upon being imported. I removed the local variable instead, which should preserve the same side-effect without making eslint complain.
This commit is contained in:
parent
830c801ec3
commit
2eea388680
@ -133,6 +133,7 @@
|
|||||||
"no-unneeded-ternary": [2, { "defaultAssignment": false }],
|
"no-unneeded-ternary": [2, { "defaultAssignment": false }],
|
||||||
"no-unreachable": 2,
|
"no-unreachable": 2,
|
||||||
"no-unsafe-finally": 2,
|
"no-unsafe-finally": 2,
|
||||||
|
"no-unused-expressions": ["error", { "allowShortCircuit" : true, "allowTernary": true }],
|
||||||
"no-unused-vars": [2, { "vars": "all", "args": "all", "argsIgnorePattern": "[_]+" }],
|
"no-unused-vars": [2, { "vars": "all", "args": "all", "argsIgnorePattern": "[_]+" }],
|
||||||
"no-use-before-define": [2, { "functions": false }],
|
"no-use-before-define": [2, { "functions": false }],
|
||||||
"no-useless-call": 2,
|
"no-useless-call": 2,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { BrowserQRCodeReader } from '@zxing/library'
|
import { BrowserQRCodeReader } from '@zxing/library'
|
||||||
import adapter from 'webrtc-adapter' // eslint-disable-line import/no-nodejs-modules, no-unused-vars
|
import 'webrtc-adapter'
|
||||||
import Spinner from '../../../ui/spinner'
|
import Spinner from '../../../ui/spinner'
|
||||||
import WebcamUtils from '../../../../../lib/webcam-utils'
|
import WebcamUtils from '../../../../../lib/webcam-utils'
|
||||||
import PageContainerFooter from '../../../ui/page-container/page-container-footer/page-container-footer.component'
|
import PageContainerFooter from '../../../ui/page-container/page-container-footer/page-container-footer.component'
|
||||||
|
@ -3,7 +3,7 @@ import { compose } from 'recompose'
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { withRouter } from 'react-router-dom'
|
import { withRouter } from 'react-router-dom'
|
||||||
import { unconfirmedTransactionsCountSelector } from '../../selectors/confirm-transaction'
|
import { unconfirmedTransactionsCountSelector } from '../../selectors/confirm-transaction'
|
||||||
``
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const { metamask, appState } = state
|
const { metamask, appState } = state
|
||||||
const {
|
const {
|
||||||
|
@ -1476,7 +1476,9 @@ function cancelAllTx (txsData) {
|
|||||||
txsData.forEach((txData, i) => {
|
txsData.forEach((txData, i) => {
|
||||||
background.cancelTransaction(txData.id, () => {
|
background.cancelTransaction(txData.id, () => {
|
||||||
dispatch(actions.completedTx(txData.id))
|
dispatch(actions.completedTx(txData.id))
|
||||||
i === txsData.length - 1 ? dispatch(actions.goHome()) : null
|
if (i === txsData.length - 1) {
|
||||||
|
dispatch(actions.goHome())
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -2394,18 +2396,21 @@ function reshowQrCode (data, coin) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function shapeShiftRequest (query, options, cb) {
|
function shapeShiftRequest (query, options = {}, cb) {
|
||||||
var queryResponse, method
|
var queryResponse, method
|
||||||
!options ? options = {} : null
|
|
||||||
options.method ? method = options.method : method = 'GET'
|
options.method ? method = options.method : method = 'GET'
|
||||||
|
|
||||||
var requestListner = function () {
|
var requestListner = function () {
|
||||||
try {
|
try {
|
||||||
queryResponse = JSON.parse(this.responseText)
|
queryResponse = JSON.parse(this.responseText)
|
||||||
cb ? cb(queryResponse) : null
|
if (cb) {
|
||||||
|
cb(queryResponse)
|
||||||
|
}
|
||||||
return queryResponse
|
return queryResponse
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
cb ? cb({error: e}) : null
|
if (cb) {
|
||||||
|
cb({error: e})
|
||||||
|
}
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user