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.

Multi-line comments & strings are incorrectly indented when Prettier is run.

See original GitHub issue

Decription

  • Multi-line comments are incorrectly indented when Prettier is run.

Example multi-line comment:

   /**
   * A component for auto-generating a table of contents for a page. All
   * elements with an [id] attribute defined will be shown in the TOC.
   */

After multiple saves can end up like so:

  /**
           * A component for auto-generating a table of contents for a page. All
           * elements with an [id] attribute defined will be shown in the TOC.
            */

Branch

  • Develop

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jonboisercommented, Jul 5, 2017

@christianmemije It might be because of the two-space offset we do inside of script tags. It does the same thing in the prettier play groung link

0reactions
christianmemijecommented, Jul 11, 2017

Fixed in #1820

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rationale - Prettier
Once an object literal becomes multiline, Prettier won't collapse it back. If in Prettier-formatted code, we add a property to an object literal,...
Read more >
Why does prettier indent multi-line strings? · Issue #869 - GitHub
Let say you have a multiline string as a single argument and then you add a second argument, then the entire string gets...
Read more >
Prettier and eslint indents not working together - Stack Overflow
ESLint's indent rule and Prettier's indentation styles do not match - they're completely separate implementations and are two different ...
Read more >
Multiline template strings that don't break indentation
Solution 1: Ignore all space and tab characters following a newline until the first non-space or tab character. The problem with this is...
Read more >
SyntaxError: unterminated string literal - JavaScript | MDN
What went wrong? ... There is an unterminated string literal somewhere. String literals must be enclosed by single ( ' ) or double...
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