[Pkg-javascript-commits] [backbone] 95/173: Add ESLint warning: no-extra-parens

Jonas Smedegaard dr at jones.dk
Wed Aug 31 07:44:07 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 1c66a6e127f7c3aff28af73731fbaafcaef8aee4
Author: Jordan Eldredge <jordan at jordaneldredge.com>
Date:   Sun Dec 20 11:14:15 2015 -0800

    Add ESLint warning: no-extra-parens
    
    This is only enabled as a warning, since in some cases I think it adds clarity.
    I left the "gratuitous parentheses" when they were clarifying nested ternary
    operators or clarifying the evaluation order of `&&`s and `||`s.
---
 .eslintrc      | 1 +
 backbone.js    | 4 ++--
 test/events.js | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/.eslintrc b/.eslintrc
index 2017362..6a512e8 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -38,6 +38,7 @@
     "no-ex-assign": 2,
     "no-extend-native": 2,
     "no-extra-boolean-cast": 2,
+    "no-extra-parens": 1,
     "no-extra-semi": 2,
     "no-fallthrough": 2,
     "no-floating-decimal": 2,
diff --git a/backbone.js b/backbone.js
index dced267..caf45ca 100644
--- a/backbone.js
+++ b/backbone.js
@@ -840,7 +840,7 @@
       var remove = options.remove;
 
       var sort = false;
-      var sortable = this.comparator && (at == null) && options.sort !== false;
+      var sortable = this.comparator && at == null && options.sort !== false;
       var sortAttr = _.isString(this.comparator) ? this.comparator : null;
 
       // Turn bare objects into model references, and prevent invalid models
@@ -1802,7 +1802,7 @@
       // fragment to store history.
       } else if (this._wantsHashChange) {
         this._updateHash(this.location, fragment, options.replace);
-        if (this.iframe && (fragment !== this.getHash(this.iframe.contentWindow))) {
+        if (this.iframe && fragment !== this.getHash(this.iframe.contentWindow)) {
           var iWindow = this.iframe.contentWindow;
 
           // Opening and closing the iframe tricks IE7 and earlier to push a
diff --git a/test/events.js b/test/events.js
index 9306f75..ffcdde6 100644
--- a/test/events.js
+++ b/test/events.js
@@ -427,7 +427,7 @@
     };
 
     var obj = _.extend({}, Backbone.Events);
-    obj.on('event', function() { this.assertTrue(); }, (new TestClass));
+    obj.on('event', function() { this.assertTrue(); }, new TestClass);
     obj.trigger('event');
   });
 

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