-
Notifications
You must be signed in to change notification settings - Fork 71
/
.eslintrc.yml
303 lines (303 loc) · 8.27 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
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
---
# SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
env:
es6: true
plugins:
- unicorn
extends: 'eslint:recommended'
rules:
array-bracket-newline: # just styling
- warn
- consistent
array-bracket-spacing: # just styling
- warn
- never
array-callback-return: # catch falsy code. return is always needed in array callbacks
- error
arrow-parens: # catch typos of => vs. >=
- error
arrow-spacing: # just styling
- warn
block-scoped-var: # causes nasty errors, especially in for loops with 'i' vars
- error
block-spacing: # just styling
- warn
brace-style: # just styling
- warn
comma-dangle: # just styling
- warn
- arrays: always-multiline
objects: always-multiline
functions: always-multiline
comma-spacing: # just styling
- warn
- before: false
after: true
comma-style: # just styling
- warn
- last
computed-property-spacing: # just styling
- warn
consistent-return: # this is an error on most other languages
- error
curly: # enforce braces around e.g. if blocks to minimize bugs
- error
dot-location: # just styling
- warn
- property
eol-last: # just styling
- warn
eqeqeq: # prefer === to ==, mitigates programming mistakes
- error
func-call-spacing: # just styling
- warn
func-name-matching: # mitigates typos
- error
func-style: # mitigate 'this' scoping mistakes
- error
- declaration
indent: # gnome-shell defaults, just styling
- warn
- 4
- ignoredNodes:
# Allow not indenting the body of GObject.registerClass, since in the
# future it's intended to be a decorator
- 'CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child'
# Allow dedenting chained member expressions
MemberExpression: 'off'
key-spacing: # just styling
- warn
- beforeColon: false
afterColon: true
keyword-spacing: # just styling
- warn
- before: true
after: true
linebreak-style: # can cause issues on some systems, better do this right
- error
- unix
lines-between-class-members: # just styling
- warn
max-nested-callbacks: # just styling
- warn
max-statements-per-line: # just styling
- warn
new-parens: # just styling
- warn
no-array-constructor: # just styling
- warn
no-await-in-loop: # joining promises is preferred
- warn
no-caller: # no fiddling with arguments.caller/callee please
- error
no-constant-condition: # mostly typos
- error
- checkLoops: false
no-div-regex: # /= at beginning of regex is nasty as it is also an assignment
- error
no-empty: # mostly styling
- warn
- allowEmptyCatch: true
no-eq-null:
- warn
no-extra-bind: # cleanup the .bind(...) mess
- warn
no-extra-parens: # just styling
- warn
- all
- conditionalAssign: false
nestedBinaryExpressions: false
returnAssign: false
no-extra-boolean-cast:
- warn
no-func-assign:
- warn
no-implicit-coercion: # just use constructors instead
- error
- allow:
- '!!'
no-invalid-this: # this outside a class is probably a mistake
- error
no-iterator: # prototype.__iterator__ is not available in gjs
- error
no-label-var: # labels should not have the same name as a variable
- error
no-lonely-if: # just styling
- warn
no-loop-func: # anonymous functions create closures within loops which are hard to get right
- error
no-nested-ternary: # just styling, but please ... don't
- warn
no-new-object: # just styling
- warn
no-new-wrappers: # just styling
- warn
no-octal-escape: # just use unicode, octals are deprecated
- error
no-proto: # is deprecated
- error
no-restricted-properties: # gjs stuff
- error
- object: Lang
property: copyProperties
message: Use Object.assign()
- object: Lang
property: bind
message: Use arrow notation or Function.prototype.bind()
- object: Lang
property: Class
message: Use ES6 classes
no-restricted-syntax: # just styling
- warn
- selector: >-
MethodDefinition[key.name="_init"] >
FunctionExpression[params.length=1] >
BlockStatement[body.length=1]
CallExpression[arguments.length=1][callee.object.type="Super"][callee.property.name="_init"] >
Identifier:first-child
message: _init() that only calls super._init() is unnecessary
- selector: >-
MethodDefinition[key.name="_init"] >
FunctionExpression[params.length=0] >
BlockStatement[body.length=1]
CallExpression[arguments.length=0][callee.object.type="Super"][callee.property.name="_init"]
message: _init() that only calls super._init() is unnecessary
- selector: BinaryExpression[operator="instanceof"][right.name="Array"]
message: Use Array.isArray()
no-return-assign: # probably a typo or at least really bad style
- error
no-return-await: # just styling
- warn
no-self-compare: # will always be true
- error
no-shadow-restricted-names: # don't do this
- error
no-spaced-func: # just styling
- warn
no-tabs: # just styling
- warn
no-template-curly-in-string: # prevent wrong syntax for string interpolation
- error
no-throw-literal: # only throw new Error(...)
- error
no-trailing-spaces: # just styling
- warn
no-undefined: # just styling
- warn
no-undef-init: # this is bad
- error
no-unneeded-ternary: # just styling
- warn
no-unused-expressions: # just styling
- warn
no-unused-vars: # just styling
- warn
# Vars use a suffix _ instead of a prefix because of file-scope private vars
- varsIgnorePattern: ^_
argsIgnorePattern: ^_
no-useless-call: # just styling
- warn
no-useless-computed-key: # just styling
- warn
no-useless-concat: # just styling
- warn
no-useless-constructor: # just styling
- warn
no-useless-rename: # just styling
- warn
no-useless-return: # just styling
- warn
no-whitespace-before-property: # just styling
- warn
no-with: # don't use this shit
- error
object-curly-newline: # just styling
- warn
- consistent: true
object-curly-spacing: # just styling
- warn
object-shorthand: # just styling
- warn
operator-assignment: # just styling
- warn
operator-linebreak: # just styling
- warn
padded-blocks: # just styling
- warn
- never
prefer-numeric-literals: # this is hacky, but just styling
- warn
prefer-promise-reject-errors: # please use Error
- error
prefer-rest-params: # do not use arguments
- error
prefer-spread: # do not use apply if possible
- error
prefer-template: # interpolated strings are far more readable
- error
quotes: # I'm a C-guy... single quotes are for char
- warn
- double
- avoidEscape: true # but avoiding escapes is ok
require-await: # async fns should contains awaits
- warn
rest-spread-spacing: # just styling
- warn
semi: # this is an error in most other languages, won't hurt
- error
- always
semi-spacing: # just styling
- warn
- before: false
after: true
semi-style: # just styling
- warn
space-before-blocks: # just styling
- warn
space-before-function-paren: # just styling
- warn
- named: never
# for `function ()` and `async () =>`, preserve space around keywords
anonymous: always
asyncArrow: always
space-in-parens: # just styling
- warn
space-infix-ops: # just styling
- warn
- int32Hint: false
space-unary-ops: # just styling
- warn
spaced-comment: # just styling
- warn
switch-colon-spacing: # just styling
- warn
symbol-description: # make debugging easier
- warn
template-curly-spacing: # just styling
- warn
template-tag-spacing: # just styling
- warn
unicode-bom: # stupid editors, don't to this
- error
wrap-iife: # just styling
- warn
- inside
yield-star-spacing: # just styling
- warn
yoda: # just styling
- warn
unicorn/no-this-assignment:
- warn
globals:
ARGV: readonly
Debugger: readonly
GIRepositoryGType: readonly
globalThis: readonly
imports: readonly
Intl: readonly
log: readonly
logError: readonly
print: readonly
printerr: readonly
parserOptions:
ecmaVersion: 2020