-
Notifications
You must be signed in to change notification settings - Fork 49
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
Blank lines option #7
Comments
Relevant: https://eslint.org/docs/rules/lines-between-class-members Might be of some help, since they both have fixes. |
Thanks @lazarljubenovic! I appreciate the "prior art" in order to get some ideas 🙂 Right now only member spacing is implemented for enum members. The options are "maintain", "newline", and "blankline" (I believe). I could add this to other nodes and make a general setting. Also, I can add a "padding blocks" option. I'm just going to get dprint/dprint#54 merged before doing any of this though. |
@dsherret Any update on this? |
Is this something you still consider? Is there anything we can help with to move it forward? I think it would be a great way to attract many new users (like myself) who can't stand how prettier works when it comes to blank lines, but still want to use some formatter. The problem is especially visible when you use decorators, but it's not just about that. Here is a relevant prettier issue: prettier/prettier#4870, it's funny how they suggest using eslint instead if this bothers you, while the TS eslint version has completely broken |
I love coming to an issue and being greeting with my own comment 😄 Experimenting with
That way, a simple class could be written as
but a more complex one would, due to blank lines between properties, force the padded lines.
Bonus points: anything multi-lined in a class forces blank lines around it (which in turn forces the padding. I love the topic of formatting code. I probably sound crazy to some with the rules I follow, and yet I had to ask myself really hard to define how I format code manually (and subconsciously) to derive all the rules up there 🤔 |
I am currently experimenting with I largely agree with the proposal made by @lazarljubenovic in #7 (comment). However, I'm not entirely convinced by the two-blank lines part. Additionally, I would like to suggest an option to preserve single empty lines and remove only redundant ones. With the AST configuration, this enhancement would make |
@lazarljubenovic for the two-blank lines part you are, probably, interested in #394 |
@dsherret after thinking about the two blank lines proposed earlier, I have come to the conclusion that the best option would be something like |
This project looks amazing, I'd use it over prettier/biome in a heartbeat once this feature is done. |
Is there a vision on how we want this to look like? I would love to give implementing it a go. |
Is possible to have an option to add blank line rule(s) in the formatter?
Eg transform this
to this:
or this:
The text was updated successfully, but these errors were encountered: