From 4357cda7b847e5eb66da54efd4624743479d4712 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Tue, 18 Aug 2020 14:06:45 -0230 Subject: [PATCH] Fix no-shadow issues (#9246) See [`no-shadow`](https://eslint.org/docs/rules/no-shadow) for more information. This change enables `no-shadow` and fixes the issues raised by the rule. --- .eslintrc.js | 1 + app/scripts/controllers/alert.js | 3 +- app/scripts/controllers/app-state.js | 3 +- app/scripts/controllers/transactions/index.js | 6 ++-- app/scripts/metamask-controller.js | 18 ++++++------ development/build/styles.js | 4 +-- development/verify-locale-strings.js | 12 ++++---- test/e2e/benchmark.js | 8 ++--- test/e2e/signature-request.spec.js | 2 +- test/e2e/webdriver/index.js | 8 ++--- .../controllers/metamask-controller-test.js | 11 ++++--- .../permissions-controller-test.js | 6 ++-- .../preferences-controller-test.js | 29 +++++++------------ .../transactions/tx-state-manager-test.js | 12 ++++---- test/unit/migrations/migrator-test.js | 2 +- test/unit/ui/app/actions.spec.js | 7 +++-- .../gas-modal-page-container.container.js | 1 + .../gas-price-button-group-component.test.js | 4 +-- .../cancel-transaction.container.js | 1 + ui/app/components/app/modals/fade-modal.js | 3 +- .../notification-modal/notification-modal.js | 1 + .../transaction-list-item.component.js | 6 ++-- .../page-container-footer.component.test.js | 2 +- ui/app/components/ui/qr-code/qr-code.js | 4 +-- ui/app/components/ui/tabs/tabs.component.js | 2 +- ui/app/ducks/gas/gas-duck.test.js | 2 +- ui/app/helpers/utils/common.util.js | 2 +- ui/app/hooks/useTokenTracker.js | 8 ++--- ui/app/hooks/useTransactionDisplayData.js | 2 +- ui/app/pages/asset/asset.js | 2 +- .../pages/confirm-approve/confirm-approve.js | 2 ++ .../connected-sites.container.js | 1 + .../create-account/import-account/index.js | 6 ++-- .../onboarding-initiator-util.js | 2 ++ ui/app/pages/keychains/restore-vault.js | 2 ++ .../permissions-connect.component.js | 4 +-- .../permissions-connect.container.js | 2 +- .../send/send-footer/send-footer.utils.js | 12 ++++---- .../unlock-page/unlock-page.container.js | 1 + ui/app/store/actions.js | 18 ++++++------ ui/index.js | 4 +-- 41 files changed, 113 insertions(+), 113 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 176d63666..dd453beb9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -66,6 +66,7 @@ module.exports = { 'no-plusplus': ['error', { 'allowForLoopAfterthoughts': true }], 'no-process-exit': 'error', 'no-prototype-builtins': 'error', + 'no-shadow': 'error', 'no-template-curly-in-string': 'error', 'no-useless-catch': 'error', 'no-useless-concat': 'error', diff --git a/app/scripts/controllers/alert.js b/app/scripts/controllers/alert.js index 7fdddcdb1..af49b9df6 100644 --- a/app/scripts/controllers/alert.js +++ b/app/scripts/controllers/alert.js @@ -48,8 +48,7 @@ export default class AlertController { ) this.store = new ObservableStore(state) - const { selectedAddress } = preferencesStore.getState() - this.selectedAddress = selectedAddress + this.selectedAddress = preferencesStore.getState().selectedAddress preferencesStore.subscribe(({ selectedAddress }) => { const currentState = this.store.getState() diff --git a/app/scripts/controllers/app-state.js b/app/scripts/controllers/app-state.js index a9414cea4..d43c74670 100644 --- a/app/scripts/controllers/app-state.js +++ b/app/scripts/controllers/app-state.js @@ -15,8 +15,6 @@ export default class AppStateController extends EventEmitter { showUnlockRequest, preferencesStore, } = opts - const { preferences } = preferencesStore.getState() - super() this.onInactiveTimeout = onInactiveTimeout || (() => undefined) @@ -40,6 +38,7 @@ export default class AppStateController extends EventEmitter { } }) + const { preferences } = preferencesStore.getState() this._setInactiveTimeout(preferences.autoLockTimeLimit) } diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 9f8da729d..ece1d47ad 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -473,8 +473,8 @@ export default class TransactionController extends EventEmitter { // this is try-catch wrapped so that we can guarantee that the nonceLock is released try { this.txStateManager.setTxStatusFailed(txId, err) - } catch (err) { - log.error(err) + } catch (err2) { + log.error(err2) } // must set transaction to submitted/failed before releasing lock if (nonceLock) { @@ -701,7 +701,7 @@ export default class TransactionController extends EventEmitter { TOKEN_METHOD_APPROVE, TOKEN_METHOD_TRANSFER, TOKEN_METHOD_TRANSFER_FROM, - ].find((tokenMethodName) => tokenMethodName === name && name.toLowerCase()) + ].find((methodName) => methodName === name && name.toLowerCase()) let result if (txParams.data && tokenMethodName) { diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index cd3729784..8790e4b69 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -49,7 +49,6 @@ import nodeify from './lib/nodeify' import accountImporter from './account-import-strategies' import selectChainId from './lib/select-chain-id' import { Mutex } from 'await-semaphore' -import { version } from '../manifest/_base.json' import ethUtil from 'ethereumjs-util' import seedPhraseVerifier from './lib/seed-phrase-verifier' @@ -81,6 +80,7 @@ export default class MetamaskController extends EventEmitter { this.sendUpdate = debounce(this.privateSendUpdate.bind(this), 200) this.opts = opts + this.platform = opts.platform const initState = opts.initState || {} this.recordFirstTimeInfo(initState) @@ -88,9 +88,6 @@ export default class MetamaskController extends EventEmitter { // the only thing that uses controller connections are open metamask UI instances this.activeControllerConnections = 0 - // platform-specific api - this.platform = opts.platform - this.getRequestAccountTabIds = opts.getRequestAccountTabIds this.getOpenMetamaskTabsIds = opts.getOpenMetamaskTabsIds @@ -221,6 +218,7 @@ export default class MetamaskController extends EventEmitter { preferencesStore: this.preferencesController.store, }) + const version = this.platform.getVersion() this.threeBoxController = new ThreeBoxController({ preferencesController: this.preferencesController, addressBookController: this.addressBookController, @@ -335,6 +333,7 @@ export default class MetamaskController extends EventEmitter { * Constructor helper: initialize a provider. */ initializeProvider () { + const version = this.platform.getVersion() const providerOpts = { static: { eth_syncing: false, @@ -594,8 +593,8 @@ export default class MetamaskController extends EventEmitter { vault = await this.keyringController.fullUpdate() } else { vault = await this.keyringController.createNewVaultAndKeychain(password) - const accounts = await this.keyringController.getAccounts() - this.preferencesController.setAddresses(accounts) + const addresses = await this.keyringController.getAccounts() + this.preferencesController.setAddresses(addresses) this.selectFirstIdentity() } return vault @@ -711,9 +710,9 @@ export default class MetamaskController extends EventEmitter { Object.keys(accountTokens[address]).forEach((networkType) => { filteredAccountTokens[checksummedAddress][networkType] = networkType === 'mainnet' ? ( - accountTokens[address][networkType].filter(({ address }) => { - const tokenAddress = ethUtil.toChecksumAddress(address) - return contractMap[tokenAddress] ? contractMap[tokenAddress].erc20 : true + accountTokens[address][networkType].filter(({ address: tokenAddress }) => { + const checksumAddress = ethUtil.toChecksumAddress(tokenAddress) + return contractMap[checksumAddress] ? contractMap[checksumAddress].erc20 : true }) ) : accountTokens[address][networkType] @@ -2058,6 +2057,7 @@ export default class MetamaskController extends EventEmitter { */ recordFirstTimeInfo (initState) { if (!('firstTimeInfo' in initState)) { + const version = this.platform.getVersion() initState.firstTimeInfo = { version, date: Date.now(), diff --git a/development/build/styles.js b/development/build/styles.js index 4667100c8..f57954c94 100644 --- a/development/build/styles.js +++ b/development/build/styles.js @@ -49,14 +49,14 @@ function createStyleTasks ({ livereload }) { return async function () { if (devMode) { watch(pattern, async (event) => { - await buildScss(devMode) + await buildScss() livereload.changed(event.path) }) } await buildScss(devMode) } - async function buildScss (devMode) { + async function buildScss () { await pump(...[ // pre-process gulp.src(src), diff --git a/development/verify-locale-strings.js b/development/verify-locale-strings.js index 3b9e72bf3..f15344d4d 100644 --- a/development/verify-locale-strings.js +++ b/development/verify-locale-strings.js @@ -46,19 +46,19 @@ for (const arg of process.argv.slice(2)) { } } -main(specifiedLocale, fix) +main() .catch((error) => { log.error(error) process.exit(1) }) -async function main (specifiedLocale, fix) { +async function main () { if (specifiedLocale) { log.info(`Verifying selected locale "${specifiedLocale}":\n`) const locale = localeIndex.find((localeMeta) => localeMeta.code === specifiedLocale) const failed = locale.code === 'en' ? - await verifyEnglishLocale(fix) : - await verifyLocale(locale, fix) + await verifyEnglishLocale() : + await verifyLocale(locale) if (failed) { process.exit(1) } @@ -116,7 +116,7 @@ async function writeLocale (code, locale) { } } -async function verifyLocale (code, fix = false) { +async function verifyLocale (code) { const englishLocale = await getLocale('en') const targetLocale = await getLocale(code) @@ -162,7 +162,7 @@ async function verifyLocale (code, fix = false) { return false } -async function verifyEnglishLocale (fix = false) { +async function verifyEnglishLocale () { const englishLocale = await getLocale('en') const javascriptFiles = await findJavascriptFiles(path.resolve(__dirname, '..', 'ui')) diff --git a/test/e2e/benchmark.js b/test/e2e/benchmark.js index a70bf6805..d418f38b7 100644 --- a/test/e2e/benchmark.js +++ b/test/e2e/benchmark.js @@ -62,10 +62,10 @@ async function profilePageLoad (pages, numSamples) { } const result = { - firstPaint: runResults.map((result) => result.paint['first-paint']), - domContentLoaded: runResults.map((result) => result.navigation[0] && result.navigation[0].domContentLoaded), - load: runResults.map((result) => result.navigation[0] && result.navigation[0].load), - domInteractive: runResults.map((result) => result.navigation[0] && result.navigation[0].domInteractive), + firstPaint: runResults.map((metrics) => metrics.paint['first-paint']), + domContentLoaded: runResults.map((metrics) => metrics.navigation[0] && metrics.navigation[0].domContentLoaded), + load: runResults.map((metrics) => metrics.navigation[0] && metrics.navigation[0].load), + domInteractive: runResults.map((metrics) => metrics.navigation[0] && metrics.navigation[0].domInteractive), } results[pageName] = { diff --git a/test/e2e/signature-request.spec.js b/test/e2e/signature-request.spec.js index 4ad70e15e..03d7fcfe6 100644 --- a/test/e2e/signature-request.spec.js +++ b/test/e2e/signature-request.spec.js @@ -74,7 +74,7 @@ describe('MetaMask', function () { await driver.delay(regularDelayMs) await driver.waitUntilXWindowHandles(3) - const windowHandles = await driver.getAllWindowHandles() + windowHandles = await driver.getAllWindowHandles() extension = windowHandles[0] dapp = await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles) diff --git a/test/e2e/webdriver/index.js b/test/e2e/webdriver/index.js index 8972d54a6..916b7db36 100644 --- a/test/e2e/webdriver/index.js +++ b/test/e2e/webdriver/index.js @@ -37,16 +37,16 @@ async function buildBrowserWebDriver (browser, webDriverOptions) { async function setupFetchMocking (driver) { // define fetchMocking script, to be evaluated in the browser - function fetchMocking (fetchMockResponses) { + function fetchMocking (mockResponses) { window.origFetch = window.fetch.bind(window) window.fetch = async (...args) => { const url = args[0] if (url.match(/^http(s)?:\/\/ethgasstation\.info\/json\/ethgasAPI.*/u)) { - return { json: async () => clone(fetchMockResponses.ethGasBasic) } + return { json: async () => clone(mockResponses.ethGasBasic) } } else if (url.match(/http(s?):\/\/ethgasstation\.info\/json\/predictTable.*/u)) { - return { json: async () => clone(fetchMockResponses.ethGasPredictTable) } + return { json: async () => clone(mockResponses.ethGasPredictTable) } } else if (url.match(/chromeextensionmm/u)) { - return { json: async () => clone(fetchMockResponses.metametrics) } + return { json: async () => clone(mockResponses.metametrics) } } return window.origFetch(...args) } diff --git a/test/unit/app/controllers/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js index 92be16f51..4abd3316e 100644 --- a/test/unit/app/controllers/metamask-controller-test.js +++ b/test/unit/app/controllers/metamask-controller-test.js @@ -7,6 +7,7 @@ import { obj as createThoughStream } from 'through2' import firstTimeState from '../../localhostState' import createTxMeta from '../../../lib/createTxMeta' import EthQuery from 'eth-query' +import proxyquire from 'proxyquire' const threeBoxSpies = { init: sinon.stub(), @@ -14,7 +15,6 @@ const threeBoxSpies = { turnThreeBoxSyncingOn: sinon.stub(), _registerUpdates: sinon.spy(), } -import proxyquire from 'proxyquire' class ThreeBoxControllerMock { constructor () { @@ -113,7 +113,7 @@ describe('MetaMaskController', function () { }, }, initState: cloneDeep(firstTimeState), - platform: { showTransactionNotification: () => undefined }, + platform: { showTransactionNotification: () => undefined, getVersion: () => 'foo' }, }) // disable diagnostics metamaskController.diagnostics = null @@ -758,11 +758,10 @@ describe('MetaMaskController', function () { }) it('errors with no from in msgParams', async function () { - const msgParams = { - 'data': data, - } try { - await metamaskController.newUnsignedPersonalMessage(msgParams) + await metamaskController.newUnsignedPersonalMessage({ + 'data': data, + }) assert.fail('should have thrown') } catch (error) { assert.equal(error.message, 'MetaMask Message Signature: from field is required.') diff --git a/test/unit/app/controllers/permissions/permissions-controller-test.js b/test/unit/app/controllers/permissions/permissions-controller-test.js index 1b4f315a3..f8aa6feaa 100644 --- a/test/unit/app/controllers/permissions/permissions-controller-test.js +++ b/test/unit/app/controllers/permissions/permissions-controller-test.js @@ -823,9 +823,9 @@ describe('permissions controller', function () { beforeEach(function () { identities = ALL_ACCOUNTS.reduce( - (identities, account) => { - identities[account] = {} - return identities + (identitiesAcc, account) => { + identitiesAcc[account] = {} + return identitiesAcc }, {}, ) diff --git a/test/unit/app/controllers/preferences-controller-test.js b/test/unit/app/controllers/preferences-controller-test.js index f0091d35a..450aa1ab1 100644 --- a/test/unit/app/controllers/preferences-controller-test.js +++ b/test/unit/app/controllers/preferences-controller-test.js @@ -366,15 +366,13 @@ describe('preferences controller', function () { }) describe('on watchAsset', function () { - let stubNext, stubEnd, stubHandleWatchAssetERC20, asy, req, res + let stubHandleWatchAssetERC20, asy, req, res const sandbox = sinon.createSandbox() beforeEach(function () { req = { params: {} } res = {} - asy = { next: () => undefined, end: () => undefined } - stubNext = sandbox.stub(asy, 'next') - stubEnd = sandbox.stub(asy, 'end').returns(0) + asy = { next: sandbox.spy(), end: sandbox.spy() } stubHandleWatchAssetERC20 = sandbox.stub(preferencesController, '_handleWatchAssetERC20') }) after(function () { @@ -382,40 +380,33 @@ describe('preferences controller', function () { }) it('shouldn not do anything if method not corresponds', async function () { - const asy = { next: () => undefined, end: () => undefined } - const stubNext = sandbox.stub(asy, 'next') - const stubEnd = sandbox.stub(asy, 'end').returns(0) req.method = 'metamask' await preferencesController.requestWatchAsset(req, res, asy.next, asy.end) - sandbox.assert.notCalled(stubEnd) - sandbox.assert.called(stubNext) + sandbox.assert.notCalled(asy.end) + sandbox.assert.called(asy.next) }) it('should do something if method is supported', async function () { - const asy = { next: () => undefined, end: () => undefined } - const stubNext = sandbox.stub(asy, 'next') - const stubEnd = sandbox.stub(asy, 'end').returns(0) req.method = 'metamask_watchAsset' req.params.type = 'someasset' await preferencesController.requestWatchAsset(req, res, asy.next, asy.end) - sandbox.assert.called(stubEnd) - sandbox.assert.notCalled(stubNext) + sandbox.assert.called(asy.end) + sandbox.assert.notCalled(asy.next) req.method = addInternalMethodPrefix('watchAsset') req.params.type = 'someasset' await preferencesController.requestWatchAsset(req, res, asy.next, asy.end) - sandbox.assert.calledTwice(stubEnd) - sandbox.assert.notCalled(stubNext) + sandbox.assert.calledTwice(asy.end) + sandbox.assert.notCalled(asy.next) }) it('should through error if method is supported but asset type is not', async function () { req.method = 'metamask_watchAsset' req.params.type = 'someasset' await preferencesController.requestWatchAsset(req, res, asy.next, asy.end) - sandbox.assert.called(stubEnd) + sandbox.assert.called(asy.end) sandbox.assert.notCalled(stubHandleWatchAssetERC20) - sandbox.assert.notCalled(stubNext) + sandbox.assert.notCalled(asy.next) assert.deepEqual(res, {}) }) it('should trigger handle add asset if type supported', async function () { - const asy = { next: () => undefined, end: () => undefined } req.method = 'metamask_watchAsset' req.params.type = 'ERC20' await preferencesController.requestWatchAsset(req, res, asy.next, asy.end) diff --git a/test/unit/app/controllers/transactions/tx-state-manager-test.js b/test/unit/app/controllers/transactions/tx-state-manager-test.js index abd7a7098..3e1819c41 100644 --- a/test/unit/app/controllers/transactions/tx-state-manager-test.js +++ b/test/unit/app/controllers/transactions/tx-state-manager-test.js @@ -34,15 +34,15 @@ describe('TransactionStateManager', function () { it('should emit a signed event to signal the execution of callback', function () { const tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} } const clock = sinon.useFakeTimers() - const noop = sinon.spy() + const onSigned = sinon.spy() txStateManager.addTx(tx) - txStateManager.on('1:signed', noop) + txStateManager.on('1:signed', onSigned) txStateManager.setTxStatusSigned(1) clock.runAll() clock.restore() - assert.ok(noop.calledOnce) + assert.ok(onSigned.calledOnce) }) }) @@ -59,15 +59,15 @@ describe('TransactionStateManager', function () { it('should emit a rejected event to signal the execution of callback', function () { const tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} } const clock = sinon.useFakeTimers() - const noop = sinon.spy() + const onSigned = sinon.spy() txStateManager.addTx(tx) - txStateManager.on('1:rejected', noop) + txStateManager.on('1:rejected', onSigned) txStateManager.setTxStatusRejected(1) clock.runAll() clock.restore() - assert.ok(noop.calledOnce) + assert.ok(onSigned.calledOnce) }) }) diff --git a/test/unit/migrations/migrator-test.js b/test/unit/migrations/migrator-test.js index a3dc2fbb7..c44ce3df7 100644 --- a/test/unit/migrations/migrator-test.js +++ b/test/unit/migrations/migrator-test.js @@ -86,8 +86,8 @@ describe('migrations', function () { }) describe('Migrator', function () { - const migrator = new Migrator({ migrations: stubMigrations }) it('migratedData version should be version 3', async function () { + const migrator = new Migrator({ migrations: stubMigrations }) const migratedData = await migrator.migrateData(versionedData) assert.equal(migratedData.meta.version, stubMigrations[2].version) }) diff --git a/test/unit/ui/app/actions.spec.js b/test/unit/ui/app/actions.spec.js index c25586950..af5f56f60 100644 --- a/test/unit/ui/app/actions.spec.js +++ b/test/unit/ui/app/actions.spec.js @@ -32,6 +32,7 @@ describe('Actions', function () { beforeEach(async function () { metamaskController = new MetaMaskController({ + platform: { getVersion: () => 'foo' }, provider, keyringController: new KeyringController({}), showUnapprovedTx: noop, @@ -337,9 +338,9 @@ describe('Actions', function () { importAccountWithStrategySpy = sinon.spy(background, 'importAccountWithStrategy') - const importPrivkey = 'c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3' - - await store.dispatch(actions.importNewAccount('Private Key', [ importPrivkey ])) + await store.dispatch(actions.importNewAccount('Private Key', [ + 'c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3', + ])) assert(importAccountWithStrategySpy.calledOnce) }) diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js index 0af8673d1..3d2b27f75 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.container.js @@ -220,6 +220,7 @@ const mapDispatchToProps = (dispatch) => { const mergeProps = (stateProps, dispatchProps, ownProps) => { const { gasPriceButtonGroupProps, + // eslint-disable-next-line no-shadow isConfirm, txId, isSpeedUp, diff --git a/ui/app/components/app/gas-customization/gas-price-button-group/tests/gas-price-button-group-component.test.js b/ui/app/components/app/gas-customization/gas-price-button-group/tests/gas-price-button-group-component.test.js index 1ca1c50d0..0499f4005 100644 --- a/ui/app/components/app/gas-customization/gas-price-button-group/tests/gas-price-button-group-component.test.js +++ b/ui/app/components/app/gas-customization/gas-price-button-group/tests/gas-price-button-group-component.test.js @@ -77,12 +77,12 @@ describe('GasPriceButtonGroup Component', function () { assert.equal(noButtonActiveByDefault, true) }) - function renderButtonArgsTest (i, mockButtonPropsAndFlags) { + function renderButtonArgsTest (i, mockPropsAndFlags) { assert.deepEqual( GasPriceButtonGroup.prototype.renderButton.getCall(i).args, [ Object.assign({}, mockGasPriceButtonGroupProps.gasButtonInfo[i]), - mockButtonPropsAndFlags, + mockPropsAndFlags, i, ], ) diff --git a/ui/app/components/app/modals/cancel-transaction/cancel-transaction.container.js b/ui/app/components/app/modals/cancel-transaction/cancel-transaction.container.js index 0f2a8593a..4e7a8d644 100644 --- a/ui/app/components/app/modals/cancel-transaction/cancel-transaction.container.js +++ b/ui/app/components/app/modals/cancel-transaction/cancel-transaction.container.js @@ -44,6 +44,7 @@ const mapDispatchToProps = (dispatch) => { const mergeProps = (stateProps, dispatchProps, ownProps) => { const { transactionId, defaultNewGasPrice, ...restStateProps } = stateProps + // eslint-disable-next-line no-shadow const { createCancelTransaction, ...restDispatchProps } = dispatchProps return { diff --git a/ui/app/components/app/modals/fade-modal.js b/ui/app/components/app/modals/fade-modal.js index 3d12414d4..89cace146 100644 --- a/ui/app/components/app/modals/fade-modal.js +++ b/ui/app/components/app/modals/fade-modal.js @@ -14,8 +14,7 @@ const insertRule = (css) => { extraSheet = extraSheet.sheet || extraSheet.styleSheet } - const index = (extraSheet.cssRules || extraSheet.rules).length - extraSheet.insertRule(css, index) + extraSheet.insertRule(css, (extraSheet.cssRules || extraSheet.rules).length) return extraSheet } diff --git a/ui/app/components/app/modals/notification-modal/notification-modal.js b/ui/app/components/app/modals/notification-modal/notification-modal.js index 71f826747..2cda61428 100644 --- a/ui/app/components/app/modals/notification-modal/notification-modal.js +++ b/ui/app/components/app/modals/notification-modal/notification-modal.js @@ -14,6 +14,7 @@ class NotificationModal extends Component { message, showCancelButton = false, showConfirmButton = false, + // eslint-disable-next-line no-shadow hideModal, onConfirm, } = this.props diff --git a/ui/app/components/app/transaction-list-item/transaction-list-item.component.js b/ui/app/components/app/transaction-list-item/transaction-list-item.component.js index d04966657..784e49907 100644 --- a/ui/app/components/app/transaction-list-item/transaction-list-item.component.js +++ b/ui/app/components/app/transaction-list-item/transaction-list-item.component.js @@ -72,7 +72,7 @@ export default function TransactionListItem ({ transactionGroup, isEarliestNonce }, [isUnapproved, history, id]) const cancelButton = useMemo(() => { - const cancelButton = ( + const btn = (