2019-07-29 12:55:39 +02:00
|
|
|
module.exports = {
|
|
|
|
'env': {
|
|
|
|
'browser': true,
|
|
|
|
'es6': true,
|
|
|
|
'node': true,
|
|
|
|
},
|
2020-08-05 00:00:11 +02:00
|
|
|
'parser': '@typescript-eslint/parser',
|
2019-07-30 09:35:42 +02:00
|
|
|
'extends': ['eslint:recommended'],
|
2020-08-05 00:00:11 +02:00
|
|
|
'settings': {
|
2020-01-29 20:03:55 +02:00
|
|
|
'react': {
|
|
|
|
'version': '16.12',
|
|
|
|
},
|
|
|
|
},
|
2019-07-29 12:55:39 +02:00
|
|
|
'globals': {
|
|
|
|
'Atomics': 'readonly',
|
2019-07-30 09:35:42 +02:00
|
|
|
'SharedArrayBuffer': 'readonly',
|
|
|
|
|
|
|
|
// Jasmine variables
|
|
|
|
'expect': 'readonly',
|
|
|
|
'describe': 'readonly',
|
|
|
|
'it': 'readonly',
|
2020-02-22 13:25:16 +02:00
|
|
|
'beforeAll': 'readonly',
|
|
|
|
'afterAll': 'readonly',
|
2019-07-30 09:35:42 +02:00
|
|
|
'beforeEach': 'readonly',
|
2020-02-22 13:25:16 +02:00
|
|
|
'afterEach': 'readonly',
|
2019-07-30 09:35:42 +02:00
|
|
|
'jasmine': 'readonly',
|
|
|
|
|
|
|
|
// React Native variables
|
|
|
|
'__DEV__': 'readonly',
|
|
|
|
|
|
|
|
// Clipper variables
|
|
|
|
'browserSupportsPromises_': true,
|
|
|
|
'chrome': 'readonly',
|
|
|
|
'browser': 'readonly',
|
2020-03-10 01:24:57 +02:00
|
|
|
|
|
|
|
'tinymce': 'readonly',
|
2019-07-29 12:55:39 +02:00
|
|
|
},
|
|
|
|
'parserOptions': {
|
|
|
|
'ecmaVersion': 2018,
|
2020-08-05 00:00:11 +02:00
|
|
|
'ecmaFeatures': {
|
|
|
|
'jsx': true,
|
|
|
|
},
|
|
|
|
'sourceType': 'module',
|
2019-07-29 12:55:39 +02:00
|
|
|
},
|
|
|
|
'rules': {
|
2019-09-30 00:01:10 +02:00
|
|
|
// -------------------------------
|
|
|
|
// Code correctness
|
|
|
|
// -------------------------------
|
2020-08-05 00:00:11 +02:00
|
|
|
'react/jsx-uses-react': 'error',
|
|
|
|
'react/jsx-uses-vars': 'error',
|
2020-10-09 19:35:46 +02:00
|
|
|
'no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }],
|
|
|
|
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }],
|
|
|
|
'@typescript-eslint/explicit-member-accessibility': 'off',
|
2020-08-05 00:00:11 +02:00
|
|
|
'no-constant-condition': 0,
|
|
|
|
'no-prototype-builtins': 0,
|
2019-09-30 00:01:10 +02:00
|
|
|
// This error is always a false positive so far since it detects
|
|
|
|
// possible race conditions in contexts where we know it cannot happen.
|
2020-08-05 00:00:11 +02:00
|
|
|
'require-atomic-updates': 0,
|
|
|
|
'prefer-const': ['error'],
|
|
|
|
'no-var': ['error'],
|
|
|
|
'no-new-func': ['error'],
|
|
|
|
'import/prefer-default-export': ['error'],
|
|
|
|
'import/first': ['error'],
|
|
|
|
'no-array-constructor': ['error'],
|
|
|
|
'radix': ['error'],
|
2020-01-29 19:54:25 +02:00
|
|
|
|
2020-08-06 01:16:51 +02:00
|
|
|
// Warn only for now because fixing everything would take too much
|
|
|
|
// refactoring, but new code should try to stick to it.
|
|
|
|
'complexity': ['warn', { max: 10 }],
|
|
|
|
|
2020-02-27 02:20:55 +02:00
|
|
|
// Checks rules of Hooks
|
2020-08-05 00:00:11 +02:00
|
|
|
'react-hooks/rules-of-hooks': 'error',
|
2020-02-27 02:20:55 +02:00
|
|
|
// Checks effect dependencies
|
2020-03-14 01:46:14 +02:00
|
|
|
// Disable because of this: https://github.com/facebook/react/issues/16265
|
|
|
|
// "react-hooks/exhaustive-deps": "warn",
|
2020-02-27 02:20:55 +02:00
|
|
|
|
2019-09-30 00:01:10 +02:00
|
|
|
// -------------------------------
|
|
|
|
// Formatting
|
|
|
|
// -------------------------------
|
2020-08-05 00:00:11 +02:00
|
|
|
'space-in-parens': ['error', 'never'],
|
|
|
|
'space-infix-ops': ['error'],
|
|
|
|
'curly': ['error', 'multi-line', 'consistent'],
|
|
|
|
'semi': ['error', 'always'],
|
|
|
|
'eol-last': ['error', 'always'],
|
|
|
|
'quotes': ['error', 'single'],
|
|
|
|
'indent': ['error', 'tab'],
|
|
|
|
'comma-dangle': ['error', {
|
|
|
|
'arrays': 'always-multiline',
|
|
|
|
'objects': 'always-multiline',
|
|
|
|
'imports': 'always-multiline',
|
|
|
|
'exports': 'always-multiline',
|
|
|
|
'functions': 'never',
|
|
|
|
}],
|
|
|
|
'no-trailing-spaces': 'error',
|
|
|
|
'linebreak-style': ['error', 'unix'],
|
|
|
|
'prefer-template': ['error'],
|
|
|
|
'template-curly-spacing': ['error', 'never'],
|
|
|
|
'object-curly-spacing': ['error', 'always'],
|
|
|
|
'array-bracket-spacing': ['error', 'never'],
|
|
|
|
'key-spacing': ['error', {
|
|
|
|
'beforeColon': false,
|
|
|
|
'afterColon': true,
|
|
|
|
'mode': 'strict',
|
2019-09-30 00:01:10 +02:00
|
|
|
}],
|
2020-08-05 00:00:11 +02:00
|
|
|
'block-spacing': ['error'],
|
|
|
|
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
|
|
|
|
'no-spaced-func': ['error'],
|
|
|
|
'func-call-spacing': ['error'],
|
|
|
|
'space-before-function-paren': ['error', {
|
|
|
|
'anonymous': 'never',
|
|
|
|
'named': 'never',
|
|
|
|
'asyncArrow': 'always',
|
2019-10-09 21:24:07 +02:00
|
|
|
}],
|
2020-08-05 00:00:11 +02:00
|
|
|
'multiline-comment-style': ['error', 'separate-lines'],
|
|
|
|
'space-before-blocks': 'error',
|
|
|
|
'spaced-comment': ['error', 'always'],
|
|
|
|
'keyword-spacing': ['error', { 'before': true, 'after': true }],
|
2019-07-29 12:55:39 +02:00
|
|
|
},
|
2020-08-05 00:00:11 +02:00
|
|
|
'plugins': [
|
|
|
|
'react',
|
|
|
|
'@typescript-eslint',
|
|
|
|
'react-hooks',
|
|
|
|
'import',
|
2019-07-29 12:55:39 +02:00
|
|
|
],
|
2020-10-09 19:35:46 +02:00
|
|
|
'overrides': [
|
|
|
|
{
|
|
|
|
// enable the rule specifically for TypeScript files
|
|
|
|
'files': ['*.ts', '*.tsx'],
|
|
|
|
'rules': {
|
|
|
|
// Warn only because it would make it difficult to convert JS classes to TypeScript, unless we
|
|
|
|
// make everything public which is not great. New code however should specify member accessibility.
|
|
|
|
'@typescript-eslint/explicit-member-accessibility': ['warn'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2020-02-22 13:25:16 +02:00
|
|
|
};
|