-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.yml
247 lines (230 loc) · 5.72 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
---
root: true
# extends:
# - prettier
env:
es6: true
browser: true
node: true
jest: true
parser: babel-eslint
parserOptions:
sourceType: module
ecmaVersion: 8
ecmaFeatures:
impliedStrict: true
experimentalObjectRestSpread: true
globals:
PACKAGE: readonly
VERSION: readonly
plugins:
- better
- filenames
- require-in-package
- prettier
rules:
prettier/prettier:
- 2
- singleQuote: true
trailingComma: es5
semi: false
# keep filenames consistent
filenames/match-regex:
- 2
- ^([a-zA-Z][a-zA-Z0-9._-]+)$
# disallow debugging in production code
no-alert: 2
no-assert: 0
no-console: 2
no-debugger: 1
# check for missing dependencies
require-in-package/require-in-package: 2
# follow (some of) the teachings of Douglas Crockford
better/no-fors: 2
better/no-whiles: 2
better/no-switches: 2
better/no-typeofs: 2
better/no-instanceofs: 2
better/no-nulls: 2
better/no-deletes: 1
better/no-exceptions: 0
# use ES6 features when they're better than the old alternative
prefer-template: 2
no-var: 2
prefer-const:
- 2
- destructuring: any
ignoreReadBeforeAssign: false
arrow-body-style:
- 2
- as-needed
arrow-parens:
- 2
- always
prefer-destructuring: 2
prefer-rest-params: 2
prefer-spread: 2
prefer-arrow-callback:
- 2
- allowNamedFunctions: true
# disallow constructs that are almost always an error
no-cond-assign: 2
no-constant-condition: 2
no-dupe-args: 2
no-dupe-keys: 2
no-duplicate-case: 2
no-dupe-class-members: 2
no-empty: 2
no-empty-pattern: 2
no-inner-declarations: 2
no-irregular-whitespace: 2
no-obj-calls: 2
no-return-assign: 2
no-return-await: 2
no-sparse-arrays: 2
no-unreachable: 2
no-unsafe-finally: 2
no-unsafe-negation: 2
use-isnan: 2
valid-typeof: 2
array-callback-return: 2
no-global-assign: 2
no-octal: 2
no-octal-escape: 2
no-self-assign: 2
no-self-compare: 2
no-unmodified-loop-condition: 2
no-unused-expressions: 2
wrap-iife:
- 2
- inside
no-bitwise: 1
constructor-super: 2
no-this-before-super: 2
no-class-assign: 2
require-yield: 2
# don't reassign stuff (it confuses things down the line)
no-ex-assign: 2
no-func-assign: 2
no-param-reassign: 2
# don't do unnecessary things
no-extra-boolean-cast: 2
no-extra-semi: 2
no-undef-init: 2
no-else-return: 2
no-extra-bind: 2
no-useless-call: 2
no-useless-concat: 2
no-useless-escape: 2
no-useless-return: 2
no-useless-rename: 2
no-useless-computed-key: 2
no-useless-constructor: 2
# help with regexes
no-control-regex: 2
no-invalid-regexp: 2
no-empty-character-class: 2
no-regex-spaces: 2
no-div-regex: 2
# guard a developer from making mistakes
no-use-before-define: 1
no-template-curly-in-string: 1
no-undef: 2
no-shadow: 2
no-shadow-restricted-names: 2
no-unused-vars:
- 2
- vars: local
args: after-used
argsIgnorePattern: ^_
varsIgnorePattern: ^_
no-loop-func: 2
no-redeclare: 2
no-catch-shadow: 2
radix: 2 # by default parseInt will auto-detect the radix, which sometimes causes weird quirks
require-await: 2
no-const-assign: 2
# apply some best practices
consistent-return: 2 # either do or don't return, make it explicit
no-empty-function: 2 # if you want a function that doesn't do anything, make it explicit
no-implicit-coercion: 2 # don't use (less-readable) tricks to do type conversion, make it explicit
no-caller: 2 # caller is deprecated and inhibits performance, don't use it
no-eval: 2
no-implied-eval: 2
no-new-func: 2 # another type of eval-ing
no-script-url: 2 # another type of eval-ing
no-extend-native: 2 # don't modify global objects
no-labels: 2 # labels quickly lead to GOTO-style coding, avoid at all costs
no-new: 2 # only instantiate classes when you're planning on reusing them
no-proto: 2 # __proto__ is deprecated
no-sequences: 2 # unreadable, prone to cause confusion and/or errors
no-throw-literal: 2 # when you really have to throw, at least use it right
no-void: 2 # there's really no reason why you'd need to use void
no-with: 2 # there's really no reason why you'd need to use with
prefer-promise-reject-errors: 2 # Errors make promise rejection reasons easier to pinpoint
no-floating-decimal: 2 # format floating point numbers nicely
no-lone-blocks: 2 # don't make blocks that have no syntactic meaning
yoda:
- 2
- never
- exceptRange: true
strict: 2 # don't be redundant, es6 is strict by default
no-array-constructor: 2 # avoid some common pitfalls with new Array
# some OO-specific hints (avoid using this unless really needed)
class-methods-use-this: 2 #don't make a class method if you're not gonna use this
no-invalid-this: 1
# give advice
complexity: 1
max-depth: 2
max-nested-callbacks:
- 2
- max: 3
max-params:
- 1
- max: 5
max-statements:
- 1
- max: 30
# encourage use of newer JS
no-restricted-properties:
- 1
- object: _
property: extend
message: use Object.assign instead of _.extend
no-restricted-globals:
- 1
- event
- length
- name
- open
# some node/commonjs-specific things
global-require: 2
no-mixed-requires: 2
no-new-require: 2
handle-callback-err: 2
no-path-concat: 2
no-process-env: 1
no-process-exit: 1
## naming and properties
no-underscore-dangle: 0
func-name-matching: 2
func-names:
- 2
- as-needed
new-cap: 2
new-parens: 2
## other conventions
consistent-this:
- 2
- self
func-style:
- 2
- declaration
- allowArrowFunctions: true
no-continue: 2
no-lonely-if: 2
no-multi-assign: 2
no-new-object: 2
no-new-symbol: 2
no-duplicate-imports: 2
symbol-description: 2