[Pkg-javascript-commits] [backbone] 85/173: Add ESLint rule: no-undef

Jonas Smedegaard dr at jones.dk
Wed Aug 31 07:44:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository backbone.

commit 7dbdd0ac6b765464a17bab841774394d002d96ff
Author: Jordan Eldredge <jordan at jordaneldredge.com>
Date:   Tue Dec 15 22:53:48 2015 -0800

    Add ESLint rule: no-undef
---
 .eslintrc          | 6 +++++-
 test/.eslintrc     | 5 ++++-
 test/collection.js | 6 +++---
 test/events.js     | 2 +-
 test/model.js      | 8 ++++----
 5 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/.eslintrc b/.eslintrc
index 3061574..2aad968 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -4,7 +4,10 @@
     "node": true,
     "amd": true
   },
-
+  "globals": {
+    "attachEvent": true,
+    "detachEvent": true
+  },
   "rules": {
     "array-bracket-spacing": [2],
     "camelcase": 2,
@@ -57,6 +60,7 @@
     "no-spaced-func": 2,
     "no-throw-literal": 2,
     "no-trailing-spaces": 2,
+    "no-undef": 2,
     "no-undef-init": 2,
     "no-undefined": 2,
     "no-unneeded-ternary": 2,
diff --git a/test/.eslintrc b/test/.eslintrc
index 50c9972..fb3ff13 100644
--- a/test/.eslintrc
+++ b/test/.eslintrc
@@ -3,7 +3,10 @@
     "browser": true
   },
   "globals": {
-    "QUnit": false
+    "QUnit": false,
+    "Backbone": true,
+    "_": true,
+    "$": true
   },
   "rules": {
     "array-bracket-spacing": 0,
diff --git a/test/collection.js b/test/collection.js
index c3ba334..80cba57 100644
--- a/test/collection.js
+++ b/test/collection.js
@@ -1139,7 +1139,7 @@
     var model = new Backbone.Model();
     var collection = new Backbone.Collection([model])
     .on('reset', function(collection, options) {
-      deepEqual(options.previousModels, [model]);
+      assert.deepEqual(options.previousModels, [model]);
     });
     collection.reset([]);
   });
@@ -1402,7 +1402,7 @@
     var collection = new (Backbone.Collection.extend({
       comparator: 'a'
     }))([{id: 1}, {id: 2}, {id: 3}]);
-    collection.on('sort', function() { ok(true); });
+    collection.on('sort', function() { assert.ok(true); });
     collection.add({id: 4}); // do sort, new model
     collection.add({id: 1, a: 1}, {merge: true}); // do sort, comparator change
     collection.add({id: 1, b: 1}, {merge: true}); // don't sort, no comparator change
@@ -1418,7 +1418,7 @@
         return a.get('a') > b.get('a') ? 1 : (a.get('a') < b.get('a') ? -1 : 0);
       }
     }))([{id: 1}, {id: 2}, {id: 3}]);
-    collection.on('sort', function() { ok(true); });
+    collection.on('sort', function() { assert.ok(true); });
     collection.add({id: 4}); // do sort, new model
     collection.add({id: 1, a: 1}, {merge: true}); // do sort, model change
     collection.add({id: 1, b: 1}, {merge: true}); // do sort, model change
diff --git a/test/events.js b/test/events.js
index e10e7dd..6a5a620 100644
--- a/test/events.js
+++ b/test/events.js
@@ -110,7 +110,7 @@
 
     obj.off().on({
       a: function() {
-        strictEqual(this, context, 'will not override explicit `context` param');
+        assert.strictEqual(this, context, 'will not override explicit `context` param');
       }
     }, this, context).trigger('a');
   });
diff --git a/test/model.js b/test/model.js
index 655712f..8d18743 100644
--- a/test/model.js
+++ b/test/model.js
@@ -849,14 +849,14 @@
     assert.expect(4);
     new Backbone.Model()
     .on('change:state', function(model, newState) {
-      equal(model.previous('state'), undefined);
-      equal(newState, 'hello');
+      assert.equal(model.previous('state'), undefined);
+      assert.equal(newState, 'hello');
       // Fire a nested change event.
       model.set({other: 'whatever'});
     })
     .on('change:state', function(model, newState) {
-      equal(model.previous('state'), undefined);
-      equal(newState, 'hello');
+      assert.equal(model.previous('state'), undefined);
+      assert.equal(newState, 'hello');
     })
     .set({state: 'hello'});
   });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list