-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc.js
160 lines (157 loc) · 4.58 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
module.exports = {
root: true,
extends: ['eslint:recommended', 'plugin:prettier/recommended', 'plugin:sonarjs/recommended'],
plugins: ['sonarjs'],
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module',
project: `./tsconfig.json`
},
env: {
browser: true,
node: true,
es6: true
},
overrides: [
{
files: ['**/*.ts'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier/@typescript-eslint'
],
rules: {
// Resets
'@typescript-eslint/camelcase': 0,
// '@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/ban-ts-ignore': 0,
'@typescript-eslint/no-this-alias': 0,
'@typescript-eslint/no-non-null-assertion': 0,
// '@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/no-use-before-define': 0,
// '@typescript-eslint/no-explicit-any': 0,
'no-constant-condition': 0,
// General formatting
'@typescript-eslint/semi': 2,
'@typescript-eslint/brace-style': 2,
'@typescript-eslint/func-call-spacing': 2,
// tslint
'@typescript-eslint/explicit-member-accessibility': [
0,
{
overrides: {
constructors: 0
}
}
],
// '@typescript-eslint/no-empty-interface': 2,
'@typescript-eslint/no-inferrable-types': 2,
'@typescript-eslint/no-misused-new': 2,
// '@typescript-eslint/no-non-null-assertion': 2,
// '@typescript-eslint/no-use-before-define': 2,
'@typescript-eslint/prefer-function-type': 2,
// '@typescript-eslint/type-annotation-spacing': 2,
'@typescript-eslint/unified-signatures': 2,
'@typescript-eslint/no-shadow': 0,
'@typescript-eslint/array-type': 2,
// tsrules
'require-await': 0,
'@typescript-eslint/require-await': 0,
'@typescript-eslint/no-unused-vars': [
2,
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false,
varsIgnorePattern: 'h|Host',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_'
}
],
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/interface-name-prefix': 0,
'@typescript-eslint/unbound-method': [
2,
{
ignoreStatic: true
}
],
'no-empty-function': 0,
'@typescript-eslint/no-empty-function': 2,
'@typescript-eslint/no-unnecessary-type-assertion': 2
}
},
// Spec files
{
files: ['**/*.spec.ts'],
rules: {
'@typescript-eslint/unbound-method': 0
}
},
// Test Files
{
files: ['**/*.e2e.ts', '**/*.spec.ts'],
rules: {
'sonarjs/no-duplicate-string': 0,
'sonarjs/cognitive-complexity': 0
},
env: {
jest: true
}
}
],
rules: {
// Best practices
'no-shadow': 2,
'require-atomic-updates': 2,
'no-var': 2,
'prefer-object-spread': 2,
'no-nested-ternary': 2,
'no-duplicate-imports': 2,
// General formatting
indent: [2, 2, { SwitchCase: 1 }],
'no-trailing-spaces': 2,
curly: [2, 'all'],
'comma-spacing': 2,
'comma-style': 2,
'computed-property-spacing': 2,
// 'func-style': [2, 'expression', { 'allowArrowFunctions': true }],
'multiline-ternary': [2, 'always-multiline'],
'operator-linebreak': [2, 'after', { overrides: { '?': 'before', ':': 'before' } }],
// 'linebreak-style': 2,
'space-in-parens': 2,
// 'arrow-body-style': [2, 'as-needed', { 'requireReturnForObjectLiteral': true }],
'constructor-super': 2,
'dot-notation': 0,
// 'eol-last': 2,
'guard-for-in': 2,
'no-bitwise': 0,
'no-caller': 2,
'no-console': [1],
'no-debugger': 2,
'no-empty': 0,
'no-empty-function': 2,
'no-fallthrough': 2,
'no-new-wrappers': 2,
'no-throw-literal': 2,
'no-undef-init': 2,
'no-unused-labels': 2,
'prefer-const': 2,
radix: 2,
'no-shadowed-variable': 0,
'max-params': [2, 4]
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.vue']
},
'import/resolver': {
typescript: {}
}
}
};