[Pkg-javascript-commits] [backbone] 80/173: Enable ESLint rule: new-cap

Jonas Smedegaard dr at jones.dk
Wed Aug 31 07:44:05 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 2f5cd8bee90b2950b3c40e2050ae1a4d5af7b18f
Author: Jordan Eldredge <jordan at jordaneldredge.com>
Date:   Tue Dec 15 21:51:38 2015 -0800

    Enable ESLint rule: new-cap
    
    Constructor functions must start with a capital letter.
---
 .eslintrc          | 1 +
 test/collection.js | 4 ++--
 test/model.js      | 8 ++++----
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/.eslintrc b/.eslintrc
index b92ad55..3061574 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -17,6 +17,7 @@
     "linebreak-style": 2,
     "max-depth": [1, 4],
     "max-params": [1, 5],
+    "new-cap": [2, {"newIsCapExceptions": ["model"]}],
     "no-alert": 2,
     "no-caller": 2,
     "no-catch-shadow": 2,
diff --git a/test/collection.js b/test/collection.js
index 7c6a1dd..c3ba334 100644
--- a/test/collection.js
+++ b/test/collection.js
@@ -1214,12 +1214,12 @@
     assert.expect(3);
     var m1 = {_id: 1};
     var m2 = {_id: 2};
-    var col = Backbone.Collection.extend({
+    var Col = Backbone.Collection.extend({
       model: Backbone.Model.extend({
         idAttribute: '_id'
       })
     });
-    var c = new col;
+    var c = new Col;
     c.set([m1, m2]);
     assert.equal(c.length, 2);
     c.set([m1]);
diff --git a/test/model.js b/test/model.js
index 47a93a6..1e31ec7 100644
--- a/test/model.js
+++ b/test/model.js
@@ -1,7 +1,7 @@
 (function() {
 
-  var proxy = Backbone.Model.extend();
-  var klass = Backbone.Collection.extend({
+  var ProxyModel = Backbone.Model.extend();
+  var Klass = Backbone.Collection.extend({
     url: function() { return '/collection'; }
   });
   var doc, collection;
@@ -9,13 +9,13 @@
   QUnit.module("Backbone.Model", {
 
     beforeEach: function(assert) {
-      doc = new proxy({
+      doc = new ProxyModel({
         id: '1-the-tempest',
         title: "The Tempest",
         author: "Bill Shakespeare",
         length: 123
       });
-      collection = new klass();
+      collection = new Klass();
       collection.add(doc);
     }
 

-- 
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