diff --git a/.eslintrc b/.eslintrc index 0cb7ec158..a99c83f4c 100644 --- a/.eslintrc +++ b/.eslintrc @@ -19,6 +19,7 @@ "array-callback-return": "warn", "arrow-spacing": "warn", "block-scoped-var": "error", + "brace-style": ["warn", "1tbs", { "allowSingleLine": true }], "class-methods-use-this": "error", "complexity": ["warn", 50], "default-case-last": "error", diff --git a/modules/osm/lanes.js b/modules/osm/lanes.js index 941f602b6..cecf09f2a 100644 --- a/modules/osm/lanes.js +++ b/modules/osm/lanes.js @@ -136,23 +136,19 @@ function parseLaneDirections(tags, isOneWay, laneCount) { forward = 0; bothways = 0; backward = laneCount; - } - else if (isOneWay) { + } else if (isOneWay) { forward = laneCount; bothways = 0; backward = 0; - } - else if (isNaN(forward) && isNaN(backward)) { + } else if (isNaN(forward) && isNaN(backward)) { backward = Math.floor((laneCount - bothways) / 2); forward = laneCount - bothways - backward; - } - else if (isNaN(forward)) { + } else if (isNaN(forward)) { if (backward > laneCount - bothways) { backward = laneCount - bothways; } forward = laneCount - bothways - backward; - } - else if (isNaN(backward)) { + } else if (isNaN(backward)) { if (forward > laneCount - bothways) { forward = laneCount - bothways; } diff --git a/modules/svg/midpoints.js b/modules/svg/midpoints.js index 891542609..9e33ddfc5 100644 --- a/modules/svg/midpoints.js +++ b/modules/svg/midpoints.js @@ -83,8 +83,7 @@ export function svgMidpoints(projection, context) { point = geoLineIntersection([a.loc, b.loc], [poly[k], poly[k + 1]]); if (point && geoVecLength(projection(a.loc), projection(point)) > 20 && - geoVecLength(projection(b.loc), projection(point)) > 20) - { + geoVecLength(projection(b.loc), projection(point)) > 20) { loc = point; break; } diff --git a/modules/svg/tag_classes.js b/modules/svg/tag_classes.js index 43b433097..a7482bdd8 100644 --- a/modules/svg/tag_classes.js +++ b/modules/svg/tag_classes.js @@ -118,8 +118,7 @@ export function svgTagClasses() { if (v === 'yes') { // e.g. `railway=rail + abandoned=yes` status = k; - } - else if (primary && primary === v) { // e.g. `railway=rail + abandoned=railway` + } else if (primary && primary === v) { // e.g. `railway=rail + abandoned=railway` status = k; } else if (!primary && primaries.indexOf(v) !== -1) { // e.g. `abandoned=railway` status = k; diff --git a/modules/ui/curtain.js b/modules/ui/curtain.js index 9fa08ad7f..6ec48cead 100644 --- a/modules/ui/curtain.js +++ b/modules/ui/curtain.js @@ -193,8 +193,7 @@ export function uiCurtain(containerNode) { if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w - 70) { side = 'left'; pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY]; - } - else { + } else { side = 'right'; pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY]; } @@ -217,8 +216,7 @@ export function uiCurtain(containerNode) { if (side === 'left' || side === 'right') { if (pos[1] < 60) { shiftY = 60 - pos[1]; - } - else if (pos[1] + tip.height > h - 100) { + } else if (pos[1] + tip.height > h - 100) { shiftY = h - pos[1] - tip.height - 100; } } diff --git a/modules/util/jxon.js b/modules/util/jxon.js index ee33f83ee..6fbc524ae 100644 --- a/modules/util/jxon.js +++ b/modules/util/jxon.js @@ -31,9 +31,16 @@ export var JXON = new (function () { if (bChildren) { for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) { oNode = oParentNode.childNodes.item(nItem); - if (oNode.nodeType === 4) { sCollectedTxt += oNode.nodeValue; } /* nodeType is 'CDATASection' (4) */ - else if (oNode.nodeType === 3) { sCollectedTxt += oNode.nodeValue.trim(); } /* nodeType is 'Text' (3) */ - else if (oNode.nodeType === 1 && !oNode.prefix) { aCache.push(oNode); } /* nodeType is 'Element' (1) */ + if (oNode.nodeType === 4) { + /* nodeType is 'CDATASection' (4) */ + sCollectedTxt += oNode.nodeValue; + } else if (oNode.nodeType === 3) { + /* nodeType is 'Text' (3) */ + sCollectedTxt += oNode.nodeValue.trim(); + } else if (oNode.nodeType === 1 && !oNode.prefix) { + /* nodeType is 'Element' (1) */ + aCache.push(oNode); + } } } diff --git a/modules/util/zoom_pan.js b/modules/util/zoom_pan.js index ee69ed73b..ccfefd114 100644 --- a/modules/util/zoom_pan.js +++ b/modules/util/zoom_pan.js @@ -297,8 +297,9 @@ export function utilZoomPan() { } else if (g.pointer0) { p = g.pointer0[0]; l = g.pointer0[1]; + } else { + return; } - else return; g.zoom(d3_event, 'touch', constrain(translate(t, p, l), g.extent, translateExtent)); }