question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Beautifier breaks ES6 nested template strings

See original GitHub issue

Hi, I have a file with the following code.

`SELECT
  nextval('${this.options.schema ? `${this.options.schema}.` : ''}"${this.tableName}_${this.autoIncrementField}_seq"'::regclass
) nextval;`

When I format the file, that line becomes

`SELECT
  nextval('${this.options.schema ? `
  $ {
    this.options.schema
  }.
  ` : ''}"${this.tableName}_${this.autoIncrementField}_seq"'::regclass
) nextval;`

it is putting a space between $ and {, and that breaks my code.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
IgorNovozhilovcommented, Nov 17, 2015

+1 I have similar problems. Before:

      return `${err.name}${err.message?`: ${err.message}`:''}\n${stackLines}`;

After:

      return `${err.name}${err.message?`: $ {
         err.message
      }
      `:''}\n${stackLines}`;
0reactions
IgorNovozhilovcommented, Jan 29, 2016

👍 good job

Read more comments on GitHub >

github_iconTop Results From Across the Web

Template literals (Template strings) - JavaScript | MDN
In certain cases, nesting a template is the easiest (and perhaps more readable) way to have configurable strings. Within a backtick-delimited ...
Read more >
How to nest template strings in ES6? - Stack Overflow
Yes, it's possible, but you had for some reason put the )}) part (that closes the require call, the interpolated value, and the...
Read more >
JS-Beautifier/CHANGELOG and JS-Beautifier Releases (Page 5 ...
Wrong indentation for comment after nested unbraced control constructs (#1079) ... Strings (#803); Beautifier breaks ES6 nested template strings (#797) ...
Read more >
website/node_modules/js-beautify/CHANGELOG.md - Rdrr.io
JS beautify break the angular compile (#1544); base64 string is broken with ... "0b" Binary Strings (#803); Beautifier breaks ES6 nested template strings...
Read more >
js-beautify | Yarn - Package Manager
Changelog. v1.14.7. Doc: Updates web browser implementation examples (#2107); HTML formatter breaks layout by introducing newlines (#1989) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found