This repository has been archived by the owner on Jan 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding jshint; jshinted js file; add more ignores; add node modules
- Loading branch information
Showing
5 changed files
with
98 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,6 @@ dwsync.xml | |
.svn | ||
publish | ||
.idea | ||
|
||
## nodejs dependencies | ||
node_modules |
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,12 @@ | ||
## config | ||
JS_ENGINE ?= `which node nodejs 2>/dev/null` | ||
|
||
all: test | ||
## test against jshint | ||
test: | ||
@@if test ! -z ${JS_ENGINE}; then \ | ||
echo "Checking files against JSHint..."; \ | ||
${JS_ENGINE} tests/jshint-check.js || return -1 \ | ||
else \ | ||
echo "You must have NodeJS installed in order to test js files against JSHint."; \ | ||
fi |
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,8 @@ | ||
{ | ||
"name": "ui-coverflow-ii", | ||
"version": "2.3.0", | ||
"private": true, | ||
"dependencies": { | ||
"jshint" : ">=0.5.8" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
var fs = require("fs"), | ||
jshint = require("jshint").JSHINT, | ||
targets = [ | ||
"src/js/ui.coverflow.js" | ||
], | ||
config = { | ||
// unfiltered forin | ||
forin : true, | ||
// allow the new keyword | ||
nonew : false, | ||
evil : true, | ||
browser : true, | ||
// allow == null | ||
eqnull : true, | ||
expr : true, | ||
curly : true, | ||
// no trailing ws | ||
trailing : true, | ||
// sloppy ws | ||
sloppy : true, | ||
// don't tell me how to format my code buddy.. | ||
strict : false, | ||
// crockfords whitespace settings - NOPE | ||
white : false, | ||
// no undefined vars | ||
undef : true, | ||
smarttabs : true, | ||
noarg : true, | ||
noempty : true, | ||
// require === | ||
eqeqeq : true, | ||
// no bitwise operators plz | ||
bitwise : true, | ||
indent : 4, | ||
eqeq : false, | ||
nomen : false, | ||
laxbreak : true, | ||
loopfunc : true, | ||
predef : [ | ||
"jQuery" | ||
], | ||
maxerr: 100 | ||
}, | ||
content = ""; | ||
|
||
(function() { | ||
if( typeof jshint == "undefined") { | ||
console.log("Install JSHint first - run `npm install -g jshint` as root."); | ||
return; | ||
} | ||
|
||
targets.forEach( function( file, key ) { | ||
content = fs.readFileSync( file , "utf8"); | ||
if ( !! content && jshint( content, config ) ) { | ||
console.log( "JSHint check passed for file: " + file ); | ||
} else { | ||
console.log( "JSHint found errors." ); | ||
jshint.errors.forEach(function( e ) { | ||
if ( !e ) { return; } | ||
var str = e.evidence ? e.evidence : "", | ||
character = e.character === true ? "EOL" : "C" + e.character; | ||
if ( str ) { | ||
str = str.replace( /\t/g, " " ).trim(); | ||
console.log( file + ": [line " + e.line + ":" + character + "] " + e.reason + "\n " + str + "\n"); | ||
} | ||
}); | ||
} | ||
}); | ||
})(); |