-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
format.spec.js.snap
631 lines (573 loc) · 18 KB
/
format.spec.js.snap
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Check codebases column-offset - eslint should give expected output 1`] = `
"
./example.js
7:4 error Cannot resolve name \`test\` flowtype-errors/show-errors
7:9 error Cannot resolve name \`x\` flowtype-errors/show-errors
8:6 error Cannot resolve name \`y\` flowtype-errors/show-errors
✖ 3 problems (3 errors, 0 warnings)
"
`;
exports[`Check codebases coverage-fail - eslint should give expected output 1`] = `
"
./example.js
1:1 error Expected coverage to be at least 50%, but is: 0% flowtype-errors/enforce-min-coverage
✖ 1 problem (1 error, 0 warnings)
"
`;
exports[`Check codebases coverage-fail2 - eslint should give expected output 1`] = `
"
./example.js
1:1 error Expected coverage to be at least 50%, but is: 33.33% flowtype-errors/enforce-min-coverage
✖ 1 problem (1 error, 0 warnings)
"
`;
exports[`Check codebases coverage-ok - eslint should give expected output 1`] = `""`;
exports[`Check codebases coverage-ok2 - eslint should give expected output 1`] = `""`;
exports[`Check codebases flow-pragma-1 - eslint should give expected output 1`] = `
"
./example.js
4:10 error Cannot return \`'string'\` because string is incompatible with boolean (see line 3) flowtype-errors/show-errors
7:6 error Cannot resolve name \`x\` flowtype-errors/show-errors
14:14 error Cannot perform arithmetic operation because string is not a number flowtype-errors/show-errors
✖ 3 problems (3 errors, 0 warnings)
"
`;
exports[`Check codebases flow-pragma-2 - eslint should give expected output 1`] = `
"
./example.js
6:10 error Cannot return \`'string'\` because string is incompatible with boolean (see line 5) flowtype-errors/show-errors
9:6 error Cannot resolve name \`x\` flowtype-errors/show-errors
16:14 error Cannot perform arithmetic operation because string is not a number flowtype-errors/show-errors
✖ 3 problems (3 errors, 0 warnings)
"
`;
exports[`Check codebases html-support - eslint should give expected output 1`] = `
"
./a.vue
5:1 error Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?
3 | </template>
4 |
> 5 | <script>
| ^
6 | // @flow
7 |
8 | import B from \\"./b.vue\\";
./b.vue
5:1 error Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?
3 | </template>
4 |
> 5 | <script>
| ^
6 | export default {};
7 | </script>
8 |
✖ 2 problems (2 errors, 0 warnings)
"
`;
exports[`Check codebases no-flow-pragma - eslint should give expected output 1`] = `""`;
exports[`Check codebases project-1 - eslint should give expected output 1`] = `
"
./1.example.js
5:10 error Cannot return \`'string'\` because string is incompatible with boolean (see line 4) flowtype-errors/show-errors
8:6 error Cannot resolve name \`x\` flowtype-errors/show-errors
15:14 error Cannot perform arithmetic operation because string is not a number flowtype-errors/show-errors
./2.example.js
8:24 error Missing type annotation for \`x\` flowtype-errors/show-errors
12:6 error Cannot resolve name \`x\` flowtype-errors/show-errors
./3.example.js
9:10 error Cannot return \`'undefined'\` because string is incompatible with number (see line 8) flowtype-errors/show-errors
13:10 error Cannot return \`some\` because string (see line 12) is incompatible with number (see line 12) flowtype-errors/show-errors
16:19 error Cannot assign \`'hello world!'\` to \`str\` because string is incompatible with number flowtype-errors/show-errors
18:7 error Cannot declare \`who\` (see line 12) because the name is already bound flowtype-errors/show-errors
20:5 error Cannot call \`moo\` because no arguments are expected by function (see line 8) flowtype-errors/show-errors
20:11 error Cannot add \`str\` and \`who\` because function (see line 12) is incompatible with number (see line 16) flowtype-errors/show-errors
./4.example.js
27:13 error Cannot create \`Foo\` element because property \`lastName\` is missing in props but exists in \`Props\` (see line 11) flowtype-errors/show-errors
27:27 error Cannot create \`Foo\` element because string is incompatible with number (see line 7) in property \`firstName\` flowtype-errors/show-errors
./5.example.js
8:3 error Cannot call \`s\` with \`'4'\` bound to \`x\` because string is incompatible with number (see line 4) flowtype-errors/show-errors
./6.example.js
8:5 error Cannot call \`foo\` with \`1234\` bound to \`bar\` because number is incompatible with object type (see line 4) flowtype-errors/show-errors
10:5 error Cannot call \`foo\` with object literal bound to \`bar\` because property \`baz\` is missing in object literal but exists in object type (see line 4) flowtype-errors/show-errors
./7.example.js
6:3 error Cannot call \`s\` with \`'4'\` bound to \`x\` because string is incompatible with number (see ./5.example.js:4) flowtype-errors/show-errors
./8.example.js
6:5 error Cannot call \`foo\` with \`1234\` bound to \`bar\` because number is incompatible with object type (see ./6.example.js:4) flowtype-errors/show-errors
8:5 error Cannot call \`foo\` with object literal bound to \`bar\` because property \`baz\` is missing in object literal but exists in object type (see ./6.example.js:4) flowtype-errors/show-errors
./9.example.js
8:18 error Cannot create \`Hello\` element because property \`name\` is missing in props but exists in object type (see ./9.example.import.js:6) flowtype-errors/show-errors
8:28 error Cannot call \`ReactDOM.render\` with \`document.getElementById(...)\` bound to \`container\` because null (see https://github.com/facebook/flow/blob/v0.93.0/lib/dom.js#L783) is incompatible with \`Element\` (see https://github.com/facebook/flow/blob/v0.93.0/lib/react-dom.js#L18) flowtype-errors/show-errors
✖ 21 problems (21 errors, 0 warnings)
"
`;
exports[`Check codebases run-all - eslint should give expected output 1`] = `
"
./example.js
2:10 error Cannot return \`'string'\` because string is incompatible with boolean (see line 1) flowtype-errors/show-errors
5:6 error Cannot resolve name \`x\` flowtype-errors/show-errors
12:14 error Cannot perform arithmetic operation because string is not a number flowtype-errors/show-errors
✖ 3 problems (3 errors, 0 warnings)
"
`;
exports[`Check codebases run-all-flowdir - eslint should give expected output 1`] = `
"
./subdir/example.js
2:10 error Cannot return \`'string'\` because string is incompatible with boolean (see line 1) flowtype-errors/show-errors
5:6 error Cannot resolve name \`x\` flowtype-errors/show-errors
12:14 error Cannot perform arithmetic operation because string is not a number flowtype-errors/show-errors
✖ 3 problems (3 errors, 0 warnings)
"
`;
exports[`Check codebases warnings-all - eslint should give expected output 1`] = `
"
./example.js
9:22 warning Unclear type. Using \`any\`, \`Object\`, or \`Function\` types is not safe! (\`unclear-type\`) flowtype-errors/show-warnings
✖ 1 problem (0 errors, 1 warning)
"
`;
exports[`Check codebases warnings-default - eslint should give expected output 1`] = `""`;
exports[`Check codebases warnings-mixed - eslint should give expected output 1`] = `
"
./example.js
10:22 warning Unclear type. Using \`any\`, \`Object\`, or \`Function\` types is not safe! (\`unclear-type\`) flowtype-errors/show-warnings
19:10 error Cannot return \`x.reduce(...) / x.length\` because number is incompatible with string (see line 18) flowtype-errors/show-errors
✖ 2 problems (1 error, 1 warning)
"
`;
exports[`Format 1.example.js - should have expected properties 1`] = `
Array [
Object {
"end": 6,
"loc": Object {
"end": Object {
"column": 17,
"line": 6,
"offset": 91,
},
"start": Object {
"column": 10,
"line": 6,
"offset": 83,
},
},
"message": "Cannot return \`'string'\` because string is incompatible with boolean (see line 5).",
"start": 6,
"type": "default",
},
Object {
"end": 9,
"loc": Object {
"end": Object {
"column": 6,
"line": 9,
"offset": 102,
},
"start": Object {
"column": 6,
"line": 9,
"offset": 101,
},
},
"message": "Cannot resolve name \`x\`.",
"start": 9,
"type": "default",
},
Object {
"end": 16,
"loc": Object {
"end": Object {
"column": 16,
"line": 16,
"offset": 208,
},
"start": Object {
"column": 14,
"line": 16,
"offset": 205,
},
},
"message": "Cannot perform arithmetic operation because string is not a number.",
"start": 16,
"type": "default",
},
]
`;
exports[`Format 2.example.js - should have expected properties 1`] = `
Array [
Object {
"end": 9,
"loc": Object {
"end": Object {
"column": 24,
"line": 9,
"offset": 96,
},
"start": Object {
"column": 24,
"line": 9,
"offset": 95,
},
},
"message": "Missing type annotation for \`x\`.",
"start": 9,
"type": "missing-annotation",
},
Object {
"end": 13,
"loc": Object {
"end": Object {
"column": 6,
"line": 13,
"offset": 121,
},
"start": Object {
"column": 6,
"line": 13,
"offset": 120,
},
},
"message": "Cannot resolve name \`x\`.",
"start": 13,
"type": "default",
},
]
`;
exports[`Format 3.example.js - should have expected properties 1`] = `
Array [
Object {
"end": 10,
"loc": Object {
"end": Object {
"column": 20,
"line": 10,
"offset": 145,
},
"start": Object {
"column": 10,
"line": 10,
"offset": 134,
},
},
"message": "Cannot return \`'undefined'\` because string is incompatible with number (see line 9).",
"start": 10,
"type": "default",
},
Object {
"end": 14,
"loc": Object {
"end": Object {
"column": 13,
"line": 14,
"offset": 207,
},
"start": Object {
"column": 10,
"line": 14,
"offset": 203,
},
},
"message": "Cannot return \`some\` because string (see line 13) is incompatible with number (see line 13).",
"start": 14,
"type": "default",
},
Object {
"end": 17,
"loc": Object {
"end": Object {
"column": 32,
"line": 17,
"offset": 244,
},
"start": Object {
"column": 19,
"line": 17,
"offset": 230,
},
},
"message": "Cannot assign \`'hello world!'\` to \`str\` because string is incompatible with number.",
"start": 17,
"type": "default",
},
Object {
"end": 19,
"loc": Object {
"end": Object {
"column": 9,
"line": 19,
"offset": 256,
},
"start": Object {
"column": 7,
"line": 19,
"offset": 253,
},
},
"message": "Cannot declare \`who\` (see line 13) because the name is already bound.",
"start": 19,
"type": "default",
},
Object {
"end": 21,
"loc": Object {
"end": Object {
"column": 13,
"line": 21,
"offset": 277,
},
"start": Object {
"column": 5,
"line": 21,
"offset": 268,
},
},
"message": "Cannot call \`moo\` because no arguments are expected by function (see line 9).",
"start": 21,
"type": "default",
},
Object {
"end": 21,
"loc": Object {
"end": Object {
"column": 13,
"line": 21,
"offset": 277,
},
"start": Object {
"column": 11,
"line": 21,
"offset": 274,
},
},
"message": "Cannot add \`str\` and \`who\` because function (see line 13) is incompatible with number (see line 17).",
"start": 21,
"type": "default",
},
]
`;
exports[`Format 4.example.js - should have expected properties 1`] = `
Array [
Object {
"end": 28,
"loc": Object {
"end": Object {
"column": 15,
"line": 28,
"offset": 431,
},
"start": Object {
"column": 13,
"line": 28,
"offset": 428,
},
},
"message": "Cannot create \`Foo\` element because property \`lastName\` is missing in props but exists in \`Props\` (see line 12).",
"start": 28,
"type": "default",
},
Object {
"end": 28,
"loc": Object {
"end": Object {
"column": 32,
"line": 28,
"offset": 448,
},
"start": Object {
"column": 27,
"line": 28,
"offset": 442,
},
},
"message": "Cannot create \`Foo\` element because string is incompatible with number (see line 8) in property \`firstName\`.",
"start": 28,
"type": "default",
},
]
`;
exports[`Format 5.example.js - should have expected properties 1`] = `
Array [
Object {
"end": 9,
"loc": Object {
"end": Object {
"column": 5,
"line": 9,
"offset": 93,
},
"start": Object {
"column": 3,
"line": 9,
"offset": 90,
},
},
"message": "Cannot call \`s\` with \`'4'\` bound to \`x\` because string is incompatible with number (see line 5).",
"start": 9,
"type": "default",
},
]
`;
exports[`Format 6.example.js - should have expected properties 1`] = `
Array [
Object {
"end": 9,
"loc": Object {
"end": Object {
"column": 8,
"line": 9,
"offset": 113,
},
"start": Object {
"column": 5,
"line": 9,
"offset": 109,
},
},
"message": "Cannot call \`foo\` with \`1234\` bound to \`bar\` because number is incompatible with object type (see line 5).",
"start": 9,
"type": "default",
},
Object {
"end": 11,
"loc": Object {
"end": Object {
"column": 18,
"line": 11,
"offset": 135,
},
"start": Object {
"column": 5,
"line": 11,
"offset": 121,
},
},
"message": "Cannot call \`foo\` with object literal bound to \`bar\` because property \`baz\` is missing in object literal but exists in object type (see line 5).",
"start": 11,
"type": "default",
},
]
`;
exports[`Format 7.example.js - should have expected properties 1`] = `
Array [
Object {
"end": 7,
"loc": Object {
"end": Object {
"column": 5,
"line": 7,
"offset": 80,
},
"start": Object {
"column": 3,
"line": 7,
"offset": 77,
},
},
"message": "Cannot call \`s\` with \`'4'\` bound to \`x\` because string is incompatible with number (see ./5.example.js:5).",
"start": 7,
"type": "default",
},
]
`;
exports[`Format 8.example.js - should have expected properties 1`] = `
Array [
Object {
"end": 7,
"loc": Object {
"end": Object {
"column": 8,
"line": 7,
"offset": 85,
},
"start": Object {
"column": 5,
"line": 7,
"offset": 81,
},
},
"message": "Cannot call \`foo\` with \`1234\` bound to \`bar\` because number is incompatible with object type (see ./6.example.js:5).",
"start": 7,
"type": "default",
},
Object {
"end": 9,
"loc": Object {
"end": Object {
"column": 18,
"line": 9,
"offset": 107,
},
"start": Object {
"column": 5,
"line": 9,
"offset": 93,
},
},
"message": "Cannot call \`foo\` with object literal bound to \`bar\` because property \`baz\` is missing in object literal but exists in object type (see ./6.example.js:5).",
"start": 9,
"type": "default",
},
]
`;
exports[`Format 9.example.js - should have expected properties 1`] = `
Array [
Object {
"end": 9,
"loc": Object {
"end": Object {
"column": 22,
"line": 9,
"offset": 165,
},
"start": Object {
"column": 18,
"line": 9,
"offset": 160,
},
},
"message": "Cannot create \`Hello\` element because property \`name\` is missing in props but exists in object type (see ./9.example.import.js:7).",
"start": 9,
"type": "default",
},
Object {
"end": 9,
"loc": Object {
"end": Object {
"column": 57,
"line": 9,
"offset": 200,
},
"start": Object {
"column": 28,
"line": 9,
"offset": 170,
},
},
"message": "Cannot call \`ReactDOM.render\` with \`document.getElementById(...)\` bound to \`container\` because null (see https://github.com/facebook/flow/blob/v0.93.0/lib/dom.js#L783) is incompatible with \`Element\` (see https://github.com/facebook/flow/blob/v0.93.0/lib/react-dom.js#L18).",
"start": 9,
"type": "default",
},
]
`;
exports[`Format 10.example.js - should have expected properties 1`] = `
Array [
Object {
"end": 9,
"loc": Object {
"end": Object {
"column": 9,
"line": 9,
"offset": 145,
},
"start": Object {
"column": 5,
"line": 9,
"offset": 140,
},
},
"message": "Cannot get \`a.foo\` because: Either property \`foo\` is missing in object type (see line 5). Or property \`foo\` is missing in object type (see line 5).",
"start": 9,
"type": "default",
},
]
`;