diff --git a/.eslintrc b/.eslintrc index e3b18209809..48088bdcc3d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,6 +3,9 @@ "extends": [ "eslint:recommended" ], + "parserOptions": { + "ecmaVersion": 5, + }, "env": { "commonjs": true }, @@ -14,7 +17,7 @@ "indent": [2, 4, {"SwitchCase": 1}], "max-len": [0, 80], "brace-style": [0, "stroustrup", {"allowSingleLine": true}], - "curly": [0, "multi"], + "curly": [2, "multi-line"], "camelcase": [0, {"properties": "never"}], "comma-spacing": [2, {"before": false, "after": true}], "comma-style": [2, "last"], @@ -32,6 +35,8 @@ "space-in-parens": [2, "never"], "space-before-function-paren": [2, "never"], "space-before-blocks": [2], + "spaced-comment": [2, "always"], + "no-tabs": [2], "no-multi-spaces": [2], "no-whitespace-before-property": [2], "no-unexpected-multiline": [2], @@ -39,13 +44,15 @@ "space-infix-ops": [2, {"int32Hint": true}], "quotes": [2, "single"], "dot-notation": [2], + "dot-location": [2, "property"], "operator-linebreak": [2, "after"], "eqeqeq": [2], - "new-cap": [0], + "new-cap": [2, { "capIsNewExceptionPattern": "^MathJax\\.." }], "no-redeclare": [2, {"builtinGlobals": true}], "no-shadow": [0, {"builtinGlobals": true}], "block-scoped-var": [2], "no-unused-vars": [2], + "no-undef-init": [2], "no-use-before-define": [2, "nofunc"], "no-loop-func": [2], "no-console": [0], diff --git a/package.json b/package.json index 4e2952e31f5..92dab422ffc 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "build": "npm run preprocess && npm run bundle && npm run header && npm run stats", "cibuild": "npm run preprocess && node tasks/cibundle.js", "watch": "node tasks/watch.js", - "lint": "eslint . || true", + "lint": "eslint --version && eslint . || true", "lint-fix": "eslint . --fix", "pretest": "node tasks/pretest.js", "test-jasmine": "karma start test/jasmine/karma.conf.js", @@ -92,7 +92,7 @@ "browserify": "^13.0.0", "browserify-transform-tools": "^1.5.1", "ecstatic": "^1.4.0", - "eslint": "^3.0.0", + "eslint": "^3.5.0", "falafel": "^1.2.0", "fs-extra": "^0.30.0", "fuse.js": "^2.2.0", diff --git a/src/components/annotations/draw.js b/src/components/annotations/draw.js index 665759756f6..2b104001477 100644 --- a/src/components/annotations/draw.js +++ b/src/components/annotations/draw.js @@ -409,16 +409,16 @@ function drawOne(gd, index, opt, value) { // and the annotation center are visible if(options.showarrow) { if(options.axref === options.xref) { - //we don't want to constrain if the tail is absolute - //or the slope (which is meaningful) will change. + // we don't want to constrain if the tail is absolute + // or the slope (which is meaningful) will change. arrowX = annPosPx.x; } else { arrowX = Lib.constrain(annPosPx.x - options.ax, 1, fullLayout.width - 1); } if(options.ayref === options.yref) { - //we don't want to constrain if the tail is absolute - //or the slope (which is meaningful) will change. + // we don't want to constrain if the tail is absolute + // or the slope (which is meaningful) will change. arrowY = annPosPx.y; } else { arrowY = Lib.constrain(annPosPx.y - options.ay, 1, fullLayout.height - 1); diff --git a/src/components/colorbar/draw.js b/src/components/colorbar/draw.js index a696bcccf5a..a6c28680724 100644 --- a/src/components/colorbar/draw.js +++ b/src/components/colorbar/draw.js @@ -527,7 +527,7 @@ module.exports = function draw(gd, id) { container.attr('transform', 'translate(' + (gs.l - xoffset) + ',' + gs.t + ')'); - //auto margin adjustment + // auto margin adjustment Plots.autoMargin(gd, id, { x: opts.x, y: opts.y, diff --git a/src/components/drawing/index.js b/src/components/drawing/index.js index 3997fd40f31..832b3e76937 100644 --- a/src/components/drawing/index.js +++ b/src/components/drawing/index.js @@ -204,8 +204,10 @@ function singlePointStyle(d, sel, trace, markerScale, lineScale, marker, markerL // handle multi-trace graph edit case if(d.ms === 'various' || marker.size === 'various') r = 3; - else r = subTypes.isBubble(trace) ? + else { + r = subTypes.isBubble(trace) ? sizeFn(d.ms) : (marker.size || 6) / 2; + } // store the calculated size so hover can use it d.mrc = r; diff --git a/src/components/legend/draw.js b/src/components/legend/draw.js index 1f43ae07392..fd08a20baa5 100644 --- a/src/components/legend/draw.js +++ b/src/components/legend/draw.js @@ -590,7 +590,7 @@ function computeLegendDimensions(gd, groups, traces) { maxTraceWidth = 0, offsetX = 0; - //calculate largest width for traces and use for width of all legend items + // calculate largest width for traces and use for width of all legend items traces.each(function(d) { maxTraceWidth = Math.max(40 + d[0].width, maxTraceWidth); }); @@ -604,7 +604,7 @@ function computeLegendDimensions(gd, groups, traces) { offsetX = 0; rowHeight = rowHeight + maxTraceHeight; opts.height = opts.height + maxTraceHeight; - //reset for next row + // reset for next row maxTraceHeight = 0; } @@ -615,7 +615,7 @@ function computeLegendDimensions(gd, groups, traces) { opts.width += traceGap + traceWidth; opts.height = Math.max(opts.height, legendItem.height); - //keep track of tallest trace in group + // keep track of tallest trace in group offsetX += traceGap + traceWidth; maxTraceHeight = Math.max(legendItem.height, maxTraceHeight); }); diff --git a/src/lib/matrix.js b/src/lib/matrix.js index 54aeac27ffc..e0a4fe5a3d3 100644 --- a/src/lib/matrix.js +++ b/src/lib/matrix.js @@ -93,7 +93,7 @@ exports.apply2DTransform = function(transform) { var args = arguments; if(args.length === 3) { args = args[0]; - }//from map + }// from map var xy = arguments.length === 1 ? args[0] : [args[0], args[1]]; return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2); }; diff --git a/src/plot_api/plot_api.js b/src/plot_api/plot_api.js index 8a048a0ee89..1b627b49bc1 100644 --- a/src/plot_api/plot_api.js +++ b/src/plot_api/plot_api.js @@ -355,7 +355,7 @@ function setPlotContext(gd, config) { } } - //staticPlot forces a bunch of others: + // staticPlot forces a bunch of others: if(context.staticPlot) { context.editable = false; context.autosizable = false; @@ -418,8 +418,8 @@ function plotPolar(gd, data, layout) { var titleLayout = function() { this.call(svgTextUtils.convertToTspans); - //TODO: html/mathjax - //TODO: center title + // TODO: html/mathjax + // TODO: center title }; var title = polarPlotSVG.select('.title-group text') @@ -1490,7 +1490,7 @@ function _restyle(gd, aobj, _traces) { } else if(Registry.traceIs(cont, 'cartesian')) { Lib.nestedProperty(cont, 'marker.colors') .set(Lib.nestedProperty(cont, 'marker.color').get()); - //look for axes that are no longer in use and delete them + // look for axes that are no longer in use and delete them flagAxForDelete[cont.xaxis || 'x'] = true; flagAxForDelete[cont.yaxis || 'y'] = true; } diff --git a/src/plots/cartesian/axes.js b/src/plots/cartesian/axes.js index e9a8d807a21..6d6d4fbd225 100644 --- a/src/plots/cartesian/axes.js +++ b/src/plots/cartesian/axes.js @@ -55,7 +55,7 @@ axes.coerceRef = function(containerIn, containerOut, gd, axLetter, dflt) { return Lib.coerce(containerIn, containerOut, attrDef, refAttr); }; -//todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef. +// todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef. // find the list of possible axes to reference with an axref or ayref attribute // and coerce it to that list axes.coerceARef = function(containerIn, containerOut, gd, axLetter, dflt) { @@ -689,7 +689,7 @@ axes.autoTicks = function(ax, roughDTick) { ax.dtick = roundDTick(roughDTick, 1000, roundBase60); } else { - //milliseconds + // milliseconds base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10)); ax.dtick = roundDTick(roughDTick, base, roundBase10); } @@ -697,7 +697,7 @@ axes.autoTicks = function(ax, roughDTick) { else if(ax.type === 'log') { ax.tick0 = 0; - //only show powers of 10 + // only show powers of 10 if(roughDTick > 0.7) ax.dtick = Math.ceil(roughDTick); else if(Math.abs(ax.range[1] - ax.range[0]) < 1) { // span is less than one power of 10 diff --git a/src/plots/cartesian/graph_interact.js b/src/plots/cartesian/graph_interact.js index f3f6ade5a14..bed9ad0b723 100644 --- a/src/plots/cartesian/graph_interact.js +++ b/src/plots/cartesian/graph_interact.js @@ -1210,7 +1210,7 @@ function hoverAvoidOverlaps(hoverData, ax) { p1 = g1[0]; topOverlap = p0.pos + p0.dp + p0.size - p1.pos - p1.dp + p1.size; - //Only group points that lie on the same axes + // Only group points that lie on the same axes if(topOverlap > 0.01 && (p0.pmin === p1.pmin) && (p0.pmax === p1.pmax)) { // push the new point(s) added to this group out of the way for(j = g1.length - 1; j >= 0; j--) g1[j].dp += topOverlap; diff --git a/src/plots/cartesian/layout_attributes.js b/src/plots/cartesian/layout_attributes.js index 400cac1756d..b1465d5836b 100644 --- a/src/plots/cartesian/layout_attributes.js +++ b/src/plots/cartesian/layout_attributes.js @@ -475,7 +475,7 @@ module.exports = { valType: 'enumerated', values: [ 'trace', 'category ascending', 'category descending', 'array' - /*, 'value ascending', 'value descending'*/ // value ascending / descending to be implemented later + /* , 'value ascending', 'value descending'*/ // value ascending / descending to be implemented later ], dflt: 'trace', role: 'info', @@ -484,7 +484,7 @@ module.exports = { 'By default, plotly uses *trace*, which specifies the order that is present in the data supplied.', 'Set `categoryorder` to *category ascending* or *category descending* if order should be determined by', 'the alphanumerical order of the category names.', - /*'Set `categoryorder` to *value ascending* or *value descending* if order should be determined by the', + /* 'Set `categoryorder` to *value ascending* or *value descending* if order should be determined by the', 'numerical order of the values.',*/ // // value ascending / descending to be implemented later 'Set `categoryorder` to *array* to derive the ordering from the attribute `categoryarray`. If a category', 'is not found in the `categoryarray` array, the sorting behavior for that attribute will be identical to', diff --git a/src/plots/gl3d/camera.js b/src/plots/gl3d/camera.js index 3b93c7ba3fb..83dcd3dcb21 100644 --- a/src/plots/gl3d/camera.js +++ b/src/plots/gl3d/camera.js @@ -112,7 +112,7 @@ function createCamera(element, options) { var curCenter = view.computedCenter.slice(); view.setMode(mode); if(mode === 'turntable') { - //Hacky time warping stuff to generate smooth animation + // Hacky time warping stuff to generate smooth animation var t0 = now(); view._active.lookAt(t0, curEye, curCenter, curUp); view._active.lookAt(t0 + 500, curEye, curCenter, [0, 0, 1]); @@ -204,17 +204,17 @@ function createCamera(element, options) { var drot = Math.PI * camera.rotateSpeed; if((rotate && left && !ctrl && !alt && !shift) || (left && !ctrl && !alt && shift)) { - //Rotate + // Rotate view.rotate(t, flipX * drot * dx, -flipY * drot * dy, 0); } if((pan && left && !ctrl && !alt && !shift) || right || (left && ctrl && !alt && !shift)) { - //Pan + // Pan view.pan(t, -camera.translateSpeed * dx * distance, camera.translateSpeed * dy * distance, 0); } if((zoom && left && !ctrl && !alt && !shift) || middle || (left && !ctrl && alt && !shift)) { - //Zoom + // Zoom var kzoom = -camera.zoomSpeed * dy / window.innerHeight * (t - view.lastT()) * 100; view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1)); } diff --git a/src/plots/gl3d/layout/convert.js b/src/plots/gl3d/layout/convert.js index ebdeaa39d8a..e5de1bd8041 100644 --- a/src/plots/gl3d/layout/convert.js +++ b/src/plots/gl3d/layout/convert.js @@ -76,7 +76,7 @@ proto.merge = function(sceneLayout) { for(var i = 0; i < 3; ++i) { var axes = sceneLayout[AXES_NAMES[i]]; - /////// Axes labels // + // Axes labels opts.labels[i] = convertHTMLToUnicode(axes.title); if('titlefont' in axes) { if(axes.titlefont.color) opts.labelColor[i] = str2RgbaArray(axes.titlefont.color); @@ -84,7 +84,7 @@ proto.merge = function(sceneLayout) { if(axes.titlefont.size) opts.labelSize[i] = axes.titlefont.size; } - /////// LINES //////// + // Lines if('showline' in axes) opts.lineEnable[i] = axes.showline; if('linecolor' in axes) opts.lineColor[i] = str2RgbaArray(axes.linecolor); if('linewidth' in axes) opts.lineWidth[i] = axes.linewidth; @@ -100,8 +100,7 @@ proto.merge = function(sceneLayout) { if('zerolinecolor' in axes) opts.zeroLineColor[i] = str2RgbaArray(axes.zerolinecolor); if('zerolinewidth' in axes) opts.zeroLineWidth[i] = axes.zerolinewidth; - //////// TICKS ///////// - /// tick lines + // tick lines if('ticks' in axes && !!axes.ticks) opts.lineTickEnable[i] = true; else opts.lineTickEnable[i] = false; diff --git a/src/plots/gl3d/layout/tick_marks.js b/src/plots/gl3d/layout/tick_marks.js index ec6558405b0..46b6f544b67 100644 --- a/src/plots/gl3d/layout/tick_marks.js +++ b/src/plots/gl3d/layout/tick_marks.js @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. */ -/*eslint block-scoped-var: 0*/ -/*eslint no-redeclare: 0*/ +/* eslint block-scoped-var: 0*/ +/* eslint no-redeclare: 0*/ 'use strict'; @@ -82,7 +82,7 @@ function computeTickMarks(scene) { axesOptions.ticks = ticks; - //Calculate tick lengths dynamically + // Calculate tick lengths dynamically for(var i = 0; i < 3; ++i) { centerPoint[i] = 0.5 * (scene.glplot.bounds[0][i] + scene.glplot.bounds[1][i]); for(var j = 0; j < 2; ++j) { diff --git a/src/plots/gl3d/scene.js b/src/plots/gl3d/scene.js index fd24a296ad3..17a50d05e5c 100644 --- a/src/plots/gl3d/scene.js +++ b/src/plots/gl3d/scene.js @@ -209,7 +209,7 @@ function initializeGLPlot(scene, fullLayout, canvas, gl) { scene.glplot.onrender = render.bind(null, scene); - //List of scene objects + // List of scene objects scene.traces = {}; return true; @@ -247,7 +247,7 @@ function Scene(options, fullLayout) { this.id = options.id || 'scene'; this.fullSceneLayout = fullLayout[this.id]; - //Saved from last call to plot() + // Saved from last call to plot() this.plotArgs = [ [], {}, {} ]; /* @@ -259,7 +259,7 @@ function Scene(options, fullLayout) { this.staticMode = !!options.staticPlot; this.pixelRatio = options.plotGlPixelRatio || 2; - //Coordinate rescaling + // Coordinate rescaling this.dataScale = [1, 1, 1]; this.contourLevels = [ [], [], [] ]; @@ -321,7 +321,7 @@ function computeTraceBounds(scene, trace, bounds) { } proto.plot = function(sceneData, fullLayout, layout) { - //Save parameters + // Save parameters this.plotArgs = [sceneData, fullLayout, layout]; if(this.glplot.contextLost) return; @@ -336,7 +336,7 @@ proto.plot = function(sceneData, fullLayout, layout) { this.glplot.snapToData = true; - //Update layout + // Update layout this.fullSceneLayout = fullSceneLayout; this.glplotLayout = fullSceneLayout; @@ -346,7 +346,7 @@ proto.plot = function(sceneData, fullLayout, layout) { // Update camera mode this.updateFx(fullSceneLayout.dragmode, fullSceneLayout.hovermode); - //Update scene + // Update scene this.glplot.update({}); // Update axes functions BEFORE updating traces @@ -355,11 +355,11 @@ proto.plot = function(sceneData, fullLayout, layout) { setConvert(axis); } - //Convert scene data + // Convert scene data if(!sceneData) sceneData = []; else if(!Array.isArray(sceneData)) sceneData = [sceneData]; - //Compute trace bounding box + // Compute trace bounding box var dataBounds = [ [Infinity, Infinity, Infinity], [-Infinity, -Infinity, -Infinity] @@ -385,10 +385,10 @@ proto.plot = function(sceneData, fullLayout, layout) { } } - //Save scale + // Save scale this.dataScale = dataScale; - //Update traces + // Update traces for(i = 0; i < sceneData.length; ++i) { data = sceneData[i]; if(data.visible !== true) { @@ -404,7 +404,7 @@ proto.plot = function(sceneData, fullLayout, layout) { trace.name = data.name; } - //Remove empty traces + // Remove empty traces var traceIds = Object.keys(this.traces); trace_id_loop: @@ -419,7 +419,7 @@ proto.plot = function(sceneData, fullLayout, layout) { delete this.traces[traceIds[i]]; } - //Update ranges (needs to be called *after* objects are added due to updates) + // Update ranges (needs to be called *after* objects are added due to updates) var sceneBounds = [[0, 0, 0], [0, 0, 0]], axisDataRange = [], axisTypeRatios = {}; @@ -472,14 +472,14 @@ proto.plot = function(sceneData, fullLayout, layout) { } axisDataRange[i] = sceneBounds[1][i] - sceneBounds[0][i]; - //Update plot bounds + // Update plot bounds this.glplot.bounds[0][i] = sceneBounds[0][i] * dataScale[i]; this.glplot.bounds[1][i] = sceneBounds[1][i] * dataScale[i]; } var axesScaleRatio = [1, 1, 1]; - //Compute axis scale per category + // Compute axis scale per category for(i = 0; i < 3; ++i) { axis = fullSceneLayout[axisProperties[i]]; axisType = axis.type; @@ -539,7 +539,7 @@ proto.plot = function(sceneData, fullLayout, layout) { this.glplot.aspect = aspectRatio; - //Update frame position for multi plots + // Update frame position for multi plots var domain = fullSceneLayout.domain || null, size = fullLayout._size || null; @@ -560,7 +560,7 @@ proto.destroy = function() { this.glplot.dispose(); this.container.parentNode.removeChild(this.container); - //Remove reference to glplot + // Remove reference to glplot this.glplot = null; }; @@ -673,10 +673,10 @@ proto.toImage = function(format) { if(this.staticMode) this.container.appendChild(STATIC_CANVAS); - //Force redraw + // Force redraw this.glplot.redraw(); - //Grab context and yank out pixels + // Grab context and yank out pixels var gl = this.glplot.gl; var w = gl.drawingBufferWidth; var h = gl.drawingBufferHeight; @@ -686,7 +686,7 @@ proto.toImage = function(format) { var pixels = new Uint8Array(w * h * 4); gl.readPixels(0, 0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, pixels); - //Flip pixels + // Flip pixels for(var j = 0, k = h - 1; j < k; ++j, --k) { for(var i = 0; i < w; ++i) { for(var l = 0; l < 4; ++l) { diff --git a/src/plots/mapbox/layers.js b/src/plots/mapbox/layers.js index c5de5901a5c..1eab1a99a98 100644 --- a/src/plots/mapbox/layers.js +++ b/src/plots/mapbox/layers.js @@ -183,7 +183,7 @@ function convertOpts(opts) { 'text-offset': textOpts.offset // TODO font family - //'text-font': symbol.textfont.family.split(', '), + // 'text-font': symbol.textfont.family.split(', '), }); Lib.extendFlat(paint, { diff --git a/src/plots/plots.js b/src/plots/plots.js index 8162489ce73..b4ffa470551 100644 --- a/src/plots/plots.js +++ b/src/plots/plots.js @@ -1215,7 +1215,7 @@ plots.modifyFrames = function(gd, operations) { switch(op.type) { // No reason this couldn't exist, but is currently unused/untested: - /*case 'rename': + /* case 'rename': frame = _frames[op.index]; delete _hash[frame.name]; _hash[op.name] = frame; diff --git a/src/plots/polar/micropolar_manager.js b/src/plots/polar/micropolar_manager.js index 8ca681c5297..47bf9c40c44 100644 --- a/src/plots/polar/micropolar_manager.js +++ b/src/plots/polar/micropolar_manager.js @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. */ +/* eslint-disable new-cap */ 'use strict'; diff --git a/src/plots/polar/undo_manager.js b/src/plots/polar/undo_manager.js index 5b9018aaa02..ee35c1c85a5 100644 --- a/src/plots/polar/undo_manager.js +++ b/src/plots/polar/undo_manager.js @@ -8,8 +8,8 @@ 'use strict'; -//Modified from https://github.com/ArthurClemens/Javascript-Undo-Manager -//Copyright (c) 2010-2013 Arthur Clemens, arthur@visiblearea.com +// Modified from https://github.com/ArthurClemens/Javascript-Undo-Manager +// Copyright (c) 2010-2013 Arthur Clemens, arthur@visiblearea.com module.exports = function UndoManager() { var undoCommands = [], index = -1, diff --git a/src/plots/ternary/ternary.js b/src/plots/ternary/ternary.js index 1fd6d7094f7..94cf5d7a8bf 100644 --- a/src/plots/ternary/ternary.js +++ b/src/plots/ternary/ternary.js @@ -256,7 +256,7 @@ proto.adjustLayout = function(ternaryLayout, graphSize) { domain: [yDomain0, yDomain0 + yDomainFinal * w_over_h], _axislayer: _this.layers.aaxis, _gridlayer: _this.layers.agrid, - _pos: 0, //_this.xaxis.domain[0] * graphSize.w, + _pos: 0, // _this.xaxis.domain[0] * graphSize.w, _gd: _this.graphDiv, _id: 'y', _length: w, @@ -274,7 +274,7 @@ proto.adjustLayout = function(ternaryLayout, graphSize) { _axislayer: _this.layers.baxis, _gridlayer: _this.layers.bgrid, _counteraxis: _this.aaxis, - _pos: 0, //(1 - yDomain0) * graphSize.h, + _pos: 0, // (1 - yDomain0) * graphSize.h, _gd: _this.graphDiv, _id: 'x', _length: w, @@ -294,7 +294,7 @@ proto.adjustLayout = function(ternaryLayout, graphSize) { _axislayer: _this.layers.caxis, _gridlayer: _this.layers.cgrid, _counteraxis: _this.baxis, - _pos: 0, //_this.xaxis.domain[1] * graphSize.w, + _pos: 0, // _this.xaxis.domain[1] * graphSize.w, _gd: _this.graphDiv, _id: 'y', _length: w, diff --git a/src/traces/contour/plot.js b/src/traces/contour/plot.js index c0e21f94ceb..2122f6e5c0e 100644 --- a/src/traces/contour/plot.js +++ b/src/traces/contour/plot.js @@ -542,7 +542,7 @@ function joinAllPaths(pi, perimeter) { endpt = pi.edgepaths[i][pi.edgepaths[i].length - 1]; nexti = -1; - //now loop through sides, moving our endpoint until we find a new start + // now loop through sides, moving our endpoint until we find a new start for(cnt = 0; cnt < 4; cnt++) { // just to prevent infinite loops if(!endpt) { Lib.log('Missing end?', i, pi); diff --git a/src/traces/mesh3d/attributes.js b/src/traces/mesh3d/attributes.js index 6c4cdd87f23..ea9082d6a36 100644 --- a/src/traces/mesh3d/attributes.js +++ b/src/traces/mesh3d/attributes.js @@ -116,7 +116,7 @@ module.exports = { ].join(' ') }, - //Color field + // Color field color: { valType: 'color', role: 'style', @@ -139,10 +139,10 @@ module.exports = { ].join(' ') }, - //Opacity + // Opacity opacity: extendFlat({}, surfaceAtts.opacity), - //Flat shaded mode + // Flat shaded mode flatshading: { valType: 'boolean', role: 'style', diff --git a/src/traces/mesh3d/convert.js b/src/traces/mesh3d/convert.js index 4ffaca7ae21..9652842315a 100644 --- a/src/traces/mesh3d/convert.js +++ b/src/traces/mesh3d/convert.js @@ -74,7 +74,7 @@ proto.update = function(data) { this.data = data; - //Unpack position data + // Unpack position data function toDataCoords(axis, coord, scale) { return coord.map(function(x) { return axis.d2l(x) * scale; @@ -139,7 +139,7 @@ proto.update = function(data) { config.meshColor = str2RgbaArray(data.color); } - //Update mesh + // Update mesh this.mesh.update(config); }; diff --git a/src/traces/mesh3d/defaults.js b/src/traces/mesh3d/defaults.js index 13b48e3f3b9..54feaaad32f 100644 --- a/src/traces/mesh3d/defaults.js +++ b/src/traces/mesh3d/defaults.js @@ -48,7 +48,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout }); } - //Coerce remaining properties + // Coerce remaining properties [ 'lighting.ambient', 'lighting.diffuse', diff --git a/src/traces/pie/plot.js b/src/traces/pie/plot.js index d50b0b307fb..85234f4d158 100644 --- a/src/traces/pie/plot.js +++ b/src/traces/pie/plot.js @@ -37,7 +37,7 @@ module.exports = function plot(gd, cdpie) { var pieGroup = d3.select(this), cd0 = cd[0], trace = cd0.trace, - tiltRads = 0, //trace.tilt * Math.PI / 180, + tiltRads = 0, // trace.tilt * Math.PI / 180, depthLength = (trace.depth||0) * cd0.r * Math.sin(tiltRads) / 2, tiltAxis = trace.tiltaxis || 0, tiltAxisRads = tiltAxis * Math.PI / 180, diff --git a/src/traces/scatter3d/convert.js b/src/traces/scatter3d/convert.js index 8715b3c962e..c58aa8a2674 100644 --- a/src/traces/scatter3d/convert.js +++ b/src/traces/scatter3d/convert.js @@ -125,7 +125,7 @@ function calculateErrorParams(errors) { } function calculateTextOffset(tp) { - //Read out text properties + // Read out text properties var textOffset = [0, 0]; if(Array.isArray(tp)) return [0, -1]; if(tp.indexOf('bottom') >= 0) textOffset[1] += 1; @@ -179,7 +179,7 @@ function convertPlotlyOptions(scene, data) { len = x.length, text; - //Convert points + // Convert points for(i = 0; i < len; i++) { // sanitize numbers and apply transforms based on axes.type xc = xaxis.d2l(x[i]) * scaleFactor[0]; @@ -196,7 +196,7 @@ function convertPlotlyOptions(scene, data) { for(i = 0; i < len; i++) text[i] = data.text; } - //Build object parameters + // Build object parameters params = { position: points, mode: data.mode, @@ -275,10 +275,10 @@ proto.update = function(data) { textOptions, dashPattern = DASH_PATTERNS.solid; - //Save data + // Save data this.data = data; - //Run data conversion + // Run data conversion var options = convertPlotlyOptions(this.scene, data); if('mode' in options) { @@ -293,7 +293,7 @@ proto.update = function(data) { this.color = arrayToColor(options.scatterColor) || arrayToColor(options.lineColor); - //Save data points + // Save data points this.dataPoints = options.position; lineOptions = { diff --git a/src/traces/scattermapbox/convert.js b/src/traces/scattermapbox/convert.js index 17c978ebf68..8928d081fd9 100644 --- a/src/traces/scattermapbox/convert.js +++ b/src/traces/scattermapbox/convert.js @@ -118,7 +118,7 @@ module.exports = function convert(calcTrace) { 'text-offset': textOpts.offset // TODO font family - //'text-font': symbol.textfont.family.split(', '), + // 'text-font': symbol.textfont.family.split(', '), }); Lib.extendFlat(symbol.paint, { diff --git a/src/traces/surface/convert.js b/src/traces/surface/convert.js index 2da7d0be209..839c559a9c7 100644 --- a/src/traces/surface/convert.js +++ b/src/traces/surface/convert.js @@ -191,7 +191,7 @@ proto.update = function(data) { yc = coords[1], contourLevels = scene.contourLevels; - //Save data + // Save data this.data = data; /* @@ -250,7 +250,7 @@ proto.update = function(data) { params.intensityBounds = [data.cmin, data.cmax]; - //Refine if necessary + // Refine if necessary if(data.surfacecolor) { var intensity = ndarray(new Float32Array(xlen * ylen), [xlen, ylen]); diff --git a/src/traces/surface/defaults.js b/src/traces/surface/defaults.js index 4bd24e9356d..a03da51d3a5 100644 --- a/src/traces/surface/defaults.js +++ b/src/traces/surface/defaults.js @@ -50,7 +50,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } } - //Coerce remaining properties + // Coerce remaining properties [ 'lighting.ambient', 'lighting.diffuse', diff --git a/test/jasmine/assets/transforms/filter.js b/test/jasmine/assets/transforms/filter.js index 95215fc50cf..8ac7e9b1f27 100644 --- a/test/jasmine/assets/transforms/filter.js +++ b/test/jasmine/assets/transforms/filter.js @@ -3,7 +3,7 @@ // var Lib = require('@src/lib'); var Lib = require('../../../../src/lib'); -/*eslint no-unused-vars: 0*/ +/* eslint no-unused-vars: 0*/ // so that Plotly.register knows what to do with it diff --git a/test/jasmine/assets/transforms/groupby.js b/test/jasmine/assets/transforms/groupby.js index 41748a75c66..50a3b9f0949 100644 --- a/test/jasmine/assets/transforms/groupby.js +++ b/test/jasmine/assets/transforms/groupby.js @@ -3,7 +3,7 @@ // var Lib = require('@src/lib'); var Lib = require('../../../../src/lib'); -/*eslint no-unused-vars: 0*/ +/* eslint no-unused-vars: 0*/ // so that Plotly.register knows what to do with it diff --git a/test/jasmine/karma.conf.js b/test/jasmine/karma.conf.js index 29772dc3714..4af5b9df14f 100644 --- a/test/jasmine/karma.conf.js +++ b/test/jasmine/karma.conf.js @@ -1,4 +1,4 @@ -/*eslint-env node*/ +/* eslint-env node*/ // Karma configuration diff --git a/test/jasmine/tests/download_test.js b/test/jasmine/tests/download_test.js index b5062886c87..1e29234a4dc 100644 --- a/test/jasmine/tests/download_test.js +++ b/test/jasmine/tests/download_test.js @@ -69,10 +69,10 @@ describe('Plotly.downloadImage', function() { function downloadTest(gd, format, done) { - //use MutationObserver to monitor the DOM - //for changes - //code modeled after - //https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver + // use MutationObserver to monitor the DOM + // for changes + // code modeled after + // https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver // select the target node var target = document.body; var domchanges = []; diff --git a/test/jasmine/tests/heatmap_test.js b/test/jasmine/tests/heatmap_test.js index 34b828ef6b3..b10652a6548 100644 --- a/test/jasmine/tests/heatmap_test.js +++ b/test/jasmine/tests/heatmap_test.js @@ -193,7 +193,7 @@ describe('heatmap convertColumnXYZ', function() { }); it('should convert x/y/z columns to z(x,y) with out-of-order data', function() { - /*eslint no-sparse-arrays: 0*/ + /* eslint no-sparse-arrays: 0*/ trace = { x: [ diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index 7adf6db7d0a..7904e62a8de 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -524,11 +524,11 @@ describe('hover info on stacked subplots', function() { y: 1000 })); - //There should be a single label on the x-axis with the shared x value, 3. + // There should be a single label on the x-axis with the shared x value, 3. expect(d3.selectAll('g.axistext').size()).toEqual(1); expect(d3.selectAll('g.axistext').select('text').html()).toEqual('3'); - //There should be two points being hovered over, in two different traces, one in each plot. + // There should be two points being hovered over, in two different traces, one in each plot. expect(d3.selectAll('g.hovertext').size()).toEqual(2); var textNodes = d3.selectAll('g.hovertext').selectAll('text'); @@ -576,11 +576,11 @@ describe('hover info on stacked subplots', function() { y: 0 })); - //There should be a single label on the y-axis with the shared y value, 0. + // There should be a single label on the y-axis with the shared y value, 0. expect(d3.selectAll('g.axistext').size()).toEqual(1); expect(d3.selectAll('g.axistext').select('text').html()).toEqual('0'); - //There should be three points being hovered over, in three different traces, one in each plot. + // There should be three points being hovered over, in three different traces, one in each plot. expect(d3.selectAll('g.hovertext').size()).toEqual(3); var textNodes = d3.selectAll('g.hovertext').selectAll('text'); diff --git a/test/jasmine/tests/legend_scroll_test.js b/test/jasmine/tests/legend_scroll_test.js index 3e09f0f91da..98b4f0f25ee 100644 --- a/test/jasmine/tests/legend_scroll_test.js +++ b/test/jasmine/tests/legend_scroll_test.js @@ -171,7 +171,7 @@ describe('The legend', function() { Plotly.relayout(gd, 'height', gd._fullLayout.height / 2).then(function() { var legendHeight = getLegendHeight(); - //legend still exists and not duplicated + // legend still exists and not duplicated expect(countLegendGroups(gd)).toBe(1); expect(countLegendClipPaths(gd)).toBe(1);