-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.yaml
333 lines (265 loc) · 8.2 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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
---
extends: eslint:all
# Allow async/await
parserOptions:
ecmaVersion: 2020
env:
es6: true
# Cut down / configure the rules we don't like
rules:
# I run this on windows
linebreak-style: off
# Comma styling - no space before, 1 after, end of line and no trailing
# Note: These are all default
comma-dangle: off
comma-style:
- error
- last
comma-spacing:
- error
- before: false
after: true
# I prefer the default to be at the start to be honest.
default-case-last: off
# 2 space indents. I suspect I should make this 4, but the rework
# would be tricky.
indent:
- error
- 2
- ArrayExpression: first
ObjectExpression: first
CallExpression:
arguments: first
flatTernaryExpressions: true
FunctionDeclaration:
parameters: first
FunctionExpression:
parameters: first
SwitchCase: 1
# One declaration per statement
one-var:
- error
- var: never
let: never
const: never
# Array brackets must have a newline if there are any newlines in the array
# list
array-bracket-newline:
- error
- multiline: true
array-element-newline:
- error
- consistent
array-bracket-spacing:
- error
- always
# Object brackets behave similarly to array brackets
object-curly-newline:
- error
- multiline: true
object-curly-spacing:
- error
- always
# Not quite sure how this is different to curly-newline
object-property-newline:
- error
- allowAllPropertiesOnSameLine: true
# only quote properties where needed
quote-props:
- error
- as-needed
# Always break after operators, not before.
operator-linebreak:
- error
- after
# allow anon function names if they can be worked out from context
func-names:
- error
- as-needed
# FIXME To be changed:
# Always break before (non assignment) operators, not after (see Knuth)
#operator-linebreak:
#- error
#- before
#- overrides:
# "=": "after"
# ":": "after"
# Dot operator appears to have a separate config
#dot-location:
#- error
#- property
# Allow multi-line strings
no-multi-str: off
# Unary operators should not have spaces apart from !
# I suspect the 1st two are default but the documentation is unclear.
space-unary-ops:
- error
- words: true
nonwords: false
overrides:
"!": true
# I don't know whether I ever want this on as in general getters and setters
# shouldn't be sorted and nor should eg hours, minutes, seconds type things.
sort-keys: "off"
# I'd like more control over this. Specifically I'd like to complain on
# unnecessarily bracketed arithmetic statements but expect them on logical
# operators. In fact I don't like how it works so much, I'll take the hit
# of temporarily disabling it when I need to.
#no-extra-parens:
#- error
#- all
#- nestedBinaryExpressions: false
# Always use double quotes
quotes:
- error
- double
- allowTemplateLiterals: true
avoidEscape: true
# mozilla has some functions that start with a capital letter
new-cap:
- error
- capIsNewExceptions:
- AppendElement
- Constructor
- EnumerateAllFonts
- QueryInterface
# Arrow functions should be consistent, and everyone omits the brackets
# for a single parameter function
arrow-parens:
- error
- as-needed
# yoda conditions not allowed except for a <= b && b <= c (although eslint
# unhelpfully flexible about that and allows things such as 1 != x && x != 2
# which is just nasty).
yoda:
- error
- never
- exceptRange: true
# Unused variables are wrong except in parameter lists. Ignore ones beginning
# with _ in that case as JS doesn't allow you to not specify a name
no-unused-vars:
- error
- args: all
argsIgnorePattern: "^_"
# --------------------Function definition styles--------------------
# Don't require newlines before/after function parens
function-paren-newline: off
# no space between named / anonymous functions and paren, otherwise space
space-before-function-paren:
- error
- anonymous: never
named: never
asyncArrow: always
# Function declarations should be as function declarations, not assignments
# (I might change my mind on this as declarations get hoisted)
func-style:
- error
- declaration
- allowArrowFunctions: true
# Allow 5 parameters.
max-params:
- error
- 5
# --------------------Braces & blocks--------------------
brace-style:
- error
- allman
# No blank lines at beginning/end of blocks
padded-blocks:
- error
- never
# --------------------Commenting style--------------------
# Do not require first character of a comment to be upper case.
capitalized-comments: off
# I like inline comments
no-inline-comments: off
# No requirements currently for multiline comments. Too much work to fix
multiline-comment-style: off
# No requirement for spacing after a comment. Again, currently too
# inconsistent
spaced-comment: off
# Not entirely sure what the best settings for this are
lines-around-comment:
- error
- beforeBlockComment: true
allowBlockStart: true
# ------------------------------------------------------------------
# These should eventually be enabled
# Conflicts with the way you set up modules and also not sure how to
# deal with constructors.
no-implicit-globals: off
# Disallows magic numbers, which we should probably do, but there's
# a fair bit of +=1 and index into argument arrays
no-magic-numbers: off
# Currently allow use of console until I have proper logging subsystem
no-console: off
# Allow == and !=
eqeqeq: off
no-eq-null: off
# I would actually prefer this on, but currently the jslint I'm using doesn't
# understand templates, so it complains about unused variables.
prefer-template: off
# Disable all the max-per for now. Only for now care about line length and
# complexity
max-statements: off
max-lines-per-function: off
max-lines: off
# Arguably unicde flag is better, but jslint currently doesn't like it, and I
# don't hardcode unicode pairs into my regexps anyway for readability.
require-unicode-regexp: off
# ------------------------------------------------------------------
# disable
# This triggers on anything that looks like an fs call. Things
# other than filing systems have exists and open methods.
# In any case, calculating a filename is not unusual.
detect-non-literal-fs-filename: off
# camelcase is evil. Allow underscores
camelcase: off
# Allow assignment to function parameters. There are two places
# where this is an issue:
# 1) You also use the arguments array (should be an issue all by itself)
# 2) You mutate the properties of a passed in object (oh for 'const'). In
# most cases in this project, this is intentional.
no-param-reassign: off
# Allow use of ternaries and don't require them to be multiline
# I'd like a better specification of multiline ternary - the current options
# don't match the way I feel is most legible
no-ternary: off
no-nested-ternary: off
multiline-ternary: off
# seriously, this is an option?
no-continue: off
# leading underscores are fine
no-underscore-dangle: off
# Having this set generally confuses things if you have allman style braces,
# and I want to allow single line when applicable
implicit-arrow-linebreak: off
# Destructuring assignments seem designed to confuse
prefer-destructuring: off
# I like comments where I like comments
line-comment-position: off
# This doesn't look right to me for chaining promises
newline-per-chained-call: off
# Validate jsdoc is off. It doesn't allow me @constructor and so on
valid-jsdoc: off
#- error
#- requireReturn: false
require-jsdoc:
- error
- require:
FunctionDeclaration: true
MethodDefinition: true
ClassDeclaration: true
ArrowFunctionExpression: false
FunctionExpression: true
# We allow undefined because this is JS6 so we can't overwrite it and we
# have the shadowing warning turned on
no-undefined: off
# I do not want to force newlines in function call params.
function-call-argument-newline: off
globals:
# Some firefox globals (though intl is standard js)
Components: false
DOMStringList: false
Intl: false
XPCNativeWrapper: false