jshint/jshint — Issue #367: function hoisting not detected inside a closure
Author: angus-c
Created: 2011-11-29 03:03:26+00:00
State: open

These two are both valid code and I have latedef options set to true.

1)
/*jshint latedef:false*/
/*globals console:true*/

(function() {
console.log(hello);
function hello() {}
})();

test.js:5:15 'hello' is not defined.
console.log(hello);

Unused variables:
test.js:4 var 'hello' in function "anonymous"

Implied globals:
test.js:5 'hello'

2)
/*jshint latedef:false*/

(function() {
hello();
function hello() {}
})();

test.js:4:3 'hello' is not defined.
hello();

Unused variables:
test.js:3 var 'hello' in function "anonymous"

Implied globals:
test.js:4 'hello'