-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.json
304 lines (304 loc) · 13.8 KB
/
.eslintrc.json
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
{
"$schema": "https://json.schemastore.org/eslintrc",
"root": true,
"ignorePatterns": ["projects/**/*"],
"overrides": [
{
"files": ["src/**/*.ts"],
"parserOptions": {
"project": ["tsconfig.json"],
"createDefaultProgram": true
},
"extends": [
"eslint:recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:rxjs/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"prettier"
],
"plugins": ["jsdoc", "rxjs-angular", "unicorn"],
"rules": {
// Component selectors should follow given naming rules.
// @see http://codelyzer.com/rules/component-selector/
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "ngx",
"style": "kebab-case"
}
],
// Directive selectors should follow given naming rules.
// @see http://codelyzer.com/rules/directive-selector/
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "ngx",
"style": "camelCase"
}
],
// Disallows usage of the host metadata property.
// @see http://codelyzer.com/rules/no-host-metadata-property/
"@angular-eslint/no-host-metadata-property": [
"error",
{ "allowStatic": true }
],
// Prefer to declare @Output as readonly since they are not supposed
// to be reassigned.
// @see http://codelyzer.com/rules/prefer-output-readonly/
"@angular-eslint/prefer-output-readonly": ["error"],
// Enforce use of component selector rules.
// @see http://codelyzer.com/rules/component-selector/
"@angular-eslint/use-component-selector": ["error"],
// Disallows using ViewEncapsulation.None.
// @see http://codelyzer.com/rules/use-component-view-encapsulation/
"@angular-eslint/use-component-view-encapsulation": ["error"],
// Ensure that components implement life cycle interfaces if they use
// them.
// @see http://codelyzer.com/rules/use-life-cycle-interface/
"@angular-eslint/use-lifecycle-interface": ["error"],
// Require consistently using either T[] or Array<T> for arrays.
// @see https://typescript-eslint.io/rules/array-type/
"@typescript-eslint/array-type": [
"error",
{ "default": "array-simple" }
],
// Enforce consistent usage of type assertions.
// @see https://typescript-eslint.io/rules/consistent-type-assertions/
"@typescript-eslint/consistent-type-assertions": [
"error",
{
"assertionStyle": "as",
"objectLiteralTypeAssertions": "never"
}
],
// Enforce type definitions to consistently use either interface or type.
// @see https://typescript-eslint.io/rules/consistent-type-definitions/
"@typescript-eslint/consistent-type-definitions": "error",
// Require explicit return types on functions and class methods.
// @see https://typescript-eslint.io/rules/explicit-function-return-type/
"@typescript-eslint/explicit-function-return-type": [
"error",
{ "allowExpressions": true }
],
// Require explicit accessibility modifiers on class properties and methods.
// @see https://typescript-eslint.io/rules/explicit-member-accessibility/
"@typescript-eslint/explicit-member-accessibility": [
"error",
{ "accessibility": "explicit" }
],
// Require explicit return and argument types on exported functions' and
// classes' public class methods.
// @see https://typescript-eslint.io/rules/explicit-module-boundary-types/
"@typescript-eslint/explicit-module-boundary-types": "error",
// Require a consistent member declaration order.
// @see https://typescript-eslint.io/rules/member-ordering/
"@typescript-eslint/member-ordering": [
"error",
{
"default": [
"constructor",
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
// Enforce naming conventions for everything across a codebase.
// @see https://typescript-eslint.io/rules/naming-convention/
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "classProperty",
"format": ["PascalCase", "camelCase"],
"modifiers": ["public"]
},
{
"selector": "function",
"format": ["camelCase"]
},
{
"selector": "interface",
"format": ["PascalCase"],
"custom": {
"regex": "^I[A-Z]",
"match": false
}
},
{
"selector": "enumMember",
"format": ["UPPER_CASE"]
}
],
// Disallow empty functions.
// @see https://typescript-eslint.io/rules/no-empty-function/
"@typescript-eslint/no-empty-function": "error",
// Disallow the declaration of empty interfaces.
// @see https://typescript-eslint.io/rules/no-empty-interface/
"@typescript-eslint/no-empty-interface": "off",
// Disallow the any type.
// @see https://typescript-eslint.io/rules/no-explicit-any/
"@typescript-eslint/no-explicit-any": "error",
// Disallow TypeScript namespaces.
// @see https://typescript-eslint.io/rules/no-namespace/
"@typescript-eslint/no-namespace": [
"error",
{ "allowDeclarations": true }
],
// Disallow unused expressions.
// @see https://typescript-eslint.io/rules/no-unused-expressions/
"@typescript-eslint/no-unused-expressions": "error",
// Disallow unused variables.
// @see https://typescript-eslint.io/rules/no-unused-vars/
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true,
"varsIgnorePattern": "^_"
}
],
// Enforce the use of for-of loop over the standard for loop where
// possible.
// @see https://typescript-eslint.io/rules/prefer-for-of/
"@typescript-eslint/prefer-for-of": ["warn"],
// Enforce using function types instead of interfaces with call
// signatures.
// @see https://typescript-eslint.io/rules/prefer-function-type/
"@typescript-eslint/prefer-function-type": ["warn"],
// Require private members to be marked as readonly if they're never
// modified outside of the constructor.
// @see https://typescript-eslint.io/rules/prefer-readonly/
"@typescript-eslint/prefer-readonly": "error",
// Disallow two overloads that could be unified into one with a union
// or an optional/rest parameter.
// @see https://typescript-eslint.io/rules/unified-signatures/
"@typescript-eslint/unified-signatures": "warn",
// Require the use of === and !==
// @see https://eslint.org/docs/latest/rules/eqeqeq
"eqeqeq": ["error"],
// Require for-in loops to include an if statement
// @see https://eslint.org/docs/latest/rules/guard-for-in
"guard-for-in": ["error"],
// Prohibit default exports.
// @see https://github.com./import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
"import/no-default-export": ["error"],
// Reports use of a deprecated name, as indicated by a JSDoc block
// with a @deprecated tag or TomDoc Deprecated: comment.
// @see https://github.com./import-js/eslint-plugin-import/blob/main/docs/rules/no-deprecated.md
"import/no-deprecated": "off",
// Ensures an imported module can be resolved to a module on the local
// filesystem.
// @see https://github.com./import-js/eslint-plugin-import/blob/main/docs/rules/no-unresolved.md
"import/no-unresolved": "off",
// Reports invalid alignment of JSDoc block asterisks.
// @see https://github.com./gajus/eslint-plugin-jsdoc/blob/master/.README/rules/check-alignment.md
"jsdoc/check-alignment": ["error"],
// Reports invalid padding inside JSDoc blocks.
// @see https://github.com./gajus/eslint-plugin-jsdoc/blob/master/.README/rules/check-indentation.md
"jsdoc/check-indentation": ["error"],
// Disallow bitwise operators
// @see https://eslint.org/docs/latest/rules/no-bitwise
"no-bitwise": ["error"],
// Disallow the use of arguments.caller or arguments.callee
// @see https://eslint.org/docs/latest/rules/no-caller
"no-caller": ["error"],
// Disallow the use of console
// @see https://eslint.org/docs/latest/rules/no-console
"no-console": ["error", { "allow": ["warn", "error"] }],
// Disallow duplicate module imports
// @see https://eslint.org/docs/latest/rules/no-duplicate-imports
"no-duplicate-imports": ["error"],
// Disallow empty block statements
// @see https://eslint.org/docs/latest/rules/no-empty
"no-empty": "error",
// Disallow the use of eval()
// @see https://eslint.org/docs/latest/rules/no-eval
"no-eval": ["error"],
// Disallow new operators with the String, Number, and Boolean objects
// @see https://eslint.org/docs/latest/rules/no-new-wrappers
"no-new-wrappers": ["error"],
// Disallow throwing literals as exceptions
// @see https://eslint.org/docs/latest/rules/no-throw-literal
"no-throw-literal": ["error"],
// Require let or const instead of var
// @see https://eslint.org/docs/latest/rules/no-var
"no-var": ["error"],
// Require or disallow method and property shorthand syntax for object
// literals
// @see https://eslint.org/docs/latest/rules/object-shorthand
"object-shorthand": ["error"],
// Enforce variables to be declared either together or separately in
// functions
// @see https://eslint.org/docs/latest/rules/one-var
"one-var": ["error", "never"],
// Require using arrow functions for callbacks
// @see https://eslint.org/docs/latest/rules/prefer-arrow-callback
"prefer-arrow/prefer-arrow-functions": "off",
// Require const declarations for variables that are never reassigned
// after declared
// @see https://eslint.org/docs/latest/rules/prefer-const
"prefer-const": ["error"],
// Enforce the consistent use of the radix argument when using
// parseInt()
// @see https://eslint.org/docs/latest/rules/radix
"radix": ["error"],
// This rule effects failures if subscribe is called within a component
// and the takeUntil-destroyed pattern is not used.
// @see https://github.com./cartant/eslint-plugin-rxjs-angular/blob/main/docs/rules/prefer-takeuntil.md
"rxjs-angular/prefer-takeuntil": [
"error",
{ "alias": ["untilDestroyed"] }
],
// This rule effects failures if async functions are passed to
// subscribe.
// @see https://github.com./cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-async-subscribe.md
"rxjs/no-async-subscribe": "off",
// This rule prevents the public or protected subjects. Developers
// should instead expose observables via the subjects' toObservable
// method.
// @see https://github.com./cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-exposed-subjects.md
"rxjs/no-exposed-subjects": ["error"],
// This rule prevents the use of Finnish notation.
// @see https://github.com./cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-finnish.md
"rxjs/no-finnish": ["error"],
// This rule effects failures if the buffer size of a replay buffer is
// not explicitly specified.
// @see https://github.com./cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-ignored-replay-buffer.md
"rxjs/no-ignored-replay-buffer": ["error"],
// This rule effects failures if the shareReplay operator is used.
// @see https://github.com./cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-sharereplay.md
"rxjs/no-sharereplay": "off",
// This rule effects failures if the tap operator is used.
// @see https://github.com./cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-tap.md
"rxjs/no-tap": ["error"],
// This rule effects failures whenever takeUntil is used in observable
// compositions that can leak subscriptions.
// @see https://github.com./cartant/eslint-plugin-rxjs/blob/main/docs/rules/no-unsafe-takeuntil.md
"rxjs/no-unsafe-takeuntil": ["error", { "alias": ["untilDestroyed"] }],
// Enforce consistent spacing after the // or /* in a comment
// @see https://eslint.org/docs/latest/rules/spaced-comment
"spaced-comment": [
"error",
"always",
{ "block": { "balanced": true } }
],
// Enforces all linted files to have their names in a certain case
// style and lowercase file extension.
// @see https://github.com./sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
"unicorn/filename-case": ["error", { "case": "kebabCase" }]
}
},
{
"files": ["src/**/*.html"],
"parser": "@angular-eslint/template-parser",
"extends": ["plugin:@angular-eslint/template/recommended"],
"rules": {}
}
]
}