Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best source code formatter for Javascript? [closed]

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.

like image 338
thebossman Avatar asked Dec 08 '08 23:12

thebossman


People also ask

Is prettier open source?

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.


2 Answers

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.

like image 73
eozzy Avatar answered Sep 27 '22 17:09

eozzy


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

You can also customize the formatting.

like image 25
Filip Dupanović Avatar answered Sep 27 '22 15:09

Filip Dupanović