That only works for valid code. One of the main arguing points is which is more error-prone - and faulty code will need to be fixed by hand before you run it through a tool.
Sure. Let's say you have a variable declaration like this:
var foo = 'foo',
bar = 'bar';
And modify it to this:
var foo = 'foo,
bar = 'bar';
baz = 'baz';
You can spot the error, but a tool to convert var styles won't. It will (likely, I haven't run it) correctly convert the first var statement and leave the implicit global intact because it doesn't want to modify behavior.
The above mistake is much less likely if you're using this style:
var foo = 'foo';
var bar = 'bar';
And because that is correct code, your tool can correctly convert it to the single-var style.
Your editor (or jshint or jscs) should be warning you that you have a global assignment. I prefer multiple vars myself, most minifiers handle them, but seriously this is a non-issue
2
u/[deleted] Mar 28 '15
That only works for valid code. One of the main arguing points is which is more error-prone - and faulty code will need to be fixed by hand before you run it through a tool.