-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc
229 lines (222 loc) · 6.63 KB
/
.eslintrc
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
{
"env": {
"node": true
},
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"impliedStrict": true
}
},
"plugins": [
"jsdoc",
"security"
],
"root": true,
"extends": "eslint:recommended",
"rules": {
//possible errors
"no-console": "off",
//best practices
"array-callback-return": "error",
"block-scoped-var": "error",
"complexity": ["error", 10],
"consistent-return": "error",
"curly": ["error", "all"],
"default-case": "error",
"dot-notation": "error",
"dot-location": ["error", "property"],
"eqeqeq": "error",
"no-alert": "error",
"no-caller": "error",
"no-eq-null": "error",
"no-extra-bind": "warn",
"no-floating-decimal": "warn",
"no-implicit-coercion": "error",
"no-magic-numbers": ["error", {
"ignoreArrayIndexes": true,
"enforceConst": true,
"detectObjects": true
}],
"no-multi-spaces": ["error", {
"exceptions": {
"Property": true
}
}],
"no-new": "error",
"no-param-reassign": "error",
"no-return-assign": "error",
"no-cond-assign": ["error", "always"],
"no-self-compare": "error",
"no-sequences": "error",
"no-unmodified-loop-condition": "error",
"no-unused-expressions": "error",
"no-useless-call": "warn",
"no-useless-concat": "warn",
"no-useless-escape": "warn",
"prefer-promise-reject-errors": "error",
"require-await": "error",
"wrap-iife": "error",
//documentation
"require-jsdoc": [ "error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": false
}
}],
"valid-jsdoc": [ "error", {
"requireReturn": false,
"requireReturnType": true,
"matchDescription": ".+",
"requireParamDescription": true,
"requireReturnDescription": false,
"preferType": {
"boolean": "Boolean",
"number": "Number",
"object": "Object",
"string": "String",
"array": "Array",
"regexp": "RegExp",
"function": "Function"
}
}],
//variables
"init-declarations": ["error", "always"],
"no-catch-shadow": "error",
"no-shadow-restricted-names": "error",
"no-undef-init": "error",
"no-use-before-define": "error",
//nodejs
"callback-return": "error",
"handle-callback-err": "error",
"no-mixed-requires": "error",
"no-new-require": "error",
"no-path-concat": "error",
"no-sync": "error",
//stylistic
"array-bracket-spacing": ["error", "never"],
"block-spacing": ["error", "always"],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"camelcase": "error",
"comma-dangle": ["error", "never"],
"comma-spacing": ["error", { "before": false, "after": true }],
"comma-style": ["error", "last"],
"computed-property-spacing": ["error", "never"],
"consistent-this": ["error", "self"],
"eol-last": ["error", "always"],
"func-call-spacing": ["error", "never"],
"func-names": ["error", "always"],
"func-style": ["error", "declaration"],
"indent": ["error", 2, {
"FunctionDeclaration": {
"body": 1,
"parameters": "first"
},
"MemberExpression": 1,
"CallExpression": {
"arguments": "first"
},
"ArrayExpression": 1,
"ObjectExpression": 1
}],
"key-spacing": ["error", {
"align": "value",
"beforeColon": false,
"afterColon": true,
"mode": "strict"
}],
"keyword-spacing": "error",
"linebreak-style": ["error", "unix"],
"lines-around-comment": ["error", {
"beforeBlockComment": true,
"beforeLineComment": true,
"allowBlockStart": true,
"allowObjectStart": true,
"allowArrayStart": true
}],
"lines-around-directive": ["error", "always"],
"max-depth": ["error", 4],
"max-len": ["error", {
"code": 100,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true,
"ignoreComments": true,
"ignoreTrailingComments": true
}],
"max-lines": ["error", {
"max": 300,
"skipBlankLines": true,
"skipComments": true
}],
"max-nested-callbacks": ["error", 5],
"max-params": ["error", 5],
"max-statements-per-line": ["error", { "max": 1 }],
"new-cap": "error",
"new-parens": "error",
"newline-after-var": ["error", "always"],
"newline-before-return": "error",
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 2 }],
"no-lonely-if": "error",
"no-mixed-operators": "error",
"no-multi-assign": "error",
"no-multiple-empty-lines": ["error", {
"max": 2
}],
"no-tabs": "error",
"no-trailing-spaces": "error",
"no-underscore-dangle": "error",
"no-unneeded-ternary": "error",
"no-whitespace-before-property": "error",
"object-curly-spacing": ["error", "never", {
"objectsInObjects": true
}],
"object-property-newline": "error",
"one-var": ["error", "never"],
"operator-linebreak": ["error", "after"],
"padded-blocks": ["error", "never"],
"quotes": ["error", "double"],
"semi": ["error", "always"],
"semi-spacing": "error",
"space-before-blocks": "error",
"space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}],
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": "error",
"unicode-bom": ["error", "never"],
//ECMAScript 6
"arrow-body-style": ["error", "always"],
"arrow-parens": ["error", "always"],
"arrow-spacing": "error",
"generator-star-spacing": "error",
"no-duplicate-imports": "error",
"no-useless-computed-key": "error",
"no-useless-rename": "error",
"no-var": "error",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"symbol-description": "error",
"yield-star-spacing": "error",
//Security related
"security/detect-unsafe-regex": "error",
"security/detect-buffer-noassert": "error",
"security/detect-child-process": "error",
"security/detect-disable-mustache-escape": "error",
"security/detect-eval-with-expression": "error",
"security/detect-no-csrf-before-method-override": "error",
"security/detect-non-literal-fs-filename": "error",
"security/detect-non-literal-regexp": "error",
"security/detect-non-literal-require": "error",
"security/detect-possible-timing-attacks": "error",
"security/detect-pseudoRandomBytes": "warn"
}
}