Skip to content

Commit 716a621

Browse files
committed
Merge pull request #544 from monfera/space-linting
Space linting rule additions and wholesale fix
2 parents 270726c + 61d8686 commit 716a621

File tree

130 files changed

+2043
-2043
lines changed

Some content is hidden

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

130 files changed

+2043
-2043
lines changed

.eslintrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"root": true,
33
"extends": [
4-
"eslint:recommended",
4+
"eslint:recommended"
55
],
66
"env": {
77
"commonjs": true
@@ -16,7 +16,7 @@
1616
"brace-style": [0, "stroustrup", {"allowSingleLine": true}],
1717
"curly": [0, "multi"],
1818
"camelcase": [0, {"properties": "never"}],
19-
"comma-spacing": [0, {"before": false, "after": true}],
19+
"comma-spacing": [2, {"before": false, "after": true}],
2020
"comma-style": [2, "last"],
2121
"semi": [2],
2222
"semi-spacing": [2, {"before": false, "after": true}],
@@ -36,7 +36,7 @@
3636
"no-whitespace-before-property": [2],
3737
"no-unexpected-multiline": [2],
3838
"no-floating-decimal": [2],
39-
"space-infix-ops": [0, {"int32Hint": false}],
39+
"space-infix-ops": [2, {"int32Hint": true}],
4040
"quotes": [2, "single"],
4141
"dot-notation": [2],
4242
"operator-linebreak": [2, "after"],
@@ -50,5 +50,5 @@
5050
"no-loop-func": [2],
5151
"no-console": [0],
5252
"no-unused-labels": [2]
53-
},
53+
}
5454
}

src/components/annotations/index.js

Lines changed: 74 additions & 74 deletions
Large diffs are not rendered by default.

src/components/color/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ color.addOpacity = function(cstr, op) {
4141
// color.background is assumed behind it
4242
color.combine = function(front, back) {
4343
var fc = tinycolor(front).toRgb();
44-
if(fc.a===1) return tinycolor(front).toRgbString();
44+
if(fc.a === 1) return tinycolor(front).toRgbString();
4545

46-
var bc = tinycolor(back||color.background).toRgb(),
47-
bcflat = bc.a===1 ? bc : {
48-
r: 255 * (1-bc.a) + bc.r*bc.a,
49-
g: 255 * (1-bc.a) + bc.g*bc.a,
50-
b: 255 * (1-bc.a) + bc.b*bc.a
46+
var bc = tinycolor(back || color.background).toRgb(),
47+
bcflat = bc.a === 1 ? bc : {
48+
r: 255 * (1 - bc.a) + bc.r * bc.a,
49+
g: 255 * (1 - bc.a) + bc.g * bc.a,
50+
b: 255 * (1 - bc.a) + bc.b * bc.a
5151
},
5252
fcflat = {
53-
r: bcflat.r*(1-fc.a) + fc.r*fc.a,
54-
g: bcflat.g*(1-fc.a) + fc.g*fc.a,
55-
b: bcflat.b*(1-fc.a) + fc.b*fc.a
53+
r: bcflat.r * (1 - fc.a) + fc.r * fc.a,
54+
g: bcflat.g * (1 - fc.a) + fc.g * fc.a,
55+
b: bcflat.b * (1 - fc.a) + fc.b * fc.a
5656
};
5757
return tinycolor(fcflat).toRgbString();
5858
};
@@ -110,7 +110,7 @@ function cleanOne(val) {
110110
if(isNumeric(val) || typeof val !== 'string') return val;
111111

112112
var valTrim = val.trim();
113-
if(valTrim.substr(0,3) !== 'rgb') return val;
113+
if(valTrim.substr(0, 3) !== 'rgb') return val;
114114

115115
var match = valTrim.match(/^rgba?\s*\(([^()]*)\)$/);
116116
if(!match) return val;

src/components/colorbar/draw.js

Lines changed: 91 additions & 91 deletions
Large diffs are not rendered by default.

src/components/colorscale/calc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ module.exports = function calc(trace, vals, containerStr, cLetter) {
3131
max = container[cLetter + 'max'],
3232
scl = container.colorscale;
3333

34-
if(auto!==false || min===undefined) {
34+
if(auto !== false || min === undefined) {
3535
min = Lib.aggNums(Math.min, null, vals);
3636
}
3737

38-
if(auto!==false || max===undefined) {
38+
if(auto !== false || max === undefined) {
3939
max = Lib.aggNums(Math.max, null, vals);
4040
}
4141

src/components/colorscale/defaults.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var flipScale = require('./flip_scale');
2222
module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, opts) {
2323
var prefix = opts.prefix,
2424
cLetter = opts.cLetter,
25-
containerStr = prefix.slice(0, prefix.length-1),
25+
containerStr = prefix.slice(0, prefix.length - 1),
2626
containerIn = prefix ?
2727
Lib.nestedProperty(traceIn, containerStr).get() || {} :
2828
traceIn,
@@ -41,7 +41,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce,
4141
// handles both the trace case (autocolorscale is false by default) and
4242
// the marker and marker.line case (autocolorscale is true by default)
4343
var autoColorscaleDftl;
44-
if(sclIn!==undefined) autoColorscaleDftl = !isValidScale(sclIn);
44+
if(sclIn !== undefined) autoColorscaleDftl = !isValidScale(sclIn);
4545
coerce(prefix + 'autocolorscale', autoColorscaleDftl);
4646
var sclOut = coerce(prefix + 'colorscale');
4747

src/components/colorscale/flip_scale.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = function flipScale(scl) {
1414
sclNew = new Array(N),
1515
si;
1616

17-
for(var i = N-1, j = 0; i >= 0; i--, j++) {
17+
for(var i = N - 1, j = 0; i >= 0; i--, j++) {
1818
si = scl[i];
1919
sclNew[j] = [1 - si[0], si[1]];
2020
}

src/components/colorscale/has_colorscale.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ module.exports = function hasColorscale(trace, containerStr) {
3333
}
3434

3535
return (
36-
(typeof container==='object' && container!==null) && (
36+
(typeof container === 'object' && container !== null) && (
3737
isArrayWithOneNumber ||
38-
container.showscale===true ||
38+
container.showscale === true ||
3939
(isNumeric(container.cmin) && isNumeric(container.cmax)) ||
4040
isValidScale(container.colorscale) ||
41-
(typeof container.colorbar==='object' && container.colorbar!==null)
41+
(typeof container.colorbar === 'object' && container.colorbar !== null)
4242
)
4343
);
4444
};

src/components/colorscale/is_valid_scale_array.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ module.exports = function isValidScaleArray(scl) {
1919

2020
if(!Array.isArray(scl)) return false;
2121
else {
22-
if(+scl[0][0]!==0 || +scl[scl.length-1][0]!==1) return false;
22+
if(+scl[0][0] !== 0 || +scl[scl.length - 1][0] !== 1) return false;
2323
for(var i = 0; i < scl.length; i++) {
2424
si = scl[i];
25-
if(si.length!==2 || +si[0]<highestVal || !tinycolor(si[1]).isValid()) {
25+
if(si.length !== 2 || +si[0] < highestVal || !tinycolor(si[1]).isValid()) {
2626
isValid = false;
2727
break;
2828
}

src/components/dragelement/align.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = function align(v, dv, v0, v1, anchor) {
2525
if(anchor === 'right' || anchor === 'top') return vmax;
2626

2727
// automatic based on position
28-
if(vmin < (2/3) - vc) return vmin;
29-
if(vmax > (4/3) - vc) return vmax;
28+
if(vmin < (2 / 3) - vc) return vmin;
29+
if(vmax > (4 / 3) - vc) return vmax;
3030
return vc;
3131
};

src/components/dragelement/cursor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ var cursorset = [
2222
];
2323

2424
module.exports = function getCursor(x, y, xanchor, yanchor) {
25-
if(xanchor === 'left') x=0;
26-
else if(xanchor === 'center') x=1;
27-
else if(xanchor === 'right') x=2;
25+
if(xanchor === 'left') x = 0;
26+
else if(xanchor === 'center') x = 1;
27+
else if(xanchor === 'right') x = 2;
2828
else x = Lib.constrain(Math.floor(x * 3), 0, 2);
2929

3030
if(yanchor === 'bottom') y = 0;

src/components/dragelement/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ dragElement.init = function init(options) {
9696

9797
if(Math.abs(dx) < minDrag) dx = 0;
9898
if(Math.abs(dy) < minDrag) dy = 0;
99-
if(dx||dy) {
99+
if(dx || dy) {
100100
gd._dragged = true;
101101
dragElement.unhover(gd);
102102
}

0 commit comments

Comments
 (0)