-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
76 lines (73 loc) · 2.16 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
73
74
75
76
import eslint from '@eslint/js';
import jest from 'eslint-plugin-jest';
import tseslint from 'typescript-eslint';
import simpleImportSort from "eslint-plugin-simple-import-sort";
const config = tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
name: 'Common rules for all files',
plugins: {
"simple-import-sort": simpleImportSort,
},
rules: {
'indent': ['error', 2, {
SwitchCase: 1,
flatTernaryExpressions: true,
}],
'quotes': ['error', 'single'],
'no-multi-spaces': 'error',
'block-spacing': ['error', 'always'],
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': ['error', {
before: false,
after: true,
}],
'eol-last': ['error', 'always'],
'func-call-spacing': ['error', 'never'],
'key-spacing': ['error', {
beforeColon: false,
}],
'keyword-spacing': 'error',
'no-console': 'warn',
'no-multiple-empty-lines': ['error', {
max: 1,
maxEOF: 1,
maxBOF: 0,
}],
'no-nested-ternary': 'error',
'no-trailing-spaces': 'error',
'object-curly-spacing': ['error', 'always', {
arraysInObjects: true,
objectsInObjects: true,
}],
'semi': ['error', 'always'],
'semi-style': ['error', 'last'],
'space-before-blocks': 'error',
'space-in-parens': ['error', 'never'],
'space-infix-ops': 'error',
'@typescript-eslint/no-unused-vars': ['error', {
caughtErrors: 'none'
}],
'simple-import-sort/imports': ['error', {
groups: [['^\\u0000', '^node:', '^@?\\w', '^', '^\\.']],
}],
}
},
{
files: ['**/**.test.ts'],
...jest.configs['flat/recommended'],
rules: {
...jest.configs['flat/recommended'].rules,
...jest.configs['flat/style'].rules,
'jest/no-disabled-tests': 'error',
'jest/no-duplicate-hooks': 'error',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-contain': 'error',
'jest/prefer-to-have-length': 'error',
'jest/valid-expect': 'error',
},
},
);
export default config;