-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
3,956 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
#contributor : Sebastian Wallin | ||
#name : function | ||
# -- | ||
function ($1) { | ||
function($1) { | ||
$0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Copy all files in this directory to /usr/local/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*jshint boss: true */ | ||
|
||
// usage: | ||
// jsc env/jsc.js -- ${file} "$(cat ${file})" "{option1:true,option2:false}" | ||
|
||
load("/usr/local/bin/jshint.js"); | ||
|
||
(function(args){ | ||
var name = args[0], | ||
input = args[1], | ||
opts = (function(arg){ | ||
switch (arg) { | ||
case undefined: | ||
case '': | ||
return {}; | ||
default: | ||
return eval('(' + arg + ')'); | ||
} | ||
})(args[2]); | ||
|
||
if (!name) { | ||
print('jshint: No file name was provided.'); | ||
quit(); | ||
} | ||
|
||
if (!input) { | ||
print('jshint: ' + name + ' contents were not provided to jshint.'); | ||
quit(); | ||
} | ||
|
||
if (!JSHINT(input, opts)) { | ||
for (var i = 0, err; err = JSHINT.errors[i]; i++) { | ||
print(err.reason + ' (line: ' + err.line + ', character: ' + err.character + ')'); | ||
print('> ' + (err.evidence || '').replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1")); | ||
print(''); | ||
} | ||
} | ||
|
||
quit(); | ||
})(arguments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
# usage (run from jshint's directory) : | ||
# env/jsc.sh /path/to/script.js | ||
# or with jshint options: | ||
# env/jsc.sh /path/to/script.js "{option1:true,option2:false,option3:25}" | ||
|
||
alias jsc="/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc" | ||
FILE="${1}" | ||
OPTS="${2}" | ||
|
||
LINT_RESULT="$(jsc /usr/local/bin/jsc.js -- ${FILE} "$(cat ${FILE})" "${OPTS}")" | ||
ERRORS=$(echo ${LINT_RESULT} | egrep [^\s] -c) | ||
|
||
if [[ ${ERRORS} -ne 0 ]]; then | ||
echo "[jshint] Error(s) in ${FILE}:" | ||
printf "%s\n" "${LINT_RESULT}" | ||
else | ||
echo "[jshint] ${FILE} passed!" | ||
fi | ||
|
||
exit $((0 + ${ERRORS})) |
Oops, something went wrong.