ruff
ruff copied to clipboard
option to format other filetypes (eg. `toml`, `yaml`, `json`, `md`, etc.)
it would be nice if ruff could format toml, yaml and md files.
i get that this may be considered out of scope for ruff, however in the nodejs ecosystem, the prettier formatter works on these filetypes in addition to js & ts files, which is useful because most projects contain files written in those languages.
Wrap dprint 🚀🚀🚀
This is related to https://github.com/astral-sh/ruff/issues/9244
Yeah, that's something I want to do eventually and we have the infrastructure for it (ruff_formatter is entirely language agnostic). But there are some things we have to figure out (what parsers to use or implement our own? How to integrate it into existing commands) and implementing additional language is a large commitment
I'm serious about dprint, I would imagine it would be a massive amount of work, when dprint is doing exactly what you are setting out to achieve.
Integrating dprint as an optional formatter (that we call into when the project has installed it) is an option. But I'm unsure if that's the experience users seek. We need to do some designing around this and decide if we want to build out support for new languages ourselves or delegate to other formatters (even Prettier)
Ruffs formatter is already integrated into dprint https://github.com/dprint/dprint-plugin-ruff 🚀
dprint also doesn't have a yaml formatter
dprint also doesn't have a yaml formatter
I mean technically it has prettier as a process plugin. Which you can configure to run only on yaml. As much as I dislike prettier for JS/TS, it does just fine for markup/static languages.
There's also pre-commit's https://github.com/macisamuele/language-formatters-pre-commit-hooks which satisfies all my toml, yaml, ini, json (haven't tried the others) needs.
dprint also still doesn't work through pre-commit's free version if you have an online shared config.
Not saying this to discourage the OP's request. I too would like if Ruff handled common python config format (.ini for historical reasons for a bunch of tools, and toml). Just offering some options in the short term.