From a23e24148054d8d5e00a71ab2731cb688a7c5d31 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 7 Dec 2016 11:37:18 +1300 Subject: [PATCH] Eslint clean ups --- app/assets/javascripts/graphs/bar_group.js | 7 +++---- app/assets/javascripts/graphs/bar_label_group.js | 2 +- app/assets/javascripts/graphs/height_scale.js | 4 ++-- app/assets/javascripts/graphs/horizontal_bar_graph.js | 2 +- app/assets/javascripts/graphs/width_scale.js | 9 +++------ spec/javascripts/graphs/bar_group_spec.js | 2 +- spec/javascripts/graphs/bar_label_group_spec.js | 4 ++-- spec/javascripts/graphs/height_scale_spec.js | 2 +- spec/javascripts/graphs/horizontal_bar_graph_spec.js | 2 +- spec/javascripts/graphs/width_scale_spec.js | 6 +----- 10 files changed, 16 insertions(+), 24 deletions(-) diff --git a/app/assets/javascripts/graphs/bar_group.js b/app/assets/javascripts/graphs/bar_group.js index baed37f6b..b0f87d196 100644 --- a/app/assets/javascripts/graphs/bar_group.js +++ b/app/assets/javascripts/graphs/bar_group.js @@ -9,7 +9,6 @@ Currently these are used for HorizontalBarGraph. */ - var growstuff = (window.growstuff = window.growstuff || {}); var WidthScale = growstuff.WidthScale; var HeightScale = growstuff.HeightScale; @@ -54,11 +53,11 @@ BarGroup.prototype.getBarValues = function () { for (i; i < data.bars.length; i++){ barValues.push(data.bars[i].value) - }; + } return barValues; - }; +}; growstuff.BarGroup = BarGroup; -})(); \ No newline at end of file +}()); \ No newline at end of file diff --git a/app/assets/javascripts/graphs/bar_label_group.js b/app/assets/javascripts/graphs/bar_label_group.js index a3d66b419..ca8f82533 100644 --- a/app/assets/javascripts/graphs/bar_label_group.js +++ b/app/assets/javascripts/graphs/bar_label_group.js @@ -37,4 +37,4 @@ This file draws the labels to the left of each bar. growstuff.BarLabelGroup = BarLabelGroup; -})(); \ No newline at end of file +}()) \ No newline at end of file diff --git a/app/assets/javascripts/graphs/height_scale.js b/app/assets/javascripts/graphs/height_scale.js index 4ed488049..7521d50f0 100644 --- a/app/assets/javascripts/graphs/height_scale.js +++ b/app/assets/javascripts/graphs/height_scale.js @@ -12,7 +12,7 @@ the svg function HeightScale(data){ this._data = data; - }; + } HeightScale.prototype.render = function(){ var data = this._data; @@ -26,4 +26,4 @@ the svg growstuff.HeightScale = HeightScale; -})(); \ No newline at end of file +}()); \ No newline at end of file diff --git a/app/assets/javascripts/graphs/horizontal_bar_graph.js b/app/assets/javascripts/graphs/horizontal_bar_graph.js index abbe9bf8f..c37593d5f 100644 --- a/app/assets/javascripts/graphs/horizontal_bar_graph.js +++ b/app/assets/javascripts/graphs/horizontal_bar_graph.js @@ -50,4 +50,4 @@ The main dimensions of the graph are rendered here. }; growstuff.HorizontalBarGraph = HorizontalBarGraph; -})(); \ No newline at end of file +}()); \ No newline at end of file diff --git a/app/assets/javascripts/graphs/width_scale.js b/app/assets/javascripts/graphs/width_scale.js index 6c3686c01..a88507116 100644 --- a/app/assets/javascripts/graphs/width_scale.js +++ b/app/assets/javascripts/graphs/width_scale.js @@ -12,19 +12,16 @@ to the display size of the svg function WidthScale (data){ this._data = data; - }; + } WidthScale.prototype.render = function() { var data = this._data; var scaleType = data.width.scale; var axisSize = data.width.size; - return d3.scale[scaleType]() .domain([0, d3.max(this.getBarValues())]) .range([0, axisSize]); - - }; WidthScale.prototype.getBarValues = function(){ @@ -35,11 +32,11 @@ to the display size of the svg for (i; i < data.bars.length; i++){ barValues.push(data.bars[i].value) - }; + } return barValues; } growstuff.WidthScale = WidthScale; -})(); \ No newline at end of file +}()); \ No newline at end of file diff --git a/spec/javascripts/graphs/bar_group_spec.js b/spec/javascripts/graphs/bar_group_spec.js index 099a6ac98..dffddd775 100644 --- a/spec/javascripts/graphs/bar_group_spec.js +++ b/spec/javascripts/graphs/bar_group_spec.js @@ -62,4 +62,4 @@ }); -})(); \ No newline at end of file +}()); \ No newline at end of file diff --git a/spec/javascripts/graphs/bar_label_group_spec.js b/spec/javascripts/graphs/bar_label_group_spec.js index 36fa7b530..a94606713 100644 --- a/spec/javascripts/graphs/bar_label_group_spec.js +++ b/spec/javascripts/graphs/bar_label_group_spec.js @@ -1,4 +1,4 @@ -function(){ +(function(){ 'use strict'; /* @@ -39,4 +39,4 @@ function(){ }); -}(); \ No newline at end of file +}()); \ No newline at end of file diff --git a/spec/javascripts/graphs/height_scale_spec.js b/spec/javascripts/graphs/height_scale_spec.js index fd2ac388f..0de6a987a 100644 --- a/spec/javascripts/graphs/height_scale_spec.js +++ b/spec/javascripts/graphs/height_scale_spec.js @@ -34,4 +34,4 @@ }); }); -})(); \ No newline at end of file +}()); \ No newline at end of file diff --git a/spec/javascripts/graphs/horizontal_bar_graph_spec.js b/spec/javascripts/graphs/horizontal_bar_graph_spec.js index 24ea1fea0..8e6b62a48 100644 --- a/spec/javascripts/graphs/horizontal_bar_graph_spec.js +++ b/spec/javascripts/graphs/horizontal_bar_graph_spec.js @@ -72,4 +72,4 @@ }); -})(); +}()); diff --git a/spec/javascripts/graphs/width_scale_spec.js b/spec/javascripts/graphs/width_scale_spec.js index df35c70f2..74265781a 100644 --- a/spec/javascripts/graphs/width_scale_spec.js +++ b/spec/javascripts/graphs/width_scale_spec.js @@ -36,10 +36,6 @@ it ('calls the d3 range function to draw the width', function(){ expect(mockD3.range).toHaveBeenCalledWith([0, 300]); }); - - - - }); -})(); \ No newline at end of file +}()); \ No newline at end of file