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 is ignored

See original GitHub issue

The following snippet of code will get formatted regardless of whether the <!-- prettier-ignore --> comment is above the line. The standard prettier html parser handles this case.

<script>
// whatever
</script>

<!-- prettier-ignore -->
<span>[</span><span>{value}</span><span>]</span>

<style>
/* whatever */
</style>

The spans need to stay on one line as this component is inside of a <pre> tag and being on new lines modifies the outcome. (That’s a separate issue that can’t necessarily be handled by #28, so the prettier-ignores should be respected.)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:40
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
foodwaterwificommented, Dec 31, 2019

This would be greatly appreciated…

8reactions
will-stonecommented, Jun 12, 2020

I just had this issue when trying to inject a dynamic style tag and found this worked, no prettier-ignore required:

{@html `<${'style'} class="block">
...
</style>`}

My other issue was that postCSS was clobbering the style tag: hiding it in the nested string got around that. Without doing that results in Prettier doing this:

{@html `<style class="block ✂prettier:content✂="LmFuaW1hdGlvbk5hbWUgewogI..."></style>`}
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 >
prettierignore is not working · Issue #279 - GitHub
I have a simple .prettierignore config that is consumed and applied as expected from ... Prettier: Ignore Path (in vscode) ~/.prettierignore.
Read more >
Prettierignore is ignored for subfolders with package.json
prettierignore file in the project root and it specifies a path to a file which is nested to a subfolder with package.json, then...
Read more >
How to Ignore all folders with folder pattern using prettier
prettierignore file. -- ignore-path is the path to a file containing patterns that describe files to ignore ; It's not the folder to...
Read more >
Ignoring rules | Dev Cheatsheets - Michael Currin
eslint-disable-next-line prettier/prettier console.log('foo'). Global ignore config. A plain text file. .prettierignore e.g.. build/ *.html. Dev Cheatsheets.
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