Skip to content

Unterminated template literal, if first line ends slashed #15704

Closed
@tmarshall

Description

@tmarshall
  • Version: 6.11.3 & 6.10.3
  • Platform: Darwin Kernel Version 16.5.0

I have a small script that templatizes a docker RUN command.

const fileContent = `RUN \\
  cd /tmp && \\
  curl -o ./Python-${version}.tgz https://www.python.org/ftp/python/${version}/Python-${version}.tgz && \\
  tar -xzf ./Python-${version}.tgz && \\
  cd ./Python-${version} && \\
  ./configure && \\
  make && \\
  make install && \\
  cd /tmp && \\
  rm -rf ./Python-${version};
`;

This fails giving:

onst fileContent = `RUN \\
const fileContent = `RUN \\
                    ^^^^^^^

SyntaxError: Unterminated template literal

If I change it to the following, it works:

const fileContent = `#comment

RUN \\
  cd /tmp && \\
  curl -o ./Python-${version}.tgz https://www.python.org/ftp/python/${version}/Python-${version}.tgz && \\
  tar -xzf ./Python-${version}.tgz && \\
  cd ./Python-${version} && \\
  ./configure && \\
  make && \\
  make install && \\
  cd /tmp && \\
  rm -rf ./Python-${version};
`;

Using NVM and switching to 8.6.0 does resolve the issue.

Metadata

Metadata

Assignees

Labels

replIssues and PRs related to the REPL subsystem.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions