Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e5a4194

Browse files
committed
eslint: add / enforce spaced-comment rule
1 parent 813fb2e commit e5a4194

File tree

33 files changed

+87
-87
lines changed

33 files changed

+87
-87
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"space-in-parens": [2, "never"],
3636
"space-before-function-paren": [2, "never"],
3737
"space-before-blocks": [2],
38+
"spaced-comment": [2, "always"],
3839
"no-tabs": [2],
3940
"no-multi-spaces": [2],
4041
"no-whitespace-before-property": [2],

src/components/annotations/draw.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,16 +409,16 @@ function drawOne(gd, index, opt, value) {
409409
// and the annotation center are visible
410410
if(options.showarrow) {
411411
if(options.axref === options.xref) {
412-
//we don't want to constrain if the tail is absolute
413-
//or the slope (which is meaningful) will change.
412+
// we don't want to constrain if the tail is absolute
413+
// or the slope (which is meaningful) will change.
414414
arrowX = annPosPx.x;
415415
} else {
416416
arrowX = Lib.constrain(annPosPx.x - options.ax, 1, fullLayout.width - 1);
417417
}
418418

419419
if(options.ayref === options.yref) {
420-
//we don't want to constrain if the tail is absolute
421-
//or the slope (which is meaningful) will change.
420+
// we don't want to constrain if the tail is absolute
421+
// or the slope (which is meaningful) will change.
422422
arrowY = annPosPx.y;
423423
} else {
424424
arrowY = Lib.constrain(annPosPx.y - options.ay, 1, fullLayout.height - 1);

src/components/colorbar/draw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ module.exports = function draw(gd, id) {
527527
container.attr('transform',
528528
'translate(' + (gs.l - xoffset) + ',' + gs.t + ')');
529529

530-
//auto margin adjustment
530+
// auto margin adjustment
531531
Plots.autoMargin(gd, id, {
532532
x: opts.x,
533533
y: opts.y,

src/components/legend/draw.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ function computeLegendDimensions(gd, groups, traces) {
590590
maxTraceWidth = 0,
591591
offsetX = 0;
592592

593-
//calculate largest width for traces and use for width of all legend items
593+
// calculate largest width for traces and use for width of all legend items
594594
traces.each(function(d) {
595595
maxTraceWidth = Math.max(40 + d[0].width, maxTraceWidth);
596596
});
@@ -604,7 +604,7 @@ function computeLegendDimensions(gd, groups, traces) {
604604
offsetX = 0;
605605
rowHeight = rowHeight + maxTraceHeight;
606606
opts.height = opts.height + maxTraceHeight;
607-
//reset for next row
607+
// reset for next row
608608
maxTraceHeight = 0;
609609
}
610610

@@ -615,7 +615,7 @@ function computeLegendDimensions(gd, groups, traces) {
615615
opts.width += traceGap + traceWidth;
616616
opts.height = Math.max(opts.height, legendItem.height);
617617

618-
//keep track of tallest trace in group
618+
// keep track of tallest trace in group
619619
offsetX += traceGap + traceWidth;
620620
maxTraceHeight = Math.max(legendItem.height, maxTraceHeight);
621621
});

src/lib/matrix.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ exports.apply2DTransform = function(transform) {
9393
var args = arguments;
9494
if(args.length === 3) {
9595
args = args[0];
96-
}//from map
96+
}// from map
9797
var xy = arguments.length === 1 ? args[0] : [args[0], args[1]];
9898
return exports.dot(transform, [xy[0], xy[1], 1]).slice(0, 2);
9999
};

src/plot_api/plot_api.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ function setPlotContext(gd, config) {
355355
}
356356
}
357357

358-
//staticPlot forces a bunch of others:
358+
// staticPlot forces a bunch of others:
359359
if(context.staticPlot) {
360360
context.editable = false;
361361
context.autosizable = false;
@@ -418,8 +418,8 @@ function plotPolar(gd, data, layout) {
418418

419419
var titleLayout = function() {
420420
this.call(svgTextUtils.convertToTspans);
421-
//TODO: html/mathjax
422-
//TODO: center title
421+
// TODO: html/mathjax
422+
// TODO: center title
423423
};
424424

425425
var title = polarPlotSVG.select('.title-group text')
@@ -1490,7 +1490,7 @@ function _restyle(gd, aobj, _traces) {
14901490
} else if(Registry.traceIs(cont, 'cartesian')) {
14911491
Lib.nestedProperty(cont, 'marker.colors')
14921492
.set(Lib.nestedProperty(cont, 'marker.color').get());
1493-
//look for axes that are no longer in use and delete them
1493+
// look for axes that are no longer in use and delete them
14941494
flagAxForDelete[cont.xaxis || 'x'] = true;
14951495
flagAxForDelete[cont.yaxis || 'y'] = true;
14961496
}

src/plots/cartesian/axes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ axes.coerceRef = function(containerIn, containerOut, gd, axLetter, dflt) {
5555
return Lib.coerce(containerIn, containerOut, attrDef, refAttr);
5656
};
5757

58-
//todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef.
58+
// todo: duplicated per github PR 610. Should be consolidated with axes.coerceRef.
5959
// find the list of possible axes to reference with an axref or ayref attribute
6060
// and coerce it to that list
6161
axes.coerceARef = function(containerIn, containerOut, gd, axLetter, dflt) {
@@ -689,15 +689,15 @@ axes.autoTicks = function(ax, roughDTick) {
689689
ax.dtick = roundDTick(roughDTick, 1000, roundBase60);
690690
}
691691
else {
692-
//milliseconds
692+
// milliseconds
693693
base = Math.pow(10, Math.floor(Math.log(roughDTick) / Math.LN10));
694694
ax.dtick = roundDTick(roughDTick, base, roundBase10);
695695
}
696696
}
697697
else if(ax.type === 'log') {
698698
ax.tick0 = 0;
699699

700-
//only show powers of 10
700+
// only show powers of 10
701701
if(roughDTick > 0.7) ax.dtick = Math.ceil(roughDTick);
702702
else if(Math.abs(ax.range[1] - ax.range[0]) < 1) {
703703
// span is less than one power of 10

src/plots/cartesian/graph_interact.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ function hoverAvoidOverlaps(hoverData, ax) {
12101210
p1 = g1[0];
12111211
topOverlap = p0.pos + p0.dp + p0.size - p1.pos - p1.dp + p1.size;
12121212

1213-
//Only group points that lie on the same axes
1213+
// Only group points that lie on the same axes
12141214
if(topOverlap > 0.01 && (p0.pmin === p1.pmin) && (p0.pmax === p1.pmax)) {
12151215
// push the new point(s) added to this group out of the way
12161216
for(j = g1.length - 1; j >= 0; j--) g1[j].dp += topOverlap;

src/plots/cartesian/layout_attributes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ module.exports = {
475475
valType: 'enumerated',
476476
values: [
477477
'trace', 'category ascending', 'category descending', 'array'
478-
/*, 'value ascending', 'value descending'*/ // value ascending / descending to be implemented later
478+
/* , 'value ascending', 'value descending'*/ // value ascending / descending to be implemented later
479479
],
480480
dflt: 'trace',
481481
role: 'info',
@@ -484,7 +484,7 @@ module.exports = {
484484
'By default, plotly uses *trace*, which specifies the order that is present in the data supplied.',
485485
'Set `categoryorder` to *category ascending* or *category descending* if order should be determined by',
486486
'the alphanumerical order of the category names.',
487-
/*'Set `categoryorder` to *value ascending* or *value descending* if order should be determined by the',
487+
/* 'Set `categoryorder` to *value ascending* or *value descending* if order should be determined by the',
488488
'numerical order of the values.',*/ // // value ascending / descending to be implemented later
489489
'Set `categoryorder` to *array* to derive the ordering from the attribute `categoryarray`. If a category',
490490
'is not found in the `categoryarray` array, the sorting behavior for that attribute will be identical to',

src/plots/gl3d/camera.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function createCamera(element, options) {
112112
var curCenter = view.computedCenter.slice();
113113
view.setMode(mode);
114114
if(mode === 'turntable') {
115-
//Hacky time warping stuff to generate smooth animation
115+
// Hacky time warping stuff to generate smooth animation
116116
var t0 = now();
117117
view._active.lookAt(t0, curEye, curCenter, curUp);
118118
view._active.lookAt(t0 + 500, curEye, curCenter, [0, 0, 1]);
@@ -204,17 +204,17 @@ function createCamera(element, options) {
204204
var drot = Math.PI * camera.rotateSpeed;
205205

206206
if((rotate && left && !ctrl && !alt && !shift) || (left && !ctrl && !alt && shift)) {
207-
//Rotate
207+
// Rotate
208208
view.rotate(t, flipX * drot * dx, -flipY * drot * dy, 0);
209209
}
210210

211211
if((pan && left && !ctrl && !alt && !shift) || right || (left && ctrl && !alt && !shift)) {
212-
//Pan
212+
// Pan
213213
view.pan(t, -camera.translateSpeed * dx * distance, camera.translateSpeed * dy * distance, 0);
214214
}
215215

216216
if((zoom && left && !ctrl && !alt && !shift) || middle || (left && !ctrl && alt && !shift)) {
217-
//Zoom
217+
// Zoom
218218
var kzoom = -camera.zoomSpeed * dy / window.innerHeight * (t - view.lastT()) * 100;
219219
view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1));
220220
}

src/plots/gl3d/layout/convert.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ proto.merge = function(sceneLayout) {
7676
for(var i = 0; i < 3; ++i) {
7777
var axes = sceneLayout[AXES_NAMES[i]];
7878

79-
/////// Axes labels //
79+
// Axes labels
8080
opts.labels[i] = convertHTMLToUnicode(axes.title);
8181
if('titlefont' in axes) {
8282
if(axes.titlefont.color) opts.labelColor[i] = str2RgbaArray(axes.titlefont.color);
8383
if(axes.titlefont.family) opts.labelFont[i] = axes.titlefont.family;
8484
if(axes.titlefont.size) opts.labelSize[i] = axes.titlefont.size;
8585
}
8686

87-
/////// LINES ////////
87+
// Lines
8888
if('showline' in axes) opts.lineEnable[i] = axes.showline;
8989
if('linecolor' in axes) opts.lineColor[i] = str2RgbaArray(axes.linecolor);
9090
if('linewidth' in axes) opts.lineWidth[i] = axes.linewidth;
@@ -100,8 +100,7 @@ proto.merge = function(sceneLayout) {
100100
if('zerolinecolor' in axes) opts.zeroLineColor[i] = str2RgbaArray(axes.zerolinecolor);
101101
if('zerolinewidth' in axes) opts.zeroLineWidth[i] = axes.zerolinewidth;
102102

103-
//////// TICKS /////////
104-
/// tick lines
103+
// tick lines
105104
if('ticks' in axes && !!axes.ticks) opts.lineTickEnable[i] = true;
106105
else opts.lineTickEnable[i] = false;
107106

src/plots/gl3d/layout/tick_marks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
/*eslint block-scoped-var: 0*/
10-
/*eslint no-redeclare: 0*/
9+
/* eslint block-scoped-var: 0*/
10+
/* eslint no-redeclare: 0*/
1111

1212
'use strict';
1313

@@ -82,7 +82,7 @@ function computeTickMarks(scene) {
8282

8383
axesOptions.ticks = ticks;
8484

85-
//Calculate tick lengths dynamically
85+
// Calculate tick lengths dynamically
8686
for(var i = 0; i < 3; ++i) {
8787
centerPoint[i] = 0.5 * (scene.glplot.bounds[0][i] + scene.glplot.bounds[1][i]);
8888
for(var j = 0; j < 2; ++j) {

src/plots/gl3d/scene.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function initializeGLPlot(scene, fullLayout, canvas, gl) {
209209

210210
scene.glplot.onrender = render.bind(null, scene);
211211

212-
//List of scene objects
212+
// List of scene objects
213213
scene.traces = {};
214214

215215
return true;
@@ -247,7 +247,7 @@ function Scene(options, fullLayout) {
247247
this.id = options.id || 'scene';
248248
this.fullSceneLayout = fullLayout[this.id];
249249

250-
//Saved from last call to plot()
250+
// Saved from last call to plot()
251251
this.plotArgs = [ [], {}, {} ];
252252

253253
/*
@@ -259,7 +259,7 @@ function Scene(options, fullLayout) {
259259
this.staticMode = !!options.staticPlot;
260260
this.pixelRatio = options.plotGlPixelRatio || 2;
261261

262-
//Coordinate rescaling
262+
// Coordinate rescaling
263263
this.dataScale = [1, 1, 1];
264264

265265
this.contourLevels = [ [], [], [] ];
@@ -321,7 +321,7 @@ function computeTraceBounds(scene, trace, bounds) {
321321
}
322322

323323
proto.plot = function(sceneData, fullLayout, layout) {
324-
//Save parameters
324+
// Save parameters
325325
this.plotArgs = [sceneData, fullLayout, layout];
326326

327327
if(this.glplot.contextLost) return;
@@ -336,7 +336,7 @@ proto.plot = function(sceneData, fullLayout, layout) {
336336

337337
this.glplot.snapToData = true;
338338

339-
//Update layout
339+
// Update layout
340340
this.fullSceneLayout = fullSceneLayout;
341341

342342
this.glplotLayout = fullSceneLayout;
@@ -346,7 +346,7 @@ proto.plot = function(sceneData, fullLayout, layout) {
346346
// Update camera mode
347347
this.updateFx(fullSceneLayout.dragmode, fullSceneLayout.hovermode);
348348

349-
//Update scene
349+
// Update scene
350350
this.glplot.update({});
351351

352352
// Update axes functions BEFORE updating traces
@@ -355,11 +355,11 @@ proto.plot = function(sceneData, fullLayout, layout) {
355355
setConvert(axis);
356356
}
357357

358-
//Convert scene data
358+
// Convert scene data
359359
if(!sceneData) sceneData = [];
360360
else if(!Array.isArray(sceneData)) sceneData = [sceneData];
361361

362-
//Compute trace bounding box
362+
// Compute trace bounding box
363363
var dataBounds = [
364364
[Infinity, Infinity, Infinity],
365365
[-Infinity, -Infinity, -Infinity]
@@ -385,10 +385,10 @@ proto.plot = function(sceneData, fullLayout, layout) {
385385
}
386386
}
387387

388-
//Save scale
388+
// Save scale
389389
this.dataScale = dataScale;
390390

391-
//Update traces
391+
// Update traces
392392
for(i = 0; i < sceneData.length; ++i) {
393393
data = sceneData[i];
394394
if(data.visible !== true) {
@@ -404,7 +404,7 @@ proto.plot = function(sceneData, fullLayout, layout) {
404404
trace.name = data.name;
405405
}
406406

407-
//Remove empty traces
407+
// Remove empty traces
408408
var traceIds = Object.keys(this.traces);
409409

410410
trace_id_loop:
@@ -419,7 +419,7 @@ proto.plot = function(sceneData, fullLayout, layout) {
419419
delete this.traces[traceIds[i]];
420420
}
421421

422-
//Update ranges (needs to be called *after* objects are added due to updates)
422+
// Update ranges (needs to be called *after* objects are added due to updates)
423423
var sceneBounds = [[0, 0, 0], [0, 0, 0]],
424424
axisDataRange = [],
425425
axisTypeRatios = {};
@@ -472,14 +472,14 @@ proto.plot = function(sceneData, fullLayout, layout) {
472472
}
473473
axisDataRange[i] = sceneBounds[1][i] - sceneBounds[0][i];
474474

475-
//Update plot bounds
475+
// Update plot bounds
476476
this.glplot.bounds[0][i] = sceneBounds[0][i] * dataScale[i];
477477
this.glplot.bounds[1][i] = sceneBounds[1][i] * dataScale[i];
478478
}
479479

480480
var axesScaleRatio = [1, 1, 1];
481481

482-
//Compute axis scale per category
482+
// Compute axis scale per category
483483
for(i = 0; i < 3; ++i) {
484484
axis = fullSceneLayout[axisProperties[i]];
485485
axisType = axis.type;
@@ -539,7 +539,7 @@ proto.plot = function(sceneData, fullLayout, layout) {
539539
this.glplot.aspect = aspectRatio;
540540

541541

542-
//Update frame position for multi plots
542+
// Update frame position for multi plots
543543
var domain = fullSceneLayout.domain || null,
544544
size = fullLayout._size || null;
545545

@@ -560,7 +560,7 @@ proto.destroy = function() {
560560
this.glplot.dispose();
561561
this.container.parentNode.removeChild(this.container);
562562

563-
//Remove reference to glplot
563+
// Remove reference to glplot
564564
this.glplot = null;
565565
};
566566

@@ -673,10 +673,10 @@ proto.toImage = function(format) {
673673

674674
if(this.staticMode) this.container.appendChild(STATIC_CANVAS);
675675

676-
//Force redraw
676+
// Force redraw
677677
this.glplot.redraw();
678678

679-
//Grab context and yank out pixels
679+
// Grab context and yank out pixels
680680
var gl = this.glplot.gl;
681681
var w = gl.drawingBufferWidth;
682682
var h = gl.drawingBufferHeight;
@@ -686,7 +686,7 @@ proto.toImage = function(format) {
686686
var pixels = new Uint8Array(w * h * 4);
687687
gl.readPixels(0, 0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
688688

689-
//Flip pixels
689+
// Flip pixels
690690
for(var j = 0, k = h - 1; j < k; ++j, --k) {
691691
for(var i = 0; i < w; ++i) {
692692
for(var l = 0; l < 4; ++l) {

src/plots/mapbox/layers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function convertOpts(opts) {
183183
'text-offset': textOpts.offset
184184

185185
// TODO font family
186-
//'text-font': symbol.textfont.family.split(', '),
186+
// 'text-font': symbol.textfont.family.split(', '),
187187
});
188188

189189
Lib.extendFlat(paint, {

0 commit comments

Comments
 (0)