Unexpected template string expression
13 "package-lock.json",
14 "CHANGELOG.md"
15 ],
16 "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"17 }
18 ]
19};
Description
ECMAScript 6 allows programmers to create strings containing variable or expressions using template literals, instead of string concatenation, by writing expressions like ${variable}
between two backtick quotes ().
It is easy to use the wrong quotes when wanting to use template literals, by writing
${variable}, and ending up with the literal value
${variable}` instead of a string containing the value of the templated expressions.
Bad Practice
"Hello ${name}!";
'Hello ${name}!';
"Time: ${12 * 60 * 60 * 1000}";
Recommended
`Hello ${name}!`;
`Time: ${12 * 60 * 60 * 1000}`;
templateFunction`Hello ${name}`;