Menu ▾ ▴

#18 feature request: support for /*jsl:declare document.body*/

open
nobody
None
5
2007-01-15
2007-01-15
No

I would like to have the possibility to write:

/*jsl:declare a.b*/

This would allow code of this form:

var x = a.b;

However, it would warn on code of this form:

var x = a; // warns of undeclared variable a
var x = a.c; // warns of undeclared variable a
var x = b; // warns of undeclared variable b

For example, I would like to replace this line:

/*jsl:declare document*/

with:

/*jsl:declare document.getElementById*/
/*jsl:declare document.body*/
/*jsl:declare document.etc*/

This would mean that use of document.randomid and document.all.randomid would be flagged up by javascript lint.

Discussion

  • Matthias Miller

    Matthias Miller - 2009-10-22

    Proposal:

    * Allow declarations of object.property.
    * If an object has any declared properties, warn against [] lookups
    * If an object has any declared properties, warn against undeclared properties.
    * The declaration of object.property is *not* an implicit declaration of object. object must be declared separately to validate its references.

    Not as bad as I thought it might be.

     

Log in to post a comment.