@enormora/eslint-config-typescript 0.0.13 → 0.0.15
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/package.json +6 -5
- package/typescript.js +92 -56
package/package.json
CHANGED
|
@@ -4,21 +4,22 @@
|
|
|
4
4
|
"Christian Rackerseder <github@echooff.de>"
|
|
5
5
|
],
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
8
|
-
"@typescript-eslint/parser": "8.
|
|
9
|
-
"eslint-plugin-functional": "
|
|
7
|
+
"@typescript-eslint/eslint-plugin": "8.6.0",
|
|
8
|
+
"@typescript-eslint/parser": "8.6.0",
|
|
9
|
+
"eslint-plugin-functional": "7.0.2",
|
|
10
|
+
"eslint-plugin-perfectionist": "3.3.0"
|
|
10
11
|
},
|
|
11
12
|
"description": "Enormora’s ESLint typescript configuration",
|
|
12
13
|
"license": "MIT",
|
|
13
14
|
"main": "typescript.js",
|
|
14
15
|
"name": "@enormora/eslint-config-typescript",
|
|
15
16
|
"peerDependencies": {
|
|
16
|
-
"@enormora/eslint-config-base": "0.0.
|
|
17
|
+
"@enormora/eslint-config-base": "0.0.15"
|
|
17
18
|
},
|
|
18
19
|
"repository": {
|
|
19
20
|
"type": "git",
|
|
20
21
|
"url": "git://github.com/enormora/eslint-config.git"
|
|
21
22
|
},
|
|
22
23
|
"type": "module",
|
|
23
|
-
"version": "0.0.
|
|
24
|
+
"version": "0.0.15"
|
|
24
25
|
}
|
package/typescript.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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 perfectionistPlugin from 'eslint-plugin-perfectionist';
|
|
4
5
|
import { baseConfig } from '@enormora/eslint-config-base/base.js';
|
|
5
6
|
import { javascriptExtensions, typescriptExtensions } from '@enormora/eslint-config-base/constants.js';
|
|
6
7
|
|
|
@@ -49,6 +50,7 @@ export const typescriptConfig = {
|
|
|
49
50
|
},
|
|
50
51
|
plugins: {
|
|
51
52
|
'@typescript-eslint': typescriptPlugin,
|
|
53
|
+
perfectionist: perfectionistPlugin,
|
|
52
54
|
functional: functionalPlugin
|
|
53
55
|
},
|
|
54
56
|
rules: {
|
|
@@ -61,38 +63,27 @@ export const typescriptConfig = {
|
|
|
61
63
|
}
|
|
62
64
|
],
|
|
63
65
|
'@typescript-eslint/await-thenable': 'error',
|
|
64
|
-
'@typescript-eslint/
|
|
66
|
+
'@typescript-eslint/no-empty-object-type': ['error', { allowInterfaces: 'never', allowObjectTypes: 'never' }],
|
|
67
|
+
'@typescript-eslint/no-unsafe-function-type': 'error',
|
|
68
|
+
'@typescript-eslint/no-wrapper-object-types': 'error',
|
|
69
|
+
'@typescript-eslint/no-restricted-types': [
|
|
65
70
|
'error',
|
|
66
71
|
{
|
|
67
72
|
types: {
|
|
68
|
-
|
|
69
|
-
message: 'Use `string` instead.',
|
|
70
|
-
fixWith: 'string'
|
|
71
|
-
},
|
|
72
|
-
Number: {
|
|
73
|
-
message: 'Use `number` instead.',
|
|
74
|
-
fixWith: 'number'
|
|
75
|
-
},
|
|
76
|
-
Boolean: {
|
|
77
|
-
message: 'Use `boolean` instead.',
|
|
78
|
-
fixWith: 'boolean'
|
|
79
|
-
},
|
|
80
|
-
Symbol: {
|
|
81
|
-
message: 'Use `symbol` instead.',
|
|
82
|
-
fixWith: 'symbol'
|
|
83
|
-
},
|
|
84
|
-
Object: {
|
|
73
|
+
'Record<never, never>': {
|
|
85
74
|
message:
|
|
86
|
-
'The `
|
|
87
|
-
fixWith: 'Record<
|
|
75
|
+
'The `object` type is hard to use. Use `Record<PropertyKey, never>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848',
|
|
76
|
+
fixWith: 'Record<PropertyKey, never>'
|
|
88
77
|
},
|
|
89
78
|
object: {
|
|
90
79
|
message:
|
|
91
80
|
'The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848',
|
|
92
81
|
fixWith: 'Record<string, unknown>'
|
|
93
82
|
},
|
|
94
|
-
|
|
95
|
-
|
|
83
|
+
Omit: {
|
|
84
|
+
message: 'Prefer the `Except` type in the `type-fest` package instead as it’s stricter.',
|
|
85
|
+
fixWith: 'Except'
|
|
86
|
+
}
|
|
96
87
|
}
|
|
97
88
|
}
|
|
98
89
|
],
|
|
@@ -135,14 +126,6 @@ export const typescriptConfig = {
|
|
|
135
126
|
'@typescript-eslint/member-ordering': 'error',
|
|
136
127
|
...configureWrappedCoreRule('no-array-constructor'),
|
|
137
128
|
...configureWrappedCoreRule('no-empty-function'),
|
|
138
|
-
'@typescript-eslint/no-empty-function': 'off',
|
|
139
|
-
'@typescript-eslint/no-empty-object-type': [
|
|
140
|
-
'error',
|
|
141
|
-
{
|
|
142
|
-
allowInterfaces: 'with-single-extends',
|
|
143
|
-
allowObjectTypes: 'never'
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
129
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
147
130
|
'@typescript-eslint/no-extraneous-class': 'error',
|
|
148
131
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
@@ -169,7 +152,6 @@ export const typescriptConfig = {
|
|
|
169
152
|
...configureWrappedCoreRule('no-unused-vars'),
|
|
170
153
|
...configureWrappedCoreRule('no-useless-constructor'),
|
|
171
154
|
'@typescript-eslint/no-useless-constructor': 'error',
|
|
172
|
-
'@typescript-eslint/no-var-requires': 'error',
|
|
173
155
|
...configureWrappedCoreRule('prefer-destructuring'),
|
|
174
156
|
'@typescript-eslint/prefer-for-of': 'error',
|
|
175
157
|
'@typescript-eslint/prefer-function-type': 'error',
|
|
@@ -211,7 +193,6 @@ export const typescriptConfig = {
|
|
|
211
193
|
'@typescript-eslint/only-throw-error': 'error',
|
|
212
194
|
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
213
195
|
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
214
|
-
'@typescript-eslint/ban-ts-comment': 'off',
|
|
215
196
|
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
|
|
216
197
|
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
217
198
|
...configureWrappedCoreRule('default-param-last'),
|
|
@@ -254,7 +235,16 @@ export const typescriptConfig = {
|
|
|
254
235
|
// disabled because we use functional/prefer-immutable-types.md
|
|
255
236
|
'@typescript-eslint/prefer-readonly-parameter-types': ['off'],
|
|
256
237
|
'@typescript-eslint/prefer-reduce-type-parameter': ['error'],
|
|
257
|
-
'@typescript-eslint/
|
|
238
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
239
|
+
'error',
|
|
240
|
+
{
|
|
241
|
+
'ts-expect-error': 'allow-with-description',
|
|
242
|
+
'ts-ignore': true,
|
|
243
|
+
'ts-nocheck': true,
|
|
244
|
+
'ts-check': false,
|
|
245
|
+
minimumDescriptionLength: 10
|
|
246
|
+
}
|
|
247
|
+
],
|
|
258
248
|
'@typescript-eslint/restrict-template-expressions': ['off'],
|
|
259
249
|
'@typescript-eslint/return-await': ['off'],
|
|
260
250
|
'@typescript-eslint/switch-exhaustiveness-check': ['error'],
|
|
@@ -281,27 +271,6 @@ export const typescriptConfig = {
|
|
|
281
271
|
}
|
|
282
272
|
],
|
|
283
273
|
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
|
|
284
|
-
'@typescript-eslint/sort-type-constituents': [
|
|
285
|
-
'error',
|
|
286
|
-
{
|
|
287
|
-
checkIntersections: true,
|
|
288
|
-
checkUnions: true,
|
|
289
|
-
groupOrder: [
|
|
290
|
-
'named',
|
|
291
|
-
'keyword',
|
|
292
|
-
'operator',
|
|
293
|
-
'literal',
|
|
294
|
-
'function',
|
|
295
|
-
'import',
|
|
296
|
-
'conditional',
|
|
297
|
-
'object',
|
|
298
|
-
'tuple',
|
|
299
|
-
'intersection',
|
|
300
|
-
'union',
|
|
301
|
-
'nullish'
|
|
302
|
-
]
|
|
303
|
-
}
|
|
304
|
-
],
|
|
305
274
|
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
306
275
|
'@typescript-eslint/prefer-return-this-type': 'off',
|
|
307
276
|
'@typescript-eslint/no-meaningless-void-operator': 'error',
|
|
@@ -320,9 +289,12 @@ export const typescriptConfig = {
|
|
|
320
289
|
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
|
321
290
|
'@typescript-eslint/class-methods-use-this': 'error',
|
|
322
291
|
'@typescript-eslint/no-array-delete': 'error',
|
|
323
|
-
'@typescript-eslint/no-
|
|
292
|
+
'@typescript-eslint/no-unnecessary-template-expression': 'error',
|
|
324
293
|
...configureWrappedCoreRule('prefer-promise-reject-errors'),
|
|
325
294
|
'@typescript-eslint/prefer-find': 'error',
|
|
295
|
+
'@typescript-eslint/no-deprecated': 'off',
|
|
296
|
+
'@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
|
|
297
|
+
'@typescript-eslint/no-unnecessary-type-parameters': 'error',
|
|
326
298
|
|
|
327
299
|
'functional/functional-parameters': 'off',
|
|
328
300
|
'functional/immutable-data': 'off',
|
|
@@ -398,6 +370,70 @@ export const typescriptConfig = {
|
|
|
398
370
|
}
|
|
399
371
|
],
|
|
400
372
|
...configureWrappedCoreRule('consistent-return'),
|
|
401
|
-
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error'
|
|
373
|
+
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
|
|
374
|
+
|
|
375
|
+
'perfectionist/sort-intersection-types': [
|
|
376
|
+
'error',
|
|
377
|
+
{
|
|
378
|
+
type: 'natural',
|
|
379
|
+
order: 'asc',
|
|
380
|
+
ignoreCase: true,
|
|
381
|
+
groups: [
|
|
382
|
+
'named',
|
|
383
|
+
'keyword',
|
|
384
|
+
'operator',
|
|
385
|
+
'literal',
|
|
386
|
+
'function',
|
|
387
|
+
'import',
|
|
388
|
+
'conditional',
|
|
389
|
+
'object',
|
|
390
|
+
'tuple',
|
|
391
|
+
'intersection',
|
|
392
|
+
'union',
|
|
393
|
+
'nullish',
|
|
394
|
+
'unknown'
|
|
395
|
+
]
|
|
396
|
+
}
|
|
397
|
+
],
|
|
398
|
+
'perfectionist/sort-union-types': [
|
|
399
|
+
'error',
|
|
400
|
+
{
|
|
401
|
+
type: 'natural',
|
|
402
|
+
order: 'asc',
|
|
403
|
+
ignoreCase: true,
|
|
404
|
+
groups: [
|
|
405
|
+
'named',
|
|
406
|
+
'keyword',
|
|
407
|
+
'operator',
|
|
408
|
+
'literal',
|
|
409
|
+
'function',
|
|
410
|
+
'import',
|
|
411
|
+
'conditional',
|
|
412
|
+
'object',
|
|
413
|
+
'tuple',
|
|
414
|
+
'intersection',
|
|
415
|
+
'union',
|
|
416
|
+
'nullish',
|
|
417
|
+
'unknown'
|
|
418
|
+
]
|
|
419
|
+
}
|
|
420
|
+
],
|
|
421
|
+
'perfectionist/sort-array-includes': 'off',
|
|
422
|
+
'perfectionist/sort-astro-attributes': 'off',
|
|
423
|
+
'perfectionist/sort-classes': 'off',
|
|
424
|
+
'perfectionist/sort-enums': 'off',
|
|
425
|
+
'perfectionist/sort-exports': 'off',
|
|
426
|
+
'perfectionist/sort-imports': 'off',
|
|
427
|
+
'perfectionist/sort-interfaces': 'off',
|
|
428
|
+
'perfectionist/sort-jsx-props': 'off',
|
|
429
|
+
'perfectionist/sort-maps': 'off',
|
|
430
|
+
'perfectionist/sort-named-exports': 'off',
|
|
431
|
+
'perfectionist/sort-named-imports': 'off',
|
|
432
|
+
'perfectionist/sort-object-types': 'off',
|
|
433
|
+
'perfectionist/sort-objects': 'off',
|
|
434
|
+
'perfectionist/sort-svelte-attributes': 'off',
|
|
435
|
+
'perfectionist/sort-switch-case': 'off',
|
|
436
|
+
'perfectionist/sort-variable-declarations': 'off',
|
|
437
|
+
'perfectionist/sort-vue-attributes': 'off'
|
|
402
438
|
}
|
|
403
439
|
};
|