Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

linting with grunt

  • Loading branch information...
commit 090ba5dfe071ef365446d42f59e592b24e6100f1 1 parent 5c0c5fe
@rmurphey authored
View
41 Gruntfile.js
@@ -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
4 package.json
@@ -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
3  tests/app/arrays.js
@@ -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 );
@Krinkle
Krinkle added a note

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?

@rmurphey Owner
rmurphey added a note

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
var result = answers.removeWithoutCopy(a, 2);
View
3  tests/app/async.js
@@ -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) {
View
3  tests/app/bestPractices.js
@@ -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
2  tests/app/flowControl.js
@@ -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
4 tests/app/functions.js
@@ -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;
- })();
+ }());
});
View
4 tests/app/logicalOperators.js
@@ -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  tests/app/modules.js
@@ -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  tests/app/numbers.js
@@ -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  tests/app/objects.js
@@ -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
2  tests/app/recursion.js
@@ -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
3  tests/app/regex.js
@@ -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  tests/runner.js
@@ -1,3 +1,4 @@
+/*globals mocha:true */
var tests = [
// link to test files here
'tests/app/bestPractices',
Please sign in to comment.
Something went wrong with that request. Please try again.