-
Notifications
You must be signed in to change notification settings - Fork 73
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
Remove "opinionated" and allow more config? #620
Comments
I just used stylua for the first time in a project and the available configuration didn't strike me. What type of extra configuration you had in mind ? |
Agreed IMO. I am still unsure about what we do need to configure, some examples include #555 or #276. |
I don't know if it is possible in current code implementation (pretty sure it's not), but maybe stylua should stay opinionated with a way to implement custom rules as go-ruleguard. That way, a user who really want a certain rule can always write it themselves. |
I think rustfmt benefits heavily from pushing a conventional approach to writing code using it. Its generally very well accepted that the defaults are very good and sensible defaults and the agreement within the ecosystem is an important aspect of using the formatter. I think the same can be used here as well. Formatting Lua code is unfortunately still very young and it'll take time for people to catch on and it'll take time for people to realize that certain patterns are very useful for writability and not very useful for readability and a formatter allows you to always favor readability. |
@LastTalon FWIW Rustfmt needs configs more than StyLua because Rustfmt treats changing how code formats as a breaking change (such that you should be able to update |
Returning to this a bit to make my thoughts a bit more explicit here.
I completely agree here. And I guess maybe I should be clear. I think the decision needs to be on one end here or the other. It either needs to be opinionated with very little configuration, or treat formatting changes as breakage and allow configuration, but leading with convention. The longer I consider it, the more firmly I find myself in the latter camp, and this is one of the reasons. I think treating formatting changes as breakage is a good thing. As it stands that's really difficult with stylua since updating means it will format things differently in your code base. |
I agree with the premise of this issue that "opinionated" is not necessarily a selling point. Consistency/repeatability certainly is and the very important thing to me is that I can always run it and just accept the output as gospel truth. This means as a maintainer I can lint for it and enforce it on projects and avoid the bike shedding about how a specific case should be written, it should always be formatted with the formatter. I would actually like to see a few more options and appreciate the ones that are there. But not having edge cases that have to be handled manually is far more important than any one style choice. |
Because
In relation to that I'd like to suggest that |
Totally Agree. |
The project has already agreed to head that direction, and several options have been added to the development branch that are not yet in a release tag. |
A discussion which continues to happen offline is the decision against config options for StyLua, so I've decided to open an issue on it.
My main goal has always been to have "sane" defaults in the formatting, but it is impossible to suit every case.
I wonder if being an "opinionated" formatted is still beneficial. It's main selling point has been to reduce bikeshedding, but in practice, I'm not sure if that actually rings true.
Rustfmt highlights an example where it's very configurable, but works pretty well (and from what I've seen, most people don't actually bother configuring, but maybe because there are so many options 😅).
Maybe we should just allow more (reasonable) configurations?
The text was updated successfully, but these errors were encountered: