-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
109 lines (105 loc) · 2.34 KB
/
.eslintrc.cjs
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
const baseConfig = {
env: { node: true },
plugins: ['import'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.eslint.json'],
},
extends: [
'airbnb-base',
'plugin:import/recommended',
],
rules: {
'max-len': [
'warn',
{
code: 80,
tabWidth: 2,
ignoreComments: true,
},
],
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'import/order': [
'error',
{ alphabetize: { order: 'asc' } },
],
},
};
const tsConfig = {
files: ['*.ts', '*.mts', '*.cts'],
excludedFiles: ['*.spec.ts', '*.test.ts'],
plugins: [
...baseConfig.plugins,
'@typescript-eslint',
'eslint-plugin-tsdoc',
],
extends: [
...baseConfig.extends,
'airbnb-typescript/base',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
rules: {
...baseConfig.rules,
'tsdoc/syntax': 'warn',
// disable rules covered by TypesScript compiler
'import/default': 'off',
'import/named': 'off',
'import/namespace': 'off',
'import/no-named-as-default-member': 'off',
// disable rules for better local performance
'import/no-cycle': 'off',
'import/no-deprecated': 'off',
'import/no-named-as-default': 'off',
'import/no-unused-modules': 'off',
},
settings: {
'import/parsers': { '@typescript-eslint/parser': ['.ts', '.mts', '.cts'] },
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: ['./tsconfig.eslint.json'],
},
},
},
};
const jestConfig = {
files: ['*.spec.ts', '*.test.ts'],
env: { node: true, 'jest/globals': true },
plugins: [
...tsConfig.plugins,
'jest',
],
extends: [
...tsConfig.extends,
'plugin:jest/recommended',
'plugin:jest/style',
],
rules: {
...tsConfig.rules,
'import/no-extraneous-dependencies': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
},
settings: tsConfig.settings,
};
const specialConfig = {
files: [
'**/*.config.js',
'**/*.config.cjs',
'**/*.config.mjs',
],
rules: {
...baseConfig.rules,
'import/no-extraneous-dependencies': 'off',
},
};
module.exports = {
root: true,
...baseConfig,
overrides: [
tsConfig,
jestConfig,
specialConfig,
],
};