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

Disallow all anonymous default export, aside from CSF and migrations (#8535)

CSF = Storybook’s Component Story Format (CSF)

See https://storybook.js.org/docs/formats/component-story-format/

Note that the migrations still use CommonJS require, so the default export as
an object is quite ergonomic (& I don't want to touch the migrations).
This commit is contained in:
Whymarrh Whitby 2020-05-18 21:18:11 -02:30 committed by GitHub
parent 3244449ab9
commit e4b8cddf02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View File

@ -50,7 +50,7 @@ module.exports = {
'import/newline-after-import': 'error', 'import/newline-after-import': 'error',
'import/no-absolute-path': 'error', 'import/no-absolute-path': 'error',
'import/no-amd': 'error', 'import/no-amd': 'error',
'import/no-anonymous-default-export': ['error', { 'allowObject': true }], 'import/no-anonymous-default-export': 'error',
'import/no-duplicates': 'error', 'import/no-duplicates': 'error',
'import/no-dynamic-require': 'error', 'import/no-dynamic-require': 'error',
'import/no-mutable-exports': 'error', 'import/no-mutable-exports': 'error',
@ -92,6 +92,16 @@ module.exports = {
'mocha/no-setup-in-describe': 'off', 'mocha/no-setup-in-describe': 'off',
}, },
overrides: [{
files: [
'app/scripts/migrations/*.js',
'*.stories.js',
],
rules: {
'import/no-anonymous-default-export': ['error', { 'allowObject': true }],
},
}],
settings: { settings: {
'react': { 'react': {
'version': 'detect', 'version': 'detect',

View File

@ -2,7 +2,7 @@ const mockHex = '0xabcdef0123456789'
const mockKey = Buffer.alloc(32) const mockKey = Buffer.alloc(32)
let cacheVal let cacheVal
export default { const mockEncryptor = {
encrypt (_, dataObj) { encrypt (_, dataObj) {
cacheVal = dataObj cacheVal = dataObj
@ -34,3 +34,5 @@ export default {
}, },
} }
export default mockEncryptor

View File

@ -1,4 +1,4 @@
export default { const state = {
'metamask': { 'metamask': {
'isInitialized': true, 'isInitialized': true,
'isUnlocked': true, 'isUnlocked': true,
@ -218,3 +218,5 @@ export default {
'errors': { 'someError': null }, 'errors': { 'someError': null },
}, },
} }
export default state