-
Notifications
You must be signed in to change notification settings - Fork 61
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
RFC: Add preset options #300
Comments
Having the presets be a list seems like it might be difficult to work with. If multiple presets change in a release it could cause some surprising changes in the output. My opinion is a preset should have a particular purpose in mind and diff-friendly first and aligned as a second concern (or vice versa) just seems like it would be trying to accomplish contradictory goals. Ormolu also seems like one that wouldn't play well with others. I'd vote to keep it simple and only allow a single selection. If a user wants to create a mixed set of flags it's easy enough to set up a config. |
It would be better to name the |
@feature-not-a-bug are you opposed to diff-friendly/aligned as presets altogether, or just in the context of not trying to mix them with the ormolu/fourmolu presets?
|
I like the idea of the presets themselves, and my apprehension is only in mixing presets |
hm or alternatively an |
Took a stab at this in #364. Any feedback would be appreciated! |
Add a new flag/config option
--preset
that specifies the default values of unspecified options. This enables certain, blessed option sets for various use cases. Possible presets:fourmolu
: The current default Fourmolu options (also the defaultpreset
if none is specified)ormolu
: Options that emulate Ormolu settingsdiff-friendly
: Options that aim to be as diff-friendly as possiblealigned
: Options that aim for everything to be as aligned as possibleIf an option isn't directly related to the preset (e.g. indentation for diff-friendly), it'll be set the same as
fourmolu
."Fourmolu already uses diff-friendly formatting by default, what's the point of the diff-friendly preset?"
As we've been adding more options, we (the maintainers) have been pushing for option defaults to not change current formatting, to prevent breaking current formatting and maintain some notion of stability. If we add a new
foo
option tomorrow with a diff-friendly setting, we'd want the default to not change existing formatting (or at least have it be opt-in, a lalet-style: auto
). But a user might explicitly want to opt in to the maximally diff-friendly setting, even if formatting changes over an upgrade. So with presets, we'd be able to say thatfourmolu
has no (or very rarely) formatting changes on upgrade (aside from changes we get from ormolu), and other presets would get the cutting edge updates.Other notes:
Optionally, we could also allowpreset
to be a list, with latter preset values overriding earlier presetsedge
preset that contains newfourmolu
values for the next major Fourmolu version bump (if we ever wanted to do so)Related: #128
The text was updated successfully, but these errors were encountered: