2020-01-22 15:37:19 +01:00
|
|
|
module.exports = {
|
2020-02-11 17:51:13 +01:00
|
|
|
root: true,
|
2020-01-22 15:37:19 +01:00
|
|
|
parser: 'babel-eslint',
|
|
|
|
parserOptions: {
|
|
|
|
'sourceType': 'module',
|
|
|
|
'ecmaVersion': 2017,
|
|
|
|
'ecmaFeatures': {
|
|
|
|
'experimentalObjectRestSpread': true,
|
|
|
|
'impliedStrict': true,
|
|
|
|
'modules': true,
|
|
|
|
'blockBindings': true,
|
|
|
|
'arrowFunctions': true,
|
|
|
|
'objectLiteralShorthandMethods': true,
|
|
|
|
'objectLiteralShorthandProperties': true,
|
|
|
|
'templateStrings': true,
|
|
|
|
'classes': true,
|
|
|
|
'jsx': true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
extends: [
|
|
|
|
'@metamask/eslint-config',
|
|
|
|
'@metamask/eslint-config/config/nodejs',
|
2020-02-11 17:51:13 +01:00
|
|
|
'@metamask/eslint-config/config/mocha',
|
2020-01-22 15:37:19 +01:00
|
|
|
'plugin:react/recommended',
|
2020-06-10 20:31:14 +02:00
|
|
|
'plugin:react-hooks/recommended',
|
2020-01-22 15:37:19 +01:00
|
|
|
],
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
'babel',
|
|
|
|
'react',
|
|
|
|
'json',
|
|
|
|
'import',
|
|
|
|
],
|
|
|
|
|
|
|
|
globals: {
|
2020-04-15 19:23:27 +02:00
|
|
|
'$': 'readonly',
|
|
|
|
document: 'readonly',
|
|
|
|
QUnit: 'readonly',
|
|
|
|
window: 'readonly',
|
2020-01-22 15:37:19 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
rules: {
|
2020-08-19 18:27:05 +02:00
|
|
|
'default-param-last': 'off',
|
|
|
|
'require-atomic-updates': 'off',
|
|
|
|
'import/no-unassigned-import': 'off',
|
2020-08-18 22:06:58 +02:00
|
|
|
'prefer-destructuring': ['error', {
|
|
|
|
'VariableDeclarator': {
|
|
|
|
'array': false,
|
|
|
|
'object': true,
|
|
|
|
},
|
|
|
|
'AssignmentExpression': {
|
|
|
|
'array': false,
|
|
|
|
'object': false,
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
'enforceForRenamedProperties': false,
|
|
|
|
}],
|
2020-08-19 22:04:58 +02:00
|
|
|
'prefer-object-spread': 'error',
|
2020-01-22 15:37:19 +01:00
|
|
|
'react/no-unused-prop-types': 'error',
|
|
|
|
'react/no-unused-state': 'error',
|
|
|
|
'react/jsx-boolean-value': 'error',
|
|
|
|
'react/jsx-curly-brace-presence': ['error', { 'props': 'never', 'children': 'never' }],
|
|
|
|
'react/jsx-equals-spacing': 'error',
|
|
|
|
'react/no-deprecated': 'error',
|
|
|
|
'react/default-props-match-prop-types': 'error',
|
|
|
|
'react/jsx-closing-tag-location': 'error',
|
|
|
|
'react/jsx-no-duplicate-props': 'error',
|
|
|
|
'react/jsx-closing-bracket-location': 'error',
|
2020-04-01 22:38:19 +02:00
|
|
|
'react/jsx-first-prop-new-line': ['error', 'multiline'],
|
2020-08-19 18:27:05 +02:00
|
|
|
'react/jsx-max-props-per-line': ['error', { 'maximum': 1, 'when': 'multiline' }],
|
2020-01-22 15:37:19 +01:00
|
|
|
'react/jsx-tag-spacing': ['error', {
|
|
|
|
'closingSlash': 'never',
|
|
|
|
'beforeSelfClosing': 'always',
|
|
|
|
'afterOpening': 'never',
|
|
|
|
}],
|
|
|
|
'react/jsx-wrap-multilines': ['error', {
|
|
|
|
'declaration': 'parens-new-line',
|
|
|
|
'assignment': 'parens-new-line',
|
|
|
|
'return': 'parens-new-line',
|
|
|
|
'arrow': 'parens-new-line',
|
|
|
|
'condition': 'parens-new-line',
|
|
|
|
'logical': 'parens-new-line',
|
|
|
|
'prop': 'parens-new-line',
|
|
|
|
}],
|
2020-08-13 01:49:33 +02:00
|
|
|
|
|
|
|
'no-invalid-this': 'off',
|
|
|
|
'babel/no-invalid-this': 'error',
|
|
|
|
|
2020-01-22 15:37:19 +01:00
|
|
|
'babel/semi': ['error', 'never'],
|
2020-02-11 17:51:13 +01:00
|
|
|
'mocha/no-setup-in-describe': 'off',
|
2020-01-22 15:37:19 +01:00
|
|
|
},
|
2020-02-24 19:54:35 +01:00
|
|
|
|
2020-05-19 01:48:11 +02:00
|
|
|
overrides: [{
|
2020-08-14 18:11:25 +02:00
|
|
|
files: [
|
|
|
|
'test/e2e/**/*.js',
|
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
'mocha/no-hooks-for-single-case': 'off',
|
|
|
|
},
|
|
|
|
}, {
|
2020-05-19 01:48:11 +02:00
|
|
|
files: [
|
|
|
|
'app/scripts/migrations/*.js',
|
|
|
|
'*.stories.js',
|
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
'import/no-anonymous-default-export': ['error', { 'allowObject': true }],
|
|
|
|
},
|
2020-07-18 01:36:29 +02:00
|
|
|
}, {
|
|
|
|
files: [
|
|
|
|
'app/scripts/migrations/*.js',
|
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
'global-require': 'off',
|
|
|
|
},
|
2020-08-13 01:49:33 +02:00
|
|
|
}, {
|
|
|
|
files: [
|
|
|
|
'test/**/*-test.js',
|
|
|
|
'test/**/*.spec.js',
|
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
// Mocha will re-assign `this` in a test context
|
|
|
|
'babel/no-invalid-this': 'off',
|
|
|
|
},
|
2020-08-13 23:31:40 +02:00
|
|
|
}, {
|
|
|
|
files: [
|
|
|
|
'development/**/*.js',
|
|
|
|
'test/e2e/benchmark.js',
|
|
|
|
'test/helper.js',
|
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
'no-process-exit': 'off',
|
|
|
|
},
|
2020-08-17 18:21:01 +02:00
|
|
|
}, {
|
|
|
|
files: [
|
|
|
|
'.eslintrc.js',
|
|
|
|
'babel.config.js',
|
|
|
|
'nyc.config.js',
|
|
|
|
'stylelint.config.js',
|
|
|
|
'development/**/*.js',
|
|
|
|
'test/e2e/**/*.js',
|
|
|
|
'test/env.js',
|
|
|
|
'test/setup.js',
|
|
|
|
],
|
|
|
|
parserOptions: {
|
|
|
|
sourceType: 'script',
|
|
|
|
},
|
2020-05-19 01:48:11 +02:00
|
|
|
}],
|
|
|
|
|
2020-02-24 19:54:35 +01:00
|
|
|
settings: {
|
|
|
|
'react': {
|
|
|
|
'version': 'detect',
|
|
|
|
},
|
|
|
|
},
|
2020-01-22 15:37:19 +01:00
|
|
|
}
|