Permalink
Browse files

linting with grunt

  • Loading branch information...
rmurphey committed Jan 2, 2013
1 parent 5c0c5fe commit 090ba5dfe071ef365446d42f59e592b24e6100f1
View
@@ -0,0 +1,41 @@
+module.exports = function(grunt) {
+ grunt.initConfig({
+ jshint: {
+ all: [
+ 'app/**/*.js',
+ 'tests/app/**/*.js',
+ 'tests/runner.js',
+ 'Gruntfile.js',
+ '!app/bestPractices.js'
+ ],
+ options: {
+ "node" : true,
+ "browser" : true,
+
+ "boss" : false,
+ "curly": false,
+ "debug": false,
+ "devel": false,
+ "eqeqeq": true,
+ "evil": true,
+ "forin": false,
+ "immed": true,
+ "laxbreak": false,
+ "newcap": true,
+ "noarg": true,
+ "noempty": false,
+ "nonew": false,
+ "nomen": false,
+ "plusplus": false,
+ "regexp": false,
+ "undef": true,
+ "sub": true,
+ "strict": false
+ }
+ }
+ });
+
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+
+ grunt.registerTask('default', [ 'jshint' ]);
+};
View
@@ -15,7 +15,9 @@
"express" : "2.5.x",
"underscore" : "1.3.x",
"amdefine" : "0.0.2",
- "expect.js" : "0.1.2"
+ "expect.js" : "0.1.2",
+ "grunt": "~0.4.0",
+ "grunt-contrib-jshint": "~0.1.0"
},
"devDependencies": {
"mocha" : "1.2.x",
View
@@ -1,3 +1,4 @@
+/*globals describe:true, it:true, expect:true, beforeEach:true */
if (typeof define !== 'function') { var define = require('amdefine')(module); }
if (typeof expect !== 'function') { var expect = require('expect.js'); }
@@ -29,6 +30,8 @@ define([
});
it("you should be able to remove a value from an array, returning the original array", function() {
+ a.splice( 1, 0, 2 );
+ a.push( 2 );
a.push( 2 );

This comment has been minimized.

Show comment
Hide comment
@Krinkle

Krinkle Jan 3, 2013

I'm not sure I understand what this is supposed to do? It another "2" in the array, next to the default 2. And then two more 2's at the end. Was this intentionally committed? If so, should it also be done in the test before this one?

@Krinkle

Krinkle Jan 3, 2013

I'm not sure I understand what this is supposed to do? It another "2" in the array, next to the default 2. And then two more 2's at the end. Was this intentionally committed? If so, should it also be done in the test before this one?

This comment has been minimized.

Show comment
Hide comment
@rmurphey

rmurphey Jan 3, 2013

Owner

This was done because there's a "solution" to this that would not pass this test, but would pass if there were no duplicates in the array. It shouldn't have gone in with this commit, but it did.

@rmurphey

rmurphey Jan 3, 2013

Owner

This was done because there's a "solution" to this that would not pass this test, but would pass if there were no duplicates in the array. It shouldn't have gone in with this commit, but it did.

var result = answers.removeWithoutCopy(a, 2);
View
@@ -1,3 +1,4 @@
+/*globals describe:true, it:true, expect:true, beforeEach:true */
if (typeof define !== 'function') { var define = require('amdefine')(module); }
if (typeof expect !== 'function') { var expect = require('expect.js'); }
@@ -11,7 +12,7 @@ define([
var total = 2;
function finish(done) {
- if (++finished == total) { done(); }
+ if (++finished === total) { done(); }
}
answers.async(true).then(function(result) {
@@ -1,6 +1,7 @@
+/*jshint expr:true*/
+/*globals describe:true, it:true, expect:true, beforeEach:true */
if (typeof define !== 'function') { var define = require('amdefine')(module); }
if (typeof expect !== 'function') { var expect = require('expect.js'); }
-if (typeof window !== 'object') { var window = {}; }
define([
'app/bestPractices'
View
@@ -1,3 +1,5 @@
+/*jshint expr:true */
+/*globals describe:true, it:true, expect:true, beforeEach:true */
if (typeof define !== 'function') { var define = require('amdefine')(module); }
if (typeof expect !== 'function') { var expect = require('expect.js'); }
View
@@ -1,3 +1,5 @@
+/*jshint expr:true */
+/*globals describe:true, it:true, expect:true, beforeEach:true */
if (typeof define !== 'function') { var define = require('amdefine')(module); }
if (typeof expect !== 'function') { var expect = require('expect.js'); }
@@ -102,7 +104,7 @@ define([
expect(wasITake2ArgumentsCalled).to.be.ok;
expect(wasITake3ArgumentsCalled).to.be.ok;
- })();
+ }());
});
@@ -1,3 +1,5 @@
+/*jshint expr:true */
+/*globals describe:true, it:true, expect:true, beforeEach:true */
if (typeof define !== 'function') { var define = require('amdefine')(module); }
if (typeof expect !== 'function') { var expect = require('expect.js'); }
@@ -17,4 +19,4 @@ define([
expect(answers.or(false, false)).not.to.be.ok;
});
});
-});
+});
View
@@ -1,3 +1,4 @@
+/*globals describe:true, it:true, expect:true, beforeEach:true */
if (typeof define !== 'function') { var define = require('amdefine')(module); }
if (typeof expect !== 'function') { var expect = require('expect.js'); }
View
@@ -1,3 +1,4 @@
+/*globals describe:true, it:true, expect:true, beforeEach:true */
if (typeof define !== 'function') { var define = require('amdefine')(module); }
if (typeof expect !== 'function') { var expect = require('expect.js'); }
View
@@ -1,3 +1,4 @@
+/*globals describe:true, it:true, expect:true, beforeEach:true */
if (typeof define !== 'function') { var define = require('amdefine')(module); }
if (typeof expect !== 'function') { var expect = require('expect.js'); }
View
@@ -1,3 +1,5 @@
+/*jshint expr:true */
+/*globals describe:true, it:true, expect:true, beforeEach:true */
if (typeof define !== 'function') { var define = require('amdefine')(module); }
if (typeof expect !== 'function') { var expect = require('expect.js'); }
View
@@ -1,3 +1,4 @@
+/*globals describe:true, it:true, expect:true, beforeEach:true */
if (typeof define !== 'function') { var define = require('amdefine')(module); }
if (typeof expect !== 'function') { var expect = require('expect.js'); }
@@ -62,4 +63,4 @@ define([
});
});
-});
+});
View
@@ -1,3 +1,4 @@
+/*globals mocha:true */
var tests = [
// link to test files here
'tests/app/bestPractices',

0 comments on commit 090ba5d

Please sign in to comment.