Where can I find a proper JavaScript beautifier
Posted
by Ernelli
on Stack Overflow
See other posts from Stack Overflow
or by Ernelli
Published on 2010-02-04T09:48:25Z
Indexed on
2010/03/23
10:03 UTC
Read the original article
Hit count: 265
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.
© Stack Overflow or respective owner