-
Notifications
You must be signed in to change notification settings - Fork 0
/
jslint
executable file
·23 lines (19 loc) · 889 Bytes
/
jslint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
JSLINT_JAR=~/bin/jslint4java-2.0.5.jar
#JSLINT_CONFIG="--bitwise --browser --eqeqeq --immed --newcap --undef --indent 4"
JSLINT_CONFIG="--browser --devel --newcap --indent 4 --vars --nomen --sloppy --white --maxerr 9999 --plusplus --todo --unparam"
GLOBALS="--predef dojo,dojox,dijit,$,jQuery,bootstrap,navBar,appState,js,util,config,widgets,i18n,security,uReleaseConfig,deploy,getBTD,applyBTD,mxClient,mxUtils,mxToolbar,mxPrintPreview,mxWindow,mxCellOverlay,mxImage,mxPoint,mxConstants,mxEvent,require,define"
ARGS=( "$@" )
if [ ${#ARGS} -eq 0 ]
then
echo "No files specified"
exit 0
fi
FILES=$( find "${ARGS[@]}" -type f \( -iname '*.js' -or -iname '*.html' \) -print )
if [ -z "$FILES" ]
then
echo "no javascript files to scan"
exit 0
fi
echo -n "$FILES" | tr '\n' '\0' | xargs -0 java -jar "$JSLINT_JAR" $GLOBALS $JSLINT_CONFIG | grep -v '^$'
exit ${PIPESTATUS[1]}