millermedeiros / esformatter

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

comma-first support #98

Closed lalitkapoor closed 10 years ago

lalitkapoor commented 10 years ago

is there planned support for specify rules about comma first?

I noticed that it was mentioned in the comments here https://github.com/millermedeiros/esformatter/issues/28. Is there any progress on this front.

millermedeiros commented 10 years ago

I think we should definitely support it, but right now I don't think it's possible since we remove some line breaks which would probably conflict with the comma-first style (we also have no tests for it so far).

we need to complete #84 and #96 before working on this feature

azhang commented 10 years ago

:+1: I would really like to see this. Planning to start using esformatter as soon as comma-first is supported.

millermedeiros commented 10 years ago

now that we don't remove the default line breaks and white spaces before the processing it should be doable... but in the meantime we also added support for plugins and @AWinterman started a comma-first plugin: https://github.com/AWinterman/rocambole-commafirst/

closing this as wontfix since I think a plugin is a better way to implement this feature so we avoid increasing the complexity of esformatter even more.

AWinterman commented 10 years ago

@aaronz8 @lalitkapoor If you guys want to lend a hand, I don't really have a lot of time to work on this.

I have commit with comma first working modulo indentation. It's a bit messy at the moment, consult lib/index.js for what code actually runs: https://github.com/AWinterman/rocambole-commafirst/tree/dev

If you want to lend a hand I'd appreciate it. The format I'm going for is:

var obj = {
    first_property: 'wutever'
  , 'two': 'yis'
  , 'three': 'so it goes'
}
AWinterman commented 10 years ago

Actually I got it working on the master branch. https://github.com/AWinterman/rocambole-commafirst