Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2821 ESLint Updates: 'consistent-return' (#6336)

Jason Hurleyb66c86a1077c
diff --git a/web/.eslintrc b/web/.eslintrc
index d086e1f5c..c07d94858 100644
--- a/web/.eslintrc
+++ b/web/.eslintrc
@@ -88,7 +88,6 @@
"no-nested-ternary": "off", // 164 errors across 40 files
"no-shadow": "warn", // 110 errors across 40 files
"max-len": "error",
- "consistent-return": "off", // 95 errors across 58 files
"no-underscore-dangle": "error",
"no-param-reassign": [ // 198 errors across 46 files
"warn",
diff --git a/web/js/components/animation-widget/play-queue.js b/web/js/components/animation-widget/play-queue.js
index 90e9b0bdb..ad1bf4e04 100644
--- a/web/js/components/animation-widget/play-queue.js
+++ b/web/js/components/animation-widget/play-queue.js
@@ -207,15 +207,15 @@ class PlayQueue extends React.Component {
const restartLoop = loopStart && currentDate.getTime() === startDate.getTime();
if ((isAnimating || this.hasPlayStarted) && !loopStart) {
- return;
+ return true;
}
if (this.isPreloadSufficient() || restartLoop) {
- if (this.isBetweenSteps) return;
+ if (this.isBetweenSteps) return true;
// console.debug('Started: ', Date.now());
this.hasPlayStarted = true;
return this.play();
}
- this.checkQueue();
+ return this.checkQueue();
};
checkShouldLoop() {
@@ -313,7 +313,7 @@ class PlayQueue extends React.Component {
this.fetchTimes.push(fetchTime);
this.setState({ loadedItems: loadedItems += 1 });
- if (!this.mounted) return;
+ if (!this.mounted) return true;
this.bufferObject[strDate] = strDate;
delete this.inQueueObject[strDate];
const currentBufferSize = util.objectLength(this.bufferObject);
@@ -401,19 +401,19 @@ class PlayQueue extends React.Component {
if (nextDate > endDate) {
this.abortController.abort();
this.checkShouldLoop();
- return;
+ return true;
}
// Playback caught up with buffer :(
if (!this.bufferObject[nextDateStr]) {
this.stopPlaying();
this.checkQueue();
- return;
+ return true;
}
if (!isPlaying || !this.mounted) {
this.stopPlaying();
}
- this.checkQueue();
+ return this.checkQueue();
};
const animIntervalMS = speed === 0.5 ? 2000 : 1000 / speed;
this.animationInterval(animIntervalMS, player);
diff --git a/web/js/components/compare/pick.js b/web/js/components/compare/pick.js
index c6b31f419..1d14b88f3 100644
--- a/web/js/components/compare/pick.js
+++ b/web/js/components/compare/pick.js
@@ -47,6 +47,7 @@ class Pick extends React.Component {
</text>
);
}
+ return false;
}
render() {
diff --git a/web/js/components/context-menu/context-menu.js b/web/js/components/context-menu/context-menu.js
index 741302eed..f84d13223 100644
--- a/web/js/components/context-menu/context-menu.js
+++ b/web/js/components/context-menu/context-menu.js
@@ -61,7 +61,7 @@ function RightClickMenu(props) {
return onToggleUnits(oppositeUnit);
}
setShow(false);
- events.trigger(`measure:${action}`);
+ return events.trigger(`measure:${action}`);
}
function addPlaceMarkerHandler(coords, olMap, crs) {
@@ -79,7 +79,7 @@ function RightClickMenu(props) {
};
useEffect(() => {
- if (isCoordinateSearchActive) return;
+ if (isCoordinateSearchActive) return false;
events.on(MAP_SINGLE_CLICK, handleClick);
events.on(MAP_CONTEXT_MENU, handleContextEvent);
return () => {
diff --git a/web/js/components/dateline/datelines.js b/web/js/components/dateline/datelines.js
index 62252d051..10b1dc47c 100644
--- a/web/js/components/dateline/datelines.js
+++ b/web/js/components/dateline/datelines.js
@@ -60,7 +60,7 @@ function DateLines(props) {
useEffect(() => {
if (proj.id !== 'geographic' || !mapIsRendered) {
- return;
+ return undefined;
}
map.on('movestart', () => {
setHideLines(true);
diff --git a/web/js/components/dateline/line.js b/web/js/components/dateline/line.js
index c607b8072..016b57bdf 100644
--- a/web/js/components/dateline/line.js
+++ b/web/js/components/dateline/line.js
@@ -56,6 +56,7 @@ export default function Line (props) {
toggleTextActive(false);
}
if (overlay !== '') return overlay.setPosition([lineX, lineY]);
+ return undefined;
});
const mouseOver = () => {
diff --git a/web/js/components/image-download/image-download-panel.js b/web/js/components/image-download/image-download-panel.js
index 456b0c259..77ad16cc0 100644
--- a/web/js/components/image-download/image-download-panel.js
+++ b/web/js/components/image-download/image-download-panel.js
@@ -144,6 +144,7 @@ function ImageDownloadPanel(props) {
</div>
);
}
+ return false;
};
const renderWorldfileSelect = () => {
@@ -169,6 +170,7 @@ function ImageDownloadPanel(props) {
</div>
);
}
+ return false;
};
const crossesDatelineAlert = () => datelineMessage && (
diff --git a/web/js/components/layer/info/date-ranges.js b/web/js/components/layer/info/date-ranges.js
index f674eecd2..77890bf75 100644
--- a/web/js/components/layer/info/date-ranges.js
+++ b/web/js/components/layer/info/date-ranges.js
@@ -15,7 +15,7 @@ export default function DateRanges ({ layer }) {
const { ongoing } = layer;
const getDateRanges = async () => {
- if (dateRanges.length) return;
+ if (dateRanges.length) return undefined;
if (!ongoing) return setDateRanges(formatDateRanges(layer.dateRanges));
const worker = new Worker('js/workers/describe-domains.worker.js');
worker.onmessage = (event) => {
@@ -31,7 +31,7 @@ export default function DateRanges ({ layer }) {
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(event.data, 'text/xml');
const domains = xmlDoc.querySelector('Domain')?.textContent || '';
- worker.postMessage({ operation: 'mergeDomains', args: [domains, 0] });
+ return worker.postMessage({ operation: 'mergeDomains', args: [domains, 0] });
};
worker.onerror = () => {
worker.terminate();
@@ -48,7 +48,7 @@ export default function DateRanges ({ layer }) {
id: layer.id,
proj: 'EPSG:4326',
};
- worker.postMessage({ operation: 'requestDescribeDomains', args: [params] });
+ return worker.postMessage({ operation: 'requestDescribeDomains', args: [params] });
};
const renderListItem = () => dateRanges
diff --git a/web/js/components/layer/product-picker/browse/browse-layers-list.js b/web/js/components/layer/product-picker/browse/browse-layers-list.js
index 0e92e9e2d..8250a6a52 100644
--- a/web/js/components/layer/product-picker/browse/browse-layers-list.js
+++ b/web/js/components/layer/product-picker/browse/browse-layers-list.js
@@ -36,6 +36,7 @@ function BrowseLayerList (props) {
/>
);
}
+ return undefined;
})
}
</div>
diff --git a/web/js/components/layer/settings/palette.js b/web/js/components/layer/settings/palette.js
index c70d0bb22..47cac3b0e 100644
--- a/web/js/components/layer/settings/palette.js
+++ b/web/js/components/layer/settings/palette.js
@@ -159,6 +159,7 @@ function PaletteSelect (props) {
activePalette === target.id,
);
}
+ return undefined;
};
const recommended = layer.palette.recommended || [];
@@ -180,6 +181,7 @@ function PaletteSelect (props) {
return item;
}
}
+ return undefined;
})
}
</Scrollbar>
diff --git a/web/js/components/layer/settings/vector-style.js b/web/js/components/layer/settings/vector-style.js
index 2fd5a0115..3463d1e65 100644
--- a/web/js/components/layer/settings/vector-style.js
+++ b/web/js/components/layer/settings/vector-style.js
@@ -166,6 +166,7 @@ class VectorStyleSelect extends React.Component {
const item = this.customLegend(styleLayerObject);
return item;
}
+ return false;
})
}
</Scrollbar>
diff --git a/web/js/components/measure-tool/measure-tooltip.js b/web/js/components/measure-tool/measure-tooltip.js
index c2ccdd099..4657a4a57 100644
--- a/web/js/components/measure-tool/measure-tooltip.js
+++ b/web/js/components/measure-tool/measure-tooltip.js
@@ -72,6 +72,7 @@ export default function MeasureTooltip(props) {
? `${roundAndLocale(imperialLength, ftPerMile)} mi`
: `${roundAndLocale(imperialLength)} ft`;
}
+ return undefined;
};
/**
@@ -91,6 +92,7 @@ export default function MeasureTooltip(props) {
? `${roundAndLocale(imperialArea, sqFtPerSqMile)} mi<sup>2</sup>`
: `${roundAndLocale(imperialArea)} ft<sup>2</sup>`;
}
+ return undefined;
};
const getMeasurementValue = () => {
@@ -103,6 +105,7 @@ export default function MeasureTooltip(props) {
if (geometry instanceof OlLineString) {
return getFormattedLength(geometry);
}
+ return undefined;
};
const checkGeographicCoordValidity = (val) => val.indexOf('NaN') < 0;
diff --git a/web/js/components/range-selection/dragger.js b/web/js/components/range-selection/dragger.js
index dd6d25171..aafb67b87 100644
--- a/web/js/components/range-selection/dragger.js
+++ b/web/js/components/range-selection/dragger.js
@@ -138,6 +138,7 @@ class TimelineDragger extends PureComponent {
</text>
);
}
+ return undefined;
}
/*
diff --git a/web/js/components/sidebar/event.js b/web/js/components/sidebar/event.js
index 7d2b9d8f0..c84099e73 100644
--- a/web/js/components/sidebar/event.js
+++ b/web/js/components/sidebar/event.js
@@ -88,7 +88,7 @@ function Event (props) {
* @returns Magnitude data output
*/
function magnitudeOutput({ magnitudeUnit, magnitudeValue }) {
- if (!magnitudeUnit || !magnitudeValue) return;
+ if (!magnitudeUnit || !magnitudeValue) return undefined;
const formattedunit = magnitudeUnit === 'kts' ? ' kts' : ' NM';
return (
<p className="magnitude">
@@ -143,6 +143,7 @@ function Event (props) {
</ul>
);
}
+ return undefined;
}
/**
@@ -177,6 +178,7 @@ function Event (props) {
return `${source.title} `;
});
}
+ return undefined;
}
return (
diff --git a/web/js/components/sidebar/paletteLegend.js b/web/js/components/sidebar/paletteLegend.js
index 2401f41f4..3dbb42998 100644
--- a/web/js/components/sidebar/paletteLegend.js
+++ b/web/js/components/sidebar/paletteLegend.js
@@ -454,6 +454,7 @@ class PaletteLegend extends React.Component {
} if (colorMap.type === 'classification') {
return this.renderClasses(colorMap, index);
}
+ return undefined;
});
}
@@ -463,7 +464,7 @@ class PaletteLegend extends React.Component {
} = this.props;
const { isHoveringLegend } = this.state;
const customClass = (showingVectorHand && layer.id.includes('AERONET')) || showingChartingIcon ? ' bottomspace-palette' : isCustomPalette ? ' is_custom' : '';
- if (!layer.palette) return;
+ if (!layer.palette) return undefined;
return (
<div
className={
diff --git a/web/js/components/timeline/timeline-axis/timeline-axis.js b/web/js/components/timeline/timeline-axis/timeline-axis.js
index 647f998a6..20e19d439 100644
--- a/web/js/components/timeline/timeline-axis/timeline-axis.js
+++ b/web/js/components/timeline/timeline-axis/timeline-axis.js
@@ -1420,7 +1420,7 @@ class TimelineAxis extends Component {
const xmlDoc = parser.parseFromString(event.data, 'text/xml');
const domains = xmlDoc.querySelector('Domain')?.textContent;
if (!domains) worker.terminate();
- worker.postMessage({ operation: 'mergeDomains', args: [domains, 60_000] });
+ return worker.postMessage({ operation: 'mergeDomains', args: [domains, 60_000] });
};
worker.onerror = () => worker.terminate();
let startDate = new Date(def.startDate);
diff --git a/web/js/components/timeline/timeline-controls/animation-button.js b/web/js/components/timeline/timeline-controls/animation-button.js
index 78d71488a..f46f760b0 100644
--- a/web/js/components/timeline/timeline-controls/animation-button.js
+++ b/web/js/components/timeline/timeline-controls/animation-button.js
@@ -43,6 +43,7 @@ function AnimationButton(props) {
} if (isMobileTablet && isLandscape) {
return `tablet-landscape${subdailyID}`;
}
+ return undefined;
};
const buttonClass = getButtonClassName();
diff --git a/web/js/components/timeline/timeline-coverage/timeline-coverage.js b/web/js/components/timeline/timeline-coverage/timeline-coverage.js
index a2a3a3fe3..e4b2d8f60 100644
--- a/web/js/components/timeline/timeline-coverage/timeline-coverage.js
+++ b/web/js/components/timeline/timeline-coverage/timeline-coverage.js
@@ -294,6 +294,7 @@ class TimelineLayerCoveragePanel extends Component {
return granuleDateRanges.map(([start, end]) => ({ startDate: start, endDate: end }));
});
}
+ return undefined;
};
stopPropagation = (e) => {
diff --git a/web/js/components/timeline/timeline-draggers/dragger-container.js b/web/js/components/timeline/timeline-draggers/dragger-container.js
index 1bbed2bb4..dd39a0f08 100644
--- a/web/js/components/timeline/timeline-draggers/dragger-container.js
+++ b/web/js/components/timeline/timeline-draggers/dragger-container.js
@@ -245,13 +245,13 @@ class DraggerContainer extends PureComponent {
null,
true,
);
- return;
+ return true;
}
return false;
}
// update parent dragger positioning
- updateDraggerDatePosition(
+ return updateDraggerDatePosition(
newDraggerTime,
draggerSelected,
newDraggerPosition,
diff --git a/web/js/components/timeline/timeline-draggers/timeline-dragger.js b/web/js/components/timeline/timeline-draggers/timeline-dragger.js
index 1fed32e67..169d79e4b 100644
--- a/web/js/components/timeline/timeline-draggers/timeline-dragger.js
+++ b/web/js/components/timeline/timeline-draggers/timeline-dragger.js
@@ -66,7 +66,7 @@ class Dragger extends PureComponent {
} if (deltaX > 0 && draggerAtEnd) {
return false;
}
- handleDragDragger(e, d);
+ return handleDragDragger(e, d);
};
/**
diff --git a/web/js/components/tour/widget-steps.js b/web/js/components/tour/widget-steps.js
index 8810e4654..00309ed2c 100644
--- a/web/js/components/tour/widget-steps.js
+++ b/web/js/components/tour/widget-steps.js
@@ -21,7 +21,7 @@ function Steps(props) {
};
useEffect(() => {
- if (!isKioskModeActive) return;
+ if (!isKioskModeActive) return undefined;
document.addEventListener('keydown', handleKeyDown);
diff --git a/web/js/containers/animation-widget/collapsed-animation-widget.js b/web/js/containers/animation-widget/collapsed-animation-widget.js
index 441817b79..92efbefdd 100644
--- a/web/js/containers/animation-widget/collapsed-animation-widget.js
+++ b/web/js/containers/animation-widget/collapsed-animation-widget.js
@@ -48,6 +48,7 @@ function CollapsedAnimationWidget (props) {
} if (isMobileTablet && isLandscape) {
return `-tablet-landscape${subdailyID}`;
}
+ return undefined;
};
const widgetIDs = getWidgetIDs();
diff --git a/web/js/containers/animation-widget/mobile-animation-widget.js b/web/js/containers/animation-widget/mobile-animation-widget.js
index 7ea74b2c8..66b8b5787 100644
--- a/web/js/containers/animation-widget/mobile-animation-widget.js
+++ b/web/js/containers/animation-widget/mobile-animation-widget.js
@@ -56,6 +56,7 @@ function MobileAnimationWidget (props) {
} if (isMobileTablet || screenWidth <= breakpoints.small) {
return 'tablet';
}
+ return undefined;
};
const mobileID = getMobileIDs();
diff --git a/web/js/containers/sidebar/layer-row.js b/web/js/containers/sidebar/layer-row.js
index f16066cd6..d312cd76e 100644
--- a/web/js/containers/sidebar/layer-row.js
+++ b/web/js/containers/sidebar/layer-row.js
@@ -261,6 +261,7 @@ function LayerRow (props) {
/>
);
}
+ return undefined;
};
useEffect(() => {
diff --git a/web/js/containers/sidebar/sidebar.js b/web/js/containers/sidebar/sidebar.js
index 1329493e5..be6f339de 100644
--- a/web/js/containers/sidebar/sidebar.js
+++ b/web/js/containers/sidebar/sidebar.js
@@ -157,7 +157,7 @@ class Sidebar extends React.Component {
});
const storageValue = isNowCollapsed ? 'collapsed' : 'expanded';
safeLocalStorage.setItem(SIDEBAR_COLLAPSED, storageValue);
- collapseExpandToggle();
+ return collapseExpandToggle();
}
getProductsToRender(activeTab, isCompareMode, isChartMode) {
@@ -189,6 +189,7 @@ class Sidebar extends React.Component {
/>
);
}
+ return undefined;
}
handleWorldviewLogoClick(e, permalink) {
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 35d403f12..3a9dc9da1 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -970,7 +970,7 @@ class Timeline extends React.Component {
if (!userIsInteracting && !isAnimationPlaying) {
return resolve();
}
- setTimeout(waitForSafeUpdate, 1000);
+ return setTimeout(waitForSafeUpdate, 1000);
}());
});
};
diff --git a/web/js/map/granule/granule-layer-builder.js b/web/js/map/granule/granule-layer-builder.js
index e19b9ba3f..adbf9d82b 100644
--- a/web/js/map/granule/granule-layer-builder.js
+++ b/web/js/map/granule/granule-layer-builder.js
@@ -154,7 +154,7 @@ export default function granuleLayerBuilder(cache, store, createLayerWMTS) {
* @returns {boolean} - true if date is within a range
*/
const isWithinRanges = (date, ranges) => {
- if (!ranges) return;
+ if (!ranges) return undefined;
return ranges.some(([start, end]) => date >= new Date(start) && date <= new Date(end));
};
diff --git a/web/js/map/granule/util.js b/web/js/map/granule/util.js
index 8a318fda7..36f22bc33 100644
--- a/web/js/map/granule/util.js
+++ b/web/js/map/granule/util.js
@@ -111,6 +111,7 @@ export const isWithinBounds = (crs, granule) => {
if (crs === CRS.ARCTIC) {
return granule.polygon.every(([lat, lon]) => lon > 40);
}
+ return undefined;
};
export const getGranuleFootprints = (layer) => {
@@ -186,6 +187,7 @@ export const getParamsForGranuleRequest = (def, date, crs) => {
} catch (e) {
console.error(`Could not get shortName for a collection associated with layer ${def.id}`);
}
+ return undefined;
};
if (def.conceptIds[0].type === 'NRT') {
diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js
index 1b60f1d05..dc4174a31 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -1128,6 +1128,7 @@ export default function mapLayerBuilder(config, cache, store) {
url.replace('/VectorTileServer', '/VectorTileServer/'),
);
}
+ return undefined;
},
});
await applyBackground(layer, vectorStyle.url);
diff --git a/web/js/map/map.js b/web/js/map/map.js
index 8068da831..f43b69b79 100644
--- a/web/js/map/map.js
+++ b/web/js/map/map.js
@@ -33,6 +33,7 @@ export function mapIsExtentValid(extent) {
valid = false;
return false;
}
+ return true;
});
return valid;
}
diff --git a/web/js/map/natural-events/event-markers.js b/web/js/map/natural-events/event-markers.js
index c7891ea47..a7be837bd 100644
--- a/web/js/map/natural-events/event-markers.js
+++ b/web/js/map/natural-events/event-markers.js
@@ -190,7 +190,7 @@ class EventMarkers extends React.Component {
return collection;
}, []);
- this.setState({ markers }, () => {
+ return this.setState({ markers }, () => {
map.getView().changed();
map.renderSync(); // Marker position will be off until this is called
});
diff --git a/web/js/map/natural-events/event-track.js b/web/js/map/natural-events/event-track.js
index 6d4c00610..2aaf9503f 100644
--- a/web/js/map/natural-events/event-track.js
+++ b/web/js/map/natural-events/event-track.js
@@ -205,7 +205,7 @@ function EventTrack () {
};
const removeTrack = (mapArg) => {
- if (!mapArg) return;
+ if (!mapArg) return undefined;
const overlayMapping = createOverlayMapping(mapArg);
const { track, pointsAndArrows } = trackDetailsRef.current;
removeTrackById(mapArg, overlayMapping, track);
diff --git a/web/js/map/natural-events/util.js b/web/js/map/natural-events/util.js
index b27569db0..cb2e1a593 100644
--- a/web/js/map/natural-events/util.js
+++ b/web/js/map/natural-events/util.js
@@ -151,7 +151,7 @@ export const getTrackLines = function(map, trackCoords, eventID, date, callback,
map.getPixelFromCoordinate(end),
map.getPixelFromCoordinate(start),
]);
- if (!pixelCoords.length) return;
+ if (!pixelCoords.length) return undefined;
const first = pixelCoords[0][0];
const last = pixelCoords[pixelCoords.length - 1][0];
const topLeft = [first[0], first[1]];
diff --git a/web/js/mapUI/components/dev-test-mode/find-orbit-tracks-mode/dev-find-orbit-tracks-mode.js b/web/js/mapUI/components/dev-test-mode/find-orbit-tracks-mode/dev-find-orbit-tracks-mode.js
index a4ee9da14..a58436e18 100644
--- a/web/js/mapUI/components/dev-test-mode/find-orbit-tracks-mode/dev-find-orbit-tracks-mode.js
+++ b/web/js/mapUI/components/dev-test-mode/find-orbit-tracks-mode/dev-find-orbit-tracks-mode.js
@@ -113,6 +113,7 @@ function FindOrbitTracksMode () {
} catch (error) {
console.error(`No image available for ${layerSelection.id} on ${date}: `, error);
}
+ return undefined;
};
const findOrbitalImagery = async () => {
@@ -120,7 +121,7 @@ function FindOrbitTracksMode () {
const verifyQuery = verifyExtent();
if (!verifyQuery) {
setIsLoading(false);
- return;
+ return undefined;
}
const dateRange = getOrbitalDateRange();
for (let i = 0; i < dateRange.length; i += 1) {
@@ -135,7 +136,7 @@ function FindOrbitTracksMode () {
return setDateFound(date);
}
}
- setIsLoading(false);
+ return setIsLoading(false);
};
const orangeStyle = { backgroundColor: '#d54e21' };
diff --git a/web/js/mapUI/components/kiosk/tile-measurement/tile-measurement.js b/web/js/mapUI/components/kiosk/tile-measurement/tile-measurement.js
index 9b7c30a58..ef6e2ab54 100644
--- a/web/js/mapUI/components/kiosk/tile-measurement/tile-measurement.js
+++ b/web/js/mapUI/components/kiosk/tile-measurement/tile-measurement.js
@@ -63,6 +63,7 @@ function TileMeasurement({ ui }) {
return bestDates[layer.id].date;
}
}
+ return undefined;
}
// #4 Loop through layers and dates to find the first date that satisfies full imagery thresholds
@@ -233,7 +234,7 @@ function TileMeasurement({ ui }) {
if (!fullImageryDate || bestDate === fullImageryDate) {
updateDate(bestDate, layerPeriod);
verifyTilesAndHandleErrors();
- return;
+ return undefined;
}
// Format date based on period and dispatch redux action
@@ -243,6 +244,7 @@ function TileMeasurement({ ui }) {
} catch (error) {
console.error('Error calculating measurements:', error);
}
+ return undefined;
};
useEffect(() => {
diff --git a/web/js/mapUI/components/kiosk/tile-measurement/utils/date-util.js b/web/js/mapUI/components/kiosk/tile-measurement/utils/date-util.js
index 4686cf7a6..d3f23d7d5 100644
--- a/web/js/mapUI/components/kiosk/tile-measurement/utils/date-util.js
+++ b/web/js/mapUI/components/kiosk/tile-measurement/utils/date-util.js
@@ -172,4 +172,5 @@ export function getOrbitalDates (selectedDate, latestDate, searchMethod) {
} if (searchMethod === 3) {
return getOrbitalDatesForwardsAndBackwards(selectedDate, latestDate);
}
+ return undefined;
}
diff --git a/web/js/mapUI/components/layers/addLayer.js b/web/js/mapUI/components/layers/addLayer.js
index 01091c084..900c0b7fb 100644
--- a/web/js/mapUI/components/layers/addLayer.js
+++ b/web/js/mapUI/components/layers/addLayer.js
@@ -87,6 +87,7 @@ function AddLayer(props) {
} else if (action.type === DISPLAY_STATIC_MAP) {
addStaticLayer();
}
+ return undefined;
}, [action]);
return null;
diff --git a/web/js/mapUI/components/markers/markers.js b/web/js/mapUI/components/markers/markers.js
index 4940a8ec3..342b49fa7 100644
--- a/web/js/mapUI/components/markers/markers.js
+++ b/web/js/mapUI/components/markers/markers.js
@@ -86,7 +86,7 @@ function Markers(props) {
coordinatesObject,
) => {
const results = geocodeResults;
- if (!results) return;
+ if (!results) return undefined;
const remove = () => removeMarker(coordinatesObject);
const marker = getCoordinatesMarker(
proj,
@@ -109,7 +109,7 @@ function Markers(props) {
flyToMarker(coordinatesObject);
}
- setGeocodeResults(geocodeResults);
+ return setGeocodeResults(geocodeResults);
};
/**
@@ -161,6 +161,7 @@ function Markers(props) {
default:
break;
}
+ return undefined;
}, [action]);
return null;
diff --git a/web/js/mapUI/components/update-collections/updateCollections.js b/web/js/mapUI/components/update-collections/updateCollections.js
index 68e8d83f0..60b4157b2 100644
--- a/web/js/mapUI/components/update-collections/updateCollections.js
+++ b/web/js/mapUI/components/update-collections/updateCollections.js
@@ -26,7 +26,7 @@ function UpdateCollections () {
};
const getHeaders = async (def, date) => {
- if (def.layergroup === 'Reference') return; // Don't query static layers
+ if (def.layergroup === 'Reference') return undefined; // Don't query static layers
const { id, period } = def;
const { matrixSet } = def.projections[proj.id];
const isoStringDate = util.toISOStringSeconds(util.roundTimeOneMinute(selectedDate));
diff --git a/web/js/mapUI/components/update-date/updateDate.js b/web/js/mapUI/components/update-date/updateDate.js
index c52b99ad7..816baef08 100644
--- a/web/js/mapUI/components/update-date/updateDate.js
+++ b/web/js/mapUI/components/update-date/updateDate.js
@@ -130,6 +130,7 @@ function UpdateDate(props) {
const skipTitiler = true;
return updateDate(outOfStep, skipTitiler);
}
+ return undefined;
};
useEffect(() => {
diff --git a/web/js/mapUI/components/update-projection/updateProjection.js b/web/js/mapUI/components/update-projection/updateProjection.js
index c12bb77b1..d75273754 100644
--- a/web/js/mapUI/components/update-projection/updateProjection.js
+++ b/web/js/mapUI/components/update-projection/updateProjection.js
@@ -318,7 +318,7 @@ function UpdateProjection(props) {
if (newState.v && !newState.e && extent) {
flyToNewExtent(extent, rotate);
}
- }, 200); return;
+ }, 200); return undefined;
}
case layerConstants.UPDATE_GRANULE_LAYER_OPTIONS: {
const granuleOptions = {
@@ -338,14 +338,14 @@ function UpdateProjection(props) {
if (compareMode === 'spy') {
return reloadLayers();
}
- return;
+ return undefined;
case layerConstants.REORDER_LAYERS:
case layerConstants.REORDER_OVERLAY_GROUPS:
case compareConstants.TOGGLE_ON_OFF:
case compareConstants.CHANGE_MODE:
reloadLayers();
preloadForCompareMode();
- return;
+ return undefined;
case layerConstants.TOGGLE_OVERLAY_GROUPS:
return reloadLayers();
case paletteConstants.SET_THRESHOLD_RANGE_AND_SQUASH:
@@ -362,6 +362,7 @@ function UpdateProjection(props) {
default:
break;
}
+ return undefined;
};
useEffect(() => {
diff --git a/web/js/mapUI/mapUI.js b/web/js/mapUI/mapUI.js
index 6e1081cc2..a01670c4f 100644
--- a/web/js/mapUI/mapUI.js
+++ b/web/js/mapUI/mapUI.js
@@ -152,14 +152,14 @@ function MapUI(props) {
duration: 500,
rotation: 0,
});
- return;
+ return undefined;
}
case REFRESH_ROTATE: {
ui.selected.getView().animate({
rotation: action.rotation,
duration: 500,
});
- return;
+ return undefined;
}
case vectorStyleConstants.SET_SELECTED_VECTORS:
return setVectorActions(action);
@@ -172,6 +172,7 @@ function MapUI(props) {
default:
break;
}
+ return undefined;
};
const updateVectorSelections = () => {
diff --git a/web/js/modules/core/actions.js b/web/js/modules/core/actions.js
index a2d64f603..0baf98dfd 100644
--- a/web/js/modules/core/actions.js
+++ b/web/js/modules/core/actions.js
@@ -39,6 +39,6 @@ export async function requestAction(
return data;
} catch (error) {
dispatch(fetchFailure(actionName, error, id));
- console.error(error);
+ return console.error(error);
}
}
diff --git a/web/js/modules/date/util.js b/web/js/modules/date/util.js
index b1f1b02cf..675ac2ead 100644
--- a/web/js/modules/date/util.js
+++ b/web/js/modules/date/util.js
@@ -85,7 +85,7 @@ export function tryCatchDate(str, initialState) {
* @returns {String | undefined} serialized time string OR undefined
*/
export function serializeDateWrapper(currentItemState, state, prev) {
- if (state.animation.isPlaying) return;
+ if (state.animation.isPlaying) return undefined;
const prevParams = Object.keys(prev).length > 0;
const initialDate = get(state, 'config.initialDate');
const initialDateString = util.toISOStringSeconds(initialDate);
@@ -142,7 +142,7 @@ export function serializeDateBWrapper(currentItemState, state, prev) {
* @returns {String | undefined} serialized time string OR undefined
*/
export function serializeDateChartingWrapper(currentItemState, state) {
- if (!state.charting.active || !state.charting.timeSpanStartDate) return;
+ if (!state.charting.active || !state.charting.timeSpanStartDate) return undefined;
return serializeDate(currentItemState);
}
@@ -293,7 +293,7 @@ export function mapLocationToDateState(
}
export const formatDisplayDate = (date, subdaily) => {
- if (!date) return;
+ if (!date) return undefined;
const format = subdaily ? 'YYYY MMM DD HH:mm' : 'YYYY MMM DD';
const dateString = moment.utc(date).format(format);
return `${dateString.toUpperCase()}${subdaily ? 'Z' : ''}`;
@@ -377,7 +377,7 @@ export const outOfStepChange = (state, newDate) => {
};
export const coverageDateFormatter = (dateType, date, period) => {
- if (!date) return;
+ if (!date) return undefined;
let dateString;
const parsedDate = new Date(date);
switch (period) {
diff --git a/web/js/modules/layers/actions.js b/web/js/modules/layers/actions.js
index 9b76ded15..bca0d54ec 100644
--- a/web/js/modules/layers/actions.js
+++ b/web/js/modules/layers/actions.js
@@ -179,7 +179,7 @@ export function removeLayer(id) {
return console.warn(`Invalid layer ID: ${id}`);
}
const def = activeLayers[index];
- dispatch({
+ return dispatch({
type: REMOVE_LAYER,
activeString,
layersToRemove: [def],
@@ -258,7 +258,7 @@ export function setOpacity(id, opacity) {
if (index === -1) {
return console.warn(`Invalid layer ID: ${id}`);
}
- dispatch({
+ return dispatch({
type: UPDATE_OPACITY,
id,
opacity: Number(opacity),
diff --git a/web/js/modules/layers/selectors.js b/web/js/modules/layers/selectors.js
index 5fe0e8301..303054499 100644
--- a/web/js/modules/layers/selectors.js
+++ b/web/js/modules/layers/selectors.js
@@ -137,7 +137,7 @@ export const isGroupingEnabled = ({
}) => layers[compare.activeString].groupOverlays;
export const getCollections = (layers, dailyDate, subdailyDate, layer, projId) => {
- if (!layers.collections[layer.id]) return;
+ if (!layers.collections[layer.id]) return undefined;
const dateCollection = layers.collections[layer.id].dates;
for (let i = 0; i < dateCollection.length; i += 1) {
if ((dateCollection[i].date === dailyDate
@@ -145,6 +145,7 @@ export const getCollections = (layers, dailyDate, subdailyDate, layer, projId) =
return dateCollection[i];
}
}
+ return undefined;
};
/**
@@ -408,6 +409,7 @@ export function dateRange({ layer }, activeLayers, parameters = {}) {
end: new Date(maxDate),
};
}
+ return undefined;
}
/**
@@ -511,6 +513,7 @@ export function isRenderable(id, layers, date, bLayers, state) {
obscured = true;
return false;
}
+ return undefined;
},
);
return !obscured;
@@ -573,10 +576,10 @@ export function hasMeasurementSource(current, config, projId) {
export const makeGetDescription = () => createSelector(
[getConfig, getLayerId],
({ layers, measurements }, layerId) => {
- if (!layerId) return;
+ if (!layerId) return undefined;
const { layergroup } = layers[layerId];
if (layergroup === 'Orbital Track') {
- return;
+ return undefined;
}
const [setting] = Object.keys(measurements)
.filter((key) => !key.includes('Featured'))
diff --git a/web/js/modules/layers/util.js b/web/js/modules/layers/util.js
index e2a2acb27..19a1942cc 100644
--- a/web/js/modules/layers/util.js
+++ b/web/js/modules/layers/util.js
@@ -41,6 +41,7 @@ export function getOrbitTrackTitle(def, includeSatName = true) {
} if (daynightValue) {
return `${lodashStartCase(daynightValue)}${satelliteName}`;
}
+ return undefined;
}
/**
diff --git a/web/js/modules/location-search/actions.js b/web/js/modules/location-search/actions.js
index a818ad8f3..954a7c727 100644
--- a/web/js/modules/location-search/actions.js
+++ b/web/js/modules/location-search/actions.js
@@ -90,7 +90,7 @@ export function setPlaceMarker(coord, reverseGeocodeResults, isInputSearch) {
}
const markerId = Math.floor(longitude * 1000 + latitude * 1000 + Math.random() * 1000);
- dispatch({
+ return dispatch({
type: SET_MARKER,
coordinates: {
id: markerId,
diff --git a/web/js/modules/location-search/util.js b/web/js/modules/location-search/util.js
index 759e9c749..e76b4a431 100644
--- a/web/js/modules/location-search/util.js
+++ b/web/js/modules/location-search/util.js
@@ -160,9 +160,9 @@ export function serializeCoordinatesWrapper(coordinates, state) {
const { map, proj } = state;
const serializeCoordinates = ({ longitude, latitude }) => {
const coordinateValues = [longitude, latitude];
- if (!map.ui.selected) return;
+ if (!map.ui.selected) return undefined;
const coordinatesWithinExtent = areCoordinatesWithinExtent(proj, coordinateValues);
- if (!coordinatesWithinExtent) return;
+ if (!coordinatesWithinExtent) return undefined;
return coordinateValues;
};
@@ -174,6 +174,7 @@ export function serializeCoordinatesWrapper(coordinates, state) {
if (coordinatesURL.length > 0) {
return coordinatesURL.join('+');
}
+ return undefined;
}
/**
diff --git a/web/js/modules/map/util.js b/web/js/modules/map/util.js
index d55886cd7..509842335 100644
--- a/web/js/modules/map/util.js
+++ b/web/js/modules/map/util.js
@@ -78,6 +78,7 @@ export function mapIsExtentValid(extent) {
valid = false;
return false;
}
+ return true;
});
return valid;
}
@@ -233,7 +234,7 @@ function promiseLayerGroup(layerGroup, map) {
*/
export async function promiseImageryForTime(state, date, activeString) {
const { map } = state;
- if (!map.ui.proj) return;
+ if (!map.ui.proj) return undefined;
const {
cache, selected, createLayer, layerKey, proj,
} = map.ui;
@@ -249,6 +250,7 @@ export async function promiseImageryForTime(state, date, activeString) {
if (!cachedItem && layerGroup.wv.proj && proj[layerGroup.wv.proj]) {
return promiseLayerGroup(layerGroup, proj[layerGroup.wv.proj]);
}
+ return undefined;
}));
selected.getView().changed();
return date;
@@ -294,6 +296,7 @@ export async function promiseImageryForTour(state, layers, dateString, activeStr
if (!cachedItem && layerGroup.wv.proj && proj[layerGroup.wv.proj]) {
return promiseLayerGroup(layerGroup, proj[layerGroup.wv.proj]);
}
+ return undefined;
}));
selected.getView().changed();
}
diff --git a/web/js/modules/natural-events/util.js b/web/js/modules/natural-events/util.js
index d5509e37f..d6e3999e6 100644
--- a/web/js/modules/natural-events/util.js
+++ b/web/js/modules/natural-events/util.js
@@ -194,4 +194,5 @@ export const validateGeometryCoords = (geometry, proj) => {
} if (type === 'Polygon') {
return coordinates[0].every(passesFilter);
}
+ return undefined;
};
diff --git a/web/js/modules/palettes/selectors.js b/web/js/modules/palettes/selectors.js
index bc37141fe..f942015d6 100644
--- a/web/js/modules/palettes/selectors.js
+++ b/web/js/modules/palettes/selectors.js
@@ -137,6 +137,7 @@ const useLookup = function(layerId, palettesObj, state) {
} else if (palette.legend.colors.length > 1) {
use = true;
}
+ return undefined;
});
return use;
};
@@ -301,6 +302,7 @@ export function findIndex(layerId, value, index, groupStr, state) {
result = index;
return false;
}
+ return true;
});
return result;
}
diff --git a/web/js/modules/product-picker/search-config.js b/web/js/modules/product-picker/search-config.js
index 388b75852..c4bc0c4fe 100644
--- a/web/js/modules/product-picker/search-config.js
+++ b/web/js/modules/product-picker/search-config.js
@@ -88,6 +88,7 @@ function filterSearch (layer, val, terms) {
isFilteredOut = matchItems.every((item) => !item.includes(term))
&& shortNames.every((name) => name.indexOf(term) < 0);
if (isFilteredOut) return false;
+ return true;
});
return isFilteredOut;
}
diff --git a/web/js/modules/product-picker/selectors.js b/web/js/modules/product-picker/selectors.js
index 67b5b8dd1..2c36fe153 100644
--- a/web/js/modules/product-picker/selectors.js
+++ b/web/js/modules/product-picker/selectors.js
@@ -46,7 +46,7 @@ export const getSourcesForProjection = createSelector(
const trackGroup = currentMeasurement && currentMeasurement.id === 'orbital-track';
const sourcesForProj = sources && sources.filter(
(source) => source.settings.some((layerId) => {
- if (!config.layers[layerId] || !config.layers[layerId].projections) return;
+ if (!config.layers[layerId] || !config.layers[layerId].projections) return undefined;
const { projections, layergroup } = config.layers[layerId];
const isOrbitTrack = layergroup === 'Orbital Track';
const inProj = !!projections[projection];
diff --git a/web/js/modules/product-picker/util.js b/web/js/modules/product-picker/util.js
index 0a554a86e..a70dd97cc 100644
--- a/web/js/modules/product-picker/util.js
+++ b/web/js/modules/product-picker/util.js
@@ -27,6 +27,7 @@ export function getRecentLayers(layerConfig, proj) {
if (a.count < b.count) return 1;
if (a.dateAdded > b.dateAdded) return 1;
if (a.dateAdded < b.dateAdded) return -1;
+ return undefined;
};
const toLayerObj = ({ id }) => layerConfig[id];
diff --git a/web/js/modules/settings/util.js b/web/js/modules/settings/util.js
index 39338199f..1ba668ebf 100644
--- a/web/js/modules/settings/util.js
+++ b/web/js/modules/settings/util.js
@@ -34,6 +34,7 @@ export function unitConvert(value, initialUnit, targetUnit) {
if (targetUnit === 'Celsius') return new Kelvin(value).toCelcius().value;
if (targetUnit === 'Fahrenheit') return new Kelvin(value).toFahrenheit().value;
}
+ return undefined;
}
export function checkTemperatureUnitConversion(units, globalTemperatureUnit) {
diff --git a/web/js/modules/smart-handoff/selectors.js b/web/js/modules/smart-handoff/selectors.js
index 493db2f25..7c461da81 100644
--- a/web/js/modules/smart-handoff/selectors.js
+++ b/web/js/modules/smart-handoff/selectors.js
@@ -12,6 +12,7 @@ export const getGranulesUrl = (state) => {
if (params.startDate && params.endDate) {
return `${params.startDate},${params.endDate}`;
}
+ return undefined;
};
const newParams = {
bounding_box: params.bbox,
diff --git a/web/js/modules/smart-handoff/util.js b/web/js/modules/smart-handoff/util.js
index c205e2aa2..b2650e3f6 100644
--- a/web/js/modules/smart-handoff/util.js
+++ b/web/js/modules/smart-handoff/util.js
@@ -44,7 +44,7 @@ function getHandoffParams (queryInput, options) {
Object.entries(options).forEach(([key, value]) => {
if (value === undefined) {
console.error(`${key} is undefined.`);
- } else if (value === {}) {
+ } else if (value && Object.keys(value).length === 0) {
console.error(`${key} is an empty object.`);
}
});
@@ -78,6 +78,7 @@ function getHandoffParams (queryInput, options) {
[ValueName]: conceptId,
};
}
+ return undefined;
};
return queryInput.reduce((params, input) => ({
diff --git a/web/js/modules/vector-styles/selectors.js b/web/js/modules/vector-styles/selectors.js
index c67cf2994..1fafba2e4 100644
--- a/web/js/modules/vector-styles/selectors.js
+++ b/web/js/modules/vector-styles/selectors.js
@@ -89,6 +89,7 @@ export function findIndex(layerId, type, value, index, groupStr, state) {
result = index;
return false;
}
+ return true;
});
return result;
}
@@ -171,7 +172,7 @@ export function setStyleFunction(opts) {
styleSelection = false,
} = opts;
const map = lodashGet(state, 'map.ui.selected');
- if (!map) return;
+ if (!map) return undefined;
const { proj } = state;
const { selected } = state.vectorStyles;
const { resolutions } = proj.selected;
@@ -204,7 +205,7 @@ export function setStyleFunction(opts) {
}
if (!layer || layer.isWMS || glStyle === undefined) {
- return;
+ return undefined;
}
// This is required to bust the openlayers functionCache
@@ -241,6 +242,7 @@ export function setStyleFunction(opts) {
}
return styleFunction(feature, resolution);
}
+ return undefined;
});
}
@@ -252,6 +254,7 @@ export function isActive(layerId, group, state) {
if (state.vectorStyles.custom[layerId]) {
return state.vectorStyles[group][layerId];
}
+ return undefined;
}
export function getKey(layerId, groupStr, state) {
@@ -296,6 +299,7 @@ export function clearStyleFunction(def, vectorStyleId, vectorStyles, layer, stat
if ((minute && minute[1] % 5 === 0) || feature.getGeometry().getType() === 'LineString') {
return styleFunction(feature, resolution);
}
+ return undefined;
});
}
return update(vectorStyles, { layerId: { maps: { $unset: ['custom'] } } });
diff --git a/web/js/modules/vector-styles/util.js b/web/js/modules/vector-styles/util.js
index d863b7c83..1112cc6dc 100644
--- a/web/js/modules/vector-styles/util.js
+++ b/web/js/modules/vector-styles/util.js
@@ -225,7 +225,7 @@ function getModalContentsAtPixel(mapProps, config, compareState, isMobile) {
const featureId = feature.getId();
if (featureId === 'coordinates-map-marker') {
isCoordinatesMarker = true;
- return;
+ return true;
}
if (lengthCheck(metaArray)) {
exceededLengthLimit = true;
@@ -233,13 +233,13 @@ function getModalContentsAtPixel(mapProps, config, compareState, isMobile) {
}
const def = lodashGet(layer, 'wv.def');
if (!def) {
- return;
+ return false;
}
const type = feature.getGeometry().getType();
if (lodashIncludes(def.clickDisabledFeatures, type)
|| !isFromActiveCompareRegion(pixels, layer.wv.group, compareState, swipeOffset)) {
- return;
+ return true;
}
if (def.vectorData && def.vectorData.id && def.title) {
const layerId = def.id;
@@ -254,7 +254,7 @@ function getModalContentsAtPixel(mapProps, config, compareState, isMobile) {
const uniqueIdentifier = features[uniqueIdentifierKey];
const title = titleKey ? features[titleKey] : 'Unknown title';
- if (selected[layerId].includes(uniqueIdentifier)) return;
+ if (selected[layerId].includes(uniqueIdentifier)) return true;
if (def.modalShouldFollowClicks) modalShouldFollowClicks = true;
const obj = {
legend: properties,
@@ -285,6 +285,7 @@ function getModalContentsAtPixel(mapProps, config, compareState, isMobile) {
metaArray.push(obj);
selected[layerId].push(layerId);
}
+ return undefined;
}, featureOptions);
return {
selected, metaArray, exceededLengthLimit, isCoordinatesMarker, modalShouldFollowClicks,
diff --git a/web/js/util/events.js b/web/js/util/events.js
index 8df18a947..41480cbfb 100644
--- a/web/js/util/events.js
+++ b/web/js/util/events.js
@@ -40,7 +40,7 @@ export default (function events() {
const [event] = args;
const listeners = events[event];
if (!listeners && !allListeners) {
- return;
+ return undefined;
}
const eventArguments = args.slice(1);
lodashEach(events[event], (listener) => {
diff --git a/web/js/util/local-storage.js b/web/js/util/local-storage.js
index fd26891d9..ca877f2fd 100644
--- a/web/js/util/local-storage.js
+++ b/web/js/util/local-storage.js
@@ -13,6 +13,7 @@ const enabled = (function() {
console.warn('Local storage disabled.');
return false;
}
+ return undefined;
}());
export default {
diff --git a/web/js/util/util.js b/web/js/util/util.js
index 1667c2ceb..e1589ee42 100644
--- a/web/js/util/util.js
+++ b/web/js/util/util.js
@@ -511,7 +511,7 @@ export default (function(self) {
try {
return func.apply(func, args);
} catch (error) {
- console.error(error);
+ return console.error(error);
}
};
};