new
is not harmful. Repeat over and over again.
If used correctly, new
works very well. Like in Backbone.
JSLint is a very opinionated linter; just because Crockford says something is bad or shouldn't be used, doesn't mean that's a universal truth. Plus, his reasoning behind it is more on the end that it obscures Javascript prototypal nature behind a more classical-oo façade.
However, if you use a tool like JSHint, you can configure these warnings.
I prefer the latter of your two declarations
$(function() {
var instantGarbage = new MainControllerView();
});
You can suppress this with the unused: false
option to JSHint.
Or you can set nonew: false
instead.
These can be set in a .jshintrc
or even per-file with a comment:
/* jshint unused: false */
At the top of your file. This will turn it off for the file. You can even disable it for specific scopes.
Check out the jshint documentation