forked from neo9/n9-coding-style
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.yaml
298 lines (295 loc) · 8.72 KB
/
.eslintrc.yaml
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
parser: '@typescript-eslint/parser'
parserOptions:
tsconfigRootDir: ./
project:
- tsconfig.json
plugins:
- '@typescript-eslint'
- simple-import-sort
- rxjs
extends:
- eslint:recommended
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
- plugin:jsdoc/recommended
- airbnb-base
- plugin:prettier/recommended
- plugin:rxjs/recommended
rules:
'@typescript-eslint/array-type':
- error
- default: array
# any management
'@typescript-eslint/no-explicit-any':
- off
'@typescript-eslint/no-unsafe-argument':
- off
no-unused-vars:
- off
no-console:
- error
'@typescript-eslint/no-unused-vars':
- error
'@typescript-eslint/member-ordering':
- error
- default:
# Index signature
# No scope for index signature. See above.
# Fields
- static-field # = ["public-static-field", "protected-static-field", "private-static-field"]
- static-get # = ["public-static-get", "protected-static-get", "private-static-get"]
- static-set # = ["public-static-set", "protected-static-set", "private-static-set"]
- static-method # = ["public-static-method", "protected-static-method", "private-static-method"]
- abstract-field # = ["public-abstract-field", "protected-abstract-field", "private-abstract-field"]
- instance-field # = ["public-instance-field", "protected-instance-field", "private-instance-field"]
# Constructors
- constructor # = ["public-constructor", "protected-constructor", "private-constructor"]
# Getters
- abstract-get # = ["public-abstract-get", "protected-abstract-get", "private-abstract-get"]
- instance-get # = ["public-instance-get", "protected-instance-get", "private-instance-get"]
# Setters
- abstract-set # = ["public-abstract-set", "protected-abstract-set", "private-abstract-set"]
- instance-set # = ["public-instance-set", "protected-instance-set", "private-instance-set"]
# Methods
- abstract-method # = ["public-abstract-method", "protected-abstract-method", "private-abstract-method"]
- instance-method # = ["public-instance-method", "protected-instance-method", "private-instance-method"]
max-classes-per-file:
- error
- max: 5
ignoreExpressions: false
'@typescript-eslint/no-inferrable-types':
- error
- ignoreParameters: true
ignoreProperties: true
'@typescript-eslint/typedef':
- error
- arrayDestructuring: false
arrowParameter: false
memberVariableDeclaration: true
objectDestructuring: false
parameter: true
propertyDeclaration: true
variableDeclaration: false
variableDeclarationIgnoreFunction: false
lines-between-class-members: # force line between fields declaration too
- off
'@typescript-eslint/lines-between-class-members': # force line between fields declaration too
- off
complexity:
- error
- max: 25
no-loop-func:
- off
'@typescript-eslint/no-loop-func':
- off
'@typescript-eslint/triple-slash-reference':
- error
- path: never
types: never
lib: never
camelcase:
- off
'@typescript-eslint/naming-convention': # https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/naming-convention.md
- error
- selector: default
format: ['camelCase'] # feature requested : https://github.com/typescript-eslint/typescript-eslint/issues/2244
leadingUnderscore: 'allow'
trailingUnderscore: 'forbid'
- selector: memberLike
modifiers: ['static']
format: ['UPPER_CASE']
- selector: memberLike
modifiers: ['private', 'static']
format: ['camelCase']
- selector: typeLike
format: ['PascalCase']
- selector: enumMember
format: ['UPPER_CASE']
sort-imports:
- off # disable eslint default sort import rule because it is on import name and not on import files
simple-import-sort/imports:
- error
object-shorthand:
- error
- always
jsdoc/require-jsdoc:
- off
jsdoc/require-param-description:
- off
jsdoc/require-returns-description:
- off
jsdoc/require-param-type:
- off
jsdoc/require-returns-type:
- off
jsdoc/require-returns:
- off # Change is too big with tslint version of n9-coding-style
jsdoc/check-param-names:
- error
- checkRestProperty: false
checkDestructured: false
jsdoc/require-param:
- off # Change is too big with tslint version of n9-coding-style
#- checkRestProperty: false
# checkDestructured: false
no-extra-label:
- error
no-labels:
- error
- allowLoop: true
allowSwitch: false
no-restricted-syntax:
- error
- selector: WithStatement
message: "'with' is disallowed in strict mode because it makes code impossible to predict and optimize"
- selector: ForInStatement
message: for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.
no-param-reassign:
- error
- props: false
no-continue:
- off
no-bitwise:
- error
no-eq-null:
- error
no-fallthrough:
- off
no-unused-expressions:
- off
'@typescript-eslint/no-unused-expressions':
- error
no-redeclare:
- off
'@typescript-eslint/no-redeclare':
- error
- ignoreDeclarationMerge: false
one-var:
- error
- initialized: never
uninitialized: never
one-var-declaration-per-line:
- error
- always
radix:
- error
- always
'@typescript-eslint/prefer-function-type':
- error
'@typescript-eslint/consistent-type-assertions':
- error
no-invalid-this:
- off
'@typescript-eslint/no-invalid-this':
- error
no-undef-init:
- error
no-undef: # https://typescript-eslint.io/docs/linting/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
- off
prefer-arrow-callback:
- error
'@typescript-eslint/unified-signatures':
- error
'@typescript-eslint/no-unnecessary-boolean-literal-compare':
- error
curly:
- error
no-return-await:
- off
'@typescript-eslint/no-unsafe-assignment':
- off
# Add rxjs classic rules
rxjs/no-async-subscribe:
- error
rxjs/no-ignored-observable:
- error
rxjs/no-ignored-subscription: # doesn't work to push in subscription array
- off
rxjs/no-nested-subscribe:
- error
rxjs/no-unbound-methods:
- error
rxjs/throw-error:
- error
import/no-unresolved: # let's TypeScript do that
- off
import/extensions: # let's TypeScript do that
- off
import/prefer-default-export:
- off
import/no-extraneous-dependencies:
- error
- devDependencies:
- 'tests/**/*'
- 'test/**/*'
- 'src/app/tests/**/*'
- 'src/app/test/**/*'
- '**/*.test.*'
- '**/*.spec.*'
no-useless-constructor:
- off
'@typescript-eslint/no-useless-constructor':
- error
no-empty-function:
- off
'@typescript-eslint/no-empty-function':
- error
default-param-last:
- off
'@typescript-eslint/default-param-last':
- error
no-underscore-dangle: # disable to allow to read _id on mongo objects
- off
consistent-return:
- off
'@typescript-eslint/unbound-method':
- off
'@typescript-eslint/no-unsafe-member-access':
- off
no-await-in-loop:
- off
prefer-destructuring:
- off
'@typescript-eslint/no-unsafe-call':
- off
'@typescript-eslint/no-unsafe-return':
- off
'@typescript-eslint/promise-function-async':
- error
'@typescript-eslint/no-misused-promises':
- error
- checksVoidReturn: false
checksConditionals: true
no-shadow:
- off
'@typescript-eslint/no-shadow':
- error
'@typescript-eslint/no-this-alias':
- error
'@typescript-eslint/restrict-template-expressions': # too restrictif with types unions
- off
'@typescript-eslint/ban-ts-comment':
- error
- ts-ignore: allow-with-description
'@typescript-eslint/no-empty-interface':
- error
class-methods-use-this: # not usable in TS https://github.com/typescript-eslint/typescript-eslint/issues/1103
- off
'@typescript-eslint/explicit-function-return-type':
- error
- allowTypedFunctionExpressions: true
allowHigherOrderFunctions: true
allowDirectConstAssertionInArrowFunctions: true
allowConciseArrowFunctionExpressionsStartingWithVoid: false
no-useless-return:
- off
array-callback-return:
- off
no-case-declarations:
- off
# missing rules not found in eslint :
# - object-shorthand-properties-first
env:
browser: true,
node: true,