6 ms·
Without CoffeeScript, automated JavaScript linters are your friend. Run them in your editor, test suites, and asset pipelines. They'll catch those pesky "var" a
by mdavidn 12y ago
Without CoffeeScript, automated JavaScript linters are your friend. Run them in your editor, test suites, and asset pipelines. They'll catch those pesky "var" and "===" typos.
http://www.jshint.com/docs/ http://www.jshint.com/docs/
- killercup 12y agoLinting CoffeeScript is a good idea, too (using coffeelint).
- rikkus 12y agoReSharper also has great support for JavaScript. ReSharper isn't just a refactoring tool - it also points out errors and other potential issues in your code and offers to help fix them. I'm just waiting for ReSharper the Vim plugin!
- rikkus 12y agoOh and if you're using VS, you could use TypeScript, which in my limited experience seems to make JavaScript better 'just enough'.
- swartkrans 12y ago> They'll catch those pesky "var" ... typos. So will "use strict"; https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- reidrac 12y agoBut what if you're targeting the browser? Is the strict mode supported?
- danabramov 12y agoSurely you can (and should) 'use strict' in browser.
- davedx 12y agoWe just transitioned our code base to "use strict". If you use it in combination with a module system it works painlessly, and indeed prevents some classes of bugs.
- deleted 12y ago[deleted]
- reidrac 12y agoOh, yes... I did. The post you linked says it is not reliable and it shouldn't be trusted as not all browsers support it. I was asking in case you had anything to add. Sorry for the misunderstanding.
- swartkrans 12y agoI apologize for that comment, it was unnecessarily brusque and actually uninformed. I think it's fine to depend on "use strict"; in Chrome.
- reidrac 12y agoThanks for the info. Seems like it is more reliable than the post in MDN suggests: http://caniuse.com/#feat=use-strict http://caniuse.com/#feat=use-strict