denoland / denoland/std

yaml stringify is different from `deno fmt`

Open
#6,194 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**

Using `@std/yaml` `stringify` and `deno fmt` on the file afterwards the file is reformatted.
This should not happen. `stringify` should output the same format or allow for the same format to be configured.

Currently, this involves the quotes style (`'` vs `"`) where `@std/yaml` uses `'` while `deno fmt` uses `"`.
There is no [`StringifyOptions`](https://jsr.io/@std/yaml/doc/stringify/~/StringifyOptions) to configure this behaviour and there is no way to call `deno fmt` from code? (Or is there?)

**Describe the solution you'd like**

Ideally `@std/yaml` `stringify` should output YAML which is already in the format expected by `deno fmt`. Being able to configure `@std/yaml` would also be helpful.

**Describe alternatives you've considered**

Being able to use `deno fmt` from code like `Deno.fmt(…)`.

Contributor guide

Open the contributing guide

Research direction

Start by comparing @std/yaml stringify with deno fmt on YAML that uses quoted strings, then inspect the StringifyOptions documentation and the available deno fmt interfaces. Decide whether matching deno fmt output or exposing configurable quote formatting is the intended scope. Done means stringify output no longer receives these formatting changes, or the requested configuration and documented programmatic formatting path are available.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.