@enormora/eslint-config-typescript 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base.js +434 -0
- package/constants.js +4 -0
- package/package.json +19 -11
- package/rule-sets/best-practices.js +188 -0
- package/rule-sets/stylistic.js +234 -0
- package/typescript.js +30 -33
package/base.js
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
import importPlugin from 'eslint-plugin-import';
|
|
2
|
+
import eslintCommentsPlugin from 'eslint-plugin-eslint-comments';
|
|
3
|
+
import noSecretsPlugin from 'eslint-plugin-no-secrets';
|
|
4
|
+
import codeSpellChecker from '@cspell/eslint-plugin';
|
|
5
|
+
import { stylisticRuleSet } from './rule-sets/stylistic.js';
|
|
6
|
+
import { bestPracticesRuleSet } from './rule-sets/best-practices.js';
|
|
7
|
+
import { ecmaVersion, javascriptExtensions } from './constants.js';
|
|
8
|
+
|
|
9
|
+
export const baseConfig = {
|
|
10
|
+
languageOptions: {
|
|
11
|
+
ecmaVersion,
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
parserOptions: {
|
|
14
|
+
ecmaVersion,
|
|
15
|
+
ecmaFeatures: {
|
|
16
|
+
jsx: false,
|
|
17
|
+
globalReturn: false,
|
|
18
|
+
impliedStrict: false
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
linterOptions: {
|
|
23
|
+
noInlineConfig: false,
|
|
24
|
+
reportUnusedDisableDirectives: true
|
|
25
|
+
},
|
|
26
|
+
plugins: {
|
|
27
|
+
...stylisticRuleSet.plugins,
|
|
28
|
+
...bestPracticesRuleSet.plugins,
|
|
29
|
+
import: importPlugin,
|
|
30
|
+
'eslint-comments': eslintCommentsPlugin,
|
|
31
|
+
'no-secrets': noSecretsPlugin,
|
|
32
|
+
'@cspell': codeSpellChecker
|
|
33
|
+
},
|
|
34
|
+
settings: {
|
|
35
|
+
...stylisticRuleSet.settings,
|
|
36
|
+
...bestPracticesRuleSet.settings,
|
|
37
|
+
'import/parsers': {
|
|
38
|
+
espree: javascriptExtensions
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
rules: {
|
|
42
|
+
...stylisticRuleSet.rules,
|
|
43
|
+
...bestPracticesRuleSet.rules,
|
|
44
|
+
|
|
45
|
+
'array-callback-return': 'error',
|
|
46
|
+
camelcase: 'off',
|
|
47
|
+
'no-array-constructor': 'error',
|
|
48
|
+
'no-bitwise': 'error',
|
|
49
|
+
'no-caller': 'error',
|
|
50
|
+
'no-case-declarations': 'error',
|
|
51
|
+
'no-class-assign': 'error',
|
|
52
|
+
'no-cond-assign': 'error',
|
|
53
|
+
'no-console': 'error',
|
|
54
|
+
'no-const-assign': 'error',
|
|
55
|
+
'no-constant-condition': 'error',
|
|
56
|
+
'no-continue': 'error',
|
|
57
|
+
'no-control-regex': 'error',
|
|
58
|
+
'no-debugger': 'error',
|
|
59
|
+
'no-delete-var': 'error',
|
|
60
|
+
'no-div-regex': 'error',
|
|
61
|
+
'no-dupe-class-members': 'error',
|
|
62
|
+
'no-dupe-keys': 'error',
|
|
63
|
+
'no-dupe-args': 'error',
|
|
64
|
+
'no-duplicate-case': 'error',
|
|
65
|
+
'no-duplicate-imports': 'error',
|
|
66
|
+
'no-else-return': ['error', { allowElseIf: false }],
|
|
67
|
+
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
68
|
+
'no-empty-character-class': 'error',
|
|
69
|
+
'no-empty-function': 'off',
|
|
70
|
+
'no-empty-pattern': 'error',
|
|
71
|
+
'no-empty-static-block': 'error',
|
|
72
|
+
'no-eq-null': 'error',
|
|
73
|
+
'no-eval': 'error',
|
|
74
|
+
'no-ex-assign': 'error',
|
|
75
|
+
'no-extend-native': 'error',
|
|
76
|
+
'no-extra-bind': 'error',
|
|
77
|
+
'no-extra-boolean-cast': 'error',
|
|
78
|
+
'no-extra-label': 'error',
|
|
79
|
+
'no-fallthrough': 'error',
|
|
80
|
+
'no-func-assign': 'error',
|
|
81
|
+
'no-implicit-coercion': 'error',
|
|
82
|
+
'no-implicit-globals': 'error',
|
|
83
|
+
'no-implied-eval': 'error',
|
|
84
|
+
'no-inline-comments': 'off',
|
|
85
|
+
'no-inner-declarations': ['error', 'functions'],
|
|
86
|
+
'no-invalid-regexp': 'error',
|
|
87
|
+
'no-invalid-this': 'off',
|
|
88
|
+
'no-irregular-whitespace': 'error',
|
|
89
|
+
'no-iterator': 'error',
|
|
90
|
+
'no-label-var': 'error',
|
|
91
|
+
'no-labels': 'error',
|
|
92
|
+
'no-lone-blocks': 'error',
|
|
93
|
+
'no-lonely-if': 'error',
|
|
94
|
+
'no-loop-func': 'error',
|
|
95
|
+
'no-new-native-nonconstructor': 'error',
|
|
96
|
+
'no-multi-str': 'error',
|
|
97
|
+
'no-global-assign': 'error',
|
|
98
|
+
'no-negated-condition': 'off',
|
|
99
|
+
'no-nested-ternary': 'error',
|
|
100
|
+
'no-new': 'error',
|
|
101
|
+
'no-new-func': 'error',
|
|
102
|
+
'no-new-symbol': 'error',
|
|
103
|
+
'no-new-wrappers': 'error',
|
|
104
|
+
'no-obj-calls': 'error',
|
|
105
|
+
'no-object-constructor': 'error',
|
|
106
|
+
'no-octal': 'error',
|
|
107
|
+
'no-octal-escape': 'error',
|
|
108
|
+
'no-param-reassign': ['error', { props: true }],
|
|
109
|
+
'no-plusplus': 'error',
|
|
110
|
+
'no-proto': 'error',
|
|
111
|
+
'no-prototype-builtins': 'error',
|
|
112
|
+
'no-redeclare': ['error', { builtinGlobals: true }],
|
|
113
|
+
'no-regex-spaces': 'error',
|
|
114
|
+
'no-restricted-syntax': 'off',
|
|
115
|
+
'no-return-assign': ['error', 'always'],
|
|
116
|
+
'no-self-assign': ['error', { props: true }],
|
|
117
|
+
'no-self-compare': 'error',
|
|
118
|
+
'no-sequences': 'error',
|
|
119
|
+
'no-shadow': ['error', { builtinGlobals: true }],
|
|
120
|
+
'no-shadow-restricted-names': 'error',
|
|
121
|
+
'no-sparse-arrays': 'error',
|
|
122
|
+
'no-ternary': 'off',
|
|
123
|
+
'no-this-before-super': 'error',
|
|
124
|
+
'no-throw-literal': 'error',
|
|
125
|
+
'no-undef': ['error', { typeof: true }],
|
|
126
|
+
'no-undef-init': 'error',
|
|
127
|
+
'no-undefined': 'off',
|
|
128
|
+
'no-unexpected-multiline': 'error',
|
|
129
|
+
'no-underscore-dangle': 'error',
|
|
130
|
+
'no-unmodified-loop-condition': 'error',
|
|
131
|
+
'no-unneeded-ternary': 'error',
|
|
132
|
+
'no-unreachable': 'error',
|
|
133
|
+
'no-unsafe-finally': 'error',
|
|
134
|
+
'no-unused-expressions': 'error',
|
|
135
|
+
'no-unused-labels': 'error',
|
|
136
|
+
'no-unused-vars': [
|
|
137
|
+
'error',
|
|
138
|
+
{
|
|
139
|
+
vars: 'all',
|
|
140
|
+
args: 'after-used',
|
|
141
|
+
ignoreRestSiblings: true,
|
|
142
|
+
argsIgnorePattern: '^_$',
|
|
143
|
+
caughtErrors: 'all',
|
|
144
|
+
caughtErrorsIgnorePattern: '^_$'
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
'no-use-before-define': 'error',
|
|
148
|
+
'no-useless-call': 'error',
|
|
149
|
+
'no-useless-computed-key': 'error',
|
|
150
|
+
'no-useless-concat': 'error',
|
|
151
|
+
'no-useless-constructor': 'error',
|
|
152
|
+
'no-useless-escape': 'error',
|
|
153
|
+
'no-useless-rename': 'error',
|
|
154
|
+
'no-void': 'error',
|
|
155
|
+
'prefer-const': [
|
|
156
|
+
'error',
|
|
157
|
+
{
|
|
158
|
+
destructuring: 'all'
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
'prefer-spread': 'error',
|
|
162
|
+
'prefer-template': 'error',
|
|
163
|
+
'no-var': 'error',
|
|
164
|
+
'no-warning-comments': [
|
|
165
|
+
'error',
|
|
166
|
+
{
|
|
167
|
+
terms: ['todo', 'fixme', 'wtf', 'falls through', 'istanbul', 'c8'],
|
|
168
|
+
location: 'anywhere'
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
'no-with': 'error',
|
|
172
|
+
'no-magic-numbers': [
|
|
173
|
+
'error',
|
|
174
|
+
{
|
|
175
|
+
ignoreDefaultValues: true,
|
|
176
|
+
ignoreArrayIndexes: false,
|
|
177
|
+
detectObjects: false,
|
|
178
|
+
enforceConst: false,
|
|
179
|
+
ignoreClassFieldInitialValues: false,
|
|
180
|
+
ignore: [-1, 0, 1]
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
'arrow-body-style': ['error', 'always'],
|
|
184
|
+
'accessor-pairs': [
|
|
185
|
+
'error',
|
|
186
|
+
{
|
|
187
|
+
enforceForClassMembers: true
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
'block-scoped-var': 'off',
|
|
191
|
+
complexity: ['error', { max: 6 }],
|
|
192
|
+
'consistent-return': 'error',
|
|
193
|
+
'consistent-this': ['error', 'self'],
|
|
194
|
+
'constructor-super': 'error',
|
|
195
|
+
curly: ['error', 'all'],
|
|
196
|
+
'default-case': 'error',
|
|
197
|
+
'dot-notation': 'error',
|
|
198
|
+
eqeqeq: 'error',
|
|
199
|
+
'func-names': 'off',
|
|
200
|
+
'func-style': 'off',
|
|
201
|
+
'guard-for-in': 'error',
|
|
202
|
+
'id-length': ['error', { min: 2, properties: 'never' }],
|
|
203
|
+
'init-declarations': ['error', 'always'],
|
|
204
|
+
'max-depth': ['error', { max: 5 }],
|
|
205
|
+
'max-lines': ['error', { max: 500, skipBlankLines: true, skipComments: true }],
|
|
206
|
+
'max-nested-callbacks': ['error', { max: 4 }],
|
|
207
|
+
'max-params': ['error', { max: 4 }],
|
|
208
|
+
'max-statements': ['error', { max: 10 }],
|
|
209
|
+
'new-cap': [
|
|
210
|
+
'error',
|
|
211
|
+
{
|
|
212
|
+
newIsCap: true,
|
|
213
|
+
capIsNew: true
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
'object-shorthand': ['error', 'always'],
|
|
217
|
+
'one-var': ['error', 'never'],
|
|
218
|
+
'operator-assignment': ['error', 'always'],
|
|
219
|
+
'prefer-arrow-callback': [
|
|
220
|
+
'error',
|
|
221
|
+
{
|
|
222
|
+
allowNamedFunctions: true
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
'prefer-rest-params': 'error',
|
|
226
|
+
radix: 'error',
|
|
227
|
+
'id-match': 'off',
|
|
228
|
+
'require-yield': 'error',
|
|
229
|
+
'sort-vars': 'off',
|
|
230
|
+
'sort-imports': 'off',
|
|
231
|
+
strict: ['error', 'safe'],
|
|
232
|
+
'unicode-bom': ['error', 'never'],
|
|
233
|
+
'use-isnan': 'error',
|
|
234
|
+
'valid-typeof': 'error',
|
|
235
|
+
'vars-on-top': 'error',
|
|
236
|
+
yoda: ['error', 'never'],
|
|
237
|
+
'capitalized-comments': 'off',
|
|
238
|
+
'class-methods-use-this': 'error',
|
|
239
|
+
'func-name-matching': 'off',
|
|
240
|
+
'line-comment-position': 'off',
|
|
241
|
+
'no-await-in-loop': 'off',
|
|
242
|
+
'no-compare-neg-zero': 'error',
|
|
243
|
+
'no-multi-assign': 'error',
|
|
244
|
+
'no-restricted-properties': 'off',
|
|
245
|
+
'no-template-curly-in-string': 'error',
|
|
246
|
+
'no-unsafe-negation': 'error',
|
|
247
|
+
'no-useless-return': 'error',
|
|
248
|
+
'prefer-destructuring': [
|
|
249
|
+
'error',
|
|
250
|
+
{
|
|
251
|
+
VariableDeclarator: {
|
|
252
|
+
array: false,
|
|
253
|
+
object: true
|
|
254
|
+
},
|
|
255
|
+
AssignmentExpression: {
|
|
256
|
+
array: false,
|
|
257
|
+
object: false
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
enforceForRenamedProperties: false
|
|
262
|
+
}
|
|
263
|
+
],
|
|
264
|
+
'prefer-numeric-literals': 'error',
|
|
265
|
+
'prefer-promise-reject-errors': [
|
|
266
|
+
'error',
|
|
267
|
+
{
|
|
268
|
+
allowEmptyReject: false
|
|
269
|
+
}
|
|
270
|
+
],
|
|
271
|
+
'require-await': 'off',
|
|
272
|
+
'sort-keys': 'off',
|
|
273
|
+
'symbol-description': 'error',
|
|
274
|
+
'for-direction': 'off',
|
|
275
|
+
'getter-return': [
|
|
276
|
+
'error',
|
|
277
|
+
{
|
|
278
|
+
allowImplicit: false
|
|
279
|
+
}
|
|
280
|
+
],
|
|
281
|
+
'multiline-comment-style': 'off',
|
|
282
|
+
'max-classes-per-file': 'off',
|
|
283
|
+
'max-lines-per-function': 'off',
|
|
284
|
+
'prefer-object-spread': 'error',
|
|
285
|
+
'no-async-promise-executor': 'error',
|
|
286
|
+
'no-misleading-character-class': 'error',
|
|
287
|
+
'default-param-last': 'error',
|
|
288
|
+
'prefer-regex-literals': 'error',
|
|
289
|
+
'require-unicode-regexp': 'off',
|
|
290
|
+
'no-useless-catch': 'error',
|
|
291
|
+
'prefer-named-capture-group': 'error',
|
|
292
|
+
'no-import-assign': 'error',
|
|
293
|
+
'require-atomic-updates': 'error',
|
|
294
|
+
|
|
295
|
+
'no-restricted-imports': 'off',
|
|
296
|
+
|
|
297
|
+
'no-alert': 'off',
|
|
298
|
+
'no-script-url': 'off',
|
|
299
|
+
'no-restricted-globals': 'off',
|
|
300
|
+
|
|
301
|
+
'grouped-accessor-pairs': 'off',
|
|
302
|
+
'no-constructor-return': 'error',
|
|
303
|
+
'no-dupe-else-if': 'error',
|
|
304
|
+
'no-setter-return': 'error',
|
|
305
|
+
'prefer-exponentiation-operator': 'error',
|
|
306
|
+
|
|
307
|
+
'default-case-last': 'error',
|
|
308
|
+
'no-restricted-exports': 'off',
|
|
309
|
+
'no-useless-backreference': 'error',
|
|
310
|
+
'id-denylist': 'off',
|
|
311
|
+
'no-loss-of-precision': 'off',
|
|
312
|
+
'no-promise-executor-return': 'error',
|
|
313
|
+
'no-unreachable-loop': 'error',
|
|
314
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
315
|
+
'no-unsafe-optional-chaining': 'error',
|
|
316
|
+
'no-unused-private-class-members': 'error',
|
|
317
|
+
'no-constant-binary-expression': 'error',
|
|
318
|
+
'logical-assignment-operators': ['error', 'never'],
|
|
319
|
+
'prefer-object-has-own': 'error',
|
|
320
|
+
|
|
321
|
+
'no-secrets/no-secrets': ['error', { tolerance: 5 }],
|
|
322
|
+
|
|
323
|
+
'eslint-comments/disable-enable-pair': [
|
|
324
|
+
'error',
|
|
325
|
+
{
|
|
326
|
+
allowWholeFile: true
|
|
327
|
+
}
|
|
328
|
+
],
|
|
329
|
+
'eslint-comments/no-aggregating-enable': 'error',
|
|
330
|
+
'eslint-comments/no-duplicate-disable': 'error',
|
|
331
|
+
'eslint-comments/no-unused-disable': 'error',
|
|
332
|
+
'eslint-comments/no-unused-enable': 'error',
|
|
333
|
+
'eslint-comments/no-restricted-disable': 'off',
|
|
334
|
+
'eslint-comments/no-unlimited-disable': 'error',
|
|
335
|
+
'eslint-comments/no-use': 'off',
|
|
336
|
+
'eslint-comments/require-description': 'error',
|
|
337
|
+
|
|
338
|
+
'import/no-deprecated': 'error',
|
|
339
|
+
'import/exports-last': 'off',
|
|
340
|
+
'import/dynamic-import-chunkname': 'off',
|
|
341
|
+
'import/unambiguous': 'off',
|
|
342
|
+
'import/no-dynamic-require': 'error',
|
|
343
|
+
'import/no-named-export': 'off',
|
|
344
|
+
'import/no-default-export': 'error',
|
|
345
|
+
'import/prefer-default-export': 'off',
|
|
346
|
+
'import/newline-after-import': 'error',
|
|
347
|
+
'import/no-nodejs-modules': 'off',
|
|
348
|
+
'import/max-dependencies': ['error', { max: 8 }],
|
|
349
|
+
'import/first': 'error',
|
|
350
|
+
'import/no-unused-modules': 'error',
|
|
351
|
+
'import/no-anonymous-default-export': 'off',
|
|
352
|
+
'import/no-named-default': 'off',
|
|
353
|
+
'import/no-cycle': 'error',
|
|
354
|
+
'import/no-relative-parent-imports': 'off',
|
|
355
|
+
'import/group-exports': 'off',
|
|
356
|
+
'import/no-internal-modules': 'off',
|
|
357
|
+
'import/no-restricted-paths': 'off',
|
|
358
|
+
'import/named': 'off',
|
|
359
|
+
'import/no-namespace': 'off',
|
|
360
|
+
'import/default': 'error',
|
|
361
|
+
'import/export': 'error',
|
|
362
|
+
'import/extensions': [
|
|
363
|
+
'error',
|
|
364
|
+
{
|
|
365
|
+
js: 'always',
|
|
366
|
+
jsx: 'always',
|
|
367
|
+
json: 'always'
|
|
368
|
+
}
|
|
369
|
+
],
|
|
370
|
+
'import/namespace': [
|
|
371
|
+
'error',
|
|
372
|
+
{
|
|
373
|
+
allowComputed: true
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
'import/no-absolute-path': 'error',
|
|
377
|
+
'import/no-webpack-loader-syntax': 'error',
|
|
378
|
+
'import/no-self-import': 'error',
|
|
379
|
+
'import/no-useless-path-segments': [
|
|
380
|
+
'error',
|
|
381
|
+
{
|
|
382
|
+
noUselessIndex: true
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
'import/no-amd': 'error',
|
|
386
|
+
'import/no-commonjs': 'error',
|
|
387
|
+
'import/no-duplicates': 'error',
|
|
388
|
+
'import/no-extraneous-dependencies': 'error',
|
|
389
|
+
'import/no-mutable-exports': 'error',
|
|
390
|
+
'import/no-named-as-default-member': 'error',
|
|
391
|
+
'import/no-named-as-default': 'error',
|
|
392
|
+
'import/order': 'error',
|
|
393
|
+
'import/no-unassigned-import': [
|
|
394
|
+
'error',
|
|
395
|
+
{
|
|
396
|
+
allow: []
|
|
397
|
+
}
|
|
398
|
+
],
|
|
399
|
+
// this rule doesn’t work correctly for ESM modules which use the exports field in package.json instead of main, see also https://github.com/import-js/eslint-plugin-import/issues/2703
|
|
400
|
+
'import/no-unresolved': 'off',
|
|
401
|
+
'import/no-relative-packages': 'off',
|
|
402
|
+
'import/no-import-module-exports': 'off',
|
|
403
|
+
'import/no-empty-named-blocks': 'error',
|
|
404
|
+
'import/consistent-type-specifier-style': 'off',
|
|
405
|
+
|
|
406
|
+
'@cspell/spellchecker': [
|
|
407
|
+
'warn',
|
|
408
|
+
{
|
|
409
|
+
autoFix: false,
|
|
410
|
+
numSuggestions: 3,
|
|
411
|
+
generateSuggestions: true,
|
|
412
|
+
ignoreImports: true,
|
|
413
|
+
ignoreImportProperties: true,
|
|
414
|
+
checkIdentifiers: true,
|
|
415
|
+
checkStrings: true,
|
|
416
|
+
checkStringTemplates: true,
|
|
417
|
+
checkJSXText: true,
|
|
418
|
+
checkComments: true,
|
|
419
|
+
cspell: {
|
|
420
|
+
words: [],
|
|
421
|
+
ignoreWords: [],
|
|
422
|
+
flagWords: [],
|
|
423
|
+
ignoreRegExpList: [],
|
|
424
|
+
includeRegExpList: [],
|
|
425
|
+
allowCompoundWords: true,
|
|
426
|
+
import: [],
|
|
427
|
+
dictionaries: []
|
|
428
|
+
},
|
|
429
|
+
customWordListFile: undefined,
|
|
430
|
+
debugMode: false
|
|
431
|
+
}
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
};
|
package/constants.js
ADDED
package/package.json
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
{
|
|
2
|
+
"dependencies": {
|
|
3
|
+
"@cspell/eslint-plugin": "8.1.3",
|
|
4
|
+
"@stylistic/eslint-plugin": "1.5.1",
|
|
5
|
+
"@typescript-eslint/eslint-plugin": "6.14.0",
|
|
6
|
+
"@typescript-eslint/parser": "6.14.0",
|
|
7
|
+
"eslint-plugin-array-func": "4.0.0",
|
|
8
|
+
"eslint-plugin-destructuring": "2.2.1",
|
|
9
|
+
"eslint-plugin-eslint-comments": "3.2.0",
|
|
10
|
+
"eslint-plugin-functional": "6.0.0",
|
|
11
|
+
"eslint-plugin-import": "2.29.0",
|
|
12
|
+
"eslint-plugin-no-secrets": "0.8.9",
|
|
13
|
+
"eslint-plugin-prettier": "5.0.1",
|
|
14
|
+
"eslint-plugin-promise": "6.1.1",
|
|
15
|
+
"eslint-plugin-sonarjs": "0.23.0",
|
|
16
|
+
"eslint-plugin-unicorn": "49.0.0"
|
|
17
|
+
},
|
|
2
18
|
"license": "MIT",
|
|
19
|
+
"main": "typescript.js",
|
|
20
|
+
"name": "@enormora/eslint-config-typescript",
|
|
3
21
|
"repository": {
|
|
4
22
|
"type": "git",
|
|
5
23
|
"url": "git://github.com/enormora/eslint-config.git"
|
|
6
24
|
},
|
|
7
|
-
"name": "@enormora/eslint-config-typescript",
|
|
8
|
-
"version": "0.0.7",
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"@typescript-eslint/eslint-plugin": "6.7.2",
|
|
11
|
-
"@typescript-eslint/parser": "6.7.2",
|
|
12
|
-
"eslint-plugin-functional": "6.0.0"
|
|
13
|
-
},
|
|
14
|
-
"main": "typescript.js",
|
|
15
25
|
"type": "module",
|
|
16
|
-
"
|
|
17
|
-
"@enormora/eslint-config-base": "0.0.7"
|
|
18
|
-
}
|
|
26
|
+
"version": "0.0.9"
|
|
19
27
|
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import unicornPlugin from 'eslint-plugin-unicorn';
|
|
2
|
+
import promisePlugin from 'eslint-plugin-promise';
|
|
3
|
+
import arrayFunctionPlugin from 'eslint-plugin-array-func';
|
|
4
|
+
import sonarjsPlugin from 'eslint-plugin-sonarjs';
|
|
5
|
+
|
|
6
|
+
const maxSwitchCases = 6;
|
|
7
|
+
|
|
8
|
+
export const bestPracticesRuleSet = {
|
|
9
|
+
plugins: {
|
|
10
|
+
unicorn: unicornPlugin,
|
|
11
|
+
promise: promisePlugin,
|
|
12
|
+
'array-func': arrayFunctionPlugin,
|
|
13
|
+
sonarjs: sonarjsPlugin
|
|
14
|
+
},
|
|
15
|
+
settings: {},
|
|
16
|
+
rules: {
|
|
17
|
+
'unicorn/string-content': 'off',
|
|
18
|
+
'unicorn/prefer-string-trim-start-end': 'error',
|
|
19
|
+
'unicorn/prefer-set-has': 'error',
|
|
20
|
+
'unicorn/prefer-string-replace-all': 'error',
|
|
21
|
+
'unicorn/prefer-number-properties': 'error',
|
|
22
|
+
'unicorn/prefer-negative-index': 'error',
|
|
23
|
+
'unicorn/prefer-modern-dom-apis': 'off',
|
|
24
|
+
'unicorn/no-null': 'off',
|
|
25
|
+
'unicorn/catch-error-name': 'error',
|
|
26
|
+
'unicorn/consistent-function-scoping': 'off',
|
|
27
|
+
'unicorn/custom-error-definition': 'off',
|
|
28
|
+
'unicorn/error-message': 'error',
|
|
29
|
+
'unicorn/escape-case': 'error',
|
|
30
|
+
'unicorn/expiring-todo-comments': 'error',
|
|
31
|
+
'unicorn/explicit-length-check': 'error',
|
|
32
|
+
'unicorn/no-useless-length-check': 'error',
|
|
33
|
+
'unicorn/filename-case': 'off',
|
|
34
|
+
'unicorn/new-for-builtins': 'error',
|
|
35
|
+
'unicorn/no-abusive-eslint-disable': 'error',
|
|
36
|
+
'unicorn/no-instanceof-array': 'error',
|
|
37
|
+
'unicorn/no-console-spaces': 'error',
|
|
38
|
+
'unicorn/no-array-callback-reference': 'off',
|
|
39
|
+
'unicorn/no-for-loop': 'error',
|
|
40
|
+
'unicorn/no-hex-escape': 'error',
|
|
41
|
+
'unicorn/no-keyword-prefix': 'off',
|
|
42
|
+
'unicorn/no-nested-ternary': 'off',
|
|
43
|
+
'unicorn/no-new-buffer': 'error',
|
|
44
|
+
'unicorn/no-process-exit': 'error',
|
|
45
|
+
'unicorn/no-unreadable-array-destructuring': 'error',
|
|
46
|
+
'unicorn/no-unused-properties': 'off',
|
|
47
|
+
'unicorn/no-zero-fractions': 'error',
|
|
48
|
+
'unicorn/number-literal-case': 'error',
|
|
49
|
+
'unicorn/prefer-add-event-listener': 'error',
|
|
50
|
+
'unicorn/prefer-dom-node-dataset': 'error',
|
|
51
|
+
'unicorn/prefer-keyboard-event-key': 'error',
|
|
52
|
+
'unicorn/prefer-array-flat-map': 'error',
|
|
53
|
+
'unicorn/prefer-includes': 'error',
|
|
54
|
+
'unicorn/prefer-dom-node-append': 'error',
|
|
55
|
+
'unicorn/prefer-dom-node-remove': 'error',
|
|
56
|
+
'unicorn/prefer-query-selector': 'error',
|
|
57
|
+
'unicorn/prefer-reflect-apply': 'error',
|
|
58
|
+
'unicorn/prefer-spread': 'off',
|
|
59
|
+
'unicorn/prefer-string-starts-ends-with': 'error',
|
|
60
|
+
'unicorn/prefer-string-slice': 'error',
|
|
61
|
+
'unicorn/prefer-dom-node-text-content': 'error',
|
|
62
|
+
'unicorn/prefer-type-error': 'error',
|
|
63
|
+
'unicorn/prevent-abbreviations': 'off',
|
|
64
|
+
'unicorn/better-regex': 'error',
|
|
65
|
+
'unicorn/throw-new-error': 'error',
|
|
66
|
+
'unicorn/no-array-reduce': 'off',
|
|
67
|
+
'unicorn/no-useless-undefined': 'off',
|
|
68
|
+
'unicorn/prefer-optional-catch-binding': 'error',
|
|
69
|
+
'unicorn/no-object-as-default-parameter': 'off',
|
|
70
|
+
'unicorn/prefer-array-find': 'error',
|
|
71
|
+
'unicorn/import-style': 'off',
|
|
72
|
+
'unicorn/numeric-separators-style': 'error',
|
|
73
|
+
'unicorn/prefer-math-trunc': 'error',
|
|
74
|
+
'unicorn/prefer-ternary': 'error',
|
|
75
|
+
'unicorn/prefer-array-some': 'error',
|
|
76
|
+
'unicorn/prefer-default-parameters': 'error',
|
|
77
|
+
'unicorn/no-lonely-if': 'error',
|
|
78
|
+
'unicorn/empty-brace-spaces': 'off',
|
|
79
|
+
'unicorn/prefer-date-now': 'error',
|
|
80
|
+
'unicorn/consistent-destructuring': 'off',
|
|
81
|
+
'unicorn/no-array-for-each': 'off',
|
|
82
|
+
'unicorn/no-array-push-push': 'error',
|
|
83
|
+
'unicorn/no-new-array': 'error',
|
|
84
|
+
'unicorn/no-this-assignment': 'error',
|
|
85
|
+
'unicorn/prefer-array-index-of': 'error',
|
|
86
|
+
'unicorn/prefer-regexp-test': 'error',
|
|
87
|
+
'unicorn/no-static-only-class': 'error',
|
|
88
|
+
'unicorn/prefer-array-flat': 'error',
|
|
89
|
+
'unicorn/prefer-module': 'off',
|
|
90
|
+
'unicorn/prefer-node-protocol': 'error',
|
|
91
|
+
'unicorn/prefer-switch': 'off',
|
|
92
|
+
'unicorn/no-document-cookie': 'off',
|
|
93
|
+
'unicorn/require-array-join-separator': 'off',
|
|
94
|
+
'unicorn/require-number-to-fixed-digits-argument': 'off',
|
|
95
|
+
'unicorn/prefer-prototype-methods': 'off',
|
|
96
|
+
'unicorn/no-array-method-this-argument': 'off',
|
|
97
|
+
'unicorn/require-post-message-target-origin': 'error',
|
|
98
|
+
'unicorn/no-useless-spread': 'error',
|
|
99
|
+
'unicorn/prefer-object-from-entries': 'error',
|
|
100
|
+
'unicorn/no-useless-fallback-in-spread': 'error',
|
|
101
|
+
'unicorn/no-invalid-remove-event-listener': 'off',
|
|
102
|
+
'unicorn/template-indent': 'error',
|
|
103
|
+
'unicorn/no-empty-file': 'error',
|
|
104
|
+
'unicorn/prefer-export-from': 'error',
|
|
105
|
+
'unicorn/no-await-expression-member': 'error',
|
|
106
|
+
'unicorn/prefer-code-point': 'error',
|
|
107
|
+
'unicorn/no-thenable': 'off',
|
|
108
|
+
'unicorn/no-useless-promise-resolve-reject': 'error',
|
|
109
|
+
'unicorn/prefer-json-parse-buffer': 'off',
|
|
110
|
+
'unicorn/relative-url-style': 'off',
|
|
111
|
+
'unicorn/text-encoding-identifier-case': 'off',
|
|
112
|
+
'unicorn/no-useless-switch-case': 'error',
|
|
113
|
+
'unicorn/prefer-modern-math-apis': 'error',
|
|
114
|
+
'unicorn/no-unreadable-iife': 'error',
|
|
115
|
+
'unicorn/prefer-native-coercion-functions': 'error',
|
|
116
|
+
'unicorn/prefer-event-target': 'off',
|
|
117
|
+
'unicorn/prefer-logical-operator-over-ternary': 'off',
|
|
118
|
+
'unicorn/no-unnecessary-await': 'error',
|
|
119
|
+
'unicorn/switch-case-braces': 'off',
|
|
120
|
+
'unicorn/no-negated-condition': 'error',
|
|
121
|
+
'unicorn/no-typeof-undefined': 'error',
|
|
122
|
+
'unicorn/prefer-set-size': 'error',
|
|
123
|
+
'unicorn/prefer-blob-reading-methods': 'error',
|
|
124
|
+
'unicorn/prefer-top-level-await': 'off',
|
|
125
|
+
'unicorn/prefer-at': 'error',
|
|
126
|
+
|
|
127
|
+
'array-func/from-map': 'error',
|
|
128
|
+
'array-func/no-unnecessary-this-arg': 'error',
|
|
129
|
+
'array-func/prefer-array-from': 'error',
|
|
130
|
+
'array-func/avoid-reverse': 'error',
|
|
131
|
+
'array-func/prefer-flat-map': 'error',
|
|
132
|
+
'array-func/prefer-flat': 'error',
|
|
133
|
+
|
|
134
|
+
'sonarjs/cognitive-complexity': 'off',
|
|
135
|
+
'sonarjs/elseif-without-else': 'off',
|
|
136
|
+
'sonarjs/max-switch-cases': ['error', maxSwitchCases],
|
|
137
|
+
'sonarjs/no-all-duplicated-branches': 'error',
|
|
138
|
+
'sonarjs/no-collapsible-if': 'error',
|
|
139
|
+
'sonarjs/no-collection-size-mischeck': 'error',
|
|
140
|
+
'sonarjs/no-duplicate-string': 'off',
|
|
141
|
+
'sonarjs/no-duplicated-branches': 'error',
|
|
142
|
+
'sonarjs/no-element-overwrite': 'error',
|
|
143
|
+
'sonarjs/no-empty-collection': 'error',
|
|
144
|
+
'sonarjs/no-extra-arguments': 'off',
|
|
145
|
+
'sonarjs/no-gratuitous-expressions': 'error',
|
|
146
|
+
'sonarjs/no-identical-conditions': 'error',
|
|
147
|
+
'sonarjs/no-identical-expressions': 'error',
|
|
148
|
+
'sonarjs/no-identical-functions': 'error',
|
|
149
|
+
'sonarjs/no-ignored-return': 'error',
|
|
150
|
+
'sonarjs/no-inverted-boolean-check': 'error',
|
|
151
|
+
'sonarjs/no-nested-switch': 'error',
|
|
152
|
+
'sonarjs/no-nested-template-literals': 'error',
|
|
153
|
+
'sonarjs/no-one-iteration-loop': 'error',
|
|
154
|
+
'sonarjs/no-redundant-boolean': 'off',
|
|
155
|
+
'sonarjs/no-redundant-jump': 'off',
|
|
156
|
+
'sonarjs/no-same-line-conditional': 'error',
|
|
157
|
+
'sonarjs/no-small-switch': 'error',
|
|
158
|
+
'sonarjs/no-unused-collection': 'error',
|
|
159
|
+
'sonarjs/no-use-of-empty-return-value': 'error',
|
|
160
|
+
'sonarjs/no-useless-catch': 'error',
|
|
161
|
+
'sonarjs/non-existent-operator': 'error',
|
|
162
|
+
'sonarjs/prefer-immediate-return': 'off',
|
|
163
|
+
'sonarjs/prefer-object-literal': 'error',
|
|
164
|
+
'sonarjs/prefer-single-boolean-return': 'error',
|
|
165
|
+
'sonarjs/prefer-while': 'error',
|
|
166
|
+
|
|
167
|
+
'promise/avoid-new': 'off',
|
|
168
|
+
'promise/no-nesting': 'error',
|
|
169
|
+
'promise/no-promise-in-callback': 'error',
|
|
170
|
+
'promise/no-callback-in-promise': 'error',
|
|
171
|
+
'promise/no-native': 'off',
|
|
172
|
+
'promise/prefer-await-to-callbacks': 'off',
|
|
173
|
+
'promise/catch-or-return': 'error',
|
|
174
|
+
'promise/always-return': 'off',
|
|
175
|
+
'promise/param-names': 'error',
|
|
176
|
+
'promise/no-return-wrap': [
|
|
177
|
+
'error',
|
|
178
|
+
{
|
|
179
|
+
allowReject: true
|
|
180
|
+
}
|
|
181
|
+
],
|
|
182
|
+
'promise/no-new-statics': 'error',
|
|
183
|
+
'promise/no-return-in-finally': 'error',
|
|
184
|
+
'promise/valid-params': 'error',
|
|
185
|
+
'promise/prefer-await-to-then': 'error',
|
|
186
|
+
'promise/no-multiple-resolved': 'error'
|
|
187
|
+
}
|
|
188
|
+
};
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import prettierPlugin from 'eslint-plugin-prettier';
|
|
2
|
+
import destructuringPlugin from 'eslint-plugin-destructuring';
|
|
3
|
+
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
4
|
+
import { indentSize } from '../constants.js';
|
|
5
|
+
|
|
6
|
+
export const stylisticRuleSet = {
|
|
7
|
+
plugins: {
|
|
8
|
+
prettier: prettierPlugin,
|
|
9
|
+
destructuring: destructuringPlugin,
|
|
10
|
+
'@stylistic': stylisticPlugin
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
settings: {},
|
|
14
|
+
|
|
15
|
+
rules: {
|
|
16
|
+
'prettier/prettier': 'error',
|
|
17
|
+
|
|
18
|
+
'destructuring/in-methods-params': 'error',
|
|
19
|
+
'destructuring/in-params': ['error', { 'max-params': 0 }],
|
|
20
|
+
'destructuring/no-rename': 'off',
|
|
21
|
+
|
|
22
|
+
'@stylistic/array-bracket-newline': ['error', 'consistent'],
|
|
23
|
+
'@stylistic/array-bracket-spacing': ['error', 'never'],
|
|
24
|
+
'@stylistic/array-element-newline': ['error', 'consistent'],
|
|
25
|
+
'@stylistic/arrow-parens': ['error', 'always'],
|
|
26
|
+
'@stylistic/arrow-spacing': [
|
|
27
|
+
'error',
|
|
28
|
+
{
|
|
29
|
+
before: true,
|
|
30
|
+
after: true
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
'@stylistic/block-spacing': 'off',
|
|
34
|
+
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: false }],
|
|
35
|
+
'@stylistic/comma-dangle': ['error', 'never'],
|
|
36
|
+
'@stylistic/comma-spacing': [
|
|
37
|
+
'error',
|
|
38
|
+
{
|
|
39
|
+
before: false,
|
|
40
|
+
after: true
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
'@stylistic/comma-style': ['error', 'last'],
|
|
44
|
+
'@stylistic/computed-property-spacing': [
|
|
45
|
+
'error',
|
|
46
|
+
'never',
|
|
47
|
+
{
|
|
48
|
+
enforceForClassMembers: true
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
'@stylistic/dot-location': ['error', 'property'],
|
|
52
|
+
'@stylistic/eol-last': 'error',
|
|
53
|
+
'@stylistic/func-call-spacing': ['error', 'never'],
|
|
54
|
+
'@stylistic/function-call-spacing': ['error', 'never'],
|
|
55
|
+
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
|
|
56
|
+
'@stylistic/function-paren-newline': 'off',
|
|
57
|
+
'@stylistic/generator-star-spacing': ['error', { before: false, after: true }],
|
|
58
|
+
'@stylistic/indent-binary-ops': ['error', indentSize],
|
|
59
|
+
'@stylistic/implicit-arrow-linebreak': 'off',
|
|
60
|
+
'@stylistic/indent': [
|
|
61
|
+
'error',
|
|
62
|
+
indentSize,
|
|
63
|
+
{
|
|
64
|
+
SwitchCase: 1,
|
|
65
|
+
VariableDeclarator: 1,
|
|
66
|
+
MemberExpression: 1
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
'@stylistic/jsx-child-element-spacing': 'off',
|
|
70
|
+
'@stylistic/jsx-closing-bracket-location': 'off',
|
|
71
|
+
'@stylistic/jsx-closing-tag-location': 'off',
|
|
72
|
+
'@stylistic/jsx-curly-brace-presence': 'off',
|
|
73
|
+
'@stylistic/jsx-curly-newline': 'off',
|
|
74
|
+
'@stylistic/jsx-curly-spacing': 'off',
|
|
75
|
+
'@stylistic/jsx-equals-spacing': 'off',
|
|
76
|
+
'@stylistic/jsx-first-prop-new-line': 'off',
|
|
77
|
+
'@stylistic/jsx-indent': 'off',
|
|
78
|
+
'@stylistic/jsx-indent-props': 'off',
|
|
79
|
+
'@stylistic/jsx-max-props-per-line': 'off',
|
|
80
|
+
'@stylistic/jsx-newline': 'off',
|
|
81
|
+
'@stylistic/jsx-one-expression-per-line': 'off',
|
|
82
|
+
'@stylistic/jsx-props-no-multi-spaces': 'off',
|
|
83
|
+
'@stylistic/jsx-self-closing-comp': 'off',
|
|
84
|
+
'@stylistic/jsx-sort-props': 'off',
|
|
85
|
+
'@stylistic/jsx-tag-spacing': 'off',
|
|
86
|
+
'@stylistic/jsx-quotes': 'off',
|
|
87
|
+
'@stylistic/jsx-wrap-multilines': 'off',
|
|
88
|
+
'@stylistic/key-spacing': [
|
|
89
|
+
'error',
|
|
90
|
+
{
|
|
91
|
+
beforeColon: false,
|
|
92
|
+
afterColon: true
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
'@stylistic/keyword-spacing': [
|
|
96
|
+
'error',
|
|
97
|
+
{
|
|
98
|
+
before: true,
|
|
99
|
+
after: true
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
'@stylistic/linebreak-style': ['error', 'unix'],
|
|
103
|
+
'@stylistic/lines-between-class-members': [
|
|
104
|
+
'error',
|
|
105
|
+
'always',
|
|
106
|
+
{
|
|
107
|
+
exceptAfterSingleLine: true
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
'@stylistic/lines-around-comment': 'off',
|
|
111
|
+
'@stylistic/max-len': [
|
|
112
|
+
'error',
|
|
113
|
+
{
|
|
114
|
+
code: 120,
|
|
115
|
+
tabWidth: indentSize,
|
|
116
|
+
ignoreComments: true,
|
|
117
|
+
ignoreTrailingComments: true,
|
|
118
|
+
ignoreUrls: true,
|
|
119
|
+
ignoreStrings: false,
|
|
120
|
+
ignoreTemplateLiterals: false,
|
|
121
|
+
ignoreRegExpLiterals: true
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
'@stylistic/max-statements-per-line': ['error', { max: 1 }],
|
|
125
|
+
'@stylistic/member-delimiter-style': [
|
|
126
|
+
'error',
|
|
127
|
+
{
|
|
128
|
+
multiline: {
|
|
129
|
+
delimiter: 'semi',
|
|
130
|
+
requireLast: true
|
|
131
|
+
},
|
|
132
|
+
singleline: {
|
|
133
|
+
delimiter: 'semi',
|
|
134
|
+
requireLast: false
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
'@stylistic/multiline-ternary': 'off',
|
|
139
|
+
'@stylistic/new-parens': 'error',
|
|
140
|
+
'@stylistic/newline-per-chained-call': 'off',
|
|
141
|
+
'@stylistic/no-confusing-arrow': 'error',
|
|
142
|
+
// Currently this rule conflicts with prettier, because in some cases prettier adds unnecessary extra parens. Unfortunately there is no way to turn this off yet. We should re-enable this rule once this has been fixed in prettier or once there is a better formatter that doesn’t add unnecessary parens. See https://github.com/prettier/prettier/issues/3089
|
|
143
|
+
'@stylistic/no-extra-parens': 'off',
|
|
144
|
+
'@stylistic/no-extra-semi': 'error',
|
|
145
|
+
'@stylistic/no-floating-decimal': 'error',
|
|
146
|
+
'@stylistic/no-mixed-operators': 'off',
|
|
147
|
+
'@stylistic/no-mixed-spaces-and-tabs': 'error',
|
|
148
|
+
'@stylistic/no-multi-spaces': 'error',
|
|
149
|
+
'@stylistic/no-multiple-empty-lines': ['error', { max: 1 }],
|
|
150
|
+
'@stylistic/no-tabs': 'error',
|
|
151
|
+
'@stylistic/no-trailing-spaces': 'error',
|
|
152
|
+
'@stylistic/no-whitespace-before-property': 'error',
|
|
153
|
+
'@stylistic/nonblock-statement-body-position': 'off',
|
|
154
|
+
'@stylistic/object-curly-newline': 'off',
|
|
155
|
+
'@stylistic/object-curly-spacing': ['error', 'always'],
|
|
156
|
+
'@stylistic/object-property-newline': 'off',
|
|
157
|
+
'@stylistic/one-var-declaration-per-line': 'error',
|
|
158
|
+
'@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
|
|
159
|
+
'@stylistic/padded-blocks': [
|
|
160
|
+
'error',
|
|
161
|
+
'never',
|
|
162
|
+
{
|
|
163
|
+
allowSingleLineBlocks: false
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
'@stylistic/padding-line-between-statements': [
|
|
167
|
+
'error',
|
|
168
|
+
{
|
|
169
|
+
blankLine: 'always',
|
|
170
|
+
prev: 'directive',
|
|
171
|
+
next: '*'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
blankLine: 'any',
|
|
175
|
+
prev: 'directive',
|
|
176
|
+
next: 'directive'
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
'@stylistic/quote-props': ['error', 'as-needed'],
|
|
180
|
+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
|
|
181
|
+
'@stylistic/rest-spread-spacing': ['error', 'never'],
|
|
182
|
+
'@stylistic/semi': ['error', 'always'],
|
|
183
|
+
'@stylistic/semi-spacing': [
|
|
184
|
+
'error',
|
|
185
|
+
{
|
|
186
|
+
before: false,
|
|
187
|
+
after: true
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
'@stylistic/semi-style': ['error', 'last'],
|
|
191
|
+
'@stylistic/space-before-blocks': ['error', 'always'],
|
|
192
|
+
'@stylistic/space-before-function-paren': [
|
|
193
|
+
'error',
|
|
194
|
+
{
|
|
195
|
+
anonymous: 'always',
|
|
196
|
+
named: 'never',
|
|
197
|
+
asyncArrow: 'always'
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
'@stylistic/space-in-parens': ['error', 'never'],
|
|
201
|
+
'@stylistic/space-infix-ops': 'error',
|
|
202
|
+
'@stylistic/space-unary-ops': 'error',
|
|
203
|
+
'@stylistic/spaced-comment': [
|
|
204
|
+
'error',
|
|
205
|
+
'always',
|
|
206
|
+
{
|
|
207
|
+
line: {
|
|
208
|
+
exceptions: ['-', '+', '*'],
|
|
209
|
+
markers: ['!', '/', '=>']
|
|
210
|
+
},
|
|
211
|
+
block: {
|
|
212
|
+
exceptions: ['-', '+', '*'],
|
|
213
|
+
markers: ['!', '*'],
|
|
214
|
+
balanced: true
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
'@stylistic/switch-colon-spacing': [
|
|
219
|
+
'error',
|
|
220
|
+
{
|
|
221
|
+
after: true,
|
|
222
|
+
before: false
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
'@stylistic/template-curly-spacing': 'error',
|
|
226
|
+
'@stylistic/template-tag-spacing': ['error', 'never'],
|
|
227
|
+
'@stylistic/type-annotation-spacing': 'error',
|
|
228
|
+
'@stylistic/type-generic-spacing': 'error',
|
|
229
|
+
'@stylistic/type-named-tuple-spacing': 'error',
|
|
230
|
+
'@stylistic/wrap-iife': ['error', 'inside'],
|
|
231
|
+
'@stylistic/wrap-regex': 'off',
|
|
232
|
+
'@stylistic/yield-star-spacing': ['error', { before: false, after: true }]
|
|
233
|
+
}
|
|
234
|
+
};
|
package/typescript.js
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import typescriptParser from '@typescript-eslint/parser';
|
|
2
2
|
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
|
|
3
3
|
import functionalPlugin from 'eslint-plugin-functional';
|
|
4
|
-
import { baseConfig } from '
|
|
5
|
-
import { javascriptExtensions, typescriptExtensions } from '
|
|
4
|
+
import { baseConfig } from './base.js';
|
|
5
|
+
import { javascriptExtensions, typescriptExtensions } from './constants.js';
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
|
|
7
|
+
function asArray(value) {
|
|
8
|
+
if (Array.isArray(value)) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return [value];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function configureWrappedCoreRule(name, optionsOverrides) {
|
|
16
|
+
const coreRuleConfig = asArray(baseConfig.rules[name]);
|
|
17
|
+
const [coreRuleSeverity, ...coreRuleOptions] = coreRuleConfig;
|
|
18
|
+
const options = optionsOverrides === undefined ? coreRuleOptions : asArray(optionsOverrides);
|
|
9
19
|
|
|
10
20
|
return {
|
|
11
21
|
[name]: 'off',
|
|
12
|
-
[`@typescript-eslint/${name}`]:
|
|
22
|
+
[`@typescript-eslint/${name}`]: [coreRuleSeverity, ...options]
|
|
13
23
|
};
|
|
14
24
|
}
|
|
15
25
|
|
|
@@ -86,7 +96,6 @@ export const typescriptConfig = {
|
|
|
86
96
|
}
|
|
87
97
|
}
|
|
88
98
|
],
|
|
89
|
-
...configureWrappedCoreRule('brace-style'),
|
|
90
99
|
'@typescript-eslint/naming-convention': [
|
|
91
100
|
'error',
|
|
92
101
|
{
|
|
@@ -122,21 +131,7 @@ export const typescriptConfig = {
|
|
|
122
131
|
allowTypedFunctionExpressions: true
|
|
123
132
|
}
|
|
124
133
|
],
|
|
125
|
-
...configureWrappedCoreRule('
|
|
126
|
-
...configureWrappedCoreRule('indent'),
|
|
127
|
-
'@typescript-eslint/member-delimiter-style': [
|
|
128
|
-
'error',
|
|
129
|
-
{
|
|
130
|
-
multiline: {
|
|
131
|
-
delimiter: 'semi',
|
|
132
|
-
requireLast: true
|
|
133
|
-
},
|
|
134
|
-
singleline: {
|
|
135
|
-
delimiter: 'semi',
|
|
136
|
-
requireLast: false
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
],
|
|
134
|
+
...configureWrappedCoreRule('max-params'),
|
|
140
135
|
'@typescript-eslint/member-ordering': 'error',
|
|
141
136
|
...configureWrappedCoreRule('no-array-constructor'),
|
|
142
137
|
...configureWrappedCoreRule('no-empty-function'),
|
|
@@ -166,6 +161,7 @@ export const typescriptConfig = {
|
|
|
166
161
|
allowDestructuring: true
|
|
167
162
|
}
|
|
168
163
|
],
|
|
164
|
+
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
|
169
165
|
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
170
166
|
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
171
167
|
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
@@ -173,6 +169,7 @@ export const typescriptConfig = {
|
|
|
173
169
|
...configureWrappedCoreRule('no-useless-constructor'),
|
|
174
170
|
'@typescript-eslint/no-useless-constructor': 'error',
|
|
175
171
|
'@typescript-eslint/no-var-requires': 'error',
|
|
172
|
+
...configureWrappedCoreRule('prefer-destructuring'),
|
|
176
173
|
'@typescript-eslint/prefer-for-of': 'error',
|
|
177
174
|
'@typescript-eslint/prefer-function-type': 'error',
|
|
178
175
|
'@typescript-eslint/prefer-includes': 'error',
|
|
@@ -185,20 +182,16 @@ export const typescriptConfig = {
|
|
|
185
182
|
allowAny: true
|
|
186
183
|
}
|
|
187
184
|
],
|
|
188
|
-
...configureWrappedCoreRule('quotes'),
|
|
189
185
|
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
190
186
|
'@typescript-eslint/require-array-sort-compare': 'error',
|
|
191
|
-
...configureWrappedCoreRule('semi'),
|
|
192
187
|
'@typescript-eslint/triple-slash-reference': [
|
|
193
188
|
'error',
|
|
194
189
|
{
|
|
195
190
|
path: 'never'
|
|
196
191
|
}
|
|
197
192
|
],
|
|
198
|
-
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
199
193
|
'@typescript-eslint/prefer-regexp-exec': 'error',
|
|
200
194
|
'@typescript-eslint/unified-signatures': 'error',
|
|
201
|
-
...configureWrappedCoreRule('no-unused-expressions'),
|
|
202
195
|
'@typescript-eslint/require-await': 'off',
|
|
203
196
|
'@typescript-eslint/strict-boolean-expressions': [
|
|
204
197
|
'error',
|
|
@@ -220,25 +213,33 @@ export const typescriptConfig = {
|
|
|
220
213
|
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
221
214
|
'@typescript-eslint/ban-ts-comment': 'off',
|
|
222
215
|
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
|
|
223
|
-
...configureWrappedCoreRule('comma-spacing'),
|
|
224
216
|
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
225
217
|
...configureWrappedCoreRule('default-param-last'),
|
|
226
218
|
...configureWrappedCoreRule('dot-notation'),
|
|
227
219
|
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
228
220
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
229
221
|
'@typescript-eslint/init-declarations': 'off',
|
|
230
|
-
...configureWrappedCoreRule('keyword-spacing'),
|
|
231
222
|
'@typescript-eslint/method-signature-style': ['error', 'method'],
|
|
232
223
|
'@typescript-eslint/no-base-to-string': 'error',
|
|
233
224
|
...configureWrappedCoreRule('no-dupe-class-members'),
|
|
234
225
|
'@typescript-eslint/no-dynamic-delete': ['error'],
|
|
235
226
|
'@typescript-eslint/no-extra-non-null-assertion': ['error'],
|
|
236
|
-
...configureWrappedCoreRule('no-extra-parens'),
|
|
237
227
|
'@typescript-eslint/no-floating-promises': ['error'],
|
|
238
228
|
'@typescript-eslint/no-implied-eval': ['error'],
|
|
239
229
|
'@typescript-eslint/no-invalid-this': ['error'],
|
|
240
230
|
'@typescript-eslint/no-invalid-void-type': ['error'],
|
|
241
|
-
...configureWrappedCoreRule('no-magic-numbers'
|
|
231
|
+
...configureWrappedCoreRule('no-magic-numbers', {
|
|
232
|
+
ignoreEnums: false,
|
|
233
|
+
ignoreNumericLiteralTypes: true,
|
|
234
|
+
ignoreReadonlyClassProperties: false,
|
|
235
|
+
ignoreTypeIndexes: false,
|
|
236
|
+
ignoreDefaultValues: true,
|
|
237
|
+
ignoreArrayIndexes: false,
|
|
238
|
+
detectObjects: false,
|
|
239
|
+
enforceConst: false,
|
|
240
|
+
ignoreClassFieldInitialValues: false,
|
|
241
|
+
ignore: [-1, 0, 1]
|
|
242
|
+
}),
|
|
242
243
|
'@typescript-eslint/no-namespace': ['error'],
|
|
243
244
|
'@typescript-eslint/no-non-null-asserted-optional-chain': ['error'],
|
|
244
245
|
'@typescript-eslint/no-non-null-assertion': ['error'],
|
|
@@ -260,7 +261,6 @@ export const typescriptConfig = {
|
|
|
260
261
|
'@typescript-eslint/switch-exhaustiveness-check': ['error'],
|
|
261
262
|
'@typescript-eslint/typedef': ['off'],
|
|
262
263
|
'@typescript-eslint/unbound-method': ['off'],
|
|
263
|
-
...configureWrappedCoreRule('lines-between-class-members'),
|
|
264
264
|
'@typescript-eslint/ban-tslint-comment': ['off'],
|
|
265
265
|
'@typescript-eslint/no-confusing-non-null-assertion': ['error'],
|
|
266
266
|
'@typescript-eslint/prefer-enum-initializers': ['off'],
|
|
@@ -272,7 +272,6 @@ export const typescriptConfig = {
|
|
|
272
272
|
'error',
|
|
273
273
|
{ prefer: 'type-imports', fixStyle: 'inline-type-imports', disallowTypeAnnotations: true }
|
|
274
274
|
],
|
|
275
|
-
...configureWrappedCoreRule('comma-dangle'),
|
|
276
275
|
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
|
|
277
276
|
'@typescript-eslint/no-loop-func': 'off',
|
|
278
277
|
'@typescript-eslint/space-infix-ops': 'off',
|
|
@@ -285,7 +284,6 @@ export const typescriptConfig = {
|
|
|
285
284
|
}
|
|
286
285
|
],
|
|
287
286
|
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
|
|
288
|
-
'@typescript-eslint/object-curly-spacing': 'off',
|
|
289
287
|
'@typescript-eslint/sort-type-constituents': [
|
|
290
288
|
'error',
|
|
291
289
|
{
|
|
@@ -325,7 +323,6 @@ export const typescriptConfig = {
|
|
|
325
323
|
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
326
324
|
'@typescript-eslint/no-duplicate-type-constituents': 'error',
|
|
327
325
|
'@typescript-eslint/lines-around-comment': 'off',
|
|
328
|
-
...configureWrappedCoreRule('key-spacing'),
|
|
329
326
|
'@typescript-eslint/block-spacing': 'off',
|
|
330
327
|
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
|
331
328
|
'@typescript-eslint/class-methods-use-this': 'error',
|