-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheslint.config.mjs
More file actions
60 lines (59 loc) · 1.71 KB
/
eslint.config.mjs
File metadata and controls
60 lines (59 loc) · 1.71 KB
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
import tseslint from 'typescript-eslint'
import vitestPlugin from '@vitest/eslint-plugin'
import noGenericNames from './lint/no-generic-names.js'
import noLineComments from './lint/no-line-comments.js'
export default tseslint.config(
{
plugins: {
custom: {
rules: {
'no-generic-names': noGenericNames,
'no-line-comments': noLineComments,
},
},
},
},
{
files: ['src/**/*.ts'],
plugins: {
'@typescript-eslint': tseslint.plugin,
},
languageOptions: {
parser: tseslint.parser,
},
rules: {
'custom/no-generic-names': 'error',
'@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'never' }],
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'no-restricted-syntax': [
'error',
{
selector: 'VariableDeclaration[kind="let"]',
message: 'Use const. Avoid mutation.',
},
{
selector: 'NewExpression[callee.name="Error"]',
message: 'Use custom precise error classes instead of generic Error.',
},
],
'prefer-const': 'error',
'max-lines': ['error', 400],
'max-depth': ['error', 3],
complexity: ['error', 12],
'custom/no-line-comments': 'error',
'no-inline-comments': 'error',
'no-negated-condition': 'error',
},
},
{
files: ['src/**/*.spec.ts'],
plugins: { vitest: vitestPlugin },
rules: {
'vitest/prefer-strict-equal': 'error',
'vitest/consistent-test-it': ['error', { fn: 'it' }],
'vitest/max-expects': ['error', { max: 4 }],
'vitest/require-to-throw-message': 'error',
},
},
)