Skip to content

Commit d7837ad

Browse files
committed
chore: render help message in snapshots (#726)
These were accidentally excluded in the initial snapshots, so I've added them now.
1 parent baedad5 commit d7837ad

14 files changed

+469
-0
lines changed

internal/rule_tester/__snapshots__/no-base-to-string.snap

Lines changed: 88 additions & 0 deletions
Large diffs are not rendered by default.

internal/rule_tester/__snapshots__/no-confusing-void-expression.snap

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
[TestNoConfusingVoidExpression/invalid-0 - 1]
33
Diagnostic 1: invalidVoidExpr (2:19 - 2:36)
44
Message: Placing a void expression inside another expression is forbidden.
5+
Help: Move it to its own statement instead.
56
1 |
67
2 | const x = console.log('foo');
78
| ~~~~~~~~~~~~~~~~~~
@@ -11,6 +12,7 @@ Message: Placing a void expression inside another expression is forbidden.
1112
[TestNoConfusingVoidExpression/invalid-1 - 1]
1213
Diagnostic 1: invalidVoidExpr (2:19 - 2:37)
1314
Message: Placing a void expression inside another expression is forbidden.
15+
Help: Move it to its own statement instead.
1416
1 |
1517
2 | const x = console?.log('foo');
1618
| ~~~~~~~~~~~~~~~~~~~
@@ -20,6 +22,7 @@ Message: Placing a void expression inside another expression is forbidden.
2022
[TestNoConfusingVoidExpression/invalid-10 - 1]
2123
Diagnostic 1: invalidVoidExpr (3:17 - 3:34)
2224
Message: Placing a void expression inside another expression is forbidden.
25+
Help: Move it to its own statement instead.
2326
2 | function notcool(input: string) {
2427
3 | return input, console.log(input);
2528
| ~~~~~~~~~~~~~~~~~~
@@ -29,53 +32,61 @@ Message: Placing a void expression inside another expression is forbidden.
2932
[TestNoConfusingVoidExpression/invalid-11 - 1]
3033
Diagnostic 1: invalidVoidExprArrow (1:7 - 1:24)
3134
Message: Returning a void expression from an arrow function shorthand is forbidden.
35+
Help: Add braces to the arrow function.
3236
1 | () => console.log('foo');
3337
| ~~~~~~~~~~~~~~~~~~
3438
---
3539

3640
[TestNoConfusingVoidExpression/invalid-12 - 1]
3741
Diagnostic 1: invalidVoidExprArrow (1:15 - 1:30)
3842
Message: Returning a void expression from an arrow function shorthand is forbidden.
43+
Help: Add braces to the arrow function.
3944
1 | foo => foo && console.log(foo);
4045
| ~~~~~~~~~~~~~~~~
4146
---
4247

4348
[TestNoConfusingVoidExpression/invalid-13 - 1]
4449
Diagnostic 1: invalidVoidExprArrow (1:28 - 1:43)
4550
Message: Returning a void expression from an arrow function shorthand is forbidden.
51+
Help: Add braces to the arrow function.
4652
1 | (foo: undefined) => foo && console.log(foo);
4753
| ~~~~~~~~~~~~~~~~
4854
---
4955

5056
[TestNoConfusingVoidExpression/invalid-14 - 1]
5157
Diagnostic 1: invalidVoidExprArrow (1:15 - 1:30)
5258
Message: Returning a void expression from an arrow function shorthand is forbidden.
59+
Help: Add braces to the arrow function.
5360
1 | foo => foo || console.log(foo);
5461
| ~~~~~~~~~~~~~~~~
5562
---
5663

5764
[TestNoConfusingVoidExpression/invalid-15 - 1]
5865
Diagnostic 1: invalidVoidExprArrow (1:28 - 1:43)
5966
Message: Returning a void expression from an arrow function shorthand is forbidden.
67+
Help: Add braces to the arrow function.
6068
1 | (foo: undefined) => foo || console.log(foo);
6169
| ~~~~~~~~~~~~~~~~
6270
---
6371

6472
[TestNoConfusingVoidExpression/invalid-16 - 1]
6573
Diagnostic 1: invalidVoidExprArrow (1:23 - 1:38)
6674
Message: Returning a void expression from an arrow function shorthand is forbidden.
75+
Help: Add braces to the arrow function.
6776
1 | (foo: void) => foo || console.log(foo);
6877
| ~~~~~~~~~~~~~~~~
6978
---
7079

7180
[TestNoConfusingVoidExpression/invalid-17 - 1]
7281
Diagnostic 1: invalidVoidExprArrow (1:15 - 1:31)
7382
Message: Returning a void expression from an arrow function shorthand is forbidden.
83+
Help: Add braces to the arrow function.
7484
1 | foo => (foo ? console.log(true) : console.log(false));
7585
| ~~~~~~~~~~~~~~~~~
7686

7787
Diagnostic 2: invalidVoidExprArrow (1:35 - 1:52)
7888
Message: Returning a void expression from an arrow function shorthand is forbidden.
89+
Help: Add braces to the arrow function.
7990
1 | foo => (foo ? console.log(true) : console.log(false));
8091
| ~~~~~~~~~~~~~~~~~~
8192
---
@@ -101,6 +112,7 @@ Message: Returning a void expression from a function is forbidden. Please move i
101112
[TestNoConfusingVoidExpression/invalid-2 - 1]
102113
Diagnostic 1: invalidVoidExpr (2:23 - 2:40)
103114
Message: Placing a void expression inside another expression is forbidden.
115+
Help: Move it to its own statement instead.
104116
1 |
105117
2 | console.error(console.log('foo'));
106118
| ~~~~~~~~~~~~~~~~~~
@@ -182,6 +194,7 @@ Message: Returning a void expression from a function is forbidden. Please remove
182194
[TestNoConfusingVoidExpression/invalid-28 - 1]
183195
Diagnostic 1: invalidVoidExprArrow (3:34 - 3:51)
184196
Message: Returning a void expression from an arrow function shorthand is forbidden.
197+
Help: Add braces to the arrow function.
185198
2 | let num = 1;
186199
3 | const foo = () => (num ? console.log('foo') : num);
187200
| ~~~~~~~~~~~~~~~~~~
@@ -191,6 +204,7 @@ Message: Returning a void expression from an arrow function shorthand is forbidd
191204
[TestNoConfusingVoidExpression/invalid-29 - 1]
192205
Diagnostic 1: invalidVoidExprArrow (3:34 - 3:51)
193206
Message: Returning a void expression from an arrow function shorthand is forbidden.
207+
Help: Add braces to the arrow function.
194208
2 | let bar = void 0;
195209
3 | const foo = () => (bar ? console.log('foo') : bar);
196210
| ~~~~~~~~~~~~~~~~~~
@@ -200,6 +214,7 @@ Message: Returning a void expression from an arrow function shorthand is forbidd
200214
[TestNoConfusingVoidExpression/invalid-3 - 1]
201215
Diagnostic 1: invalidVoidExpr (2:10 - 2:27)
202216
Message: Placing a void expression inside another expression is forbidden.
217+
Help: Move it to its own statement instead.
203218
1 |
204219
2 | [console.log('foo')];
205220
| ~~~~~~~~~~~~~~~~~~
@@ -264,6 +279,7 @@ Message: Returning a void expression from a function is forbidden. Please remove
264279
[TestNoConfusingVoidExpression/invalid-37 - 1]
265280
Diagnostic 1: invalidVoidExprArrow (1:20 - 1:37)
266281
Message: Returning a void expression from an arrow function shorthand is forbidden.
282+
Help: Add braces to the arrow function.
267283
1 | const test = () => console.log('foo');
268284
| ~~~~~~~~~~~~~~~~~~
269285
---
@@ -289,6 +305,7 @@ Message: Returning a void expression from a function is forbidden. Please remove
289305
[TestNoConfusingVoidExpression/invalid-4 - 1]
290306
Diagnostic 1: invalidVoidExpr (2:15 - 2:32)
291307
Message: Placing a void expression inside another expression is forbidden.
308+
Help: Move it to its own statement instead.
292309
1 |
293310
2 | ({ x: console.log('foo') });
294311
| ~~~~~~~~~~~~~~~~~~
@@ -298,6 +315,7 @@ Message: Placing a void expression inside another expression is forbidden.
298315
[TestNoConfusingVoidExpression/invalid-40 - 1]
299316
Diagnostic 1: invalidVoidExprArrow (2:20 - 2:37)
300317
Message: Returning a void expression from an arrow function shorthand is forbidden.
318+
Help: Add braces to the arrow function.
301319
1 |
302320
2 | (): any => console.log('foo');
303321
| ~~~~~~~~~~~~~~~~~~
@@ -307,6 +325,7 @@ Message: Returning a void expression from an arrow function shorthand is forbidd
307325
[TestNoConfusingVoidExpression/invalid-41 - 1]
308326
Diagnostic 1: invalidVoidExprArrow (2:24 - 2:41)
309327
Message: Returning a void expression from an arrow function shorthand is forbidden.
328+
Help: Add braces to the arrow function.
310329
1 |
311330
2 | (): unknown => console.log('foo');
312331
| ~~~~~~~~~~~~~~~~~~
@@ -316,6 +335,7 @@ Message: Returning a void expression from an arrow function shorthand is forbidd
316335
[TestNoConfusingVoidExpression/invalid-42 - 1]
317336
Diagnostic 1: invalidVoidExprArrow (3:15 - 3:27)
318337
Message: Returning a void expression from an arrow function shorthand is forbidden.
338+
Help: Add braces to the arrow function.
319339
2 | function test(): void {
320340
3 | () => () => console.log();
321341
| ~~~~~~~~~~~~~
@@ -325,6 +345,7 @@ Message: Returning a void expression from an arrow function shorthand is forbidd
325345
[TestNoConfusingVoidExpression/invalid-43 - 1]
326346
Diagnostic 1: invalidVoidExprArrow (3:12 - 3:24)
327347
Message: Returning a void expression from an arrow function shorthand is forbidden.
348+
Help: Add braces to the arrow function.
328349
2 | type Foo = any;
329350
3 | (): Foo => console.log();
330351
| ~~~~~~~~~~~~~
@@ -334,6 +355,7 @@ Message: Returning a void expression from an arrow function shorthand is forbidd
334355
[TestNoConfusingVoidExpression/invalid-44 - 1]
335356
Diagnostic 1: invalidVoidExprArrow (3:12 - 3:24)
336357
Message: Returning a void expression from an arrow function shorthand is forbidden.
358+
Help: Add braces to the arrow function.
337359
2 | type Foo = unknown;
338360
3 | (): Foo => console.log();
339361
| ~~~~~~~~~~~~~
@@ -343,6 +365,7 @@ Message: Returning a void expression from an arrow function shorthand is forbidd
343365
[TestNoConfusingVoidExpression/invalid-45 - 1]
344366
Diagnostic 1: invalidVoidExprArrow (3:15 - 3:27)
345367
Message: Returning a void expression from an arrow function shorthand is forbidden.
368+
Help: Add braces to the arrow function.
346369
2 | function test(): any {
347370
3 | () => () => console.log();
348371
| ~~~~~~~~~~~~~
@@ -370,6 +393,7 @@ Message: Returning a void expression from a function is forbidden. Please remove
370393
[TestNoConfusingVoidExpression/invalid-48 - 1]
371394
Diagnostic 1: invalidVoidExprArrow (3:18 - 3:30)
372395
Message: Returning a void expression from an arrow function shorthand is forbidden.
396+
Help: Add braces to the arrow function.
373397
2 | type Foo = () => any;
374398
3 | (): Foo => () => console.log();
375399
| ~~~~~~~~~~~~~
@@ -379,6 +403,7 @@ Message: Returning a void expression from an arrow function shorthand is forbidd
379403
[TestNoConfusingVoidExpression/invalid-49 - 1]
380404
Diagnostic 1: invalidVoidExprArrow (3:18 - 3:30)
381405
Message: Returning a void expression from an arrow function shorthand is forbidden.
406+
Help: Add braces to the arrow function.
382407
2 | type Foo = () => unknown;
383408
3 | (): Foo => () => console.log();
384409
| ~~~~~~~~~~~~~
@@ -388,6 +413,7 @@ Message: Returning a void expression from an arrow function shorthand is forbidd
388413
[TestNoConfusingVoidExpression/invalid-5 - 1]
389414
Diagnostic 1: invalidVoidExpr (2:14 - 2:31)
390415
Message: Placing a void expression inside another expression is forbidden.
416+
Help: Move it to its own statement instead.
391417
1 |
392418
2 | void console.log('foo');
393419
| ~~~~~~~~~~~~~~~~~~
@@ -397,6 +423,7 @@ Message: Placing a void expression inside another expression is forbidden.
397423
[TestNoConfusingVoidExpression/invalid-50 - 1]
398424
Diagnostic 1: invalidVoidExprArrow (3:25 - 3:37)
399425
Message: Returning a void expression from an arrow function shorthand is forbidden.
426+
Help: Add braces to the arrow function.
400427
2 | type Foo = () => any;
401428
3 | const test: Foo = () => console.log();
402429
| ~~~~~~~~~~~~~
@@ -406,6 +433,7 @@ Message: Returning a void expression from an arrow function shorthand is forbidd
406433
[TestNoConfusingVoidExpression/invalid-51 - 1]
407434
Diagnostic 1: invalidVoidExprArrow (3:25 - 3:37)
408435
Message: Returning a void expression from an arrow function shorthand is forbidden.
436+
Help: Add braces to the arrow function.
409437
2 | type Foo = () => unknown;
410438
3 | const test: Foo = () => console.log();
411439
| ~~~~~~~~~~~~~
@@ -460,6 +488,7 @@ Message: Returning a void expression from a function is forbidden. Please remove
460488
[TestNoConfusingVoidExpression/invalid-6 - 1]
461489
Diagnostic 1: invalidVoidExpr (2:9 - 2:26)
462490
Message: Placing a void expression inside another expression is forbidden.
491+
Help: Move it to its own statement instead.
463492
1 |
464493
2 | console.log('foo') ? true : false;
465494
| ~~~~~~~~~~~~~~~~~~
@@ -469,6 +498,7 @@ Message: Placing a void expression inside another expression is forbidden.
469498
[TestNoConfusingVoidExpression/invalid-7 - 1]
470499
Diagnostic 1: invalidVoidExpr (2:10 - 2:27)
471500
Message: Placing a void expression inside another expression is forbidden.
501+
Help: Move it to its own statement instead.
472502
1 |
473503
2 | (console.log('foo') && true) || false;
474504
| ~~~~~~~~~~~~~~~~~~
@@ -478,6 +508,7 @@ Message: Placing a void expression inside another expression is forbidden.
478508
[TestNoConfusingVoidExpression/invalid-8 - 1]
479509
Diagnostic 1: invalidVoidExpr (2:18 - 2:34)
480510
Message: Placing a void expression inside another expression is forbidden.
511+
Help: Move it to its own statement instead.
481512
1 |
482513
2 | (cond && console.log('ok')) || console.log('error');
483514
| ~~~~~~~~~~~~~~~~~
@@ -487,6 +518,7 @@ Message: Placing a void expression inside another expression is forbidden.
487518
[TestNoConfusingVoidExpression/invalid-9 - 1]
488519
Diagnostic 1: invalidVoidExpr (2:10 - 2:27)
489520
Message: Placing a void expression inside another expression is forbidden.
521+
Help: Move it to its own statement instead.
490522
1 |
491523
2 | !console.log('foo');
492524
| ~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)