kriskowal/q — pull request #46 by domenic (2012-02-08 02:02:39+00:00)
Title: JSHinting?

This pull request is just for discussion. Feel free to close if it's annoying or not useful. At this point I'm questioning the value myself but the work was already done so I thought I'd push it up just in case.

---

Inspired by #45, I thought it'd be great if we could automate finding such problems, so I tried to set us up with JSHint.

Unfortunately, it doesn't really work, since JSHint issue #431 overloads us with "Implied globals" and "Unused Variables" when running `jshint --show-non-errors`. And it's not even an error anyway, so automated tools would be hard-pressed to catch it.

Regardless, I thought maybe it would be nice to have a linter in hand, so committers can be sure they stick to accepted style and we can have early warnings if we do anything stupid. Right now it passes with only one error: `'MessageChannel' is not defined.`, which I've filed an issue for.

---

Each commit is a distinct change so we can pick the ones we like and squash them into a single one. Possibly-controversial highlights:

* e898d50da9468e9f10b66c162129e6649ef32a97 puts curly braces in the dozen or so places they were missing; don't know if this was intentional.
* df1ed1c4fa8bd628ce8331cb8897e682e11bc2c2 renames the promise factory function to `makePromise`, to match the external API and reflect the fact it's not a constructor, it's a factory function. We already lowercase `defer`.