views:

1179

answers:

4

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.

+6  A: 

In one breath: Aptana Studio! Yes, it's Java based and free (Eclipse, as standalone or plugin).

You can also customize the formatting.

kRON
+2  A: 

If you already use Eclipse, I recommend you to try Aptana, you can install it as an Eclipse Plugin.

CMS
A: 

If you also need Java programming i can recommend [link text][1]

It offers excellent JavaScript formatting and refactoring out of the box

[1]: http://www.jetbrains.com/idea/ 'IntelliJ IDEA'

Peter
+1  A: 

This is by far the best I've come across: http://jsbeautifier.org/

Its an online tool, but source is available.

Nimbuz