Best source code formatter for Javascript? [closed]
Asked Answered
H

7

16

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.

Edit: Thanks to kRON for linking to the format customizations page.

Edit: Related question on Stack Overflow.

Hydranth answered 8/12, 2008 at 23:11 Comment(0)
E
12

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

You can also customize the formatting.

Eldaelden answered 8/12, 2008 at 23:15 Comment(2)
The link above results in 404 -- this looks like the current page aptana.com/products/studio3.htmlAmadavat
Thanks @Jeff, I've updated the link accordingly.Alberich
A
15

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.

Augsburg answered 13/9, 2009 at 17:9 Comment(0)
E
12

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

You can also customize the formatting.

Eldaelden answered 8/12, 2008 at 23:15 Comment(2)
The link above results in 404 -- this looks like the current page aptana.com/products/studio3.htmlAmadavat
Thanks @Jeff, I've updated the link accordingly.Alberich
T
5

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

Theriault answered 8/12, 2008 at 23:15 Comment(0)
G
5
Grozny answered 20/5, 2013 at 13:40 Comment(0)
A
3

If you also need Java programming I can recommend 'IntelliJ IDEA'

It offers excellent JavaScript formatting and refactoring out of the box.

Andryc answered 9/12, 2008 at 6:53 Comment(0)
C
1

Have you tried jsfiddler. It's great for trying things out with Javascript. Built in JSLint & something called Tidy. Not sure whether that infers jstidy Piotr Zalewa is the guy who wrote it. May be worth giving him a Tweet @zalun to confirm.

Cyte answered 21/2, 2011 at 19:42 Comment(0)
A
0

If you are using notepad++, you can try jsminnpp plugin

Accentual answered 28/12, 2012 at 12:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.