joseph / Monocle

A silky, tactile browser-based ebook JavaScript library.
http://monocle.inventivelabs.com.au
MIT License
743 stars 200 forks source link

add jshint file #213

Closed danshultz closed 10 years ago

danshultz commented 10 years ago

The jshint file is currently configured to based primarily on the practices of the code base.

JSHint will help "lint" the code base for consistency and help prevent common bugs.

After pull requests #209, #210, #211, #212 have been merged - this jshint file will validate the current state of the codebase. There are however a couple outstanding items that the jshint file flags and I will fix and they revolve around regex escaping.

I will address and test the necessary updates to clean up the last 4 issues after the jshint file is merged if you are in favor of including this as part of the project.

Jshint docs can be found http://www.jshint.com/docs/

joseph commented 10 years ago

I'm inclined to close this because its presence in the source tree I feel implies a heavy dependency, and I don't want to imply that dependency.

I've looked into jshint before and I like the idea, but I dislike the need to install a JS engine in the same environment as my text editor. I don't even have Ruby on my Mac, so I'm going to baulk hard at Node/V8.

I'm amenable to a manual step perhaps in a compilation phase, which I can run in a VM. If that's the case, I'm happy to use this file, but I don't think it belongs in the Monocle tree. Thanks though.

danshultz commented 10 years ago

I guess I'm not sure what the difference between including a jshint file and requiring ruby to build the project.

I understand the apprehension to want to add a dependency on a javascript run time, particularly node - but I think most javascript developers are more likely to have node installed vs ruby.

The jshint file is only used when building, if it's decided to add a step to verify against the jshint file.

I find value in jshint as it helps in the following areas:

I know you aim to primarily keep your development environments isolated to VMs but I typically have node and ruby installed hand in hand due to the rails dependency on a javascript run time (asset pipeline).

All this said, there are some things that jshint enforces that I'm pretty sure you cannot disable, primarily false == foo vs false === foo or 0 == false and vice versa but I agree with the preference of === under some isolated scenarios.

Any other thoughts?

joseph commented 10 years ago

Okay.