@enormora/eslint-config-typescript 0.0.13 → 0.0.14
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 -55
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.3.0",
|
|
8
|
+
"@typescript-eslint/parser": "8.3.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.14"
|
|
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.14"
|
|
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
|
],
|
|
@@ -136,13 +127,6 @@ export const typescriptConfig = {
|
|
|
136
127
|
...configureWrappedCoreRule('no-array-constructor'),
|
|
137
128
|
...configureWrappedCoreRule('no-empty-function'),
|
|
138
129
|
'@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
130
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
147
131
|
'@typescript-eslint/no-extraneous-class': 'error',
|
|
148
132
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
@@ -169,7 +153,6 @@ export const typescriptConfig = {
|
|
|
169
153
|
...configureWrappedCoreRule('no-unused-vars'),
|
|
170
154
|
...configureWrappedCoreRule('no-useless-constructor'),
|
|
171
155
|
'@typescript-eslint/no-useless-constructor': 'error',
|
|
172
|
-
'@typescript-eslint/no-var-requires': 'error',
|
|
173
156
|
...configureWrappedCoreRule('prefer-destructuring'),
|
|
174
157
|
'@typescript-eslint/prefer-for-of': 'error',
|
|
175
158
|
'@typescript-eslint/prefer-function-type': 'error',
|
|
@@ -211,7 +194,6 @@ export const typescriptConfig = {
|
|
|
211
194
|
'@typescript-eslint/only-throw-error': 'error',
|
|
212
195
|
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
213
196
|
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
214
|
-
'@typescript-eslint/ban-ts-comment': 'off',
|
|
215
197
|
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
|
|
216
198
|
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
217
199
|
...configureWrappedCoreRule('default-param-last'),
|
|
@@ -254,7 +236,16 @@ export const typescriptConfig = {
|
|
|
254
236
|
// disabled because we use functional/prefer-immutable-types.md
|
|
255
237
|
'@typescript-eslint/prefer-readonly-parameter-types': ['off'],
|
|
256
238
|
'@typescript-eslint/prefer-reduce-type-parameter': ['error'],
|
|
257
|
-
'@typescript-eslint/
|
|
239
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
240
|
+
'error',
|
|
241
|
+
{
|
|
242
|
+
'ts-expect-error': 'allow-with-description',
|
|
243
|
+
'ts-ignore': true,
|
|
244
|
+
'ts-nocheck': true,
|
|
245
|
+
'ts-check': false,
|
|
246
|
+
minimumDescriptionLength: 10
|
|
247
|
+
}
|
|
248
|
+
],
|
|
258
249
|
'@typescript-eslint/restrict-template-expressions': ['off'],
|
|
259
250
|
'@typescript-eslint/return-await': ['off'],
|
|
260
251
|
'@typescript-eslint/switch-exhaustiveness-check': ['error'],
|
|
@@ -281,27 +272,6 @@ export const typescriptConfig = {
|
|
|
281
272
|
}
|
|
282
273
|
],
|
|
283
274
|
'@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
275
|
'@typescript-eslint/no-unsafe-argument': 'error',
|
|
306
276
|
'@typescript-eslint/prefer-return-this-type': 'off',
|
|
307
277
|
'@typescript-eslint/no-meaningless-void-operator': 'error',
|
|
@@ -320,9 +290,12 @@ export const typescriptConfig = {
|
|
|
320
290
|
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
|
321
291
|
'@typescript-eslint/class-methods-use-this': 'error',
|
|
322
292
|
'@typescript-eslint/no-array-delete': 'error',
|
|
323
|
-
'@typescript-eslint/no-
|
|
293
|
+
'@typescript-eslint/no-unnecessary-template-expression': 'error',
|
|
324
294
|
...configureWrappedCoreRule('prefer-promise-reject-errors'),
|
|
325
295
|
'@typescript-eslint/prefer-find': 'error',
|
|
296
|
+
'@typescript-eslint/no-deprecated': 'off',
|
|
297
|
+
'@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
|
|
298
|
+
'@typescript-eslint/no-unnecessary-type-parameters': 'error',
|
|
326
299
|
|
|
327
300
|
'functional/functional-parameters': 'off',
|
|
328
301
|
'functional/immutable-data': 'off',
|
|
@@ -398,6 +371,70 @@ export const typescriptConfig = {
|
|
|
398
371
|
}
|
|
399
372
|
],
|
|
400
373
|
...configureWrappedCoreRule('consistent-return'),
|
|
401
|
-
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error'
|
|
374
|
+
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
|
|
375
|
+
|
|
376
|
+
'perfectionist/sort-intersection-types': [
|
|
377
|
+
'error',
|
|
378
|
+
{
|
|
379
|
+
type: 'natural',
|
|
380
|
+
order: 'asc',
|
|
381
|
+
ignoreCase: true,
|
|
382
|
+
groups: [
|
|
383
|
+
'named',
|
|
384
|
+
'keyword',
|
|
385
|
+
'operator',
|
|
386
|
+
'literal',
|
|
387
|
+
'function',
|
|
388
|
+
'import',
|
|
389
|
+
'conditional',
|
|
390
|
+
'object',
|
|
391
|
+
'tuple',
|
|
392
|
+
'intersection',
|
|
393
|
+
'union',
|
|
394
|
+
'nullish',
|
|
395
|
+
'unknown'
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
],
|
|
399
|
+
'perfectionist/sort-union-types': [
|
|
400
|
+
'error',
|
|
401
|
+
{
|
|
402
|
+
type: 'natural',
|
|
403
|
+
order: 'asc',
|
|
404
|
+
ignoreCase: true,
|
|
405
|
+
groups: [
|
|
406
|
+
'named',
|
|
407
|
+
'keyword',
|
|
408
|
+
'operator',
|
|
409
|
+
'literal',
|
|
410
|
+
'function',
|
|
411
|
+
'import',
|
|
412
|
+
'conditional',
|
|
413
|
+
'object',
|
|
414
|
+
'tuple',
|
|
415
|
+
'intersection',
|
|
416
|
+
'union',
|
|
417
|
+
'nullish',
|
|
418
|
+
'unknown'
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
],
|
|
422
|
+
'perfectionist/sort-array-includes': 'off',
|
|
423
|
+
'perfectionist/sort-astro-attributes': 'off',
|
|
424
|
+
'perfectionist/sort-classes': 'off',
|
|
425
|
+
'perfectionist/sort-enums': 'off',
|
|
426
|
+
'perfectionist/sort-exports': 'off',
|
|
427
|
+
'perfectionist/sort-imports': 'off',
|
|
428
|
+
'perfectionist/sort-interfaces': 'off',
|
|
429
|
+
'perfectionist/sort-jsx-props': 'off',
|
|
430
|
+
'perfectionist/sort-maps': 'off',
|
|
431
|
+
'perfectionist/sort-named-exports': 'off',
|
|
432
|
+
'perfectionist/sort-named-imports': 'off',
|
|
433
|
+
'perfectionist/sort-object-types': 'off',
|
|
434
|
+
'perfectionist/sort-objects': 'off',
|
|
435
|
+
'perfectionist/sort-svelte-attributes': 'off',
|
|
436
|
+
'perfectionist/sort-switch-case': 'off',
|
|
437
|
+
'perfectionist/sort-variable-declarations': 'off',
|
|
438
|
+
'perfectionist/sort-vue-attributes': 'off'
|
|
402
439
|
}
|
|
403
440
|
};
|