File tree Expand file tree Collapse file tree 4 files changed +75
-1
lines changed Expand file tree Collapse file tree 4 files changed +75
-1
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,8 @@ const create = context => {
98
98
yield fixer . insertTextBefore ( node , ';' ) ;
99
99
}
100
100
101
- yield fixer . replaceText ( node , suggestion ) ;
101
+ yield fixer . replaceText ( node . quasi , suggestion ) ;
102
+ yield fixer . remove ( node . tag ) ;
102
103
} ,
103
104
} ;
104
105
} ) ;
Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ test.snapshot({
64
64
b\\c
65
65
de\`
66
66
` ,
67
+ outdent `
68
+ a = String.raw
69
+ // Comment
70
+ \`ab\\c\`
71
+ ` ,
67
72
] ,
68
73
invalid : [
69
74
'a = String.raw`abc`' ,
@@ -91,6 +96,16 @@ test.snapshot({
91
96
a
92
97
String.raw\`a\${b}\`
93
98
` ,
99
+ outdent `
100
+ a = String.raw
101
+ // Comment
102
+ \`ab
103
+ c\`
104
+ ` ,
105
+ outdent `
106
+ a = String.raw /* comment */ \`ab
107
+ c\`
108
+ ` ,
94
109
] ,
95
110
} ) ;
96
111
Original file line number Diff line number Diff line change @@ -365,3 +365,61 @@ Generated by [AVA](https://avajs.dev).
365
365
> 2 | String.raw\`a${b}\`␊
366
366
| ^^^^^^^^^^^^^^^^^ Using \`String.raw\` is unnecessary as the string does not contain any \`\\\`.␊
367
367
`
368
+
369
+ ## invalid(11): a = String.raw // Comment ` ab c `
370
+
371
+ > Input
372
+
373
+ `␊
374
+ 1 | a = String.raw␊
375
+ 2 | // Comment␊
376
+ 3 | \`ab␊
377
+ 4 | c\`␊
378
+ `
379
+
380
+ > Output
381
+
382
+ `␊
383
+ 1 | a = ␊
384
+ 2 | // Comment␊
385
+ 3 | \`ab␊
386
+ 4 | c\`␊
387
+ `
388
+
389
+ > Error 1/1
390
+
391
+ `␊
392
+ > 1 | a = String.raw␊
393
+ | ^^^^^^^^^^␊
394
+ > 2 | // Comment␊
395
+ | ^^^^^^^^^^␊
396
+ > 3 | \`ab␊
397
+ | ^^^^^^^^^^␊
398
+ > 4 | c\`␊
399
+ | ^^^ Using \`String.raw\` is unnecessary as the string does not contain any \`\\\`.␊
400
+ `
401
+
402
+ ## invalid(12): a = String.raw /* comment * / ` ab c `
403
+
404
+ > Input
405
+
406
+ `␊
407
+ 1 | a = String.raw /* comment */ \`ab␊
408
+ 2 | c\`␊
409
+ `
410
+
411
+ > Output
412
+
413
+ `␊
414
+ 1 | a = /* comment */ \`ab␊
415
+ 2 | c\`␊
416
+ `
417
+
418
+ > Error 1/1
419
+
420
+ `␊
421
+ > 1 | a = String.raw /* comment */ \`ab␊
422
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^␊
423
+ > 2 | c\`␊
424
+ | ^^^ Using \`String.raw\` is unnecessary as the string does not contain any \`\\\`.␊
425
+ `
You can’t perform that action at this time.
0 commit comments