Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ming Gao authored and gaoxm committed Jul 29, 2019
1 parent 9985d65 commit 01466ea
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 126 deletions.
16 changes: 8 additions & 8 deletions modules/services/fb_ml_roads.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var _tileCache;
var _tree;
var _deferredFBRoadsParsing = new Set();

var _off;
var _off;

function abortRequest(i) {
i.abort();
Expand Down Expand Up @@ -163,7 +163,7 @@ export default {
// save the current history state
checkpoint: function(key) {
_checkpoints[key] = {
graph: _graph,
graph: _graph,
};
return this;
},
Expand All @@ -182,10 +182,10 @@ export default {
else {
_graph = coreGraph();
_tree = coreTree(_graph);
_tileCache = { inflight: {}, loaded: {}, seen: {}, origIdTile: {} };
_tileCache = { inflight: {}, loaded: {}, seen: {}, origIdTile: {} };
}

return this;
return this;
},


Expand Down Expand Up @@ -217,12 +217,12 @@ export default {
};
}

// access cache directly for testing
// access cache directly for testing
if (obj === 'get') {
return _tileCache;
}

_tileCache = obj;
_tileCache = obj;
},


Expand All @@ -233,7 +233,7 @@ export default {


loadTiles: function(projection, taskExtent) {
if (_off) return;
if (_off) return;

var tiles = tiler.getTiles(projection);

Expand Down Expand Up @@ -262,7 +262,7 @@ export default {
dispatch.call('loadedData');
});
})
.catch(function(err) {});
.catch(function() {});
_tileCache.inflight[tile.id] = controller;
});
}
Expand Down
3 changes: 1 addition & 2 deletions modules/svg/fb_roads.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function svgFbRoads(projection, context, dispatch) {


function onHistoryRestore() {
_actioned = new Set();
_actioned = new Set();
context.history().peekAllAnnotations().forEach(function (annotation) {
if (isFbRoadsAnnotation(annotation)) {
_actioned.add(annotation.id);
Expand Down Expand Up @@ -150,7 +150,6 @@ export function svgFbRoads(projection, context, dispatch) {
if (!surface || surface.empty() || waitingForTaskExtent) return; // not ready to draw yet, starting up

var roadsService = getService();
var graph = context.graph();
var roadsGraph = roadsService && roadsService.graph();
var getPath = svgPath(projection, roadsGraph);
var getTransform = svgPointTransform(projection);
Expand Down
30 changes: 14 additions & 16 deletions modules/svg/lines.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import { osmEntity, osmOldMultipolygonOuterMember } from '../osm';
import { utilArrayFlatten, utilArrayGroupBy } from '../util';
import { utilDetect } from '../util/detect';
import _isEqual from 'lodash-es/isEqual';
import _transform from 'lodash-es/transform';
import _omit from 'lodash-es/omit';
import _isObject from 'lodash-es/isObject';
import _omit from 'lodash-es/omit';

export function svgLines(projection, context) {
var detected = utilDetect();
Expand Down Expand Up @@ -59,13 +57,13 @@ export function svgLines(projection, context) {
.remove();

var graphEditClass = function(d) {

return d.properties.nodes.some(function(n) {
if (!base.entities[n.id]) {
return true;
}
var result = !_isEqual(_omit(graph.entities[n.id], ['tags', 'v']), _omit(base.entities[n.id], ['tags', 'v']));
return result;
return true;
}
var result = !_isEqual(_omit(graph.entities[n.id], ['tags', 'v']), _omit(base.entities[n.id], ['tags', 'v']));
return result;
}) ? ' graphedited ': '';
};

Expand Down Expand Up @@ -93,8 +91,8 @@ export function svgLines(projection, context) {
.append('path')
.merge(nopes)
.attr('d', getPath)
.attr('class', function(d) {
return 'way line target target-nope ' + nopeClass + d.id + graphEditClass(d);
.attr('class', function(d) {
return 'way line target target-nope ' + nopeClass + d.id + graphEditClass(d);
});
}

Expand All @@ -114,21 +112,21 @@ export function svgLines(projection, context) {

// Class for styling currently edited lines
var tagEditClass = function(d) {
var result = graph.entities[d.id] && base.entities[d.id] && !_isEqual(graph.entities[d.id].tags, base.entities[d.id].tags);
var result = graph.entities[d.id] && base.entities[d.id] && !_isEqual(graph.entities[d.id].tags, base.entities[d.id].tags);

return result ?
' tagedited ' : '';
return result ?
' tagedited ' : '';
};

// Class for styling currently edited lines
var graphEditClass = function(d) {
if (!base.entities[d.id]) {
return ' graphedited ';
return ' graphedited ';
}

var result = graph.entities[d.id] && base.entities[d.id] && !_isEqual(_omit(graph.entities[d.id], ['tags', 'v']), _omit(base.entities[d.id], ['tags', 'v']));
var result = graph.entities[d.id] && base.entities[d.id] && !_isEqual(_omit(graph.entities[d.id], ['tags', 'v']), _omit(base.entities[d.id], ['tags', 'v']));

return result ? ' graphedited ' : '';
return result ? ' graphedited ' : '';
};

function drawLineGroup(selection, klass, isSelected) {
Expand Down
10 changes: 5 additions & 5 deletions modules/ui/fb_road_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function uiFbRoadPicker(context, keybinding) {
var ML_ROADS_LIMIT_NON_TM_MODE = 50;


function isAddRoadDisabled(_) {
function isAddRoadDisabled() {
// when task GPX is set in URL (TM mode), "add roads" is always enabled
var gpxInUrl = utilStringQs(window.location.hash).gpx;
if (gpxInUrl) return false;
Expand All @@ -25,7 +25,7 @@ export function uiFbRoadPicker(context, keybinding) {
var entities = context.graph().entities;
for (var eid in entities) {
var e = entities[eid];
if (eid.startsWith('w-') && e && e.tags['source'] === 'digitalglobe') {
if (eid.startsWith('w-') && e && e.tags.source === 'digitalglobe') {
mlRoadsCount += 1;
}
}
Expand Down Expand Up @@ -60,11 +60,11 @@ export function uiFbRoadPicker(context, keybinding) {
};
context.perform(actionStitchFbRoad(_datum.id, serviceFbMLRoads.graph()), annotation);
context.enter(modeSelect(context, [_datum.id]));

if (context.inIntro()) return;

if (sessionStorage.getItem('acknowledgedLogin') === 'true') return;
sessionStorage.setItem('acknowledgedLogin', 'true');
sessionStorage.setItem('acknowledgedLogin', 'true');
var osm = context.connection();

if (!osm.authenticated()) {
Expand Down
6 changes: 2 additions & 4 deletions modules/ui/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { uiScale } from './scale';
import { uiShortcuts } from './shortcuts';
import { uiSidebar } from './sidebar';
import { uiSpinner } from './spinner';
import { uiSplash } from './splash';
import { uiSplashRapid } from './splash_rapid';
import { uiStatus } from './status';
import { uiTopToolbar } from './top_toolbar';
Expand Down Expand Up @@ -298,23 +297,22 @@ export function uiInit(context) {

context.enter(modeBrowse(context));

var osm = context.connection();
if (!_initCounter++) {
if (!hash.startWalkthrough) {
var osm = context.connection();
if (context.history().lock() && context.history().restorableChanges()) {
context.container()
.call(uiRestore(context));
} else if (osm.authenticated()) {
context.container()
.call(uiSplashRapid(context))
.call(uiSplashRapid(context));
}
}

context.container()
.call(uiShortcuts(context));
}

var osm = context.connection();
var auth = uiLoading(context).message(t('loading_auth')).blocking(true);

if (osm && auth) {
Expand Down
16 changes: 8 additions & 8 deletions modules/ui/intro/intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var chapterUi = {
area: uiIntroArea,
line: uiIntroLine,
building: uiIntroBuilding,
rapid: uiIntroRapid,
rapid: uiIntroRapid,
startEditing: uiIntroStartEditing
};

Expand All @@ -52,7 +52,7 @@ var chapterFlow = [
export function uiIntro(context, skipToRapid) {
var INTRO_IMAGERY = 'EsriWorldImageryClarity';
var introGraph = {};
var rapidGraph = {};
var rapidGraph = {};
var _currChapter;

// create entities for intro graph and localize names
Expand All @@ -61,7 +61,7 @@ export function uiIntro(context, skipToRapid) {
}

// create entities for RapiD graph and localize names
for (var id in dataIntroRapidGraph) {
for (id in dataIntroRapidGraph) {
rapidGraph[id] = osmEntity(localize(dataIntroRapidGraph[id]));
}

Expand All @@ -82,7 +82,7 @@ export function uiIntro(context, skipToRapid) {
var caches = osm && osm.caches();
var baseEntities = context.history().graph().base().entities;
var countryCode = services.geocoder.countryCode;
var fbMLRoadsEntities = services.fbMLRoads && services.fbMLRoads.graph().entities;
var fbMLRoadsEntities = services.fbMLRoads && services.fbMLRoads.graph().entities;
var fbMLRoadsCache = services.fbMLRoads && services.fbMLRoads.cache();

// Show sidebar and disable the sidebar resizing button
Expand All @@ -97,7 +97,7 @@ export function uiIntro(context, skipToRapid) {
if (osm) { osm.toggle(false).reset(); }
context.history().reset();

var loadedGraph = coreGraph().load(introGraph);
var loadedGraph = coreGraph().load(introGraph);
var graphEntities = Object.values(loadedGraph.entities);
context.history().merge(graphEntities);
context.history().checkpoint('initial');
Expand Down Expand Up @@ -127,11 +127,11 @@ export function uiIntro(context, skipToRapid) {
callback(null, t('intro.graph.countrycode'));
};

if (services.fbMLRoads) services.fbMLRoads.toggle(false).reset();
if (services.fbMLRoads) services.fbMLRoads.toggle(false).reset();

var coreGraphEntities = coreGraph().load(rapidGraph).entities;
var coreGraphEntities = coreGraph().load(rapidGraph).entities;
services.fbMLRoads.merge(Object.values(coreGraphEntities));
services.fbMLRoads.checkpoint('initial');
services.fbMLRoads.checkpoint('initial');

d3_selectAll('#map .layer-background').style('opacity', 1);
d3_selectAll('#map .layer-fb-roads').style('opacity', 1);
Expand Down
Loading

0 comments on commit 01466ea

Please sign in to comment.