-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
121 lines (117 loc) · 3.07 KB
/
.eslintrc.js
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
110
111
112
113
114
115
116
117
118
119
120
121
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
globals: {
build: 'readonly',
},
plugins: [
'prettier',
'@typescript-eslint',
'import',
'simple-import-sort',
'unused-imports',
'jest',
'jest-formatting',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:jest-formatting/recommended',
'prettier',
],
ignorePatterns: ['dist', 'node_modules'],
rules: {
// recommended config for integrating prettier
'prettier/prettier': ['error', { singleQuote: true, printWidth: 100 }],
'arrow-body-style': 'off',
'prefer-arrow-callback': 'off',
// end of prettier related config
'max-depth': 'error',
'max-statements': ['error', 20],
'@typescript-eslint/no-explicit-any': 0,
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-unused-vars': 'off',
'import/no-unresolved': 'off',
'import/named': 'off',
'unused-imports/no-unused-imports-ts': 'error',
'unused-imports/no-unused-vars-ts': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
},
overrides: [
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
'import/no-commonjs': 'off',
'import/no-nodejs-modules': 'off',
'import/no-unassigned-import': 'off',
},
},
{
files: ['*.json'],
rules: {
quotes: ['error', 'double'],
'max-lines': 'off',
'sonarjs/no-duplicate-string': 'off',
},
},
{
files: ['*.*.ts'],
rules: {
'max-statements': ['error', 25],
'@typescript-eslint/ban-ts-comment': 0,
'sonarjs/no-duplicate-string': 'off',
},
},
//
// all unit test files
//
{
files: ['*.spec.ts', '*.e2e.ts'],
env: {
'jest/globals': true,
},
extends: ['plugin:jest/recommended', 'plugin:jest/style', 'plugin:jest-formatting/strict'],
rules: {
'@typescript-eslint/ban-types': 'off',
'jest/no-test-prefixes': 'off',
'import/no-nodejs-modules': 'off',
'jest/no-test-return-statement': 'error',
'jest/consistent-test-it': 'error',
'jest/no-duplicate-hooks': 'error',
'jest/no-if': 'error',
'jest/no-restricted-matchers': [
'error',
{
toBeFalsy: 'Use `toBeFalse` from jest-extended instead',
},
],
'jest/require-to-throw-message': 'error',
'jest/prefer-hooks-on-top': 'error',
'jest/expect-expect': [
'error',
{
assertFunctionNames: ['expect', 'expect*'],
},
],
'max-statements': ['error', 20],
'sonarjs/no-duplicate-string': 'off',
'sonarjs/no-identical-functions': 'off',
'no-undef': 'off',
'vue/one-component-per-file': 'off',
},
},
],
};