angelozerr/tern.lint — pull request #9 by rkistner (2014-05-13 08:58:01+00:00)
Title: Fix (some) false negatives

This fixes some false negatives I've found during testing.

1. `infer.scopeAt()` turned out to not be very reliable at finding the correct function scope, in addition to probably being slow for large files. The walk process was modified to keep track of the scope of function calls. I'm not sure if the current implementation is 100% correct for all cases, but it passes the test cases that were failing previously.

2. In some cases the type of an identifier may be unknown, even though the variable is defined. An common example is function parameters. The logic was changed to not complain if there is an `originNode` for the type of the identifier.

3. The logic on properties was changed to only warn if the parent (object) type is known. A warning will be displayed on the parent if it's really an error. This also reduces false negatives when the parent type is not known but potentially valid.

I added tests for all the cases. Also note that the `test Unknown property + identifier` test now produces one less warning.