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 at this point is still outputting invalid JavaScript or badly formatted output in many cases. This will go down as time goes but in the meantime, it would be great to be able to disable it for just an expression.

Proposal:

// prettier-ignore-next-block
function a() { 
  iCanDoWhateverIdent
    (a, b,); }

and prettier will keep the next AST node as is.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:9
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

11reactions
joshwcomeaucommented, Jan 11, 2017

@jlongster could follow ESLint’s example:

/* prettier-disable */
matrix(
  1, 0, 0,
  0, 1, 0,
  0, 0, 1
)
/* prettier-enable */

EDIT: Alternatively:

// prettier-ignore-next-statement
matrix(
  1, 0, 0,
  0, 1, 0,
  0, 0, 1
)

Because it’s being run through an AST, statements should be easy to isolate regardless of formatting.

7reactions
schpetcommented, May 2, 2018

i keep googling this and ending up here despite good documentation for it existing: https://prettier.io/docs/en/ignore.html

in case it’s helpful for other folks coming across this, the current way to do this is with a comment of prettier-ignore, e.g.

// prettier-ignore
matrix(
  1, 0, 0,
  0, 1, 0,
  0, 0, 1
)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Escape Hatches - React Docs
In this chapter, you'll learn the escape hatches that let you “step outside” React and connect to external systems. Most of your application...
Read more >
How to Add an Escape Hatch to Your Python Run in Two Steps
Create a new module, in the repository, I call this module api_utils.py, I define the decorator function here and call it escape hatch....
Read more >
Escape Hatch - C2 wiki
Solution: Pop the EscapeHatch and go somewhere else. You can generally return from wherever it is you go. Resulting Context: You now have...
Read more >
ESCAPE HATCH definition | Cambridge English Dictionary
a way of getting out of a difficult or unwanted situation: The psychiatrist offered him an escape hatch from his feelings of guilt....
Read more >
Escape Hatches and Ejector Seats - Anvil Works
I call this pattern an “escape hatch”, rather than an “ejector seat” – you don't need to jump all ... and the browser...
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