5 ms·
what do people use to make sure the JavaScript they write is valid, as they write it. Not something I run on my code after the fact?
by googletron 15y ago
what do people use to make sure the JavaScript they write is valid, as they write it. Not something I run on my code after the fact?
- dave1010uk 15y agoI code with SublimeText 2, which validates JS files as soon as I save them using a local Node instance of jshint.com and a plugin called SublimeLint. It took a while to set up but the productivity gain is well worth it.
- techiferous 15y agoNice. Quick off-topic question: assuming you have experience with TextMate, do you find SublimeText 2 to be slightly better than TextMate or significantly better?
- manojlds 15y agoI general I have heard and seen that SublimeText is better than TextMate and look good as well. The fact that most of the plugins from TextMate work with Sublime means it is a no-brainer which to use.
- dave1010uk 15y agoI use SublimeText on Linux and haven't got any first-hand experience of TextMate. I have seen coworkers use it and as far as I can tell, the main difference between them is SublimeText is much faster. It loads in under 1 second on an old PC and working with files feels instantaneous. It's also available cross platform so you can get the same experience on any computer. Well worth installing the trial then shelling out for the licence IMO.
- Stratoscope 15y agoI use Komodo IDE. Both their IDE version and the free Komodo Edit have near-realtime syntax checking for JavaScript, Python, Ruby, Perl, PHP, and one or two other languages. You get red squiggly underlines for syntax errors, green squigglies for warnings. It's quite nice to know that my code is at least free of syntax errors before I even save the file. I recommend the 7.0 release candidate: http://downloads.activestate.com/Komodo/releases/ http://downloads.activestate.com/Komodo/releases/ More info: http://www.activestate.com/komodo-ide http://www.activestate.com/komodo-ide http://www.activestate.com/komodo-edit http://www.activestate.com/komodo-edit
- plf 15y agoI'm learning CoffeeScript right now, is what I write using it always valid JavaScript?
- ricardobeat 15y agoThe valid CoffeeScript you write is always valid JavaScript :)
- plf 15y agoCan there be invalid CoffeScript?
- ricardobeat 15y agoof course, why not? any syntax can be broken.
- plf 15y agoI meant something that would not be detected when compiling to JavaScript from CoffeeScript. Maybe I got it all wrong and CoffeeScript just translates without performing any checks. Also I thought maybe the subset of code you can write with CoffeeScript can't be invalid, if it were wrong it just wouldn't work.
- tikhonj 15y agoJS2-mode for Emacs[1][2] does this. It is awesome. [1]: Original version: http://code.google.com/p/js2-mode/ http://code.google.com/p/js2-mode/ [2]: Improved (IMO) fork: https://github.com/mooz/js2-mode https://github.com/mooz/js2-mode Additionally, you can configure JS[HL]int to use flymake[3]. The trick is to improve performance by having it talk to a running JavaScript process (e.g. a node server) instead of starting a new one each time. [3]: http://www.emacswiki.org/emacs/FlymakeJavaScript#toc3 http://www.emacswiki.org/emacs/FlymakeJavaScript#toc3
- ricardobeat 15y agojavascript-tools for TextMate. Calls JSHint on every save and quickly gives you the number of errors. Also allows a full check using JSLint or Closure linter, minifying etc. https://github.com/subtleGradient/javascript-tools.tmbundle https://github.com/subtleGradient/javascript-tools.tmbundle
- s3b 15y agoI use jshint as a vim plugin.