Skip to content

Commit fd1ac9a

Browse files
Update tag template format (#43)
Change `--noTemplates` output to use `%{tag}` for tagged template variables, instead of `%<tag>s`.
1 parent 96b360e commit fd1ac9a

4 files changed

Lines changed: 35 additions & 30 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.2.1
4+
5+
- Change `--noTemplates` output to use `%{tag}` for tagged template variables,
6+
instead of `%<tag>s`.
7+
38
## 0.2.0
49

510
- Per https://github.com/exercism/automated-mentoring-support/issues/53,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@exercism/javascript-analyzer",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Exercism analyzer for javascript",
55
"repository": "https://github.com/exercism/javascript-analyzer",
66
"author": "Derk-Jan Karrenbeld <derk-jan+github@karrenbeld.info>",

src/comments/comment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function factory<R extends string = ''>(strings: TemplateStringsArray, ..
104104
function buildTemplateTag(tag: string | number): string {
105105
return typeof tag === 'number'
106106
? `%${tag}$s`
107-
: `%<${tag}>s`
107+
: `%{${tag}}`
108108
}
109109

110110
function separateValues<R extends string>(...values: FactoryResultParameter<R>): { dictionary: NamedTags<R>; positionalValues: string[] } {

test/analyzers/two-fer/__snapshots__/snapshot.ts.snap

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ AnalyzerOutput {
5959
of name to 'you' to avoid this conditional.",
6060
"template": "You currently use a conditional to branch in case there is no value passed into
6161
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
62-
of %<parameter>s to 'you' to avoid this conditional.",
62+
of %{parameter} to 'you' to avoid this conditional.",
6363
"variables": Object {
6464
"parameter": "name",
6565
},
@@ -79,7 +79,7 @@ AnalyzerOutput {
7979
of name to 'you' to avoid this conditional.",
8080
"template": "You currently use a conditional to branch in case there is no value passed into
8181
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
82-
of %<parameter>s to 'you' to avoid this conditional.",
82+
of %{parameter} to 'you' to avoid this conditional.",
8383
"variables": Object {
8484
"parameter": "name",
8585
},
@@ -95,7 +95,7 @@ AnalyzerOutput {
9595
CommentImpl {
9696
"externalTemplate": "javascript.general.no_method",
9797
"message": "No method called \`twoFer\`. The tests won't pass without it.",
98-
"template": "No method called \`%<method.name>s\`. The tests won't pass without it.",
98+
"template": "No method called \`%{method.name}\`. The tests won't pass without it.",
9999
"variables": Object {
100100
"method.name": "twoFer",
101101
},
@@ -106,10 +106,10 @@ AnalyzerOutput {
106106
The tests won't pass without it.
107107
108108
Did you forget adding: \`export twoFer\`?",
109-
"template": "No [export](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export) called \`%<export.name>s\`.
109+
"template": "No [export](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export) called \`%{export.name}\`.
110110
The tests won't pass without it.
111111
112-
Did you forget adding: \`export %<export.name>s\`?",
112+
Did you forget adding: \`export %{export.name}\`?",
113113
"variables": Object {
114114
"export.name": "twoFer",
115115
},
@@ -129,7 +129,7 @@ AnalyzerOutput {
129129
of name to 'you' to avoid this conditional.",
130130
"template": "You currently use a conditional to branch in case there is no value passed into
131131
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
132-
of %<parameter>s to 'you' to avoid this conditional.",
132+
of %{parameter} to 'you' to avoid this conditional.",
133133
"variables": Object {
134134
"parameter": "name",
135135
},
@@ -149,7 +149,7 @@ AnalyzerOutput {
149149
of name to 'you' to avoid this conditional.",
150150
"template": "You currently use a conditional to branch in case there is no value passed into
151151
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
152-
of %<parameter>s to 'you' to avoid this conditional.",
152+
of %{parameter} to 'you' to avoid this conditional.",
153153
"variables": Object {
154154
"parameter": "name",
155155
},
@@ -189,7 +189,7 @@ that's not the case in this exercise.",
189189
of name to 'you' to avoid this conditional.",
190190
"template": "You currently use a conditional to branch in case there is no value passed into
191191
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
192-
of %<parameter>s to 'you' to avoid this conditional.",
192+
of %{parameter} to 'you' to avoid this conditional.",
193193
"variables": Object {
194194
"parameter": "name",
195195
},
@@ -229,7 +229,7 @@ that's not the case in this exercise.",
229229
of name to 'you' to avoid this conditional.",
230230
"template": "You currently use a conditional to branch in case there is no value passed into
231231
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
232-
of %<parameter>s to 'you' to avoid this conditional.",
232+
of %{parameter} to 'you' to avoid this conditional.",
233233
"variables": Object {
234234
"parameter": "name",
235235
},
@@ -249,7 +249,7 @@ AnalyzerOutput {
249249
of X to 'you' to avoid this conditional.",
250250
"template": "You currently use a conditional to branch in case there is no value passed into
251251
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
252-
of %<parameter>s to 'you' to avoid this conditional.",
252+
of %{parameter} to 'you' to avoid this conditional.",
253253
"variables": Object {
254254
"parameter": "X",
255255
},
@@ -264,11 +264,11 @@ AnalyzerOutput {
264264
"comments": Array [
265265
CommentImpl {
266266
"externalTemplate": "javascript.two-fer.optimise_explicity_default_value",
267-
"message": "Instead of relying on %<maybe_undefined_expression>s being \\"undefined\\" when
267+
"message": "Instead of relying on %{maybe_undefined_expression} being \\"undefined\\" when
268268
no value is passed in, you could set the default value of 'name' to
269269
'you'.",
270-
"template": "Instead of relying on %<maybe_undefined_expression>s being \\"undefined\\" when
271-
no value is passed in, you could set the default value of '%<parameter>s' to
270+
"template": "Instead of relying on %{maybe_undefined_expression} being \\"undefined\\" when
271+
no value is passed in, you could set the default value of '%{parameter}' to
272272
'you'.",
273273
"variables": Object {
274274
"maybe-undefined-expression": "name",
@@ -285,11 +285,11 @@ AnalyzerOutput {
285285
"comments": Array [
286286
CommentImpl {
287287
"externalTemplate": "javascript.two-fer.optimise_explicity_default_value",
288-
"message": "Instead of relying on %<maybe_undefined_expression>s being \\"undefined\\" when
288+
"message": "Instead of relying on %{maybe_undefined_expression} being \\"undefined\\" when
289289
no value is passed in, you could set the default value of 'name' to
290290
'you'.",
291-
"template": "Instead of relying on %<maybe_undefined_expression>s being \\"undefined\\" when
292-
no value is passed in, you could set the default value of '%<parameter>s' to
291+
"template": "Instead of relying on %{maybe_undefined_expression} being \\"undefined\\" when
292+
no value is passed in, you could set the default value of '%{parameter}' to
293293
'you'.",
294294
"variables": Object {
295295
"maybe-undefined-expression": "name",
@@ -311,7 +311,7 @@ AnalyzerOutput {
311311
of name to 'you' to avoid this conditional.",
312312
"template": "You currently use a conditional to branch in case there is no value passed into
313313
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
314-
of %<parameter>s to 'you' to avoid this conditional.",
314+
of %{parameter} to 'you' to avoid this conditional.",
315315
"variables": Object {
316316
"parameter": "name",
317317
},
@@ -351,7 +351,7 @@ that's not the case in this exercise.",
351351
of name to 'you' to avoid this conditional.",
352352
"template": "You currently use a conditional to branch in case there is no value passed into
353353
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
354-
of %<parameter>s to 'you' to avoid this conditional.",
354+
of %{parameter} to 'you' to avoid this conditional.",
355355
"variables": Object {
356356
"parameter": "name",
357357
},
@@ -371,7 +371,7 @@ AnalyzerOutput {
371371
of name to 'you' to avoid this conditional.",
372372
"template": "You currently use a conditional to branch in case there is no value passed into
373373
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
374-
of %<parameter>s to 'you' to avoid this conditional.",
374+
of %{parameter} to 'you' to avoid this conditional.",
375375
"variables": Object {
376376
"parameter": "name",
377377
},
@@ -387,7 +387,7 @@ AnalyzerOutput {
387387
CommentImpl {
388388
"externalTemplate": "javascript.general.no_method",
389389
"message": "No method called \`twoFer\`. The tests won't pass without it.",
390-
"template": "No method called \`%<method.name>s\`. The tests won't pass without it.",
390+
"template": "No method called \`%{method.name}\`. The tests won't pass without it.",
391391
"variables": Object {
392392
"method.name": "twoFer",
393393
},
@@ -398,10 +398,10 @@ AnalyzerOutput {
398398
The tests won't pass without it.
399399
400400
Did you forget adding: \`export twoFer\`?",
401-
"template": "No [export](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export) called \`%<export.name>s\`.
401+
"template": "No [export](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export) called \`%{export.name}\`.
402402
The tests won't pass without it.
403403
404-
Did you forget adding: \`export %<export.name>s\`?",
404+
Did you forget adding: \`export %{export.name}\`?",
405405
"variables": Object {
406406
"export.name": "twoFer",
407407
},
@@ -421,7 +421,7 @@ AnalyzerOutput {
421421
of name to 'you' to avoid this conditional.",
422422
"template": "You currently use a conditional to branch in case there is no value passed into
423423
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
424-
of %<parameter>s to 'you' to avoid this conditional.",
424+
of %{parameter} to 'you' to avoid this conditional.",
425425
"variables": Object {
426426
"parameter": "name",
427427
},
@@ -441,7 +441,7 @@ AnalyzerOutput {
441441
of name to 'you' to avoid this conditional.",
442442
"template": "You currently use a conditional to branch in case there is no value passed into
443443
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
444-
of %<parameter>s to 'you' to avoid this conditional.",
444+
of %{parameter} to 'you' to avoid this conditional.",
445445
"variables": Object {
446446
"parameter": "name",
447447
},
@@ -461,7 +461,7 @@ AnalyzerOutput {
461461
of name to 'you' to avoid this conditional.",
462462
"template": "You currently use a conditional to branch in case there is no value passed into
463463
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
464-
of %<parameter>s to 'you' to avoid this conditional.",
464+
of %{parameter} to 'you' to avoid this conditional.",
465465
"variables": Object {
466466
"parameter": "name",
467467
},
@@ -481,7 +481,7 @@ AnalyzerOutput {
481481
of name to 'you' to avoid this conditional.",
482482
"template": "You currently use a conditional to branch in case there is no value passed into
483483
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
484-
of %<parameter>s to 'you' to avoid this conditional.",
484+
of %{parameter} to 'you' to avoid this conditional.",
485485
"variables": Object {
486486
"parameter": "name",
487487
},
@@ -501,7 +501,7 @@ AnalyzerOutput {
501501
of name to 'you' to avoid this conditional.",
502502
"template": "You currently use a conditional to branch in case there is no value passed into
503503
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
504-
of %<parameter>s to 'you' to avoid this conditional.",
504+
of %{parameter} to 'you' to avoid this conditional.",
505505
"variables": Object {
506506
"parameter": "name",
507507
},
@@ -521,7 +521,7 @@ AnalyzerOutput {
521521
of name to 'you' to avoid this conditional.",
522522
"template": "You currently use a conditional to branch in case there is no value passed into
523523
\`twoFer\`. Instead you could set the [default value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters)
524-
of %<parameter>s to 'you' to avoid this conditional.",
524+
of %{parameter} to 'you' to avoid this conditional.",
525525
"variables": Object {
526526
"parameter": "name",
527527
},

0 commit comments

Comments
 (0)