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

Support YAML formatting #736

Closed
darthwade opened this issue Aug 17, 2023 · 5 comments · Fixed by #876
Closed

Support YAML formatting #736

darthwade opened this issue Aug 17, 2023 · 5 comments · Fixed by #876

Comments

@darthwade
Copy link

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

@nuke-web3
Copy link

+1 on this request 🙏

unicornware added a commit to flex-development/tutils that referenced this issue Sep 7, 2023
- prettier 3.0 formatting has degraded in quality for js-like files, but the team refuses to fix it
- prettier can be removed completely once dprint has its own yaml plugin
- prettier formatting markdown was always subpar; it never played nicely with markdownlint
- prettier/prettier#15358
- prettier/prettier#5715
- prettier/prettier#11881
- dprint/dprint#736
- dprint/dprint-plugin-typescript#432

Signed-off-by: Lexus Drumgold <[email protected]>
unicornware added a commit to flex-development/tutils that referenced this issue Sep 7, 2023
- prettier 3.0 formatting has degraded in quality for js-like files, but the team refuses to fix it
- prettier can be removed completely once dprint has its own yaml plugin
- prettier formatting markdown was always subpar; it never played nicely with markdownlint
- prettier/prettier#15358
- prettier/prettier#5715
- prettier/prettier#11881
- dprint/dprint#736
- dprint/dprint-plugin-typescript#432

Signed-off-by: Lexus Drumgold <[email protected]>
unicornware added a commit to flex-development/tutils that referenced this issue Sep 7, 2023
- prettier 3.0 formatting has degraded in quality for js-like files, but the team refuses to fix it
- prettier can be removed completely once dprint has its own yaml plugin
- prettier formatting markdown was always subpar; it never played nicely with markdownlint
- prettier/prettier#15358
- prettier/prettier#5715
- prettier/prettier#11881
- dprint/dprint#736
- dprint/dprint-plugin-typescript#432

Signed-off-by: Lexus Drumgold <[email protected]>
unicornware added a commit to flex-development/mkbuild that referenced this issue Sep 9, 2023
- prettier 3.0 formatting has degraded in quality for js-like files, but the team refuses to fix it
- prettier can be removed completely once dprint has its own yaml plugin + better json5 support
- prettier markdown formatting was always subpar; it never played nicely with markdownlint
- prettier/prettier#15358
- prettier/prettier#5715
- prettier/prettier#11881
- dprint/dprint#736
- dprint/dprint-plugin-typescript#432

Signed-off-by: Lexus Drumgold <[email protected]>
@rattrayalex
Copy link

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

@bewee-i
Copy link

bewee-i commented Dec 21, 2023

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"
  ]
}

@eggplants
Copy link

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

@g-plane
Copy link
Contributor

g-plane commented Jul 4, 2024

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.

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.

6 participants