Where can I find a proper JavaScript beautifier
- by Ernelli
I have used http://jsbeautifier.org/ successfully using Rhino and ant, but the problem is that it is not deterministic. If you run the beautifier twice on a file the result is different from each time, e.g. each pass inserts additional array intendation on some lines.
I have spent a lot of time debugging the code in beautify.js and have made some workarounds for comment handling, but the array indentation bug is annoying.
Is there a correct and properly working JS code formatter anywhere that can be used as part of a source code indentation verification system?
EDIT
I have now tested with preserve-array-formating disabled, and it seems that it solves the problem. Too bad, since preserve-array-formating is quite useful with large array constructs.