diff options
author | Timo Tijhof <krinklemail@gmail.com> | 2013-10-12 01:58:46 +0200 |
---|---|---|
committer | Timo Tijhof <krinklemail@gmail.com> | 2013-10-12 01:58:46 +0200 |
commit | 0343f75622d85330925d35b6193cd728699b7477 (patch) | |
tree | 32546c1a9bd4327ba8a97674eb747cb7caa19725 | |
parent | 976cde8c0c8acaa2d7e1f4a9c03f8419e942d9f7 (diff) | |
download | fastdom-0343f75622d85330925d35b6193cd728699b7477.zip fastdom-0343f75622d85330925d35b6193cd728699b7477.tar.gz fastdom-0343f75622d85330925d35b6193cd728699b7477.tar.bz2 |
Set up JSHint and fix outstanding violations
Added a jshintrc file resembling as close as what the source
code did already. The only violation was that main code used
single quotes and tests double quotes. Shall we go for single
quotes, then?
-rw-r--r-- | .jshintignore | 1 | ||||
-rw-r--r-- | .jshintrc | 11 | ||||
-rw-r--r-- | package.json | 3 | ||||
-rw-r--r-- | test/test.clear.js | 12 | ||||
-rw-r--r-- | test/test.defer.js | 6 | ||||
-rw-r--r-- | test/test.set.js | 20 |
6 files changed, 33 insertions, 20 deletions
diff --git a/.jshintignore b/.jshintignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.jshintignore @@ -0,0 +1 @@ +node_modules diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..ebec543 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,11 @@ +{ + // Enforcing options + "camelcase": true, + "curly": false, + "quotmark": "single", + + // Relaxing options + "boss": true, + "sub": true, + "laxbreak": true +} diff --git a/package.json b/package.json index 58384df..c2e4272 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "0.7.1", "main": "index.js", "scripts": { - "test": "mocha-phantomjs test/index.html" + "test": "jshint . && mocha-phantomjs test/index.html" }, "homepage": "https://github.com/wilsonpage/fastdom", "author": { @@ -18,6 +18,7 @@ "license": "MIT", "devDependencies": { "mocha": "~1.12.0", + "jshint": "~2.1.0", "sinon": "~1.7.3", "chai": "~1.7.2", "mocha-phantomjs": "~3.1.2" diff --git a/test/test.clear.js b/test/test.clear.js index 20be9ed..5194830 100644 --- a/test/test.clear.js +++ b/test/test.clear.js @@ -1,7 +1,7 @@ suite('clear', function(){ - test("Should not run 'read' job if cleared (sync)", function(done) { + test('Should not run "read" job if cleared (sync)', function(done) { var fastdom = new FastDom(); var read = sinon.spy(); @@ -14,7 +14,7 @@ suite('clear', function(){ }); }); - test("Should fail silently if job not found in queue", function(done) { + test('Should fail silently if job not found in queue', function(done) { var fastdom = new FastDom(); var read = sinon.spy(); var read2 = sinon.spy(); @@ -28,7 +28,7 @@ suite('clear', function(){ }); }); - test("Should not run 'write' job if cleared (async)", function(done) { + test('Should not run "write" job if cleared (async)', function(done) { var fastdom = new FastDom(); var read = sinon.spy(); var write = sinon.spy(); @@ -44,7 +44,7 @@ suite('clear', function(){ }); }); - test("Should not run 'write' job if cleared", function(done) { + test('Should not run "write" job if cleared', function(done) { var fastdom = new FastDom(); var write = sinon.spy(); var id = fastdom.write(write); @@ -57,7 +57,7 @@ suite('clear', function(){ }); }); - test("Should not run 'defer' job if cleared", function(done) { + test('Should not run "defer" job if cleared', function(done) { var fastdom = new FastDom(); var write = sinon.spy(); var id = fastdom.defer(3, write); @@ -76,7 +76,7 @@ suite('clear', function(){ }); }); - test("Should remove reference to the job if cleared", function(done) { + test('Should remove reference to the job if cleared', function(done) { var fastdom = new FastDom(); var write = sinon.spy(); var id = fastdom.defer(2, write); diff --git a/test/test.defer.js b/test/test.defer.js index c1ae179..3e56a94 100644 --- a/test/test.defer.js +++ b/test/test.defer.js @@ -1,7 +1,7 @@ suite('defer', function(){ - test("Should run the job after the specified number of frames", function(done) { + test('Should run the job after the specified number of frames', function(done) { var fastdom = new FastDom(); var job = sinon.spy(); @@ -22,7 +22,7 @@ suite('defer', function(){ }); }); - test("Should call a deferred callback with the given context", function(done) { + test('Should call a deferred callback with the given context', function(done) { var fastdom = new FastDom(); var cb = sinon.spy(); var ctx = { foo: 'bar' }; @@ -33,7 +33,7 @@ suite('defer', function(){ }, ctx); }); - test("Should remove the reference to the job once run", function(done) { + test('Should remove the reference to the job once run', function(done) { var fastdom = new FastDom(); var callback = sinon.spy(); var id = fastdom.defer(2, callback); diff --git a/test/test.set.js b/test/test.set.js index 0ed296b..440848d 100644 --- a/test/test.set.js +++ b/test/test.set.js @@ -1,7 +1,7 @@ suite('set', function() { - test("Should run reads before writes", function(done) { + test('Should run reads before writes', function(done) { var fastdom = new FastDom(); var read = sinon.spy(function() { @@ -17,7 +17,7 @@ suite('set', function() { fastdom.write(write); }); - test("Should call all reads together, followed by all writes", function(done) { + test('Should call all reads together, followed by all writes', function(done) { var fastdom = new FastDom(); var read1 = sinon.spy(); var read2 = sinon.spy(); @@ -41,7 +41,7 @@ suite('set', function() { }); }); - test("Should call a read in the same frame if scheduled inside a read callback", function(done) { + test('Should call a read in the same frame if scheduled inside a read callback', function(done) { var fastdom = new FastDom(); var cb = sinon.spy(); @@ -62,7 +62,7 @@ suite('set', function() { }); }); - test("Should call a write in the same frame if scheduled inside a read callback", function(done) { + test('Should call a write in the same frame if scheduled inside a read callback', function(done) { var fastdom = new FastDom(); var cb = sinon.spy(); @@ -83,7 +83,7 @@ suite('set', function() { }); }); - test("Should call a read in the *next* frame if scheduled inside a write callback", function(done) { + test('Should call a read in the *next* frame if scheduled inside a write callback', function(done) { var fastdom = new FastDom(); var cb = sinon.spy(); @@ -103,7 +103,7 @@ suite('set', function() { }); }); - test("Should call a 'read' callback with the given context", function(done) { + test('Should call a "read" callback with the given context', function(done) { var fastdom = new FastDom(); var cb = sinon.spy(); var ctx = { foo: 'bar' }; @@ -114,7 +114,7 @@ suite('set', function() { }, ctx); }); - test("Should call a 'write' callback with the given context", function(done) { + test('Should call a "write" callback with the given context', function(done) { var fastdom = new FastDom(); var cb = sinon.spy(); var ctx = { foo: 'bar' }; @@ -125,7 +125,7 @@ suite('set', function() { }, ctx); }); - test("Should have empty job hash when batch complete", function(done) { + test('Should have empty job hash when batch complete', function(done) { var fastdom = new FastDom(); fastdom.read(function(){}); @@ -142,7 +142,7 @@ suite('set', function() { }); }); - test("Should maintain correct context if single method is registered twice", function(done) { + test('Should maintain correct context if single method is registered twice', function(done) { var fastdom = new FastDom(); var ctx1 = { foo: 'bar' }; var ctx2 = { bar: 'baz' }; @@ -162,7 +162,7 @@ suite('set', function() { }); }); - test("Should call a registered onError handler when an error is thrown inside a job", function(done) { + test('Should call a registered onError handler when an error is thrown inside a job', function(done) { var fastdom = new FastDom(); var err1 = { some: 'error1' }; var err2 = { some: 'error2' }; |