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.

prettier-ignore comments not working for inline scripts in VSCode

See original GitHub issue

Prettier has the ability to ignore blocks of code. https://github.com/prettier/prettier#excluding-code-from-formatting

If you have one of these comments in an inline scripts such as:

<script>
  // prettier-ignore
  {{ test: "test" }}
</script>

It will not ignore the block.

As far as I am aware prettier does not support inline script tags like this, so I assume prettier-vscode is instructing prettier to format these sections?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
CiGitcommented, Sep 26, 2017

What’s this file type? html? What are your settings?

I tried with a html file. It’s not the default formatter as it doesn’t expand collapsed block statements. By default prettier doesn’t run on html. Have you tried with prettier-vscode disabled?

0reactions
github-actions[bot]commented, Apr 13, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignoring Code - Prettier
Use .prettierignore to ignore (i.e. not reformat) certain files and folders completely. Use “prettier-ignore” comments to ignore parts of files.
Read more >
How to make Prettier to ignore a block of code? - Stack Overflow
While this doesnt work for OP's example, one option is to add the prettier-ignore comment to the start of each line to be...
Read more >
vscode prettier ignore not working - You.com | The AI Search ...
It will not ignore the block. As far as I am aware prettier does not support inline script tags like this, so I...
Read more >
April 2022 (version 1.67) - Visual Studio Code
Update 1.67.2: The update addresses these issues. ... Behind the scenes, VS Code has supported multiline comments since the comments UX was finalized, ......
Read more >
Formatting your source code with Prettier - Packt Subscription
The problem is worsened by the fact that modern JS projects will not only include JS ... a single sentence by preceding it...
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