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

yaml stringify is different from deno fmt #6194

Open
EdJoPaTo opened this issue Nov 19, 2024 · 2 comments
Open

yaml stringify is different from deno fmt #6194

EdJoPaTo opened this issue Nov 19, 2024 · 2 comments

Comments

@EdJoPaTo
Copy link

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 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(…).

@lionel-rowe
Copy link
Contributor

deno fmt uses "

Not if you set the singleQuote option to true 😉

there is no way to call deno fmt from code

There is, as long as you don't mind running it against a file on disk (not a string/buffer in memory) and as long as you're able to run your code with --allow-run permissions:

await new Deno.Command(Deno.execPath(), { args: ['fmt', filePath] }).spawn().output()

@EdJoPaTo
Copy link
Author

deno fmt uses "

Not if you set the singleQuote option to true 😉

Changing that option would also change the code. And I would prefer less complex config, ideally defaults.

For now I went with excluding yaml in the deno.jsonc as they are generated by @std/yaml. But in the long run I shouldn’t need this, therefore this issue.

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

No branches or pull requests

2 participants