dprint icon indicating copy to clipboard operation
dprint copied to clipboard

Support YAML formatting

Open darthwade opened this issue 1 year ago • 4 comments

Hey, It would be great if dprint will support yaml formatting.

There's a good lib in Go for it - https://github.com/google/yamlfmt

darthwade avatar Aug 17 '23 10:08 darthwade

+1 on this request :pray:

nuke-web3 avatar Sep 02 '23 01:09 nuke-web3

This blocks us from moving fully from prettier to dprint in a project.

rattrayalex avatar Dec 15 '23 19:12 rattrayalex

In the meantime, we are using the following workaround based on dprint-plugin-exec:

{
  "exec": {
    "commands": [{
      "command": "sh -c \"yamlfmt {{file_path}} && cat {{file_path}}\"",
      "exts": ["yml", "yaml"]
    }]
  },
  "plugins": [
    "https://plugins.dprint.dev/exec-0.4.4.json"
  ]
}

bewee-i avatar Dec 21 '23 13:12 bewee-i

Biome has begun working on YAML support. If that is done, we may be able to add YAML support by modifying dprint-plugin-biome. https://github.com/biomejs/biome/issues/2365

eggplants avatar Jun 30 '24 01:06 eggplants

Hey guys, you don't need to wait for Biome. I made a dprint plugin that can format YAML: https://github.com/g-plane/pretty_yaml . It's WebAssembly-based, no external process needed.

Just run:

dprint config add g-plane/pretty_yaml

to install it.

g-plane avatar Jul 04 '24 08:07 g-plane