Replies: 1 comment 2 replies
|
I think this makes sense in the abstract but I think this sentence is doing a lot:
That's exactly what prettier said. But 'what you need' and what I need are not necessarily the same thing. In theory what you need is consistency but in reality what people want trumps what they need. Which is why prettier adopted a config. And, to date, I'm not aware of a formatter than doesn't have some kind of config. Even the zero config ones usually cheat and pull in editor config for example. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
TLDR: tsv has non-configurable formatting style behavior; its guide is Prettier+prettier-plugin-svelte+Svelte's config with room for principled+preferred divergences, and adopting all of Svelte's intentional choices
Background you can skip
I took a significantly slower path with tsv by developing an original fixture set instead of using Prettier as an oracle. I suspected this would lead to cleaner architecture, and I documented the process in docs/conformance_prettier.md as I went.
Indeed I found numerous bugs (including a handful of fixes I upstreamed to acorn-typescript), along with quirks that were sometimes heavily downvoted in Prettier's issues. I think the internals would be a lot more tortured had I treated Prettier as an oracle.
But do users care? The costs are sunk -- I probably spent an extra 2-3 months of the initial release's 7 to get this original fixture set and principled divergences -- but if it's not what people expect, then I could backtrack on that decision and go all-in on tracking Prettier and prettier-plugin-svelte.
There's also potential design targets that straddle the line -- keep some principled divergences, and conform where it makes sense given some agreed-upon framing. The conformance doc above can be sliced a few different ways.
A related question is what options of Prettier's to adopt, both data options and config locations, and whether tsv should even have its own configuration scheme.
I don't want to chase user adoption, but I also don't want to contribute to ecosystem fragmentation within the already not-React-sized Svelte world. I like the idea of a zero-config tool that just does what you need, so you don't need to navigate numerous configuration strategies and worry about whether some directory is set up correctly, you just run the tool. This is an attractively simple choice, but my sense is this only works if Svelte has an official tool, if you also want to avoid causing fragmentation.
I built tsv because I wanted faster, slimmer tools where Svelte is first class. Long term I'd expect Svelte to own its language tools. I could see tsv staying in my little niche, and not even try to court users, and I could also see donating the project to the Svelte team, were they confident that the code is maintainable and not slop, like I am. The technical maintenance burden here doesn't worry me at all, the project can be near-automated at this point; it's the social burden and costs that concern me. This leads me to an easy answer: defer subjective questions to Svelte's official repo Prettier config, and point tsv users at that source of truth when it provides an answer.
Update
update: following up on the formatter's config design, the value of being non-configurable so you always get consistent results, no matter what config is included in the context running the tool, is what I'm going with. Here's Prettier's config resolution:
These config strategies imply dependencies on a JS runtime and YAML support, which tsv doesn't have. In keeping with the tool's goal to reduce complexity (and it's currently just Rust, tsv doesn't even need a C compiler let alone one of Node/Deno/Bun), tsv chooses to omit all style config support, both the above and dynamic params when
formatis called programmatically. I think gofmt, zig fmt, and Python's Black show that a significant fraction of users like monoculture formatting, and swapping out a formatter should be a oneliner for your dev environments and apps. tsv can be useful without its formatter, it was just the first useful tool after that parser that I chose to implement, and it doesn't need to monopolize one's toolset.I'm also dropping the premium domain -- it'll just be tsv.fuz.dev, under the same domain as my other repos in this org.
The resulting policy from this: follow Svelte's lead and use its Prettier config options, with room for divergences from Prettier's behavior when preferred and defensible.
All reactions