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).
feature/default_network_editable
Whymarrh Whitby 5 years ago committed by GitHub
parent 3244449ab9
commit e4b8cddf02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      .eslintrc.js
  2. 4
      test/lib/mock-encryptor.js
  3. 4
      ui/app/selectors/tests/send-selectors-test-data.js

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

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

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

Loading…
Cancel
Save