Khan/KaTeX — pull request #117 by jmeas (2014-09-24 02:57:43+00:00)
Title: Adds JSHint to the build step. Sort of. Ok not really.

This is a quick show of what #116 might look like. I have no idea what I'm doing in Make, so that stuff was basically just made up. And I think it's broken. :worried:

I just ran JSHint from the command line to make these fixes. It looked like there were a few places where there was placeholder code, so maybe you'd rather just relax the linting on those files. But there are some legitimately useful cleanups in here, too, I think.

Adding JSHint can be telling about the general health of the library, too. For instance, the maximum function depth is 6, and there are lots and lots of methods with [cyclomatic complexity](http://en.wikipedia.org/wiki/Cyclomatic_complexity) > 6. That might seem like a bunch of gibberish, but it basically suggests that the code might be more difficult to test. These possibly negative attributes could be resolved by splitting up some of the larger methods in this library into smaller ones. An example of a pretty big one is this [120-liner](https://github.com/Khan/KaTeX/blob/master/src/buildTree.js#L248-L367).

Speaking of that method, there are a handful of outstanding JSHint problems with it that I didn't get around to solving. The full list can be seen [over in this gist](https://gist.github.com/jmeas/550535b1e637e388b802).