Use .jshintrc files.

This commit is contained in:
Scott González 2012-04-20 09:38:04 -04:00
parent 33df9b788d
commit a166540251
4 changed files with 107 additions and 94 deletions

12
.jshintrc Normal file
View File

@ -0,0 +1,12 @@
{
"curly": true,
"eqnull": true,
"eqeqeq": true,
"expr": true,
"latedef": true,
"noarg": true,
"onevar": true,
"smarttabs": true,
"trailing": true,
"undef": true
}

110
grunt.js
View File

@ -1,3 +1,4 @@
/*jshint node: true */
module.exports = function( grunt ) { module.exports = function( grunt ) {
var // modules var // modules
@ -293,104 +294,29 @@ grunt.initConfig({
} }
}, },
jshint: (function() { jshint: (function() {
var defaults = { function parserc( path ) {
curly: true, var rc = grunt.file.readJSON( (path || "") + ".jshintrc" ),
eqnull: true, settings = {
eqeqeq: true, options: rc,
expr: true, globals: {}
latedef: true,
noarg: true,
onevar: true,
// TODO: limit to multi-line comments https://github.com/jshint/jshint/issues/503
smarttabs: true,
// TODO: use "faux strict mode" https://github.com/jshint/jshint/issues/504
// strict: true,
trailing: true,
undef: true
}; };
function extend( a, b ) { (rc.predef || []).forEach(function( prop ) {
for ( var prop in b ) { settings.globals[ prop ] = true;
a[ prop ] = b[ prop ]; });
} delete rc.predef;
return a;
return settings;
} }
return { return {
options: defaults, // TODO: use "faux strict mode" https://github.com/jshint/jshint/issues/504
grunt: { // TODO: limit `smarttabs` to multi-line comments https://github.com/jshint/jshint/issues/503
options: extend({ options: parserc(),
node: true ui: parserc( "ui/" ),
}, defaults ), // TODO: `evil: true` is only for document.write() https://github.com/jshint/jshint/issues/519
globals: {
task: true,
config: true,
file: true,
log: true,
template: true
}
},
ui: {
options: extend({
browser: true,
jquery: true
}, defaults ),
globals: {
Globalize: true
}
},
tests: {
options: extend({
browser: true,
jquery: true,
// TODO: this is only for document.write() https://github.com/jshint/jshint/issues/519
evil: true
}, defaults ),
// TODO: don't create so many globals in tests // TODO: don't create so many globals in tests
globals: { tests: parserc( "tests/" )
addMonths: true,
asyncTest: true,
container: true,
deepEqual: true,
d1: true,
d2: true,
dlg: true,
domEqual: true,
drag: true,
dragged: true,
el: true,
equal: true,
equalsDate: true,
expect: true,
Globalize: true,
heightAfter: true,
init: true,
isNotOpen: true,
isOpen: true,
modal: true,
module: true,
moved: true,
notEqual: true,
offsetAfter: true,
offsetBefore: true,
ok: true,
PROP_NAME: true,
QUnit: true,
restoreScroll: true,
shouldBeDroppable: true,
shouldmove: true,
shouldNotBeDroppable: true,
shouldnotmove: true,
shouldnotresize: true,
shouldresize: true,
start: true,
strictEqual: true,
stop: true,
test: true,
TestHelpers: true,
widthAfter: true
}
}
}; };
})() })()
}); });

58
tests/.jshintrc Normal file
View File

@ -0,0 +1,58 @@
{
"browser": true,
"curly": true,
"eqnull": true,
"eqeqeq": true,
"expr": true,
"evil": true,
"jquery": true,
"latedef": true,
"noarg": true,
"onevar": true,
"smarttabs": true,
"trailing": true,
"undef": true,
"predef": [
"addMonths",
"asyncTest",
"container",
"deepEqual",
"d1",
"d2",
"dlg",
"domEqual",
"drag",
"dragged",
"el",
"equal",
"equalsDate",
"expect",
"Globalize",
"heightAfter",
"init",
"isNotOpen",
"isOpen",
"modal",
"module",
"moved",
"notEqual",
"offsetAfter",
"offsetBefore",
"ok",
"PROP_NAME",
"QUnit",
"restoreScroll",
"shouldBeDroppable",
"shouldmove",
"shouldNotBeDroppable",
"shouldnotmove",
"shouldnotresize",
"shouldresize",
"start",
"strictEqual",
"stop",
"test",
"TestHelpers",
"widthAfter"
]
}

17
ui/.jshintrc Normal file
View File

@ -0,0 +1,17 @@
{
"browser": true,
"curly": true,
"eqnull": true,
"eqeqeq": true,
"expr": true,
"jquery": true,
"latedef": true,
"noarg": true,
"onevar": true,
"smarttabs": true,
"trailing": true,
"undef": true,
"predef": [
"Globalize"
]
}