1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Fix global-require issues (#8999)

This commit is contained in:
Whymarrh Whitby 2020-07-17 21:06:29 -02:30 committed by GitHub
parent 4d66223f5c
commit 50c4db73cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 5 deletions

View File

@ -44,6 +44,7 @@ module.exports = {
/* TODO: Remove these when upgrading to `@metamask/eslint-config@2` */
'array-callback-return': 'error',
'callback-return': 'error',
'global-require': 'error',
/* End v2 rules */
'arrow-parens': 'error',
'no-tabs': 'error',
@ -105,6 +106,13 @@ module.exports = {
rules: {
'import/no-anonymous-default-export': ['error', { 'allowObject': true }],
},
}, {
files: [
'app/scripts/migrations/*.js',
],
rules: {
'global-require': 'off',
},
}],
settings: {

View File

@ -3,6 +3,8 @@ import nock from 'nock'
import Enzyme from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import log from 'loglevel'
import { JSDOM } from 'jsdom'
nock.disableNetConnect()
nock.enableNetConnect('localhost')
@ -45,8 +47,6 @@ global.log = log
//
// dom
const { JSDOM } = require('jsdom')
const jsdom = new JSDOM()
global.window = jsdom.window
@ -87,5 +87,6 @@ if (!window.crypto) {
window.crypto = {}
}
if (!window.crypto.getRandomValues) {
// eslint-disable-next-line global-require
window.crypto.getRandomValues = require('polyfill-crypto.getrandomvalues')
}

View File

@ -1,4 +1,5 @@
import assert from 'assert'
import firstTimeState from '../../../app/scripts/first-time-state'
import migration26 from '../../../app/scripts/migrations/026'
const oldStorage = {
@ -32,7 +33,7 @@ describe('migration #26', function () {
it('should successfully migrate first time state', function (done) {
migration26.migrate({
meta: {},
data: require('../../../app/scripts/first-time-state'),
data: firstTimeState,
})
.then((migratedData) => {
assert.equal(migratedData.meta.version, migration26.version)

View File

@ -1,4 +1,5 @@
import assert from 'assert'
import firstTimeState from '../../../app/scripts/first-time-state'
import migration27 from '../../../app/scripts/migrations/027'
const oldStorage = {
@ -42,7 +43,7 @@ describe('migration #27', function () {
it('should successfully migrate first time state', function (done) {
migration27.migrate({
meta: {},
data: require('../../../app/scripts/first-time-state'),
data: firstTimeState,
})
.then((migratedData) => {
assert.equal(migratedData.meta.version, migration27.version)

View File

@ -1,4 +1,5 @@
import assert from 'assert'
import firstTimeState from '../../../app/scripts/first-time-state'
import migration28 from '../../../app/scripts/migrations/028'
const oldStorage = {
@ -36,7 +37,7 @@ describe('migration #28', function () {
it('should successfully migrate first time state', function (done) {
migration28.migrate({
meta: {},
data: require('../../../app/scripts/first-time-state'),
data: firstTimeState,
})
.then((migratedData) => {
assert.equal(migratedData.meta.version, migration28.version)