-
Notifications
You must be signed in to change notification settings - Fork 13
/
.eslintrc.yml
218 lines (210 loc) · 7.46 KB
/
.eslintrc.yml
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
root: true
overrides:
- files:
- "*.js"
env:
es2020: true # first version to support lookbehind with regexp
node: true # so that "module" is defined
browser: true # so that "window" is defined
extends:
- eslint:all
- prettier # this turns off all rules from eslint, @typescript-eslint and @angular-eslint that conflicts with prettier
rules:
# deactivate unwanted rules
capitalized-comments: off
no-implicit-coercion: off
no-undefined: off
no-use-before-define: off
no-ternary: off
one-var: off
func-names: off
func-style: off
require-unicode-regexp: off
sort-keys: off
# override default values
max-statements:
- error
- 15
no-console:
- error
- allow:
- info
- warn
- error
no-magic-numbers:
- error
- ignore:
- -1
- 0
- 1
ignoreArrayIndexes: true
sort-imports:
- error
- ignoreDeclarationSort: true
- files:
- "*.ts"
parser: "@typescript-eslint/parser"
parserOptions:
project:
- tsconfig.json
- tsconfig.other.json
createDefaultProgram: true
extends:
- eslint:all
- plugin:@typescript-eslint/eslint-plugin/all
- plugin:@angular-eslint/all
- plugin:@angular-eslint/template/process-inline-templates
- prettier # this turns off all rules from eslint, @typescript-eslint and @angular-eslint that conflicts with prettier
rules:
# deactivate unwanted rules
"@angular-eslint/prefer-on-push-component-change-detection": off
"@angular-eslint/use-component-view-encapsulation": off # oblique uses ViewEncapsulation.NONE
"@angular-eslint/use-injectable-provided-in": off # some specialized services are directly provided in a component
"@typescript-eslint/class-methods-use-this": off #ideally, this rule should be limited to private methods
"@typescript-eslint/consistent-type-exports": off
"@typescript-eslint/consistent-type-imports": off
"@typescript-eslint/explicit-member-accessibility": off # public methods and property only accessed from the template should not be marked as public
"@typescript-eslint/init-declarations": off
"@typescript-eslint/lines-between-class-members": off
"@typescript-eslint/no-confusing-void-expression": off
"@typescript-eslint/no-dynamic-delete": off # this is needed
"@typescript-eslint/no-invalid-this": off # triggers an error when enabled
"@typescript-eslint/no-parameter-properties": off
"@typescript-eslint/no-redundant-type-constituents": off # disallows union with any or unknown
"@typescript-eslint/no-require-imports": off # used by node scripts and to load some static assets
"@typescript-eslint/no-type-alias": off
"@typescript-eslint/no-unsafe-return": off # reports many false positive
"@typescript-eslint/non-nullable-type-assertion-style": off # conflicts with @typescript-eslint/no-non-null-assertion
"@typescript-eslint/parameter-properties": off # disallows declaring variables in constructor
"@typescript-eslint/prefer-enum-initializers": off
"@typescript-eslint/prefer-readonly-parameter-types": off # forces "readonly" on functions where it is not allowed
"@typescript-eslint/promise-function-async": off # no compatible with Angular's lazy loading
"@typescript-eslint/sort-type-constituents": off
"@typescript-eslint/sort-type-union-intersection-members": off
accessor-pairs: off
capitalized-comments: off
class-methods-use-this: off #ideally, this rule should be limited to private methods
func-names: off
func-style: off
line-comment-position: off
multiline-comment-style: off
new-cap: off
no-implicit-coercion: off
no-inline-comments: off
no-plusplus: off
no-ternary: off
no-undefined: off
no-void: off
prefer-object-has-own: off # could be activated with ES2022
one-var: off
require-unicode-regexp: off # forces to escape all special characters
sort-keys: off
# override default values
"@angular-eslint/component-max-inline-declarations":
- error
- template: 0
styles: 0
"@angular-eslint/no-host-metadata-property":
- error
- allowStatic: true
"@typescript-eslint/explicit-function-return-type":
- error
- allowExpressions: true
"@typescript-eslint/member-ordering":
- error
- default:
- public-static-field
- public-instance-field
- protected-static-field
- protected-field
- private-static-field
- private-field
- public-constructor
- protected-constructor
- private-constructor
- public-method
- protected-method
- private-method
"@typescript-eslint/no-extraneous-class":
- error
- allowWithDecorator: true
allowStaticOnly: true
"@typescript-eslint/no-invalid-void-type":
- error
- allowAsThisParameter: true
"@typescript-eslint/no-use-before-define":
- error
- functions: false
"@typescript-eslint/restrict-template-expressions":
- error
- allowBoolean: true
"@typescript-eslint/unbound-method":
- error
- ignoreStatic: true
max-lines-per-function:
- error
- max: 35
max-statements:
- error
- 15
no-console:
- error
- allow:
- info
- warn
- error
prefer-destructuring:
- error
- object: true
- enforceForRenamedProperties: false
sort-imports:
- error
- ignoreDeclarationSort: true
- files:
- "*.spec.ts"
rules:
"@angular-eslint/component-max-inline-declarations": off
"@angular-eslint/use-component-selector": off
"@typescript-eslint/ban-ts-comment": off
"@typescript-eslint/no-empty-function": off
"@typescript-eslint/no-floating-promises": off
"@typescript-eslint/no-non-null-assertion": off
"@typescript-eslint/unbound-method": off # because "expect" uses unbound methods
max-classes-per-file: off
max-lines: off
max-lines-per-function: off
max-statements: off
- files:
- "scripts/**/*.ts"
rules:
"@typescript-eslint/max-params": off
"@typescript-eslint/no-magic-numbers": off
"@typescript-eslint/no-unnecessary-condition": off
"@typescript-eslint/prefer-destructuring": off
"@typescript-eslint/prefer-nullish-coalescing": off
"@typescript-eslint/strict-boolean-expressions": off
no-console:
- error
- files:
- "scripts/shared/log.ts"
rules:
no-console:
- error
- allow:
- log
- files:
- "tests/*.ts"
rules:
"@typescript-eslint/no-unnecessary-condition": off
"@typescript-eslint/prefer-nullish-coalescing": off
"@typescript-eslint/strict-boolean-expressions": off
"@typescript-eslint/no-explicit-any": off
"@typescript-eslint/no-unsafe-member-access": off
- files:
- "*.html"
extends:
- plugin:@angular-eslint/template/all
rules:
# deactivate unwanted rules
"@angular-eslint/template/i18n": off
"@angular-eslint/template/use-track-by-function": off