diff --git a/.eslintrc.js b/.eslintrc.js index 9ac053afc..1d690ca3d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -51,6 +51,7 @@ module.exports = { 'no-empty': 'error', 'no-eq-null': 'error', 'no-loop-func': 'error', + 'no-plusplus': ['error', { 'allowForLoopAfterthoughts': true }], 'no-useless-catch': 'error', 'no-useless-concat': 'error', /* End v2 rules */ diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index cc0f48af6..71b228a11 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -684,7 +684,7 @@ export default class TransactionController extends EventEmitter { if (!('retryCount' in txMeta)) { txMeta.retryCount = 0 } - txMeta.retryCount++ + txMeta.retryCount += 1 this.txStateManager.updateTx(txMeta, 'transactions/pending-tx-tracker#event: tx:retry') }) } diff --git a/app/scripts/lib/random-id.js b/app/scripts/lib/random-id.js index f7abc4169..eebba0619 100644 --- a/app/scripts/lib/random-id.js +++ b/app/scripts/lib/random-id.js @@ -3,5 +3,6 @@ const MAX = Number.MAX_SAFE_INTEGER let idCounter = Math.round(Math.random() * MAX) export default function createRandomId () { idCounter = idCounter % MAX + // eslint-disable-next-line no-plusplus return idCounter++ } diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 7cc6445a0..4cfcf38d6 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -1519,7 +1519,7 @@ export default class MetamaskController extends EventEmitter { const api = this.getApi() const dnode = Dnode(api) // report new active controller connection - this.activeControllerConnections++ + this.activeControllerConnections += 1 this.emit('controllerConnectionChanged', this.activeControllerConnections) // connect dnode api to remote connection pump( @@ -1528,7 +1528,7 @@ export default class MetamaskController extends EventEmitter { outStream, (err) => { // report new active controller connection - this.activeControllerConnections-- + this.activeControllerConnections -= 1 this.emit('controllerConnectionChanged', this.activeControllerConnections) // report any error if (err) { diff --git a/app/scripts/migrations/019.js b/app/scripts/migrations/019.js index e87bdad62..aa1e8a6cc 100644 --- a/app/scripts/migrations/019.js +++ b/app/scripts/migrations/019.js @@ -72,7 +72,7 @@ function getHighestContinuousFrom (txList, startPoint) { let highest = startPoint while (nonces.includes(highest)) { - highest++ + highest += 1 } return highest diff --git a/development/sourcemap-validator.js b/development/sourcemap-validator.js index dd6af7ba7..cfb569138 100644 --- a/development/sourcemap-validator.js +++ b/development/sourcemap-validator.js @@ -91,7 +91,7 @@ async function validateSourcemapForFile ({ buildName }) { const matchesPerLine = buildLines.map((line) => indicesOf(targetString, line)) matchesPerLine.forEach((matchIndices, lineIndex) => { matchIndices.forEach((matchColumn) => { - sampleCount++ + sampleCount += 1 const position = { line: lineIndex + 1, column: matchColumn } const result = consumer.originalPositionFor(position) // warn if source content is missing diff --git a/test/unit/migrations/023-test.js b/test/unit/migrations/023-test.js index 98a65ceee..362b4dbe2 100644 --- a/test/unit/migrations/023-test.js +++ b/test/unit/migrations/023-test.js @@ -41,7 +41,7 @@ while (transactions.length <= 100) { // This is an old migration, let's allow it // eslint-disable-next-line no-loop-func if (!deletableTxStates.find((s) => s === status)) { - nonDeletableCount++ + nonDeletableCount += 1 } transactions.push({ status }) } @@ -67,7 +67,7 @@ describe('storage is migrated successfully and the proper transactions are remov const migratedTransactions = migratedData.data.TransactionController.transactions migratedTransactions.forEach((tx) => { if (!deletableTxStates.find((s) => s === tx.status)) { - leftoverNonDeletableTxCount++ + leftoverNonDeletableTxCount += 1 } }) assert.equal(leftoverNonDeletableTxCount, nonDeletableCount, "migration shouldn't delete transactions we want to keep") diff --git a/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js b/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js index d9c04c4bf..13659b4cd 100644 --- a/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js +++ b/ui/app/components/app/gas-customization/gas-price-chart/gas-price-chart.utils.js @@ -163,7 +163,7 @@ export function setSelectedCircle ({ while (lowerX === higherX) { higherX = getCoordinateData(`.c3-circle-${count}`).x higherY = getCoordinateData(`.c3-circle-${count}`).y - count++ + count += 1 } } diff --git a/ui/app/components/app/modals/fade-modal.js b/ui/app/components/app/modals/fade-modal.js index aa39a8e18..5b993e40e 100644 --- a/ui/app/components/app/modals/fade-modal.js +++ b/ui/app/components/app/modals/fade-modal.js @@ -22,6 +22,7 @@ const insertRule = (css) => { const insertKeyframesRule = (keyframes) => { // random name + // eslint-disable-next-line no-plusplus const name = 'anim_' + (++index) + (+new Date()) let css = `@keyframes ${name} {` diff --git a/ui/app/pages/mobile-sync/mobile-sync.component.js b/ui/app/pages/mobile-sync/mobile-sync.component.js index 1a0d0355f..1bd69b9cb 100644 --- a/ui/app/pages/mobile-sync/mobile-sync.component.js +++ b/ui/app/pages/mobile-sync/mobile-sync.component.js @@ -173,8 +173,10 @@ export default class MobileSyncPage extends Component { chunkString (str, size) { const numChunks = Math.ceil(str.length / size) const chunks = new Array(numChunks) - for (let i = 0, o = 0; i < numChunks; ++i, o += size) { + for (let i = 0, o = 0; i < numChunks;) { chunks[i] = str.substr(o, size) + i += 1 + o += size } return chunks }