-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy patheslint.config.mjs
72 lines (70 loc) · 1.88 KB
/
eslint.config.mjs
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
// eslint.config.mjs
import antfu from '@antfu/eslint-config';
import parser from '@typescript-eslint/parser';
function typescriptPreset() {
return {
files: ['**/*.ts', '**/*.tsx'],
rules: {
'ts/naming-convention': [
'warn',
// Interfaces' names should start with a capital 'I'.
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z0-9]',
match: true,
},
},
// Private fields of a class should start with an underscore '_'.
{
selector: ['classMethod', 'classProperty'],
modifiers: ['private'],
format: ['camelCase'],
leadingUnderscore: 'require',
},
],
},
languageOptions: {
parser,
},
};
}
export default antfu(
{
stylistic: {
indent: 4,
semi: true,
},
react: false,
yaml: {
overrides: {
'yaml/indent': ['error', 4, { indicatorValueIndent: 2 }],
},
},
markdown: false,
typescript: true,
formatters: {
css: true,
html: true,
},
},
{
files: ['**/*.ts', '**/*.tsx'],
ignores: [
'**/*.tsx',
'**/*.d.ts',
'**/vite.config.ts',
'playwright.config.ts',
'**/*.spec.ts',
'**/*.spec.tsx',
'**/*.test.ts',
'**/*.test.tsx',
], // do not check test files
rules: {
'complexity': ['warn', { max: 20 }],
'max-lines-per-function': ['warn', 200],
},
},
typescriptPreset(),
);