esformatter & rocambole

Yesterday I pushed 2 new projects to github, was unsure if I was going to do it since maintaining opensource projects can demand a lot of time but heck, I’m looking for contributors and they can be useful to more people, so why not?

I used editors/IDEs that had a good code formatter for a while and ever since I started doing more JavaScript development I missed a code formatter as powerful/flexible as FDT. I know WebStorm has a very good support for JavaScript but nowadays I’m a Vim user and it’s really hard to make the switch. I wish I could have the same amount of settings on a command-line tool, that way it could be hooked into multiple text editors (Vim, Emacs, SublimeText, Cloud9, etc…), have an external configuration file (so it could be shared between team members) and used to batch-process files. Being written in JavaScript would also be a plus (so it could be used inside the browser and have more contributors).

At the beginning of 2012 I decided to look for tools that accomplished what I wanted but couldn’t find anything that was even close (jsbeautifier is not enough), so I submitted a feature request to escodegen, given that it had a good structure and was being actively maintained, I thought it could be a strong candidate. The months passed by and I didn’t had time to contribute to it (and forgot about), but most importantly, my opinion did change. – Nowadays I believe that a reliable code formatter should not rewrite the original source code, it should only modify the white spaces and line breaks while keeping all the original tokens (only non-destructive transformations). I also fell that it would increase escodegen complexity a lot and it is beyond the responsibility of the project (generate JavaScript from an AST).

During the process I tried to use node-falafel to traverse & modify the AST but it didn’t work as I needed – recursive walk started from root node and some nodes was traversed more than once – and it also didn’t had any information about original tokens, so I created a separate project to do the AST walk and manipulation. It’s called Rocambole – inspired by a popular Brazilian cake and also by node-falafel and node-burrito (rocambole is a sweet wrap).

Check both projects on Github and use the issue tracker for feature requests, questions and bugs:

Contributors are always welcome.


Thanks for starting this project. I've been on the lookout just like you ever since I switched to Sublime Text 2. Also spoiled from a FDT and Flash Builder (Eclipse) background it is really annoying not having a decent code formatter. I have never started my own solution for many of the same reasons you mentioned - mainly time. I would love to contribute on that as much as I can. Keep up the amazing work.