aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Stacey <markjstacey@gmail.com>2019-07-12 23:41:39 +0800
committerGitHub <noreply@github.com>2019-07-12 23:41:39 +0800
commit2eea38868081d5e1d87b70712253cceb750f2011 (patch)
tree9364fe770c15f45ae6b9d51a8ae299eba2b74fab
parent830c801ec39ee5dc878b1a08d7241d96bba0b6d6 (diff)
downloadtangerine-wallet-browser-2eea38868081d5e1d87b70712253cceb750f2011.tar.gz
tangerine-wallet-browser-2eea38868081d5e1d87b70712253cceb750f2011.tar.zst
tangerine-wallet-browser-2eea38868081d5e1d87b70712253cceb750f2011.zip
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.
-rw-r--r--.eslintrc1
-rw-r--r--ui/app/components/app/modals/qr-scanner/qr-scanner.component.js2
-rw-r--r--ui/app/pages/home/home.container.js2
-rw-r--r--ui/app/store/actions.js15
4 files changed, 13 insertions, 7 deletions
diff --git a/.eslintrc b/.eslintrc
index 22585aa9d..b9a20c1f2 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -133,6 +133,7 @@
"no-unneeded-ternary": [2, { "defaultAssignment": false }],
"no-unreachable": 2,
"no-unsafe-finally": 2,
+ "no-unused-expressions": ["error", { "allowShortCircuit" : true, "allowTernary": true }],
"no-unused-vars": [2, { "vars": "all", "args": "all", "argsIgnorePattern": "[_]+" }],
"no-use-before-define": [2, { "functions": false }],
"no-useless-call": 2,
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 a83ba8f8e..cb8b07ff1 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
@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
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 WebcamUtils from '../../../../../lib/webcam-utils'
import PageContainerFooter from '../../../ui/page-container/page-container-footer/page-container-footer.component'
diff --git a/ui/app/pages/home/home.container.js b/ui/app/pages/home/home.container.js
index d0a5d7b47..7508654dc 100644
--- a/ui/app/pages/home/home.container.js
+++ b/ui/app/pages/home/home.container.js
@@ -3,7 +3,7 @@ import { compose } from 'recompose'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { unconfirmedTransactionsCountSelector } from '../../selectors/confirm-transaction'
-``
+
const mapStateToProps = state => {
const { metamask, appState } = state
const {
diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js
index c9e595421..634e6c058 100644
--- a/ui/app/store/actions.js
+++ b/ui/app/store/actions.js
@@ -1476,7 +1476,9 @@ function cancelAllTx (txsData) {
txsData.forEach((txData, i) => {
background.cancelTransaction(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
- !options ? options = {} : null
options.method ? method = options.method : method = 'GET'
var requestListner = function () {
try {
queryResponse = JSON.parse(this.responseText)
- cb ? cb(queryResponse) : null
+ if (cb) {
+ cb(queryResponse)
+ }
return queryResponse
} catch (e) {
- cb ? cb({error: e}) : null
+ if (cb) {
+ cb({error: e})
+ }
return e
}
}