0

Possible Duplicate:
HTML formatter/tidy/beautifier for JavaScript

I'm looking for a good automated javascript cleaner (as in locates and fixes errors), similar to the w3c validator's cleaner function (that fixes the javascript errors).

Update: Thanks to a helpful responce I found my solution: Closure Linter.

Community
  • 1
  • 1
Chris
  • 1,881
  • 3
  • 20
  • 27
  • @Matt Ball Im looking for a free online serivce that cleans javascript, not a program based in javascript that cleans html – Chris Aug 19 '11 at 15:00
  • @Chris, didn't your read the first answer? http://jsbeautifier.org/ – Alex Turpin Aug 19 '11 at 15:01
  • @Xeon, yes and I went to the site. Im looking for a something that fixes the errors similar to W3C html's tidyclean function. – Chris Aug 19 '11 at 15:03

3 Answers3

2

Try jsbeautifier to beautify your code and jslint to clean up its syntax.

maerics
  • 151,642
  • 46
  • 269
  • 291
1

If I understand you correctly, you might be interested in Google's Closure Linter, which, like JSLint, validates your code and reports problems, but also provides the possibility to fix them:

(...) you can substitute fixjsstyle for gjslint to automatically fix many of the errors that gjslint checks for.

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
  • Yes, thats exactly what I'm looking for.....how easy is it to use though? – Chris Aug 19 '11 at 15:09
  • @Chris: Have a look at the website. It's very easy, you just have to run `fixjsstyle path/to/file.js` (but also note comment about making backups). – Felix Kling Aug 19 '11 at 15:11
0

I quite like http://jsbeautifier.org/ for cleaning up Javascript.

This site is also mentioned in the answer provided by Matt in the comments.

Jamie Dixon
  • 53,019
  • 19
  • 125
  • 162