]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix ESLint errors (#4485)
authorBen McCann <benjamin.j.mccann@gmail.com>
Sat, 22 Jul 2017 07:19:06 +0000 (00:19 -0700)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Sat, 22 Jul 2017 07:19:06 +0000 (09:19 +0200)
src/chart.js
src/controllers/controller.doughnut.js
src/core/core.controller.js
src/core/core.scale.js
src/scales/scale.logarithmic.js
src/scales/scale.radialLinear.js
test/jasmine.utils.js
test/specs/controller.polarArea.tests.js
test/specs/scale.category.tests.js
test/specs/scale.logarithmic.tests.js

index 56fc8f24cd0941793809b174ed7a4318cb213320..9b50728a263a0e841162d4b8fe872293495ca95e 100644 (file)
@@ -53,9 +53,9 @@ require('./charts/Chart.Scatter')(Chart);
 var plugins = [];
 
 plugins.push(
-    require('./plugins/plugin.filler')(Chart),
-    require('./plugins/plugin.legend')(Chart),
-    require('./plugins/plugin.title')(Chart)
+       require('./plugins/plugin.filler')(Chart),
+       require('./plugins/plugin.legend')(Chart),
+       require('./plugins/plugin.title')(Chart)
 );
 
 Chart.plugins.register(plugins);
index 8c472fe302b1d22d19cc2d90fd2e02c83a0c81ec..500c83c7c50b6d4dc1505265bad557c63c078baf 100644 (file)
@@ -168,7 +168,7 @@ module.exports = function(Chart) {
                                var endAngle = startAngle + circumference;
                                var start = {x: Math.cos(startAngle), y: Math.sin(startAngle)};
                                var end = {x: Math.cos(endAngle), y: Math.sin(endAngle)};
-                               var contains0 = (startAngle <= 0 && 0 <= endAngle) || (startAngle <= Math.PI * 2.0 && Math.PI * 2.0 <= endAngle);
+                               var contains0 = (startAngle <= 0 && endAngle >= 0) || (startAngle <= Math.PI * 2.0 && Math.PI * 2.0 <= endAngle);
                                var contains90 = (startAngle <= Math.PI * 0.5 && Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 2.5 && Math.PI * 2.5 <= endAngle);
                                var contains180 = (startAngle <= -Math.PI && -Math.PI <= endAngle) || (startAngle <= Math.PI && Math.PI <= endAngle);
                                var contains270 = (startAngle <= -Math.PI * 0.5 && -Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 1.5 && Math.PI * 1.5 <= endAngle);
index 2033c5425495be82fb2ab094880ee3145eace991..54de51d773a6dfa38e3b4783cc433f7a20225f8d 100644 (file)
@@ -95,7 +95,7 @@ module.exports = function(Chart) {
                         * @private
                         */
                        me.chart = me;
-                       me.controller = me;  // chart.chart.controller #inception
+                       me.controller = me; // chart.chart.controller #inception
 
                        // Add the chart instance to the global namespace
                        Chart.instances[me.id] = me;
@@ -172,7 +172,7 @@ module.exports = function(Chart) {
                        // the canvas render width and height will be casted to integers so make sure that
                        // the canvas display style uses the same integer values to avoid blurring effect.
 
-            // Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collased
+                       // Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collased
                        var newWidth = Math.max(0, Math.floor(helpers.getMaximumWidth(canvas)));
                        var newHeight = Math.max(0, Math.floor(aspectRatio ? newWidth / aspectRatio : helpers.getMaximumHeight(canvas)));
 
@@ -709,7 +709,7 @@ module.exports = function(Chart) {
                        var me = this;
                        me.tooltip = new Chart.Tooltip({
                                _chart: me,
-                               _chartInstance: me,            // deprecated, backward compatibility
+                               _chartInstance: me, // deprecated, backward compatibility
                                _data: me.data,
                                _options: me.options.tooltips
                        }, me);
index 27a0f0596fe40fc1ce52da9c3fd7cad885c6e1da..18c04bd99d524e296a53a64b624e9c95f07f416f 100644 (file)
@@ -509,9 +509,9 @@ module.exports = function(Chart) {
                        var min = me.min;
                        var max = me.max;
 
-                       return me.beginAtZero ? 0:
-                               min < 0 && max < 0? max :
-                               min > 0 && max > 0? min :
+                       return me.beginAtZero ? 0 :
+                               min < 0 && max < 0 ? max :
+                               min > 0 && max > 0 ? min :
                                0;
                },
 
index a6a0606ade1edba368387c406f019d92f6f9297e..3d2b81c4e0ef8a5070084bb3371eff3736d5d26e 100644 (file)
@@ -235,7 +235,7 @@ module.exports = function(Chart) {
                        if (me.isHorizontal()) {
                                innerDimension = me.width;
                                value = me.start * Math.pow(10, (pixel - me.left) * range / innerDimension);
-                       } else {  // todo: if start === 0
+                       } else { // todo: if start === 0
                                innerDimension = me.height;
                                value = Math.pow(10, (me.bottom - pixel) * range / innerDimension) / me.start;
                        }
index f1194fd82ae58f7e2955e6abd0586cabb1be67d0..7b5f5a537b8eeae06eb26f89756dde4803bdcbdf 100644 (file)
@@ -460,9 +460,9 @@ module.exports = function(Chart) {
                        var max = me.max;
 
                        return me.getPointPositionForValue(0,
-                               me.beginAtZero? 0:
-                               min < 0 && max < 0? max :
-                               min > 0 && max > 0? min :
+                               me.beginAtZero ? 0 :
+                               min < 0 && max < 0 ? max :
+                               min > 0 && max > 0 ? min :
                                0);
                },
 
index f5ead49ec09a348783c17b57bd3cef0f7190d348..8d27485bf4bd8ccb3dbf16f9b0360d7d0252ca24 100644 (file)
@@ -98,7 +98,7 @@ function injectCSS(css) {
        var head = document.getElementsByTagName('head')[0];
        var style = document.createElement('style');
        style.setAttribute('type', 'text/css');
-       if (style.styleSheet) {   // IE
+       if (style.styleSheet) { // IE
                style.styleSheet.cssText = css;
        } else {
                style.appendChild(document.createTextNode(css));
index de7d4acfaaceaadf88168b387eecd3166320bc8f..636473cabf7793fe7c83cd1398eff232da9930a4 100644 (file)
@@ -5,8 +5,8 @@ describe('Polar area controller tests', function() {
                        type: 'polarArea',
                        data: {
                                datasets: [
-                               {data: []},
-                               {data: []}
+                                       {data: []},
+                                       {data: []}
                                ],
                                labels: []
                        }
index c11f751962baaf9ffa8a93b8e7485b7ab0d51fb1..e7774bf443fbf25bf72860189a05134e3e57e5bd 100644 (file)
@@ -42,7 +42,7 @@ describe('Category scale tests', function() {
                                padding: 0,
                                reverse: false,
                                display: true,
-                               callback: defaultConfig.ticks.callback,  // make this nicer, then check explicitly below
+                               callback: defaultConfig.ticks.callback, // make this nicer, then check explicitly below
                                autoSkip: true,
                                autoSkipPadding: 0,
                                labelOffset: 0,
index 16ab3d7800d05d63cf03d9da86fa607ac95d3156..863f747729393893bb15ca024d8baa42bc4a3d59 100644 (file)
@@ -718,9 +718,9 @@ describe('Logarithmic Scale tests', function() {
                });
 
                var xScale = chart.scales.xScale;
-               expect(xScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(495);  // right - paddingRight
+               expect(xScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(495); // right - paddingRight
                expect(xScale.getPixelForValue(1, 0, 0)).toBeCloseToPixel(37);   // left + paddingLeft
-               expect(xScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(278);  // halfway
+               expect(xScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(278); // halfway
                expect(xScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(37);   // 0 is invalid, put it on the left.
 
                expect(xScale.getValueForPixel(495)).toBeCloseToPixel(80);
@@ -728,10 +728,10 @@ describe('Logarithmic Scale tests', function() {
                expect(xScale.getValueForPixel(278)).toBeCloseTo(10, 1e-4);
 
                var yScale = chart.scales.yScale;
-               expect(yScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(32);   // top + paddingTop
+               expect(yScale.getPixelForValue(80, 0, 0)).toBeCloseToPixel(32);  // top + paddingTop
                expect(yScale.getPixelForValue(1, 0, 0)).toBeCloseToPixel(484);  // bottom - paddingBottom
-               expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(246);  // halfway
-               expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484);   // 0 is invalid. force it on bottom
+               expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(246); // halfway
+               expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484);  // 0 is invalid. force it on bottom
 
                expect(yScale.getValueForPixel(32)).toBeCloseTo(80, 1e-4);
                expect(yScale.getValueForPixel(484)).toBeCloseTo(1, 1e-4);
@@ -762,20 +762,20 @@ describe('Logarithmic Scale tests', function() {
                });
 
                var yScale = chart.scales.yScale;
-               expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(32);   // top + paddingTop
-               expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484);  // bottom - paddingBottom
-               expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(475);  // minNotZero 2% from range
+               expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(32);     // top + paddingTop
+               expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(484);     // bottom - paddingBottom
+               expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(475); // minNotZero 2% from range
                expect(yScale.getPixelForValue(0.5, 0, 0)).toBeCloseToPixel(344);
                expect(yScale.getPixelForValue(4, 0, 0)).toBeCloseToPixel(213);
                expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(155);
                expect(yScale.getPixelForValue(63, 0, 0)).toBeCloseToPixel(38.5);
 
-               chart.options.scales.yAxes[0].ticks.reverse = true;   // Reverse mode
+               chart.options.scales.yAxes[0].ticks.reverse = true;     // Reverse mode
                chart.update();
 
-               expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(484); // bottom - paddingBottom
-               expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(32);  // top + paddingTop
-               expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(41);  // minNotZero 2% from range
+               expect(yScale.getPixelForValue(70, 0, 0)).toBeCloseToPixel(484);   // bottom - paddingBottom
+               expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(32);     // top + paddingTop
+               expect(yScale.getPixelForValue(0.063, 0, 0)).toBeCloseToPixel(41); // minNotZero 2% from range
                expect(yScale.getPixelForValue(0.5, 0, 0)).toBeCloseToPixel(172);
                expect(yScale.getPixelForValue(4, 0, 0)).toBeCloseToPixel(303);
                expect(yScale.getPixelForValue(10, 0, 0)).toBeCloseToPixel(361);