mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
Enable block-scoped-var eslint rule
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
"rules": {
|
||||
"accessor-pairs": "error",
|
||||
"arrow-spacing": "warn",
|
||||
"block-scoped-var": "error",
|
||||
"class-methods-use-this": "error",
|
||||
"complexity": ["warn", 50],
|
||||
"default-case-last": "error",
|
||||
|
||||
@@ -169,7 +169,8 @@ export function actionAddMember(relationId, member, memberIndex, insertPair) {
|
||||
// members 0 1 2 3 x 5 4 7 6 x 8 9 keep 6 in j+k
|
||||
//
|
||||
function moveMember(arr, findIndex, toIndex) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
var i;
|
||||
for (i = 0; i < arr.length; i++) {
|
||||
if (arr[i].index === findIndex) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -242,9 +242,11 @@ export function actionCircularize(wayId, projection, maxAngle) {
|
||||
var centroid = d3_polygonCentroid(points);
|
||||
var radius = geoVecLengthSquare(centroid, points[0]);
|
||||
|
||||
var i, actualPoint;
|
||||
|
||||
// compare distances between centroid and points
|
||||
for (var i = 0; i<hull.length; i++){
|
||||
var actualPoint = hull[i];
|
||||
for (i = 0; i < hull.length; i++){
|
||||
actualPoint = hull[i];
|
||||
var actualDist = geoVecLengthSquare(actualPoint, centroid);
|
||||
var diff = Math.abs(actualDist - radius);
|
||||
//compare distances with epsilon-error (5%)
|
||||
@@ -254,7 +256,7 @@ export function actionCircularize(wayId, projection, maxAngle) {
|
||||
}
|
||||
|
||||
//check if central angles are smaller than maxAngle
|
||||
for (i = 0; i<hull.length; i++){
|
||||
for (i = 0; i < hull.length; i++){
|
||||
actualPoint = hull[i];
|
||||
var nextPoint = hull[(i+1)%hull.length];
|
||||
var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
|
||||
|
||||
@@ -190,16 +190,17 @@ export function modeDragNode(context) {
|
||||
var currMouse = geoVecSubtract(currPoint, nudge);
|
||||
var loc = context.projection.invert(currMouse);
|
||||
|
||||
var target, edge;
|
||||
|
||||
if (!_nudgeInterval) { // If not nudging at the edge of the viewport, try to snap..
|
||||
// related code
|
||||
// - `mode/drag_node.js` `doMove()`
|
||||
// - `behavior/draw.js` `click()`
|
||||
// - `behavior/draw_way.js` `move()`
|
||||
var d = datum(d3_event);
|
||||
var target = d && d.properties && d.properties.entity;
|
||||
target = d && d.properties && d.properties.entity;
|
||||
var targetLoc = target && target.loc;
|
||||
var targetNodes = d && d.properties && d.properties.nodes;
|
||||
var edge;
|
||||
|
||||
if (targetLoc) { // snap to node/vertex - a point target with `.loc`
|
||||
if (shouldSnapToNode(target)) {
|
||||
|
||||
@@ -40,9 +40,10 @@ function vtToGeoJSON(data, tile, mergeCache) {
|
||||
geometry.coordinates = [geometry.coordinates];
|
||||
}
|
||||
|
||||
var isClipped = false;
|
||||
|
||||
// Clip to tile bounds
|
||||
if (geometry.type === 'MultiPolygon') {
|
||||
var isClipped = false;
|
||||
var featureClip = turf_bboxClip(feature, tile.extent.rectangle());
|
||||
if (!deepEqual(feature.geometry, featureClip.geometry)) {
|
||||
// feature = featureClip;
|
||||
|
||||
@@ -289,8 +289,9 @@ export function uiFieldRestrictions(field, context) {
|
||||
.selectAll('.related')
|
||||
.classed('related', false);
|
||||
|
||||
var way;
|
||||
if (_fromWayID) {
|
||||
var way = vgraph.entity(_fromWayID);
|
||||
way = vgraph.entity(_fromWayID);
|
||||
surface
|
||||
.selectAll('.' + _fromWayID)
|
||||
.classed('selected', true)
|
||||
|
||||
@@ -418,8 +418,9 @@ export function utilEditDistance(a, b) {
|
||||
if (a.length === 0) return b.length;
|
||||
if (b.length === 0) return a.length;
|
||||
var matrix = [];
|
||||
for (var i = 0; i <= b.length; i++) { matrix[i] = [i]; }
|
||||
for (var j = 0; j <= a.length; j++) { matrix[0][j] = j; }
|
||||
var i, j;
|
||||
for (i = 0; i <= b.length; i++) { matrix[i] = [i]; }
|
||||
for (j = 0; j <= a.length; j++) { matrix[0][j] = j; }
|
||||
for (i = 1; i <= b.length; i++) {
|
||||
for (j = 1; j <= a.length; j++) {
|
||||
if (b.charAt(i-1) === a.charAt(j-1)) {
|
||||
|
||||
Reference in New Issue
Block a user