1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Fix no-invalid-this issues (#9207)

See [`no-invalid-this`](https://eslint.org/docs/rules/no-invalid-this) for more information.

This change enables `no-invalid-this` and fixes the issues raised by the rule.
This commit is contained in:
Whymarrh Whitby 2020-08-12 21:19:33 -02:30 committed by GitHub
parent c0f05ccae6
commit cd370be728
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -105,6 +105,10 @@ module.exports = {
'logical': 'parens-new-line', 'logical': 'parens-new-line',
'prop': 'parens-new-line', 'prop': 'parens-new-line',
}], }],
'no-invalid-this': 'off',
'babel/no-invalid-this': 'error',
'babel/semi': ['error', 'never'], 'babel/semi': ['error', 'never'],
'mocha/no-setup-in-describe': 'off', 'mocha/no-setup-in-describe': 'off',
}, },
@ -124,6 +128,15 @@ module.exports = {
rules: { rules: {
'global-require': 'off', 'global-require': 'off',
}, },
}, {
files: [
'test/**/*-test.js',
'test/**/*.spec.js',
],
rules: {
// Mocha will re-assign `this` in a test context
'babel/no-invalid-this': 'off',
},
}], }],
settings: { settings: {

View File

@ -164,10 +164,10 @@ export default class TransactionStateManager extends EventEmitter {
txMeta.txParams = this.normalizeAndValidateTxParams(txMeta.txParams) txMeta.txParams = this.normalizeAndValidateTxParams(txMeta.txParams)
} }
this.once(`${txMeta.id}:signed`, function () { this.once(`${txMeta.id}:signed`, () => {
this.removeAllListeners(`${txMeta.id}:rejected`) this.removeAllListeners(`${txMeta.id}:rejected`)
}) })
this.once(`${txMeta.id}:rejected`, function () { this.once(`${txMeta.id}:rejected`, () => {
this.removeAllListeners(`${txMeta.id}:signed`) this.removeAllListeners(`${txMeta.id}:signed`)
}) })
// initialize history // initialize history

View File

@ -124,6 +124,7 @@ export function setTickPosition (axis, n, newPosition, secondNewPosition) {
.style('visibility', 'visible') .style('visibility', 'visible')
} }
/* eslint-disable babel/no-invalid-this */
export function appendOrUpdateCircle ({ data, itemIndex, cx, cy, cssId, appendOnly }) { export function appendOrUpdateCircle ({ data, itemIndex, cx, cy, cssId, appendOnly }) {
const circle = this.main const circle = this.main
.select('.c3-selected-circles' + this.getTargetSelectorSuffix(data.id)) .select('.c3-selected-circles' + this.getTargetSelectorSuffix(data.id))
@ -144,6 +145,7 @@ export function appendOrUpdateCircle ({ data, itemIndex, cx, cy, cssId, appendOn
.attr('cy', cy) .attr('cy', cy)
} }
} }
/* eslint-enable babel/no-invalid-this */
export function setSelectedCircle ({ export function setSelectedCircle ({
chart, chart,