-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
110 lines (102 loc) · 3.2 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
const tsProjectOptions = { project: ['./tsconfig.lint.json'] };
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'simple-import-sort'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended', // Disables incompatible eslint:recommended settings
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
...tsProjectOptions,
},
settings: {
react: {
version: 'detect',
},
},
env: {
browser: true,
node: true,
jest: true,
es6: true,
},
rules: {
'sort-imports': 'off',
// Use nice import rules
'simple-import-sort/sort': ['warn'],
'@typescript-eslint/no-unused-expressions': [
'error',
{ allowTernary: true, allowShortCircuit: true },
],
'@typescript-eslint/prefer-readonly': 'warn',
'@typescript-eslint/await-thenable': 'warn',
'@typescript-eslint/no-unnecessary-type-arguments': 'warn',
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-unused-vars': ['off'],
'@typescript-eslint/camelcase': [
'warn',
{ ignoreDestructuring: true, properties: 'never' },
],
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-inferrable-types': 'warn',
'@typescript-eslint/ban-types': 'warn',
'@typescript-eslint/member-ordering': [
'warn',
{
default: [
'signature',
'static-field',
'static-method',
'field',
'constructor',
'method',
],
},
],
'@typescript-eslint/method-signature-style': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/no-unused-vars-experimental': [
'error',
{ ignoreArgsIfArgsAfterAreUsed: true },
],
'@typescript-eslint/array-type': [
'error',
{ default: 'array-simple', readonly: 'array-simple' },
],
// Built in eslint rules
'no-empty': 'warn',
'no-useless-escape': 'warn',
'default-case': 'warn',
'prefer-template': 'warn',
'guard-for-in': 'warn',
'prefer-object-spread': 'warn',
curly: ['warn', 'all'],
'no-invalid-regexp': 'error',
'no-multi-str': 'error',
'no-constant-condition': 'error',
'no-extra-boolean-cast': 'error',
radix: 'error',
'no-return-assign': ['error', 'except-parens'],
eqeqeq: ['error', 'always', { null: 'ignore' }],
'prefer-exponentiation-operator': 'error',
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
},
};