itteco/iframely — pull request #16 by panzi (2013-07-03 02:56:34+00:00)
Title: only parse exported functions and error out if there is an unrecoverable error

The way JSLINT was used produced silent errors and caused me some headache during debugging. If you just use `JSLINT.data().functions` you will find functions that aren't exported (in theory there could be an arbitrary number of `getLink` functions in a module, just only one in `exports`) and more importantly JSLINT will **stop parsing** if it encounters to many errors or a certain kind of error (that isn't an error at all for any compliant JavaScript parser -- JSLINT is much more strict that strict mode).

So I changed it so that only the exported functions are parsed and I throw an error if it couldn't parse the function at all (which was the case for functions in `favicon.js` and `dc.js` -- I wonder how these even worked). I don't error out on any error that is reported by JSLINT (that would be too much, even if I pass a lot of relaxing options), but only on those where it couldn't parse the function at all.

Off topic: I often saw code like this in the source:
```javascript
var ys = [];
xs.forEach(function (x) { ys.push(f(x)); });
```

Why not write it like this?
```javascript
var ys = xs.map(function (x) { return f(x); });
```