gh-1880 + tests

Closes #1880
Here and below, you can simplify the config (best to only specify the options that are necessary to produce an error) and streamline the way you declare it:

```js
var jshintrc = JSON.stringify({ undef: true });
```