Commit | Line | Data |
---|---|---|
758a629f DV |
1 | #!/bin/bash |
2 | jsc_opts='maxerr:10000,devel:true,browser:true' | |
3 | rhino_opts='maxerr=10000,devel=true,browser=true' | |
4 | ||
5 | files=$(ls dygraph*.js | grep -v combined | grep -v dev.js); | |
6 | ||
7 | if [ -e /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc ]; then | |
8 | # use JSC (Safari/JavaScriptCore) to run JSHint -- much faster than Rhino. | |
9 | echo 'Running JSHint w/ JavaScriptCore (jsc)...' | |
10 | for file in $files; do | |
11 | ./jshint/env/jsc.sh $file $jsc_opts | |
12 | done | |
13 | else | |
14 | # fall back to Rhino. | |
15 | echo 'Running JSHint w/ Rhino...' | |
16 | ||
17 | for FILE in $files; do | |
18 | LINT_RESULT=$(java -jar ./jsdoc-toolkit/java/classes/js.jar ./jshint/build/jshint-rhino.js $rhino_opts $FILE) | |
19 | ERRORS=$(echo ${LINT_RESULT} | egrep [^\s] -c) | |
20 | if [[ ${ERRORS} -ne 0 ]]; then | |
21 | echo "[jshint] Error(s) in ${FILE}:" | |
22 | printf "%s\n" "${LINT_RESULT}" | |
23 | else | |
24 | echo "[jshint] ${FILE} passed!" | |
25 | fi | |
26 | done | |
27 | fi |