add JSHint to the tree, with all JSHint tests disabled

This commit is contained in:
Jeff Williams 2012-07-03 16:42:59 -07:00
parent 81f145708d
commit 6a5c2f07d4
3 changed files with 4677 additions and 0 deletions

60
.jshintrc Normal file
View File

@ -0,0 +1,60 @@
{
"bitwise": false,
"curly": false,
"eqeqeq": false,
"forin": false,
"immed": false,
"latedef": false,
"newcap": false,
"noarg": false,
"noempty": false,
"nonew": false,
"plusplus": false,
"regexp": false,
"undef": false,
"strict": false,
"trailing": false,
"asi": true,
"boss": true,
"debug": true,
"eqnull": true,
"es5": true,
"esnext": true,
"evil": true,
"expr": true,
"funcscope": true,
"globalstrict": true,
"iterator": true,
"lastsemic": true,
"laxbreak": true,
"laxcomma": true,
"loopfunc": true,
"multistr": true,
"onecase": true,
"proto": true,
"regexdash": true,
"scripturl": true,
"shadow": true,
"smarttabs": true,
"sub": true,
"supernew": true,
"validthis": true,
"browser": false,
"couch": false,
"devel": false,
"dojo": false,
"jquery": false,
"mootools": false,
"node": true,
"nonstandard": false,
"prototypejs": false,
"rhino": true,
"wsh": false,
"nomen": false,
"onevar": false,
"passfail": false,
"white": false
}

4557
node_modules/jshint/jshint.js generated vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,60 @@
/*global app: true, describe: true, env: true, expect: true, it: true */
var fs = require("fs"),
path = require("path");
var config = JSON.parse( fs.readFileSync( path.join(__dirname, ".jshintrc"), "utf-8" ) );
function jsHintCheck(filename, source, conf) {
var JSHINT = require("jshint/jshint").JSHINT;
source = source || fs.readFileSync(filename, "utf-8");
conf = conf || config;
JSHINT(source, conf);
if (JSHINT.errors.length) {
throw new Error( filename + " is not JSHint clean: " + JSON.stringify(JSHINT.errors) );
}
}
describe("jshint-clean", function() {
it("should generate JSHint errors for bad code", function() {
var check = function() {
jsHintCheck("dummyFile.js", "hasOwnProperty = 0");
};
expect(check).toThrow();
});
it("should not generate JSHint errors for good code", function() {
var check = function() {
jsHintCheck("dummy.js", "var foo = 0;");
};
expect(check).not.toThrow();
});
it("should not find JSHint errors in JSDoc", function() {
var check,
files,
filter,
source,
i,
l;
// check all .js files unless they're tests; rhino shim files that probably can't be
// delinted; or third-party modules
source = {
includePattern: ".+\\.js$",
excludePattern: ".+[\\\\|/]test[\\\\|/].+|.+rhino-shim\\.js|.+[\\\\|/]Jake[\\\\|/].+|.+[\\\\|/]node_modules[\\\\|/].+"
};
filter = new (require('jsdoc/src/filter').Filter)(source);
files = app.jsdoc.scanner.scan([env.dirname], 10, filter);
check = function() {
jsHintCheck(files[i]);
};
for (i = 0, l = files.length; i < l; i++) {
expect(check).not.toThrow();
}
});
});