I've been digging through Stack Overflow as well as a number of Google searches, and I cannot find a satisfactory code formatter for Javascript.
I have found several related tools, such as syntax highlighters and pretty-printers, but I am looking for a tool that I can ideally create a wrapper for in Eclipse and simply run from the menu bar. Hence, if any Java-based ones are available, that is a big plus. Free and/or open-source is preferred as well.
I am looking for something that my development group can use to maintain a consistent code style.
Thanks.
[EDIT] Thank you for the incredibly fast responses! I would upvote you both if I had any karma. But especially kRON for linking to the format customizations page.
[EDIT] Related question on Stack Overflow.
Prettier is an open source, opinionated code formatter that basically takes all the original styling of your code and enforces a consistent code style through parsing and reprinting following its own rules. It takes the maximum line length into account, wrapping code if needed.
This is by far the best I've come across: http://jsbeautifier.org/
Available as an online tool, or on the command-line using node.js or python. The source code is available.
In one breath: Aptana Studio! Yes, it's Java based and free (Eclipse, as standalone or plugin).
You can also customize the formatting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With