Add JS hint & gjslint #35

ctavan opened this Issue Apr 12, 2012 · 5 comments


None yet

2 participants

ctavan commented Apr 12, 2012

I've seen you have added travis-ci, which is great! What about adding some linting to enforce consistent code style? I'm usually using the following make targets to achieve that:

test: jshint gjslint
    # start testsuite here

JSHINT = node_modules/jshint/bin/hint {lib,test,bin}/**/*.js \
    --config share/jshint-config.json

    @shopt -s globstar && echo '$(JSHINT)' && $(JSHINT)

    gjslint --debug_indentation --nojsdoc --unix_mode \
        -e test/fixtures \
        -r lib -r test -r bin

Here's the jshint-config. It's tuned to follow the Google Javascript Style-Guide.


I actually use linting myself, I have the following in my settings, but adding a make target would also be a good idea:

{    "jshint_options":
        "evil": true,
        "regexdash": true,
        "browser": true,
        "wsh": true,
        "trailing": true,
        "sub": true,
        "curly": true,
        "eqeqeq": true,
ctavan commented Apr 12, 2012

I think for a node-only project like this one, options browser, wsh, jquery should be set to false.

I personally like to allow plusplus and i think trailing = false would also help to remove trailing whitespaces (I see them in my editor and they hurt my feelings).

I like gjslint a lot since it does quite proper code-style checking (like where to put spaces, avoiding tabs, respect 80-char line limit etc. pp.). Would you allow that or is that too strict for you?


ill allow it, but plusplus is a must for me. It's part of the good parts and it keeps things like this from happening: v = + +i

ctavan commented Apr 13, 2012

OK, I can live with plusplus. What do you think about applying the Google Styleguide rules?


I agree with the Google StyleGuide rules.

@devdazed devdazed closed this May 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment