esformatter
esformatter copied to clipboard
Not an issue but a request
I love this tool. It meets almost all of my requirements. I am trying to push my team to use this.
I wanted to know if it is possible to add the following behavior to the formatting.
- new line before return if it is not the only statement in the block
- wrapped line (everything after the first part of the line) will be indented once (or [n] times) more than usual to indicate the line is wrapped
if ( condition-a && condition-b
&& condition-c
&& conditon-d ...) {
}
must become
if ( condition-a && condition-b
&& condition-c // <-- Indented twice so that it sticks out as part of another line
&& conditon-d ...) { // <-- Indented twice so that it sticks out as part of another line
}
- max line length
I am not sure if this is the right place for such a request, correct me if am wrong.
new line before return if it is not the only statement in the block
could easily be done as a plugin. Would be a nice thing to have (I would use this plugin).
max line length
anything related to wrapping and max-line length will be handled by plugins, because there are so many ways to do it, that it would be hard to configure and would increase the complexity of this project drastically. (see: #409 for more details)
I looked into making a plugin and gave it a shot
https://github.com/iamprasad88/esformatter-only-return
Thought I'd comment for the wrapped lines: in the #409 that @millermedeiros linked, I commented about the plugin I made for wrapping lines. Get it here https://github.com/pgelinas/esformatter-auto-wrap and feedback very much welcome :smile:
@pgelinas Thank you. I just had a chance to try it out. It works really well.