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.

Support prettier-ignore-start/end for other languages (not only Markdown)

See original GitHub issue

It seems this feature was added only for markdown (#4202 cc @ikatyang), but it’s actually useful for other languages as well. It is not working on typescript files on my tests.

Related: https://github.com/facebook/create-react-app/issues/5543

Environments:

  • Prettier Version: 1.14.3
  • Running Prettier via: CLI
  • Runtime: Node.js v8.11.4
  • Operating System: macOS

Steps to reproduce:

Create a index.d.ts file with the following content:

// prettier-ignore
type A1 = string;

// prettier-ignore
type A2 = string

/* prettier-ignore-start */
type B1 = string;
type B2 = string
/* prettier-ignore-end */

type C1 = string;
type C2 = string

Expected behavior:

// prettier-ignore
type A1 = string;

// prettier-ignore
type A2 = string

/* prettier-ignore-start */
type B1 = string;
type B2 = string
/* prettier-ignore-end */

-type C1 = string;
+type C1 = string
type C2 = string

Actual behavior:

// prettier-ignore
type A1 = string;

// prettier-ignore
type A2 = string

/* prettier-ignore-start */
-type B1 = string;
+type B1 = string
type B2 = string
/* prettier-ignore-end */

-type C1 = string;
+type C1 = string
type C2 = string

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:306
  • Comments:53 (12 by maintainers)

github_iconTop GitHub Comments

162reactions
neilveilcommented, Dec 1, 2020

Okay, I will start working on this feature if there are at least 100 thumbs up on this comment. Let’s see if people still need this feature except myself.

133reactions
lydellcommented, Nov 27, 2018

@muuvmuuv There’s already // prettier-ignore – check it out! https://prettier.io/docs/en/ignore.html#javascript

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettier disable on certain languages not working
Try adding *.ejs to the .prettierignore file. You can read more about it here: https://prettier.io/docs/en/ignore.html.
Read more >
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 >
prettier ignore block - You.com | The search engine you control.
prettier-ignore-start and prettier-ignore-end are supported only in Markdown. ... prettier-ignore-start/end for other languages (not only Markdown)#5287.
Read more >
Disabling languages for Prettier (in VScode) | Zell Liew
How to disable Prettier for specific languages. ... You just added a prettier. ... Don't worry about where to start. I'll send you...
Read more >
Bountysource
Support prettier-ignore -start/end for other languages (not only Markdown)
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