feature request: support for /*jsl:declare document.body*/
Status: Beta
Brought to you by:
matthiasmiller
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.
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.