Add JSHint and make dygraphs pass its checks.
authorDan Vanderkam <dan@dygraphs.com>
Mon, 26 Dec 2011 04:18:12 +0000 (23:18 -0500)
committerDan Vanderkam <dan@dygraphs.com>
Mon, 26 Dec 2011 04:18:12 +0000 (23:18 -0500)
commit758a629f806fa73483f730fb343013acd0ace078
tree18e7b51ee37f6bdf6a723f9f77381fd0cd993b48
parentab80172e885f5cafb2525dab0bf4102d49e8f7b6
Add JSHint and make dygraphs pass its checks.

JSHint is a JS Linter based on JSLint. This commit includes a script which can
run it using either JSC (JavaScriptCore, available on Mac OS X) or Rhino (Java,
on all other platforms).

This catches issues like:
- Unused variables
- Uses of == where === would be better
- Repeated declarations of vars.
- Missing/superfluous semicolons.
- Missing base param on parseInt.

and many others. This did require some adjustments to coding styles (e.g.
hoisting vars up out of for loops) but overall I think it's worth it.

Squashed commit of the following:

commit 4de410a39953da0ad1b9574eab30d5eb81a2e0f5
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 23:17:47 2011 -0500

    track jshint build dir

commit 88da991955e57438fabfbe337fd5c7ff214f7c97
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 23:14:03 2011 -0500

    clear up unused vars and implied globals

commit f48b09df35e1156ab8095a29f082014885b45465
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 22:47:47 2011 -0500

    remove my files

commit b2a58ca5743aee1422608b41cad21c8296aceb2a
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 22:47:29 2011 -0500

    remove jshint tests

commit bf49732c46808752a704ee6a0a5870c6a6812e83
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 22:46:24 2011 -0500

    add a copy of jshint; include its license in README

commit 9b4baf4a36ad1beadf56f0e87e7fa4a226710121
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 22:42:12 2011 -0500

    update lint script to choose either jsc or rhino

commit dcf8db9d762575a43f4aaac8d6a7e1c5d4b8b116
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 22:02:48 2011 -0500

    fix two-arg constructor bug & add test

commit 35ad9c0aeed835ae79bd0fe04ffcfdfe5d54301c
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 21:53:19 2011 -0500

    demo works

commit 012823ca2a491ab8a559815dccb5daeefb224576
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 21:52:15 2011 -0500

    demo works

commit 0f27f4daf820d08f418f33271eee08d1d80551ee
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 21:47:10 2011 -0500

    add lint script -- all JS files pass!

commit 6b9fedce85a383a4776ef059b15c38a451bba023
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 21:46:56 2011 -0500

    dygraph-canvas.js passes

commit f51a2f3c440b44b0d5414acd07da60b28b4e66f2
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 21:13:37 2011 -0500

    dygraph-utils passes

commit f847e67a5f2be36cd7e1d534b47dfdc02878a594
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 21:03:48 2011 -0500

    dygraph-tickers passes

commit 1582fc1f591311ec21a71bdf19b6f3dee3fad728
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 20:56:51 2011 -0500

    dygraph-range-selector passes

commit 974083c7311c9a42161c50c8723d7f8a4ce251fb
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 18:41:52 2011 -0500

    dygraph-options-reference.js passes

commit 1b88fe74a331acea77449d051482d99669dbbef2
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 18:38:58 2011 -0500

    dygraph-layout passes

commit 6b92c4e8993f1ffd56159cb1f623bc8c2cb7b3c9
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 18:35:35 2011 -0500

    dygraph-interaction-model.js passes

commit 955b58fbb3c41f8916f5d65fba0b767a61a5f3b1
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 18:34:08 2011 -0500

    dygraph-gviz.js passes

commit 41a65c43ae7f13f100468460b181be154b400853
Author: Dan Vanderkam <dan@dygraphs.com>
Date:   Sun Dec 25 18:29:09 2011 -0500

    dygraph.js passes
21 files changed:
README
auto_tests/tests/sanity.js
dygraph-canvas.js
dygraph-gviz.js
dygraph-interaction-model.js
dygraph-layout.js
dygraph-options-reference.js
dygraph-range-selector.js
dygraph-tickers.js
dygraph-utils.js
dygraph.js
jshint/CHANGELOG [new file with mode: 0644]
jshint/Makefile [new file with mode: 0644]
jshint/README.markdown [new file with mode: 0755]
jshint/build/jshint-rhino.js [new file with mode: 0644]
jshint/env/jsc.js [new file with mode: 0644]
jshint/env/jsc.sh [new file with mode: 0755]
jshint/env/rhino.js [new file with mode: 0644]
jshint/env/wsh.js [new file with mode: 0644]
jshint/jshint.js [new file with mode: 0644]
lint.sh [new file with mode: 0755]