Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play nice with <!-- prettier-ignore --> switching between prettier<>dprint #83

Closed
nuke-web3 opened this issue Sep 1, 2023 · 2 comments · Fixed by #85
Closed

Play nice with <!-- prettier-ignore --> switching between prettier<>dprint #83

nuke-web3 opened this issue Sep 1, 2023 · 2 comments · Fixed by #85

Comments

@nuke-web3
Copy link

To make use of this tool easy to transition or be directly compatible with Prettier users, I would love to have https://dprint.dev/plugins/markdown/#ignore-comments be expanded to also ignore using:

@nuke-web3
Copy link
Author

nuke-web3 commented Sep 2, 2023

https://dprint.dev/plugins/markdown/config/#ignoreDirective

Actually if I can get this to work, that is all I need. The playground is working for this:

## Something

Working              format

<!-- prettier-ignore -->
Ignore                 format

With config snippet:

{
  "ignoreNodeCommentText": "prettier-ignore",
}

@nuke-web3 nuke-web3 reopened this Sep 2, 2023
@nuke-web3
Copy link
Author

nuke-web3 commented Sep 2, 2023

So in collaborating with others that use prettier instead of dprint (for example via prettier setup to automatically run on an IDE), here is an example of problem:

<diagram class="mermaid limit size-40">
<!-- prettier-ignore-start -->
flowchart TD
subgraph paraA[Parachain A              .]
  executor --"success?"--> palletxcm
  palletxcm("pallet-xcm") --"execute"--> executor("xcm-executor")
end
execute("execute(xcm)") --> palletxcm
<!-- prettier-ignore-end -->
</diagram>

Prettier needs there to be no new lines to respect the inner block.
But dprint formats to

<diagram class="mermaid limit size-40">
<!-- prettier-ignore-start -->

flowchart TD
subgraph paraA[Parachain A              .]
  executor --"success?"--> palletxcm
  palletxcm("pallet-xcm") --"execute"--> executor("xcm-executor")
end
execute("execute(xcm)") --> palletxcm

<!-- prettier-ignore-end -->
</diagram>

And a run of prettier after this formats the block in an untended way.

@nuke-web3 nuke-web3 changed the title Respect <!-- prettier-ignore --> Play nice with <!-- prettier-ignore --> switching between prettier<>dprint Sep 2, 2023
nuke-web3 added a commit to Polkadot-Blockchain-Academy/pba-book that referenced this issue Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant