-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
237 lines (236 loc) · 7.98 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: [
'@typescript-eslint/eslint-plugin',
'import'
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
eqeqeq: ['warn', 'always'],
'no-console': 'warn',
'no-debugger': 'warn',
'no-empty': ['warn', { allowEmptyCatch: true }],
'no-process-exit': 'off',
'no-useless-escape': 'off',
'no-new-object': 'error',
'no-multi-spaces': 'error',
'prefer-const': [
'warn',
{
destructuring: 'all',
},
],
'object-shorthand': ['error', 'always'],
'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
'no-array-constructor': 'error',
'prefer-destructuring': ['error', {
VariableDeclarator: {
array: true,
object: true,
},
AssignmentExpression: {
array: true,
object: false,
},
}, {
enforceForRenamedProperties: false,
}],
quotes: ['error', 'single', { avoidEscape: true }],
'symbol-description': 'error',
'template-curly-spacing': 'error',
'yield-star-spacing': ['error', 'after'],
'prefer-rest-params': 'error',
'default-param-last': 'error',
'no-new-func': 'error',
'no-tabs': 'error',
'space-before-blocks': 'off',
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'space-in-parens': ['error', 'never'],
'prefer-arrow-callback': ['error', { allowUnboundThis: false }],
'arrow-body-style': ['error', 'as-needed'],
'no-useless-constructor': 'off',
indent: ['error', 2, {
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
FunctionDeclaration: {
parameters: 1,
body: 1,
},
FunctionExpression: {
parameters: 1,
body: 1,
},
CallExpression: {
arguments: 1,
},
ArrayExpression: 1,
ObjectExpression: 1,
ImportDeclaration: 1,
flatTernaryExpressions: false,
MemberExpression: 1,
ignoredNodes: ['ClassBody.body > PropertyDefinition[decorators.length > 0] > Identifier', 'JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXFragment', 'JSXOpeningFragment', 'JSXClosingFragment', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],
ignoreComments: false,
}],
'keyword-spacing': ['error', {
before: true,
after: true,
overrides: {
return: { after: true },
throw: { after: true },
case: { after: true },
},
}],
'space-infix-ops': 'off',
'eol-last': ['error', 'always'],
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
'no-whitespace-before-property': 'error',
'padded-blocks': ['error', 'never'],
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
'no-lonely-if': 'error',
'array-bracket-spacing': ['error', 'never'],
'object-curly-spacing': ['error', 'always', { objectsInObjects: true }],
'block-spacing': 'off',
camelcase: ['error', { properties: 'never', ignoreDestructuring: false }],
'capitalized-comments': ['off', 'never', {
line: {
ignorePattern: '.*',
ignoreInlineComments: true,
ignoreConsecutiveComments: true,
},
block: {
ignorePattern: '.*',
ignoreInlineComments: true,
ignoreConsecutiveComments: true,
},
}],
'comma-dangle': ['error', {
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'always-multiline',
functions: 'always-multiline',
}],
'comma-spacing': ['error', { before: false, after: true }],
'comma-style': ['error', 'last', {
exceptions: {
ArrayExpression: false,
ArrayPattern: false,
ArrowFunctionExpression: false,
CallExpression: false,
FunctionDeclaration: false,
FunctionExpression: false,
ImportDeclaration: false,
ObjectExpression: false,
ObjectPattern: false,
VariableDeclaration: false,
NewExpression: false,
},
}],
'computed-property-spacing': ['error', 'never'],
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
'linebreak-style': ['error', 'unix'],
'brace-style': 'off',
'no-mixed-spaces-and-tabs': 'error',
'no-trailing-spaces': ['error', {
skipBlankLines: false,
ignoreComments: false,
}],
'implicit-arrow-linebreak': ['error', 'beside'],
'no-underscore-dangle': ['error', {
allow: [],
allowAfterThis: true,
allowAfterSuper: false,
enforceInMethodNames: true,
allowInArrayDestructuring: true,
allowInObjectDestructuring: true,
allowFunctionParams: true,
}],
semi: 'off',
'semi-style': ['error', 'last'],
'no-new-wrappers': 'error',
'no-restricted-globals': 'off',
'no-else-return': ['error', { allowElseIf: false }],
'no-return-await': 'error',
'no-script-url': 'error',
'no-self-assign': ['error', {
props: true,
}],
'no-self-compare': 'error',
'no-sequences': 'error',
'newline-before-return': 'error',
'function-paren-newline': ['error', 'multiline-arguments'],
'object-property-newline': ['error', {
allowAllPropertiesOnSameLine: true,
}],
'func-call-spacing': ['error', 'never'],
'function-call-argument-newline': ['error', 'consistent'],
'switch-colon-spacing': ['error', { after: true, before: false }],
'template-tag-spacing': ['error', 'never'],
'prefer-object-spread': 'error',
'prefer-exponentiation-operator': 'error',
'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }],
'operator-assignment': ['error', 'always'],
'one-var': ['error', 'never'],
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }],
'new-cap': ['error', {
newIsCap: true,
newIsCapExceptions: [],
capIsNew: false,
capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'],
}],
'prefer-template': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-function': [
'error',
{ allow: ['functions', 'arrowFunctions', 'constructors', 'methods'] },
],
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
],
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/consistent-indexed-object-style': 'error',
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/member-ordering': [
'error',
{ default: ['signature', 'field', 'constructor', 'method'] },
],
'@typescript-eslint/method-signature-style': ['error', 'method'],
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
'@typescript-eslint/sort-type-constituents': 'error',
'@typescript-eslint/block-spacing': 'error',
'@typescript-eslint/brace-style': 'error',
'@typescript-eslint/semi': 'error',
'@typescript-eslint/space-before-blocks': 'error',
'@typescript-eslint/space-infix-ops': 'error',
},
};