Profile

Cover photo
Roderick Obrist
3,254 views
AboutPostsPhotosYouTube

Stream

Roderick Obrist

Shared publicly  - 
1
Add a comment...

Roderick Obrist

Discussion  - 
 
Case 1:
try {
    fail();
} catch (e) {
    //Expected 'ignore' and instead saw 'e'.
   // This is good behaviour
}

Case 2:
try {
    fail();
} catch (ignore) {
    // No errors
   // This is good behaviour
}


Is this supposed to happen?

Case 3:
try {
    fail();
} catch (e) {
    errorHandler("custom description, not referencing e");
    // No errors
   // I would have expected : Expected 'ignore' and instead saw 'e'.
}

Case 4:
try {
    fail();
} catch (ignore) {
    errorHandler("custom description, not referencing ignore");
   //Unexpected 'ignore'.
   // I would have expected there to be no errors
}

It does not seem intuitive to me, but I know how to live it it. Thought I would let you know +Douglas Crockford 
1
Douglas Crockford's profile photo
 
Please let me know if you find any real problems.
Add a comment...
In his circles
12 people

Roderick Obrist

Shared publicly  - 
1
Add a comment...

Roderick Obrist

Discussion  - 
 
I have started using the /properties/ directive in my JSLint backed IDE, and I believe it solves the typo in property access problem quite well.

I can think of numerous reasons why native methods/properties are not added into the properties directive. But at the same time it would be nice if I don't need to keep adding these into each script, as it does become a bit tedious after a while.

I'm wondering if there is any reason not to add a option to assume native properties e.g.

/jslint native: true/
which is the equivalent of:

/properties some, forEach, hasOwnProperty, length, map, reduce, getTime, concat, replace, test ....../

Or perhaps even:

/properties customProp1, customProp2, native:es6/
/properties customProp1, customProp2, native:es5/
/properties customProp1, customProp2, native:es3/

Which solves the problems like:
1. Which native properties do you assume?
2. If native option is true and there is no property directive, what do you do.

Does anyone have any thoughts to add to this?
1
Douglas Crockford's profile photoSaravanan M's profile photo
2 comments
 
How to pass global functions through options in jslint?
Add a comment...

Roderick Obrist

Discussion  - 
 
I don't know if this is intentional or not, but:

alert("hello" + " world");  //good

alert("hello"+ " world");  //Missing space between 'hello' and '+'.

alert("hello"     + " world"); // good?

Note there are multiple spaces between "hello" and +, I thought JSLint would expect there to be absolutley one.
3
Ben Quarmby's profile photoRon Waldon's profile photo
2 comments
 
I could be wrong, but I believe that JSLint allows you to use extra spaces to align assignments and other expressions. I'm not a fan of the practice, but if it helps organize code and doesn't cause errors...
Add a comment...
People
In his circles
12 people
Links
Basic Information
Gender
Male