millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

Not an issue but a request #462

Open iamprasad88 opened 8 years ago

iamprasad88 commented 8 years ago

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.

  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
}

I am not sure if this is the right place for such a request, correct me if am wrong.

millermedeiros commented 8 years ago

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)

iamprasad88 commented 8 years ago

I looked into making a plugin and gave it a shot

https://github.com/iamprasad88/esformatter-only-return

pgelinas commented 8 years ago

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:

iamprasad88 commented 7 years ago

@pgelinas Thank you. I just had a chance to try it out. It works really well.