kayvee 3.17.0 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +124 -0
- package/.github/workflows/notify-ci-status.yml +20 -0
- package/.nvmrc +1 -1
- package/Makefile +0 -1
- package/build/lib/kayvee.js +13 -17
- package/build/lib/logger/logger.js +84 -76
- package/build/lib/middleware.js +56 -84
- package/build/lib/router/index.js +61 -63
- package/build/package.json +10 -6
- package/build/test/context_logger.js +36 -44
- package/build/test/kayvee.js +16 -16
- package/build/test/logger_test.js +112 -101
- package/build/test/middleware.js +81 -82
- package/build/test/router.js +232 -92
- package/lib/logger/logger.ts +17 -1
- package/lib/middleware.ts +1 -1
- package/package.json +10 -6
- package/test/middleware.ts +1 -1
- package/tsconfig.json +1 -1
- package/.eslintrc.yml +0 -44
- package/tslint.json +0 -134
package/build/test/router.js
CHANGED
|
@@ -1,11 +1,59 @@
|
|
|
1
1
|
var assert = require("assert");
|
|
2
2
|
var router = require("../lib/router");
|
|
3
|
-
describe("router.Router",
|
|
4
|
-
describe("constructor",
|
|
5
|
-
it("parses well formatted configs",
|
|
3
|
+
describe("router.Router", () => {
|
|
4
|
+
describe("constructor", () => {
|
|
5
|
+
it("parses well formatted configs", () => {
|
|
6
6
|
process.env.SCHOOL = "Hogwarts";
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const conf = `
|
|
8
|
+
routes:
|
|
9
|
+
rule-one:
|
|
10
|
+
matchers:
|
|
11
|
+
title: ["authorize-app"]
|
|
12
|
+
output:
|
|
13
|
+
type: "notifications"
|
|
14
|
+
channel: "%{foo.bar}"
|
|
15
|
+
icon: ":rocket:"
|
|
16
|
+
message: "authorized %{foo.bar} in \${SCHOOL}"
|
|
17
|
+
user: "@fishman"
|
|
18
|
+
rule-two:
|
|
19
|
+
matchers:
|
|
20
|
+
foo.bar: ["multiple", "matches"]
|
|
21
|
+
baz: ["whatever"]
|
|
22
|
+
output:
|
|
23
|
+
type: "alerts"
|
|
24
|
+
series: "other-series"
|
|
25
|
+
dimensions: ["baz"]
|
|
26
|
+
stat_type: "gauge"
|
|
27
|
+
rule-three:
|
|
28
|
+
matchers:
|
|
29
|
+
foo.bar: ["multiple", "matches"]
|
|
30
|
+
baz: ["whatever"]
|
|
31
|
+
output:
|
|
32
|
+
type: "alerts"
|
|
33
|
+
series: "other-series"
|
|
34
|
+
dimensions: ["baz"]
|
|
35
|
+
stat_type: "gauge"
|
|
36
|
+
value_field: "hello"
|
|
37
|
+
rule-four:
|
|
38
|
+
matchers:
|
|
39
|
+
foo.bar: ["multiple", "matches"]
|
|
40
|
+
baz: ["whatever"]
|
|
41
|
+
output:
|
|
42
|
+
type: "alerts"
|
|
43
|
+
series: "other-series"
|
|
44
|
+
dimensions: []
|
|
45
|
+
stat_type: "gauge"
|
|
46
|
+
rule-five:
|
|
47
|
+
matchers:
|
|
48
|
+
foo.bar: [true]
|
|
49
|
+
baz: [false]
|
|
50
|
+
output:
|
|
51
|
+
type: "alerts"
|
|
52
|
+
series: "other-series"
|
|
53
|
+
dimensions: []
|
|
54
|
+
stat_type: "gauge"
|
|
55
|
+
`;
|
|
56
|
+
const expected = [
|
|
9
57
|
new router.Rule("rule-one", { title: ["authorize-app"] }, {
|
|
10
58
|
type: "notifications",
|
|
11
59
|
channel: "%{foo.bar}",
|
|
@@ -42,119 +90,211 @@ describe("router.Router", function () {
|
|
|
42
90
|
value_field: "value",
|
|
43
91
|
}),
|
|
44
92
|
];
|
|
45
|
-
|
|
93
|
+
const actual = new router.Router();
|
|
46
94
|
actual._loadConfigString(conf);
|
|
47
95
|
assert.deepEqual(actual.rules, expected);
|
|
48
96
|
});
|
|
49
|
-
it("rejects specials in matchers",
|
|
50
|
-
|
|
97
|
+
it("rejects specials in matchers", () => {
|
|
98
|
+
const confTmpl = (v) => `
|
|
99
|
+
routes:
|
|
100
|
+
non-string-values:
|
|
101
|
+
matchers:
|
|
102
|
+
no-numbers: [${v}]
|
|
103
|
+
output:
|
|
104
|
+
type: "analytics"
|
|
105
|
+
series: "fun"
|
|
106
|
+
`;
|
|
51
107
|
// Make sure the template works
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
assert.doesNotThrow(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
assert.throws(
|
|
58
|
-
};
|
|
59
|
-
for (var _i = 0, _a = ["5", "[]", "{}"]; _i < _a.length; _i++) {
|
|
60
|
-
var invalidVal = _a[_i];
|
|
61
|
-
_loop_1(invalidVal);
|
|
108
|
+
const conf = confTmpl('"valid"');
|
|
109
|
+
const actual = new router.Router();
|
|
110
|
+
assert.doesNotThrow(() => actual._loadConfigString(conf));
|
|
111
|
+
for (const invalidVal of ["5", "[]", "{}"]) {
|
|
112
|
+
const invalidConf = confTmpl(invalidVal);
|
|
113
|
+
assert.throws(() => actual._loadConfigString(invalidConf));
|
|
62
114
|
}
|
|
63
|
-
assert.throws(
|
|
115
|
+
assert.throws(() => actual._loadConfigString(confTmpl('""')));
|
|
64
116
|
return;
|
|
65
117
|
});
|
|
66
|
-
it("rejects duplicates in matchers",
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
118
|
+
it("rejects duplicates in matchers", () => {
|
|
119
|
+
const confTmpl = (v) => `
|
|
120
|
+
routes:
|
|
121
|
+
sloppy:
|
|
122
|
+
matchers:
|
|
123
|
+
title: [${v}]
|
|
124
|
+
output:
|
|
125
|
+
type: "analytics"
|
|
126
|
+
series: "fun"
|
|
127
|
+
`;
|
|
128
|
+
const actual = new router.Router();
|
|
129
|
+
const validConf = confTmpl('"non-repeated", "name"');
|
|
130
|
+
assert.doesNotThrow(() => actual._loadConfigString(validConf));
|
|
131
|
+
const invalidConf = confTmpl('"repeated", "repeated", "name"');
|
|
132
|
+
assert.throws(() => actual._loadConfigString(invalidConf));
|
|
73
133
|
});
|
|
74
|
-
it("requires correct types in outputs",
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
134
|
+
it("requires correct types in outputs", () => {
|
|
135
|
+
const confTmpl = (series, dimensions) => `
|
|
136
|
+
routes:
|
|
137
|
+
wrong:
|
|
138
|
+
matchers:
|
|
139
|
+
title: ["test"]
|
|
140
|
+
output:
|
|
141
|
+
type: "alerts"
|
|
142
|
+
series: ${series}
|
|
143
|
+
dimensions: ${dimensions}
|
|
144
|
+
value_field: "hihi"
|
|
145
|
+
stat_type: "gauge"
|
|
146
|
+
`;
|
|
147
|
+
const actual = new router.Router();
|
|
148
|
+
const validConf = confTmpl('"my-series"', '["dim1", "dim2"]');
|
|
149
|
+
assert.doesNotThrow(() => actual._loadConfigString(validConf));
|
|
150
|
+
const invalidConf0 = confTmpl('["my-series"]', '["dim1", "dim2"]');
|
|
151
|
+
assert.throws(() => actual._loadConfigString(invalidConf0));
|
|
152
|
+
const invalidConf1 = confTmpl('"my-series"', '"dim1"');
|
|
153
|
+
assert.throws(() => actual._loadConfigString(invalidConf1));
|
|
83
154
|
});
|
|
84
|
-
it("requires all keys in outputs",
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
155
|
+
it("requires all keys in outputs", () => {
|
|
156
|
+
const confTmpl = (v) => `
|
|
157
|
+
routes:
|
|
158
|
+
wrong:
|
|
159
|
+
matchers:
|
|
160
|
+
title: ["test"]
|
|
161
|
+
output:
|
|
162
|
+
type: "alerts"${v}
|
|
163
|
+
dimensions: ["dim1", "dim2"]
|
|
164
|
+
stat_type: "gauge"
|
|
165
|
+
`;
|
|
166
|
+
const actual = new router.Router();
|
|
167
|
+
const validConf = confTmpl(`
|
|
168
|
+
series: "whatever"`);
|
|
169
|
+
assert.doesNotThrow(() => actual._loadConfigString(validConf));
|
|
170
|
+
const invalidConf = confTmpl("");
|
|
171
|
+
assert.throws(() => actual._loadConfigString(invalidConf));
|
|
91
172
|
});
|
|
92
|
-
it("doesn't allow extra keys",
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
173
|
+
it("doesn't allow extra keys", () => {
|
|
174
|
+
const confTmpl = (v) => `
|
|
175
|
+
routes:
|
|
176
|
+
wrong:
|
|
177
|
+
matchers:
|
|
178
|
+
title: ["test"]
|
|
179
|
+
output:
|
|
180
|
+
type: "metrics"${v}
|
|
181
|
+
dimensions: ["dim1", "dim2"]
|
|
182
|
+
`;
|
|
183
|
+
const actual = new router.Router();
|
|
184
|
+
const validConf = confTmpl(`
|
|
185
|
+
series: "whatever"`);
|
|
186
|
+
assert.doesNotThrow(() => actual._loadConfigString(validConf));
|
|
187
|
+
const invalidConf = confTmpl(`
|
|
188
|
+
series: "whatever"
|
|
189
|
+
something-else: "hi there"`);
|
|
190
|
+
assert.throws(() => actual._loadConfigString(invalidConf));
|
|
99
191
|
});
|
|
100
|
-
it("errors on type-os",
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
config =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
assert.throws(
|
|
113
|
-
config =
|
|
114
|
-
|
|
192
|
+
it("errors on type-os", () => {
|
|
193
|
+
const actual = new router.Router();
|
|
194
|
+
let config;
|
|
195
|
+
config = `
|
|
196
|
+
route: # Should be routes (plural)
|
|
197
|
+
string-values:
|
|
198
|
+
matchers:
|
|
199
|
+
errors: [ "type-o" ]
|
|
200
|
+
output:
|
|
201
|
+
type: "analytics"
|
|
202
|
+
series: "fun"
|
|
203
|
+
`;
|
|
204
|
+
assert.throws(() => actual._loadConfigString(config));
|
|
205
|
+
config = `
|
|
206
|
+
routes:
|
|
207
|
+
string-values:
|
|
208
|
+
matcher: # Should be matchers (plural)
|
|
209
|
+
errors: [ "type-o" ]
|
|
210
|
+
output:
|
|
211
|
+
type: "analytics"
|
|
212
|
+
series: "fun"
|
|
213
|
+
`;
|
|
214
|
+
assert.throws(() => actual._loadConfigString(config));
|
|
215
|
+
config = `
|
|
216
|
+
routes:
|
|
217
|
+
string-values:
|
|
218
|
+
matchers:
|
|
219
|
+
errors: [ "type-o" ]
|
|
220
|
+
outputs: # Should be output (signular)
|
|
221
|
+
type: "analytics"
|
|
222
|
+
series: "fun"
|
|
223
|
+
`;
|
|
224
|
+
assert.throws(() => actual._loadConfigString(config));
|
|
225
|
+
config = `
|
|
226
|
+
routes:
|
|
227
|
+
$invalid-string-values: # Invalid rule name
|
|
228
|
+
matchers:
|
|
229
|
+
errors: [ "type-o" ]
|
|
230
|
+
output:
|
|
231
|
+
type: "analytics"
|
|
232
|
+
series: "fun"
|
|
233
|
+
`;
|
|
234
|
+
assert.throws(() => actual._loadConfigString(config));
|
|
235
|
+
config = `
|
|
236
|
+
routes:
|
|
237
|
+
string-values:
|
|
238
|
+
matchers:
|
|
239
|
+
errors: [ "type-o" ]
|
|
240
|
+
output:
|
|
241
|
+
type: "analytic" # Should be analytics (plural)p
|
|
242
|
+
series: "fun"
|
|
243
|
+
`;
|
|
244
|
+
assert.throws(() => actual._loadConfigString(config));
|
|
245
|
+
config = `
|
|
246
|
+
routes:
|
|
247
|
+
string-values:
|
|
248
|
+
matchers:
|
|
249
|
+
errors: [ "*", "type-o" ] # A wildcard cannot exist with other matchers
|
|
250
|
+
output:
|
|
251
|
+
type: "analytics"
|
|
252
|
+
series: "fun"
|
|
253
|
+
`;
|
|
254
|
+
assert.throws(() => actual._loadConfigString(config));
|
|
115
255
|
});
|
|
116
256
|
});
|
|
117
|
-
describe("route",
|
|
118
|
-
it("matches one or more rule and returns appropriate outputs",
|
|
119
|
-
|
|
257
|
+
describe("route", () => {
|
|
258
|
+
it("matches one or more rule and returns appropriate outputs", () => {
|
|
259
|
+
const r = new router.Router([
|
|
120
260
|
new router.Rule("rule-one", { title: ["hello", "hi"], foo: ["bar", "baz"] }, { channel: "#-%{foo}-", dimensions: ["-%{foo}-"] }),
|
|
121
261
|
new router.Rule("rule-two", { "bing.bong": ["buzz"] }, { series: "x" }),
|
|
122
262
|
]);
|
|
123
|
-
|
|
263
|
+
const msg0 = {
|
|
124
264
|
title: "hi",
|
|
125
265
|
foo: "bar",
|
|
126
266
|
};
|
|
127
|
-
|
|
267
|
+
const expected0 = [
|
|
128
268
|
{
|
|
129
269
|
rule: "rule-one",
|
|
130
270
|
channel: "#-bar-",
|
|
131
271
|
dimensions: ["-bar-"],
|
|
132
272
|
},
|
|
133
273
|
];
|
|
134
|
-
|
|
274
|
+
const actual0 = r.route(msg0).routes;
|
|
135
275
|
assert.deepEqual(expected0, actual0);
|
|
136
|
-
|
|
276
|
+
const msg1 = {
|
|
137
277
|
title: "hi",
|
|
138
278
|
bing: {
|
|
139
279
|
bong: "buzz",
|
|
140
280
|
},
|
|
141
281
|
};
|
|
142
|
-
|
|
282
|
+
const expected1 = [
|
|
143
283
|
{
|
|
144
284
|
rule: "rule-two",
|
|
145
285
|
series: "x",
|
|
146
286
|
},
|
|
147
287
|
];
|
|
148
|
-
|
|
288
|
+
const actual1 = r.route(msg1).routes;
|
|
149
289
|
assert.deepEqual(expected1, actual1);
|
|
150
|
-
|
|
290
|
+
const msg2 = {
|
|
151
291
|
title: "hello",
|
|
152
292
|
foo: "baz",
|
|
153
293
|
bing: {
|
|
154
294
|
bong: "buzz",
|
|
155
295
|
},
|
|
156
296
|
};
|
|
157
|
-
|
|
297
|
+
const expected2 = [
|
|
158
298
|
{
|
|
159
299
|
rule: "rule-one",
|
|
160
300
|
channel: "#-baz-",
|
|
@@ -165,15 +305,15 @@ describe("router.Router", function () {
|
|
|
165
305
|
series: "x",
|
|
166
306
|
},
|
|
167
307
|
];
|
|
168
|
-
|
|
308
|
+
const actual2 = r.route(msg2).routes;
|
|
169
309
|
assert.deepEqual(expected2, actual2);
|
|
170
310
|
});
|
|
171
311
|
});
|
|
172
312
|
});
|
|
173
|
-
describe("router.Rule",
|
|
174
|
-
describe("matches",
|
|
175
|
-
it("works on simple cases",
|
|
176
|
-
|
|
313
|
+
describe("router.Rule", () => {
|
|
314
|
+
describe("matches", () => {
|
|
315
|
+
it("works on simple cases", () => {
|
|
316
|
+
const r = new router.Rule("test-rule", { title: ["hello", "hi"], foo: ["bar"] }, {});
|
|
177
317
|
assert(r.matches({
|
|
178
318
|
title: "hello",
|
|
179
319
|
foo: "bar",
|
|
@@ -194,8 +334,8 @@ describe("router.Rule", function () {
|
|
|
194
334
|
"missing-stuff": "indeed",
|
|
195
335
|
}));
|
|
196
336
|
});
|
|
197
|
-
it("works on nested messages",
|
|
198
|
-
|
|
337
|
+
it("works on nested messages", () => {
|
|
338
|
+
const r = new router.Rule("test-rule", { "foo.bar": ["hello", "hi"] }, {});
|
|
199
339
|
assert(r.matches({
|
|
200
340
|
title: "greeting",
|
|
201
341
|
foo: {
|
|
@@ -231,8 +371,8 @@ describe("router.Rule", function () {
|
|
|
231
371
|
foo: "hi",
|
|
232
372
|
}));
|
|
233
373
|
});
|
|
234
|
-
it("wild card matching",
|
|
235
|
-
|
|
374
|
+
it("wild card matching", () => {
|
|
375
|
+
const r = new router.Rule("test-rule", { any: ["*"] }, {});
|
|
236
376
|
assert(r.matches({
|
|
237
377
|
any: false,
|
|
238
378
|
}));
|
|
@@ -263,8 +403,8 @@ describe("router.Rule", function () {
|
|
|
263
403
|
},
|
|
264
404
|
}));
|
|
265
405
|
});
|
|
266
|
-
it("bool matching",
|
|
267
|
-
|
|
406
|
+
it("bool matching", () => {
|
|
407
|
+
const r = new router.Rule("test-rule", { bull: [true] }, {});
|
|
268
408
|
assert(r.matches({
|
|
269
409
|
bull: true,
|
|
270
410
|
}));
|
|
@@ -286,25 +426,25 @@ describe("router.Rule", function () {
|
|
|
286
426
|
}));
|
|
287
427
|
});
|
|
288
428
|
});
|
|
289
|
-
describe("outputFor",
|
|
290
|
-
it("substitutes kv entries",
|
|
291
|
-
|
|
429
|
+
describe("outputFor", () => {
|
|
430
|
+
it("substitutes kv entries", () => {
|
|
431
|
+
const r = new router.Rule("myrule", {}, {
|
|
292
432
|
channel: "#-%{foo}-",
|
|
293
433
|
dimensions: ["-%{foo}-", "-%{bar.baz}-"],
|
|
294
434
|
});
|
|
295
|
-
|
|
435
|
+
const msg = {
|
|
296
436
|
title: "greeting",
|
|
297
437
|
foo: "partner",
|
|
298
438
|
bar: {
|
|
299
439
|
baz: "nest egg",
|
|
300
440
|
},
|
|
301
441
|
};
|
|
302
|
-
|
|
442
|
+
const expected = {
|
|
303
443
|
rule: "myrule",
|
|
304
444
|
channel: "#-partner-",
|
|
305
445
|
dimensions: ["-partner-", "-nest egg-"],
|
|
306
446
|
};
|
|
307
|
-
|
|
447
|
+
const actual = r.outputFor(msg);
|
|
308
448
|
assert.deepEqual(expected, actual);
|
|
309
449
|
});
|
|
310
450
|
});
|
package/lib/logger/logger.ts
CHANGED
|
@@ -40,6 +40,7 @@ class Logger {
|
|
|
40
40
|
globals = null;
|
|
41
41
|
logWriter = null;
|
|
42
42
|
logRouter = null;
|
|
43
|
+
asyncLocalStorage = null;
|
|
43
44
|
|
|
44
45
|
constructor(
|
|
45
46
|
source,
|
|
@@ -52,6 +53,7 @@ class Logger {
|
|
|
52
53
|
this.globals = {};
|
|
53
54
|
this.globals.source = source;
|
|
54
55
|
this.logWriter = output;
|
|
56
|
+
this.asyncLocalStorage = null;
|
|
55
57
|
|
|
56
58
|
if (process.env._TEAM_OWNER) {
|
|
57
59
|
this.globals.team = process.env._TEAM_OWNER;
|
|
@@ -76,6 +78,10 @@ class Logger {
|
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
|
|
81
|
+
setAsyncLocalStorage(asyncLocalStorage) {
|
|
82
|
+
this.asyncLocalStorage = asyncLocalStorage;
|
|
83
|
+
}
|
|
84
|
+
|
|
79
85
|
setRouter(r) {
|
|
80
86
|
this.logRouter = r;
|
|
81
87
|
}
|
|
@@ -238,7 +244,17 @@ class Logger {
|
|
|
238
244
|
if (LOG_LEVEL_ENUM[logLvl] < LOG_LEVEL_ENUM[this.logLvl]) {
|
|
239
245
|
return;
|
|
240
246
|
}
|
|
241
|
-
|
|
247
|
+
// I'm not clever enough to want to do these in one line without extra vars.
|
|
248
|
+
// We're on a REALLY old version of TS compiling to ES5. So I don't get a lot of the fancy tools
|
|
249
|
+
// like ?. and ??.
|
|
250
|
+
const store = this.asyncLocalStorage && this.asyncLocalStorage.getStore();
|
|
251
|
+
const storeData = store || { get: () => ({}) };
|
|
252
|
+
const contextData = storeData.get("context") ? storeData.get("context") : {};
|
|
253
|
+
const plainContextData =
|
|
254
|
+
contextData instanceof Map ? Object.fromEntries(contextData) : contextData;
|
|
255
|
+
|
|
256
|
+
var data = assign({ level: logLvl }, this.globals, metadata, plainContextData, userdata);
|
|
257
|
+
|
|
242
258
|
if (this.logRouter) {
|
|
243
259
|
data._kvmeta = this.logRouter.route(data);
|
|
244
260
|
} else if (globalRouter) {
|
package/lib/middleware.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kayvee",
|
|
3
3
|
"description": "Write data to key=val pairs, for human and machine readability",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.18.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -19,20 +19,24 @@
|
|
|
19
19
|
"@clever/prettier-config": "1.0.0",
|
|
20
20
|
"@types/mocha": "^8.0.3",
|
|
21
21
|
"@types/node": "^12.12.68",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
|
23
|
+
"@typescript-eslint/parser": "^5.2.0",
|
|
22
24
|
"babel-eslint": "^6.0.2",
|
|
23
25
|
"benchmark": "^2.1.1",
|
|
24
|
-
"eslint": "^
|
|
26
|
+
"eslint": "^7.11.0",
|
|
25
27
|
"eslint-config-airbnb": "^7.0.0",
|
|
26
|
-
"eslint-
|
|
27
|
-
"eslint-
|
|
28
|
+
"eslint-config-prettier": "^6.12.0",
|
|
29
|
+
"eslint-formatter-summary": "^1.1.0",
|
|
30
|
+
"eslint-plugin-jsx-a11y": "^6.3.1",
|
|
31
|
+
"eslint-plugin-react": "^7.21.5",
|
|
32
|
+
"eslint-plugin-react-hooks": "^4.1.2",
|
|
28
33
|
"express": "^4.13.4",
|
|
29
34
|
"mocha": "^3.5.3",
|
|
30
35
|
"prettier": "2.1.2",
|
|
31
36
|
"sinon": "^1.17.4",
|
|
32
37
|
"supertest": "^1.2.0",
|
|
33
38
|
"ts-node": "^9.0.0",
|
|
34
|
-
"
|
|
35
|
-
"typescript": "^4.0.3"
|
|
39
|
+
"typescript": "^3.9.10"
|
|
36
40
|
},
|
|
37
41
|
"scripts": {
|
|
38
42
|
"test": "make -Br test",
|
package/test/middleware.ts
CHANGED
package/tsconfig.json
CHANGED
package/.eslintrc.yml
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
extends: "airbnb"
|
|
2
|
-
env:
|
|
3
|
-
mocha: true
|
|
4
|
-
parser: "babel-eslint"
|
|
5
|
-
parserOptions:
|
|
6
|
-
ecmaVersion: 6
|
|
7
|
-
rules:
|
|
8
|
-
# no hard limit on line length
|
|
9
|
-
max-len: 0
|
|
10
|
-
|
|
11
|
-
# we allow use of console...for now
|
|
12
|
-
no-console: 0
|
|
13
|
-
|
|
14
|
-
# we currently use snake case in most places, however, we'd like to switch to camelCase eventually since it's more common in the JS community
|
|
15
|
-
camelcase: 0
|
|
16
|
-
|
|
17
|
-
# vars are necessary for server-side requires right now
|
|
18
|
-
no-var: 0
|
|
19
|
-
vars-on-top: 0
|
|
20
|
-
|
|
21
|
-
# multi spaces only allowed for aligning variable/import declarations
|
|
22
|
-
no-multi-spaces:
|
|
23
|
-
- 2
|
|
24
|
-
- exceptions:
|
|
25
|
-
VariableDeclarator: true
|
|
26
|
-
ImportDeclaration: true
|
|
27
|
-
|
|
28
|
-
# we currently use null in many places, so allow == for null checks
|
|
29
|
-
eqeqeq:
|
|
30
|
-
- 2
|
|
31
|
-
- "smart"
|
|
32
|
-
|
|
33
|
-
quotes: [2, "double", "avoid-escape"]
|
|
34
|
-
new-cap:
|
|
35
|
-
- 2
|
|
36
|
-
- newIsCapExceptions: ["kayvee.logger"]
|
|
37
|
-
no-param-reassign:
|
|
38
|
-
- 2
|
|
39
|
-
- props: false
|
|
40
|
-
key-spacing:
|
|
41
|
-
- 2
|
|
42
|
-
- mode: "minimum"
|
|
43
|
-
|
|
44
|
-
guard-for-in: 0
|