2 jsc_opts
='maxerr:10000,devel:true,browser:true'
3 rhino_opts
='maxerr=10000,devel=true,browser=true'
5 files
=$
(ls dygraph
*.js |
grep -v combined |
grep -v dev.js
);
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
15 echo 'Running JSHint w/ Rhino...'
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}"
24 echo "[jshint] ${FILE} passed!"