Also, what if the comment is a server macro or something that will be processed by the server so it doesn't show up to the end user? Is JSLint useless for this...
2767
cse_html_validator
cse_html_val...
Jan 31, 2012 5:13 pm
... Thanks for the information on using comments before the DOCTYPE. However, it seems there is no solution to this if one decides they want or need to use...
2766
douglascrockford
douglascrock...
Jan 27, 2012 6:48 pm
Last year I experimented with type inference in JSLint. I was not satisfied with the results of the experiment, so I am pulling all of that code out. JSLint...
2765
caerusx
Jan 23, 2012 4:09 pm
Hi I rewrote all my functions declared as var to functions declared as function. (Thanks for giving me an insight that it's safe to declare nested functions)....
2764
caerusx
Jan 23, 2012 4:00 pm
Hi Thanks for answer! It makes a sense. But '+=' operator is vulnerable to character swap typo, 'i =+ 1' is also valid javascript expression. The unary...
2763
Benjamin Gandon
bgandon
Jan 23, 2012 2:39 pm
Hi caerusx, hi everyone, I am new to the list too, so I'm not (yet) tired of answering the (easy) ++ question, so I'll answer. 1. I would personally say that...
2762
caerusx
Jan 23, 2012 1:52 pm
1) I agree, it is not a real problem. When I validated my code I hit just several errors of such kind for 1000+ lines of code. And I was not able to find out...
2761
Jakob Kruse
thekrucible
Jan 23, 2012 12:53 pm
I don’t see this going anywhere, but I’d like to point out that 1) A function call split over 3-4 lines is not a “one line function”. If you would...
2760
caerusx
Jan 23, 2012 12:36 pm
Hi Very often one line function does not fit in the same line with function keyword, so it's naturally to write it as open block. Consider: ...
2759
Jakob Kruse
thekrucible
Jan 23, 2012 11:55 am
Hi The formatting problem you outlined had to do with how your code should be distributed over multiple lines, so it is not “just one line”. If it was just...
2758
caerusx
Jan 23, 2012 11:37 am
Hi For one liners it's better to use lambda forms. No matter how descriptive name is, better to see an actual code immediately, if it just one line. Often...
2757
Jakob Kruse
thekrucible
Jan 23, 2012 9:22 am
Good morning, Your problem seems to be your insistence on declaring a function inside a function call. This is much better (from a readability perspective): ...
2756
caerusx
Jan 23, 2012 8:57 am
Good morning! I was thinking about mixing open and compact forms. And I think disallowing to use open inside compact and vice verse brings inconveniences. It's...
2755
caerusx
Jan 22, 2012 10:30 pm
Thank you for a quick answer! It's a honor to get an answer directly from JSLint author. So JSLint does not allow to mix open and compact forms. If I get right...
2754
douglascrockford
douglascrock...
Jan 22, 2012 8:51 pm
JSLint accepts two conventions for block-like structures, open and compact. Your code conforms to neither. Try /*global g */ /*jslint indent: 2 */ (function ()...
2753
caerusx
Jan 22, 2012 7:09 pm
Hi There is some indentation strangeness. JSLint does not like properly indented text: /*global g */ /*jslint indent: 2 */ (function () { "use strict"; return...
2750
caerusx
Jan 22, 2012 12:09 pm
Hi I'm new to javascript, but I have a solid C/C++ background. One of reasons why I prefer C++ over C is because it stricter. I prefer to catch errors during...
2749
Marc Spoor
marc.spoor@...
Jan 18, 2012 8:57 pm
... I was under the impression that a line that starts with the return statement should end with a semicolon, in order to not give the interpreter a chance to...
2748
douglascrockford
douglascrock...
Jan 18, 2012 5:11 pm
... Dear Sree, In this relationship, I am not a vendor. I have never submitted an invoice to you. You have never paid a penny to me. I am an Open Source...
2747
Vardhan,Sree
vardhantrav
Jan 18, 2012 4:57 pm
Dear Vendor, Please provide an update on ECCN for the product JSLint. Thanks, Sree OAI-sys, Application Development and Testing Tools Travelers Insurance. HPSM...
2746
spence.randall@...
spence.randa...
Jan 18, 2012 4:44 pm
... Thanks Rob, I agree switch makes more sense, but the question was on the indention expected, not the function itself. I just quickly created that one to...
2745
douglascrockford
douglascrock...
Jan 18, 2012 4:37 pm
... case is not a statement. It is a switch level. You should take JSLint's advice....
2744
Rob Richardson
erobrich@...
Jan 18, 2012 4:03 pm
... ~~~~'use strict'; ~~~~return x === 1 ~~~~~~~~? 'one' ~~~~~~~~: x === 2 ~~~~~~~~? 'two' ~~~~~~~~: x === 3 ~~~~~~~~? 'three39; ~~~~~~~~: x === 4 ~~~~~~~~?...
2743
Satyam
satyamutsa
Jan 18, 2012 1:11 pm
... If both the 'if' part and the 'else' part had nested expressions, having all in the same indentation level would be confusing. This example has all the...
2742
douglascrockford
douglascrock...
Jan 18, 2012 1:03 pm
... I would write it this way: function test(x) { ~~~~'use strict'; ~~~~return x === 1 ~~~~~~~~? 'one' ~~~~~~~~: x === 2 ~~~~~~~~? 'two' ~~~~~~~~: x === 3 ...
2741
douglascrockford
douglascrock...
Jan 18, 2012 12:57 pm
... I would right it this way: function test(x) { ~~~~'use strict'; ~~~~return x === 1 ~~~~~~~~? 'one' ~~~~~~~~: x === 2 ~~~~~~~~? 'two' ~~~~~~~~: x === 3 ...
2740
Rob Richardson
erobrich@...
Jan 18, 2012 12:56 pm
A comment before the DOCTYPE sends all versions of IE into quirks mode, defeating the purpose of the doctype you've specified. See ...
2739
spence.randall@...
spence.randa...
Jan 18, 2012 5:40 am
Given the following example code: function test(x) { ~~~~'use strict'; ~~~~return x === 1 ? 'one' : ~~~~~~~~x === 2 ? 'two' : ~~~~~~~~~~~~x === 3 ? 'three39; : ...
2738
Mark Volkmann
mark_volkmann
Jan 16, 2012 3:58 pm
... It is valid according to the HTML spec., but IE doesn't like it. See http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html and ...
2737
Martin Cooper
mfncooper
Jan 16, 2012 3:51 pm
... The DOCTYPE must be the very first thing in the document, so a comment before the DOCTYPE is not valid. -- Martin Cooper...