estools / escodegen

ECMAScript code generator
BSD 2-Clause "Simplified" License
2.66k stars 334 forks source link

Specifing extra whitespace between blocks #203

Open albertjan opened 10 years ago

albertjan commented 10 years ago

Over at fixmyjs people really want to be able to add an extra line between function. Would you consider a PR that added this option to escodegen? And if you would, could you give some pointers how to implement this.

stereokai commented 10 years ago

I'm going to be upfront on this one and bump and cc:

@Constellation @michaelficarra @goatslacker @addyosmani

We have other options, such as benjamn/recast and millermedeiros/esformatter that prove to solve this issue, but that would mean dropping escodegen and having to adjust everything to a new code formatter - which is obviously something the current collective train of thought wishes to avoid.

What can be done to make escodegen more lenient in regards to whitespace? Noted complaints where raised where escodegen removes any and all line-breaks - which deters readability and formatting, as well as function declarations which are all forced to function () {}, whereas function() {} is actually valid according to lint/hint conventions (although I personally support enforcing this).

Having these acute code modifications keeps many devs away from fixmyjs simply because they cannot maintain their own rhythm and code formatting. We would like to look into proposing some alternative handling of whitespace, namely regarding these two points above, and would like to get your blessing, or even input on the matter.

Thanks in advance, jshint/fixmyjs community.