From 68b3cbe12dbb060533e8e7a9a0d5cd9b9fdb8eb1 Mon Sep 17 00:00:00 2001
From: Chris Hallberg <crhallberg@gmail.com>
Date: Fri, 10 Jun 2016 11:01:49 -0400
Subject: [PATCH] Add comma-spacing to eslint.

---
 .eslintrc.json                        |  3 ++-
 themes/bootstrap3/js/cart.js          | 12 ++++++------
 themes/bootstrap3/js/common.js        |  2 +-
 themes/bootstrap3/js/hierarchyTree.js |  2 +-
 themes/bootstrap3/js/lightbox.js      |  8 ++++----
 themes/bootstrap3/js/pubdate_vis.js   |  6 +++---
 6 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/.eslintrc.json b/.eslintrc.json
index 38cee1aa3be..fc5c94a7180 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -21,7 +21,8 @@
     "no-console": ["warn", { "allow": ["warn", "error"] }],
     "no-unneeded-ternary": "warn",
 
-    "block-spacing" : ["warn", "always"],
+    "block-spacing": ["warn", "always"],
+    "comma-spacing": ["warn", { "before": false, "after": true }],
     "indent": ["error", 2],
     "keyword-spacing": ["warn", { "before": true, "after": true }],
     "linebreak-style": ["error", "unix"],
diff --git a/themes/bootstrap3/js/cart.js b/themes/bootstrap3/js/cart.js
index 6e3e1fc7f46..79b81fd33dc 100644
--- a/themes/bootstrap3/js/cart.js
+++ b/themes/bootstrap3/js/cart.js
@@ -70,7 +70,7 @@ VuFind.register('cart', function Cart() {
     updateCount();
     return true;
   }
-  function removeItem(id,source) {
+  function removeItem(id, source) {
     var cartItems = _getItems();
     var cartSources = _getSources();
     // Find
@@ -88,11 +88,11 @@ VuFind.register('cart', function Cart() {
           break;
         }
       }
-      cartItems.splice(cartIndex,1);
+      cartItems.splice(cartIndex, 1);
       // Remove unused sources
       if (!saveSource) {
         var oldSources = cartSources.slice(0);
-        cartSources.splice(sourceIndex,1);
+        cartSources.splice(sourceIndex, 1);
         // Adjust source index characters
         for (var j = cartItems.length; j--;) {
           var si = cartItems[j].charCodeAt(0) - 65;
@@ -174,11 +174,11 @@ VuFind.register('cart', function Cart() {
         var $parent = $(this).parent();
         $parent.find('.cart-add.correct,.cart-remove.correct').removeClass('correct hidden');
         $parent.find('.cart-add').click(function cartAddClick() {
-          addItem(currentId,currentSource);
+          addItem(currentId, currentSource);
           $parent.find('.cart-add,.cart-remove').toggleClass('hidden');
         });
         $parent.find('.cart-remove').click(function cartRemoveClick() {
-          removeItem(currentId,currentSource);
+          removeItem(currentId, currentSource);
           $parent.find('.cart-add,.cart-remove').toggleClass('hidden');
         });
       });
@@ -188,7 +188,7 @@ VuFind.register('cart', function Cart() {
       _registerUpdate($form);
     }
     $("#updateCart, #bottom_updateCart").popover({content: '', html: true, trigger: 'manual'});
-  };
+  }
 
   // Reveal
   return {
diff --git a/themes/bootstrap3/js/common.js b/themes/bootstrap3/js/common.js
index 41e07f33b56..5b6c6555a4c 100644
--- a/themes/bootstrap3/js/common.js
+++ b/themes/bootstrap3/js/common.js
@@ -90,7 +90,7 @@ function deparam(url) {
       continue;
     }
     if (name.substring(name.length - 2) === '[]') {
-      name = name.substring(0,name.length - 2);
+      name = name.substring(0, name.length - 2);
       if (!request[name]) {
         request[name] = [];
       }
diff --git a/themes/bootstrap3/js/hierarchyTree.js b/themes/bootstrap3/js/hierarchyTree.js
index 4035c78d77c..3acdf3e48b3 100644
--- a/themes/bootstrap3/js/hierarchyTree.js
+++ b/themes/bootstrap3/js/hierarchyTree.js
@@ -182,7 +182,7 @@ $(document).ready(function hierarchyTreeReady() {
       }
     })
     .jstree({
-      plugins: ['search','types'],
+      plugins: ['search', 'types'],
       core: {
         data: function jsTreeCoreData(obj, cb) {
           $.ajax({
diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js
index 089307b53d6..b3d42e2fa6c 100644
--- a/themes/bootstrap3/js/lightbox.js
+++ b/themes/bootstrap3/js/lightbox.js
@@ -23,7 +23,7 @@ VuFind.register('lightbox', function Lightbox() {
       _lightboxTitle = '';
     }
     _modal.modal('handleUpdate');
-  };
+  }
   function _emit(msg, _details) {
     var details = _details || {};
     // Fallback to document.createEvent() if creating a new CustomEvent fails (e.g. IE 11)
@@ -62,7 +62,7 @@ VuFind.register('lightbox', function Lightbox() {
     _html('<div class="flash-message alert alert-' + type + '">' + message + '</div>'
         + '<button class="btn btn-default" data-dismiss="modal">' + VuFind.translate('close') + '</button>');
     _modal.modal('show');
-  };
+  }
   function flashMessage(message, _type) {
     var type = _type || 'info';
     _modalBody.find('.flash-message,.fa.fa-spinner').remove();
@@ -176,10 +176,10 @@ VuFind.register('lightbox', function Lightbox() {
         showAlert(VuFind.translate('error_occurred'), 'danger');
       });
     return _xhr;
-  };
+  }
   function reload() {
     ajax({ url: _currentUrl || _originalUrl });
-  };
+  }
 
   /**
    * Evaluate a callback
diff --git a/themes/bootstrap3/js/pubdate_vis.js b/themes/bootstrap3/js/pubdate_vis.js
index 9863e90040a..97b417ff54a 100644
--- a/themes/bootstrap3/js/pubdate_vis.js
+++ b/themes/bootstrap3/js/pubdate_vis.js
@@ -92,7 +92,7 @@ function loadVis(facetFields, searchParams, baseURL, zooming) {
         for (var i = 0; i < val.data.length; i++) {
           if (val.data[i][0] < val.min - 5 || val.data[i][0] > parseInt(val.max, 10) + 5) {
             //remove this
-            val.data.splice(i,1);
+            val.data.splice(i, 1);
             i--;
           }
         }
@@ -109,13 +109,13 @@ function loadVis(facetFields, searchParams, baseURL, zooming) {
       var plot = $.plot(placeholder, [val], options);
       if (hasFilter) {
         // mark pre-selected area
-        plot.setSelection({ x1: val.min , x2: val.max});
+        plot.setSelection({ x1: val.min, x2: val.max});
       }
       // selection handler
       placeholder.bind("plotselected", function plotselected(event, ranges) {
         var from = Math.floor(ranges.xaxis.from);
         var to = Math.ceil(ranges.xaxis.to);
-        window.location.href = val.removalURL + '&daterange[]=' + key + '&' + key + 'to=' + PadDigits(to,4) + '&' + key + 'from=' + PadDigits(from,4);
+        window.location.href = val.removalURL + '&daterange[]=' + key + '&' + key + 'to=' + PadDigits(to, 4) + '&' + key + 'from=' + PadDigits(from, 4);
       });
 
       if (hasFilter) {
-- 
GitLab