-
-
Save munro/3100600 to your computer and use it in GitHub Desktop.
| /*jshint undef: false */ | |
| var hello = 123, | |
| world = 3421; | |
| foo = 321, | |
| bar = 421; | |
| // passes! |
| var hello = 123, | |
| world = 3421, | |
| foo = 321, | |
| bar = 421; |
| var hello = 123, | |
| world = 3421; | |
| window.foo = 321, | |
| window.bar = 421; |
| /*jslint undef: true */ | |
| var hello = 123, | |
| world = 3421; | |
| foo = 421; | |
| /** | |
| * Fails: | |
| * Expected 'foo' at column 1, not column 5. | |
| * foo = 421; | |
| */ |
Aw yea! I thought undef existed in JSLint, but I didn't find it after looking for a second. I have to manipulate the example a bit, because JSLint doesn't allow , in statements. But anyways, this is where JSLint is superior, because indentation leads to certain expectations. Though, expectations are subjective. ;)
I actually was typing "To be fair, JSLint has this option ...", but I couldn't find it after looking at their site for a second. But you found it! 'Cause somebody on the internet is wrong, dammit! Also, your comment about expectations leads to some interesting concepts on why I believe JSLint to be superior to JSHint and CoffeeScript when it comes to writing quality JavaScript code. I'll distill my thoughts in a blog post later this week.
I don't think you know what
to be fairmeans. When JSHint was forked JSLint shared the exact same behavior (undefwas false by default) and we don't like to break backwards compatibility.