RE: [JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-24 Thread Joel Dart
>Warning: Undeclared global variable "$" detected > >Also: > >Warning: Undeclared global variable "window" detected jslint wants you to declare your globals at the top of your file with a comment: /*global window, $ */ http://www.jslint.com/lint.html (find "/*global"). There's really no other wa

[JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-24 Thread cancel bubble
Thanks for the link. The output results aren't that great, though, especially when using jQuery. The report is littered with: Warning: Undeclared global variable "$" detected Also: Warning: Undeclared global variable "window" detected ORLY? This is doing essentially: window.open('print_inst

[JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-24 Thread glathoud
My 2 cents : AFAIK JSLint is restricted to a subset of the JS syntax anyway so if you have to deal with very long legacy code you may prefer any code checker that supports the whole syntax (at least ECMAScript 3). For ex. http://glat.info/jscheck/ does not constrain your coding style at all and s

[JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-19 Thread Jorge
On Jan 19, 3:22 pm, Balázs Galambosi wrote: > 2011/1/19 Jorge : > > > I sometimes just don't declare them with var but as parameters: > > > function (x) { > >  var a,b; > >  ... > > } > > > function (x, a, b) { ... } > > That is an awful habit, leads to confusion and error prone. > Apart from that

Re: [JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-19 Thread Balázs Galambosi
2011/1/19 Jorge : > I sometimes just don't declare them with var but as parameters: > > function (x) { >  var a,b; >  ... > } > > function (x, a, b) { ... } That is an awful habit, leads to confusion and error prone. Apart from that... it's still bad. :) - Balázs -- To view archived discussions

[JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-19 Thread Jorge
On Jan 15, 12:40 pm, Oleg Slobodskoi wrote: > > 3. my personal preference: it looks much more structured and consistent if > there are all declarations on the top. I can easier see all defined stuff > and easier detect if there is something unneeded or dublicate or can be > reused. I sometimes ju

[JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-19 Thread MRoderick
I really need to read up on stuff, before commenting in this thread, clearly my knowledge was falling behind. The onevar switch still exists ... it's getting kind of pointless though, if we are not provided with a switch to turn off the "move all vars to top" opinion. On Jan 18, 11:47 am, MRoderi

[JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-18 Thread Diego Perini
On Jan 18, 11:47 am, MRoderick wrote: > Hmm ... more reports seem to suggest that the documentation on > jslint.com is out of date. > > Bummer, I LIKED the onevar switch, allowing for gradual adoption. > Try existing alternatives: http://www.javascriptlint.com/ it is quite powerful and co

[JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-18 Thread MRoderick
Hmm ... more reports seem to suggest that the documentation on jslint.com is out of date. Bummer, I LIKED the onevar switch, allowing for gradual adoption. On Jan 17, 1:22 pm, MRoderick wrote: > Anyone using jslint should really consider all the options available > athttp://www.jslint.com/lint.h

[JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-17 Thread MRoderick
Anyone using jslint should really consider all the options available at http://www.jslint.com/lint.html To switch off Crockfords opinion on only having one var declaration per function, add this to the top of the file you're working with: /*jslint onevar:false */ Since it's still in the documenta

[JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-15 Thread David Mathew
Only using one 'var' is a best practice to prevent problems related to 'variable hoisting' This link provides a good explanation/video: http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-javascript-hoisting-explained/ Not sure about the online tool, but I assume you can download jslint a

Re: [JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-14 Thread Oleg Slobodskoi
need more linter? https://github.com/kof/node-linter build for nodejs, uses jslint, closure-linter, closure-compiler provides a unified configuration json and unified reporting has api and command line its a kind of linter framework, you can easily add even more linter. 2011/1/14 cancel bubb

[JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-14 Thread cancel bubble
Never heard of that one before until a previous poster had it in a link, it's bookmarked now, thanks much. -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.

[JSMentors] Re: jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-14 Thread Diego Perini
On Jan 14, 7:12 pm, cancel bubble wrote: > At jslint.com (which I use from time to time depending on where I'm working) > with no apparent checkbox option to disable this test. > > Can you all help me out and let me know why this is a good idea? > > Part of my job is supporting existing apps tha