google / yamlfmt

An extensible command line tool or library to format yaml files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: use .editorconfig values as fallback config source

twelvelabs opened this issue · comments

I already have things like indent size configured in .editorconfig. I'd love to have yamlfmt use those settings rather than duplicate them in .yamlfmt.

Would you be open to a PR that includes editorconfig-core-go and uses .editorconfig values as defaults?

Thanks for making an issue!
I would open to that PR, as long as it's configurable. I'm trying not to buy in directly to any other tools by default if possible, but if it was a configurable feature that would be good with me.

Something like this would be great:

formatters:
  type: basic
  use_editorconfig: true

@twelvelabs Did you end up working on a PR for this? I've been thinking about it again, and I realized that it doesn't necessarily need to be a config flag. I think as long as it's done in a way where it doesn't fail if the user does not have an editorconfig, then I think it's fine to check the user's environment for one and simply no-op if one isn't found.