#3675·jshint

Template literals incorrectly parse comment-like sequences

Author: vlakoffCreated Mar 5, 2026Updated Mar 5, 2026

JSHint misinterprets comment-like sequences inside template literals. When a template string contains #…, //…, or /*…*/, the linter highlights them as actual comments or errors instead of treating the entire template literal as plain text.

Try the following in jshint.com:

javascript
/* jshint esversion: 6 */

`foobar #foobar foobar`;
`foobar //foobar foobar`;
`foobar /*foobar*/ foobar`;

Results:

  • #foobar ... is marked as a red error up to the end of the line.
  • //foobar ... is treated as a line comment.
  • /*foobar*/ is treated as a block comment.

Expected:

  • All content inside these template literals should be treated as plain text, without comment parsing or special meaning.

Note: Regular strings ('...' and "...") do not exhibit this issue.