If you use emacs for Javascript or Node.js development, you should have a look at js2-mode (apt-get install js2-mode in Debian / Ubuntu).

In addition to providing syntax highlight, it will parse your Javascript and issue errors and warnings. (It's not as pedantic as jslint or jshint so you'll probably want to fix all of them before committing your files.)

Unfortunately the default indentation style looks a bit crazy and adds excessive indentation to your code. Here's an example:

    navigator.id.secret.generate(identity, function (plainKey, wrappedKey) {  
                                     var data = {wrappedKey: wrappedKey};  
                                     $.post('/loggedin', data, function (res) {  
                                                $("#message").text('All done');  
                                            }, 'json');  
                                 }, function (error) {  
                                     $("#message").text('ERROR: ' + error);  
                                 });  

It turns out that indenting Javascript properly is really hard, but you can turn on a special flag which will cause the indentation to "bounce" between different strategies, starting with the most likely one.

This is what I now have in my ~/.emacs:

(custom-set-variables  
 '(js2-basic-offset 2)  
 '(js2-bounce-indent-p t)  
)

You can find and configure all other options by issuing the following command:

M-x customize-group [RET] js2-mode [RET]

So yes, you can have both the reasonable indentation of the standard js-mode and the helpful warnings and errors of js2-mode!