Skip to content

Commit 2daa656

Browse files
committed
lint -> function() not function ()
1 parent abeae11 commit 2daa656

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+229
-216
lines changed

devtools/image_viewer/viewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function createButton(imageName) {
3737
button.style.height = '40px';
3838
button.innerHTML = imageName;
3939

40-
button.addEventListener('click', function () {
40+
button.addEventListener('click', function() {
4141
var imgBaseline = createImg(dirBaseline, imageName),
4242
imgTest = createImg(dirTest, imageName),
4343
imgDiff = createImg(dirDiff, 'diff-' + imageName);

devtools/test_dashboard/buttons.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ anchor.style.width = '1000px';
1313

1414
function plotButtons(plots, figDir) {
1515

16-
Object.keys(plots).forEach(function (plotname) {
16+
Object.keys(plots).forEach(function(plotname) {
1717

1818
var button = document.createElement('button');
1919

@@ -25,7 +25,7 @@ function plotButtons(plots, figDir) {
2525

2626
plotlist.appendChild(button);
2727

28-
button.addEventListener('click', function () {
28+
button.addEventListener('click', function() {
2929

3030
var myImage = new Image();
3131
myImage.src = figDir + plotname + '.png';
@@ -90,7 +90,7 @@ function plotButtons(plots, figDir) {
9090
var myImage = new Image();
9191
myImage.src = dataURL;
9292

93-
myImage.onload = function () {
93+
myImage.onload = function() {
9494
myImage.height = scene.container.clientHeight;
9595
myImage.width = scene.container.clientWidth;
9696
};
@@ -114,17 +114,17 @@ function plotButtons(plots, figDir) {
114114
var mock = require('@mocks/gl3d_marker-color.json');
115115
var statusDiv = document.getElementById('status-info');
116116

117-
pummelButton.addEventListener('click', function () {
118-
setInterval(function () {
117+
pummelButton.addEventListener('click', function() {
118+
setInterval(function() {
119119
var plotDiv = document.createElement('div');
120120
window.plotDiv = plotDiv;
121121

122122
plotDiv.id = 'div' + i;
123123
document.body.appendChild(plotDiv);
124124

125-
Plotly.plot(plotDiv, mock.data, mock.layout, {staticPlot: true}).then(function () {
125+
Plotly.plot(plotDiv, mock.data, mock.layout, {staticPlot: true}).then(function() {
126126

127-
Plotly.Plots.getSubplotIds(plotDiv._fullLayout, 'gl3d').forEach(function (key) {
127+
Plotly.Plots.getSubplotIds(plotDiv._fullLayout, 'gl3d').forEach(function(key) {
128128
var scene = plotDiv._fullLayout[key]._scene;
129129
scene.destroy();
130130
i ++;
@@ -146,7 +146,7 @@ function plotButtons(plots, figDir) {
146146
scrapeButton.style.background = 'blue';
147147
plotlist.appendChild(scrapeButton);
148148

149-
scrapeButton.addEventListener('click', function () {
149+
scrapeButton.addEventListener('click', function() {
150150
Plotly.Snapshot.toSVG(Tabs.get());
151151
return;
152152
});

src/components/colorbar/draw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ module.exports = function draw(gd, id) {
500500
}
501501

502502
// setter/getters for every item defined in opts
503-
Object.keys(opts).forEach(function (name) {
503+
Object.keys(opts).forEach(function(name) {
504504
component[name] = function(v) {
505505
// getter
506506
if(!arguments.length) return opts[name];

src/components/errorbars/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) {
2121
containerOut = traceOut[objName] = {},
2222
containerIn = traceIn[objName] || {};
2323

24-
function coerce (attr, dflt) {
24+
function coerce(attr, dflt) {
2525
return Lib.coerce(containerIn, containerOut, attributes, attr, dflt);
2626
}
2727

src/components/modebar/buttons.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ modeBarButtons.toImage = {
8383
ev.clean();
8484
});
8585

86-
ev.once('error', function (err) {
86+
ev.once('error', function(err) {
8787
gd._snapshotInProgress = false;
8888

8989
Lib.notifier('Sorry there was a problem downloading your ' + format, 'long');

src/components/modebar/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ proto.updateButtons = function(buttons) {
102102
* Empty div for containing a group of buttons
103103
* @Return {HTMLelement}
104104
*/
105-
proto.createGroup = function () {
105+
proto.createGroup = function() {
106106
var group = document.createElement('div');
107107
group.className = 'modebar-group';
108108

@@ -114,7 +114,7 @@ proto.createGroup = function () {
114114
* @Param {object} config (see ./buttons.js for more info)
115115
* @Return {HTMLelement}
116116
*/
117-
proto.createButton = function (config) {
117+
proto.createButton = function(config) {
118118
var _this = this,
119119
button = document.createElement('a');
120120

@@ -162,7 +162,7 @@ proto.createButton = function (config) {
162162
* @Param {string} thisIcon.path
163163
* @Return {HTMLelement}
164164
*/
165-
proto.createIcon = function (thisIcon) {
165+
proto.createIcon = function(thisIcon) {
166166
var iconHeight = thisIcon.ascent - thisIcon.descent,
167167
svgNS = 'http://www.w3.org/2000/svg',
168168
icon = document.createElementNS(svgNS, 'svg'),
@@ -216,7 +216,7 @@ proto.updateActiveButton = function(buttonClicked) {
216216
* @Param {object} buttons 2d array of grouped button config objects
217217
* @Return {boolean}
218218
*/
219-
proto.hasButtons = function (buttons) {
219+
proto.hasButtons = function(buttons) {
220220
var currentButtons = this.buttons;
221221

222222
if(!currentButtons) return false;

src/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ lib.syncOrAsync = function(sequence, arg, finalStep) {
303303
* Helper to strip trailing slash, from
304304
* http://stackoverflow.com/questions/6680825/return-string-without-trailing-slash
305305
*/
306-
lib.stripTrailingSlash = function (str) {
306+
lib.stripTrailingSlash = function(str) {
307307
if (str.substr(-1) === '/') return str.substr(0, str.length - 1);
308308
return str;
309309
};

src/lib/matrix.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ exports.dot = function(x, y) {
6767
};
6868

6969
// translate by (x,y)
70-
exports.translationMatrix = function (x, y) {
70+
exports.translationMatrix = function(x, y) {
7171
return [[1, 0, x], [0, 1, y], [0, 0, 1]];
7272
};
7373

7474
// rotate by alpha around (0,0)
75-
exports.rotationMatrix = function (alpha) {
75+
exports.rotationMatrix = function(alpha) {
7676
var a = alpha*Math.PI/180;
7777
return [[Math.cos(a), -Math.sin(a), 0],
7878
[Math.sin(a), Math.cos(a), 0],

src/lib/queue.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var Plotly = require('../plotly');
1818
* @param args
1919
* @returns {Array}
2020
*/
21-
function copyArgArray (gd, args) {
21+
function copyArgArray(gd, args) {
2222
var copy = [];
2323
var arg;
2424

@@ -188,7 +188,7 @@ queue.redo = function redo(gd) {
188188
* @param func
189189
* @param args
190190
*/
191-
queue.plotDo = function (gd, func, args) {
191+
queue.plotDo = function(gd, func, args) {
192192
gd.autoplay = true;
193193

194194
// this *won't* copy gd and it preserves `undefined` properties!

src/lib/show_no_webgl_msg.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
var Plotly = require('../plotly');
1313

14+
var noop = function() {};
15+
16+
1417
/**
1518
* Prints a no webgl error message into the scene container
1619
* @param {scene instance} scene
@@ -19,13 +22,11 @@ var Plotly = require('../plotly');
1922
*
2023
*/
2124
module.exports = function showWebGlMsg(scene) {
22-
var noop = function () {};
23-
2425
for(var prop in scene) {
2526
if (typeof scene[prop] === 'function') scene[prop] = noop;
2627
}
2728

28-
scene.destroy = function () {
29+
scene.destroy = function() {
2930
scene.container.parentNode.removeChild(scene.container);
3031
};
3132

@@ -37,7 +38,7 @@ module.exports = function showWebGlMsg(scene) {
3738

3839
scene.container.appendChild(div);
3940
scene.container.style.background = '#FFFFFF';
40-
scene.container.onclick = function () {
41+
scene.container.onclick = function() {
4142
window.open('http://get.webgl.org');
4243
};
4344

src/plot_api/plot_api.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ Plotly.redraw = function(gd) {
824824
}
825825

826826
gd.calcdata = undefined;
827-
return Plotly.plot(gd).then(function () {
827+
return Plotly.plot(gd).then(function() {
828828
gd.emit('plotly_redraw');
829829
return gd;
830830
});
@@ -838,7 +838,7 @@ Plotly.redraw = function(gd) {
838838
* @param {Object} layout
839839
* @param {Object} config
840840
*/
841-
Plotly.newPlot = function (gd, data, layout, config) {
841+
Plotly.newPlot = function(gd, data, layout, config) {
842842
gd = getGraphDiv(gd);
843843
plots.purge(gd);
844844
return Plotly.plot(gd, data, layout, config);
@@ -1096,7 +1096,7 @@ function assertExtendTracesArgs(gd, update, indices, maxPoints) {
10961096
* @param {Number||Object} maxPoints
10971097
* @return {Object[]}
10981098
*/
1099-
function getExtendProperties (gd, update, indices, maxPoints) {
1099+
function getExtendProperties(gd, update, indices, maxPoints) {
11001100

11011101
var maxPointsIsObject = Plotly.Lib.isPlainObject(maxPoints),
11021102
updateProps = [];
@@ -1172,7 +1172,7 @@ function getExtendProperties (gd, update, indices, maxPoints) {
11721172
* @param {Function} spliceArray
11731173
* @return {Object}
11741174
*/
1175-
function spliceTraces (gd, update, indices, maxPoints, lengthenArray, spliceArray) {
1175+
function spliceTraces(gd, update, indices, maxPoints, lengthenArray, spliceArray) {
11761176

11771177
assertExtendTracesArgs(gd, update, indices, maxPoints);
11781178

@@ -1243,7 +1243,7 @@ function spliceTraces (gd, update, indices, maxPoints, lengthenArray, spliceArra
12431243
* @param {Number|Object} [maxPoints] Number of points for trace window after lengthening.
12441244
*
12451245
*/
1246-
Plotly.extendTraces = function extendTraces (gd, update, indices, maxPoints) {
1246+
Plotly.extendTraces = function extendTraces(gd, update, indices, maxPoints) {
12471247
gd = getGraphDiv(gd);
12481248

12491249
var undo = spliceTraces(gd, update, indices, maxPoints,
@@ -1272,7 +1272,7 @@ Plotly.extendTraces = function extendTraces (gd, update, indices, maxPoints) {
12721272
return promise;
12731273
};
12741274

1275-
Plotly.prependTraces = function prependTraces (gd, update, indices, maxPoints) {
1275+
Plotly.prependTraces = function prependTraces(gd, update, indices, maxPoints) {
12761276
gd = getGraphDiv(gd);
12771277

12781278
var undo = spliceTraces(gd, update, indices, maxPoints,
@@ -1310,7 +1310,7 @@ Plotly.prependTraces = function prependTraces (gd, update, indices, maxPoints) {
13101310
* @param {Number[]|Number} [newIndices=[gd.data.length]] Locations to add traces
13111311
*
13121312
*/
1313-
Plotly.addTraces = function addTraces (gd, traces, newIndices) {
1313+
Plotly.addTraces = function addTraces(gd, traces, newIndices) {
13141314
gd = getGraphDiv(gd);
13151315

13161316
var currentIndices = [],
@@ -1382,7 +1382,7 @@ Plotly.addTraces = function addTraces (gd, traces, newIndices) {
13821382
* @param {Object[]} gd.data The array of traces we're removing from
13831383
* @param {Number|Number[]} indices The indices
13841384
*/
1385-
Plotly.deleteTraces = function deleteTraces (gd, indices) {
1385+
Plotly.deleteTraces = function deleteTraces(gd, indices) {
13861386
gd = getGraphDiv(gd);
13871387

13881388
var traces = [],
@@ -1449,7 +1449,7 @@ Plotly.deleteTraces = function deleteTraces (gd, indices) {
14491449
* // reorder all traces (assume there are 5--a, b, c, d, e)
14501450
* Plotly.moveTraces(gd, [b, d, e, a, c]) // same as 'move to end'
14511451
*/
1452-
Plotly.moveTraces = function moveTraces (gd, currentIndices, newIndices) {
1452+
Plotly.moveTraces = function moveTraces(gd, currentIndices, newIndices) {
14531453
gd = getGraphDiv(gd);
14541454

14551455
var newData = [],
@@ -1499,7 +1499,7 @@ Plotly.moveTraces = function moveTraces (gd, currentIndices, newIndices) {
14991499
}
15001500

15011501
// reorder this mapping by newIndex, ascending
1502-
movingTraceMap.sort(function (a, b) {
1502+
movingTraceMap.sort(function(a, b) {
15031503
return a.newIndex - b.newIndex;
15041504
});
15051505

src/plots/cartesian/axes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ axes.setConvert = function(ax) {
707707
v = axes.cleanDatum(v);
708708
return isNumeric(v) ? Number(v) : axes.BADNUM;
709709
};
710-
ax.d2l = function (v, clip) {
710+
ax.d2l = function(v, clip) {
711711
if (ax.type === 'log') return ax.c2l(ax.d2c(v), clip);
712712
else return ax.d2c(v);
713713
};
@@ -1187,7 +1187,7 @@ axes.autoBin = function(data,ax,nbins,is2d) {
11871187
// if ticks are set to automatic, determine the right values (tick0,dtick)
11881188
// in any case, set tickround to # of digits to round tick labels to,
11891189
// or codes to this effect for log and date scales
1190-
axes.calcTicks = function calcTicks (ax) {
1190+
axes.calcTicks = function calcTicks(ax) {
11911191
if(ax.tickmode === 'array') return arrayTicks(ax);
11921192

11931193
// calculate max number of (auto) ticks to display based on plot size
@@ -1935,7 +1935,7 @@ axes.getFromId = function(td, id, type) {
19351935
};
19361936

19371937
// get an axis object of specified type from the containing trace
1938-
axes.getFromTrace = function (td, fullTrace, type) {
1938+
axes.getFromTrace = function(td, fullTrace, type) {
19391939
var fullLayout = td._fullLayout;
19401940
var ax = null;
19411941
if (Plotly.Plots.traceIs(fullTrace, 'gl3d')) {

src/plots/cartesian/graph_interact.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ var HOVERARROWSIZE = constants.HOVERARROWSIZE,
264264
// The actual rendering is done by private functions
265265
// hover() and unhover().
266266

267-
fx.hover = function (gd, evt, subplot) {
267+
fx.hover = function(gd, evt, subplot) {
268268
if(typeof gd === 'string') gd = document.getElementById(gd);
269269
if(gd._lastHoverTime === undefined) gd._lastHoverTime = 0;
270270

@@ -281,14 +281,14 @@ fx.hover = function (gd, evt, subplot) {
281281
return;
282282
}
283283
// Queue up the next hover for 100ms from now (if no further events)
284-
gd._hoverTimer = setTimeout(function () {
284+
gd._hoverTimer = setTimeout(function() {
285285
hover(gd,evt,subplot);
286286
gd._lastHoverTime = Date.now();
287287
gd._hoverTimer = undefined;
288288
}, constants.HOVERMINTIME);
289289
};
290290

291-
fx.unhover = function (gd, evt, subplot) {
291+
fx.unhover = function(gd, evt, subplot) {
292292
if(typeof gd === 'string') gd = document.getElementById(gd);
293293
// Important, clear any queued hovers
294294
if (gd._hoverTimer) {

src/plots/gl3d/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ exports.cleanId = function cleanId(id) {
7676

7777
exports.setConvert = require('./set_convert');
7878

79-
exports.initAxes = function (gd) {
79+
exports.initAxes = function(gd) {
8080
var fullLayout = gd._fullLayout;
8181

8282
// until they play better together

src/plots/gl3d/layout/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var layoutAttributes = require('./layout_attributes');
1414
var supplyGl3dAxisLayoutDefaults = require('./axis_defaults');
1515

1616

17-
module.exports = function supplyLayoutDefaults (layoutIn, layoutOut, fullData) {
17+
module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
1818
if (!layoutOut._hasGL3D) return;
1919

2020
var scenes = Plotly.Plots.getSubplotIdsInData(fullData, 'gl3d');

0 commit comments

Comments
 (0)