mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
Enable array-callback-return eslint rule
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
},
|
||||
"rules": {
|
||||
"accessor-pairs": "error",
|
||||
"array-callback-return": "warn",
|
||||
"arrow-spacing": "warn",
|
||||
"block-scoped-var": "error",
|
||||
"class-methods-use-this": "error",
|
||||
|
||||
@@ -17,14 +17,14 @@ export function operationExtract(context, selectedIDs) {
|
||||
var _actions = selectedIDs.map(function(entityID) {
|
||||
var graph = context.graph();
|
||||
var entity = graph.hasEntity(entityID);
|
||||
if (!entity || !entity.hasInterestingTags()) return;
|
||||
if (!entity || !entity.hasInterestingTags()) return null;
|
||||
|
||||
if (entity.type === 'node' && graph.parentWays(entity).length === 0) return;
|
||||
if (entity.type === 'node' && graph.parentWays(entity).length === 0) return null;
|
||||
|
||||
if (entity.type !== 'node') {
|
||||
var preset = presetManager.match(entity, graph);
|
||||
// only allow extraction from ways/relations if the preset supports points
|
||||
if (preset.geometry.indexOf('point') === -1) return;
|
||||
if (preset.geometry.indexOf('point') === -1) return null;
|
||||
}
|
||||
|
||||
_extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
|
||||
|
||||
@@ -18,18 +18,18 @@ export function operationReverse(context, selectedIDs) {
|
||||
function actions(situation) {
|
||||
return selectedIDs.map(function(entityID) {
|
||||
var entity = context.hasEntity(entityID);
|
||||
if (!entity) return;
|
||||
if (!entity) return null;
|
||||
|
||||
if (situation === 'toolbar') {
|
||||
if (entity.type === 'way' &&
|
||||
(!entity.isOneWay() && !entity.isSided())) return;
|
||||
(!entity.isOneWay() && !entity.isSided())) return null;
|
||||
}
|
||||
|
||||
var geometry = entity.geometry(context.graph());
|
||||
if (entity.type !== 'node' && geometry !== 'line') return;
|
||||
if (entity.type !== 'node' && geometry !== 'line') return null;
|
||||
|
||||
var action = actionReverse(entityID);
|
||||
if (action.disabled(context.graph())) return;
|
||||
if (action.disabled(context.graph())) return null;
|
||||
|
||||
return action;
|
||||
}).filter(Boolean);
|
||||
|
||||
@@ -398,9 +398,8 @@ export function presetIndex() {
|
||||
|
||||
return _addablePresetIDs.map((id) => {
|
||||
const preset = _this.item(id);
|
||||
if (preset) {
|
||||
return RibbonItem(preset, 'addable');
|
||||
}
|
||||
if (preset) return RibbonItem(preset, 'addable');
|
||||
return null;
|
||||
}).filter(Boolean);
|
||||
};
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ export default {
|
||||
// Using multiple individual item + class requests to reduce fetched data size
|
||||
const allRequests = items.map(itemType => {
|
||||
// No need to request data we already have
|
||||
if (itemType in _cache.strings[locale]) return;
|
||||
if (itemType in _cache.strings[locale]) return null;
|
||||
|
||||
const cacheData = data => {
|
||||
// Bunch of nested single value arrays of objects
|
||||
@@ -249,7 +249,7 @@ export default {
|
||||
const url = `${_osmoseUrlRoot}/items/${item}/class/${cl}?langs=${locale}`;
|
||||
|
||||
return d3_json(url).then(cacheData);
|
||||
});
|
||||
}).filter(Boolean);
|
||||
|
||||
return Promise.all(allRequests).then(() => _cache.strings[locale]);
|
||||
},
|
||||
|
||||
@@ -170,6 +170,7 @@ export function svgMapillaryImages(projection, context, dispatch) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
if (fromDate) {
|
||||
|
||||
@@ -11,6 +11,7 @@ export function uiFeatureInfo(context) {
|
||||
count += stats[k];
|
||||
return t('inspector.title_count', { title: t.html('feature.' + k + '.description'), count: stats[k] });
|
||||
}
|
||||
return null;
|
||||
}).filter(Boolean);
|
||||
|
||||
selection.html('');
|
||||
|
||||
@@ -242,11 +242,11 @@ export function uiFieldWikidata(field, context) {
|
||||
|
||||
var actions = initEntityIDs.map(function(entityID) {
|
||||
var entity = context.hasEntity(entityID);
|
||||
if (!entity) return;
|
||||
if (!entity) return null;
|
||||
|
||||
var currTags = Object.assign({}, entity.tags); // shallow copy
|
||||
if (newWikipediaValue === null) {
|
||||
if (!currTags[_wikipediaKey]) return;
|
||||
if (!currTags[_wikipediaKey]) return null;
|
||||
|
||||
delete currTags[_wikipediaKey];
|
||||
} else {
|
||||
|
||||
@@ -238,6 +238,7 @@ export function uiFieldWikipedia(field, context) {
|
||||
currTags.wikidata = value;
|
||||
return actionChangeTags(entityID, currTags);
|
||||
}
|
||||
return null;
|
||||
}).filter(Boolean);
|
||||
|
||||
if (!actions.length) return;
|
||||
|
||||
@@ -170,6 +170,8 @@ export function validationDisconnectedWay() {
|
||||
if (parentRelation.isMultipolygon() &&
|
||||
isTaggedAsHighway(parentRelation) &&
|
||||
(!ignoreInnerWays || parentRelation.memberById(way.id).role !== 'inner')) return true;
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user