Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2818: ESLint Cleanup - Re-enable 'no-shadow' rule and update files (#6403)

Jason Hurley4dd49891f1ea
diff --git a/eslint_log.txt b/eslint_log.txt
deleted file mode 100644
index e69de29bb..000000000
diff --git a/web/.eslintrc b/web/.eslintrc
index acd02a174..0b4386888 100644
--- a/web/.eslintrc
+++ b/web/.eslintrc
@@ -86,7 +86,6 @@
// Base rule overrides
"no-nested-ternary": "off", // 164 errors across 40 files
- "no-shadow": "warn", // 110 errors across 40 files
"max-len": "error",
"no-underscore-dangle": "error",
// Import rules overrides
diff --git a/web/js/components/compare/opacity-slider.js b/web/js/components/compare/opacity-slider.js
index 6b370ba3b..ad99edbc9 100644
--- a/web/js/components/compare/opacity-slider.js
+++ b/web/js/components/compare/opacity-slider.js
@@ -20,13 +20,13 @@ function OpacitySlider ({
onSlide(val);
};
- const getDateTextOptions = (dateA, dateB) => {
- const isSameDate = dateA === dateB;
+ const getDateTextOptions = (dateOne, dateTwo) => {
+ const isSameDate = dateOne === dateTwo;
let dateAText = '';
let dateBText = '';
if (!isSameDate) {
- dateAText += `: ${dateA}`;
- dateBText += `: ${dateB}`;
+ dateAText += `: ${dateOne}`;
+ dateBText += `: ${dateTwo}`;
}
const labelStyle = isSameDate ? {} : { width: '105px', paddingLeft: '3px' };
const caseStyle = { width: isSameDate ? '178px' : '420px' };
diff --git a/web/js/components/context-menu/context-menu.js b/web/js/components/context-menu/context-menu.js
index 6a38c2c2d..f46439932 100644
--- a/web/js/components/context-menu/context-menu.js
+++ b/web/js/components/context-menu/context-menu.js
@@ -64,8 +64,8 @@ function RightClickMenu(props) {
return events.trigger(`measure:${action}`);
}
- function addPlaceMarkerHandler(coords, olMap, crs) {
- events.trigger(CONTEXT_MENU_LOCATION, coords, olMap, crs);
+ function addPlaceMarkerHandler(coords, olMap, crsValue) {
+ events.trigger(CONTEXT_MENU_LOCATION, coords, olMap, crsValue);
setShow(false);
}
diff --git a/web/js/components/image-download/lat-long-inputs.js b/web/js/components/image-download/lat-long-inputs.js
index 0cb27b1af..421aee7a3 100644
--- a/web/js/components/image-download/lat-long-inputs.js
+++ b/web/js/components/image-download/lat-long-inputs.js
@@ -173,20 +173,20 @@ function LatLongSelect(props) {
export default LatLongSelect;
const {
- number, arrayOf, func, string,
+ number, func, string,
} = PropTypes;
LatLongSelect.propTypes = {
onLatLongChange: func,
- geoLatLong: arrayOf,
- viewExtent: arrayOf,
+ geoLatLong: PropTypes.oneOfType([PropTypes.array, PropTypes.oneOf(['null'])]),
+ viewExtent: PropTypes.oneOfType([PropTypes.array, PropTypes.oneOf(['null'])]),
crs: string,
};
Input.propTypes = {
onLatLongChange: func,
index: number,
title: string,
- boundingBoxArray: arrayOf,
+ boundingBoxArray: PropTypes.oneOfType([PropTypes.array, PropTypes.oneOf(['null'])]),
inputNumber: string,
- viewExtent: arrayOf,
+ viewExtent: PropTypes.oneOfType([PropTypes.array, PropTypes.oneOf(['null'])]),
crs: string,
};
diff --git a/web/js/components/layer/settings/band-selection/band-selection-menu.js b/web/js/components/layer/settings/band-selection/band-selection-menu.js
index c0cd78613..0fec82230 100644
--- a/web/js/components/layer/settings/band-selection/band-selection-menu.js
+++ b/web/js/components/layer/settings/band-selection/band-selection-menu.js
@@ -15,7 +15,7 @@ import { onClose } from '../../../../modules/modal/actions';
export default function BandSelection({ layer }) {
const dispatch = useDispatch();
const { activeLayers } = useSelector((state) => ({
- activeLayers: getActiveLayers(state, state.compare.activeString).map((layer) => layer),
+ activeLayers: getActiveLayers(state, state.compare.activeString).map((layerObj) => layerObj),
}));
const layerIndex = activeLayers.findIndex((activeLayer) => activeLayer.id === layer.id);
const currentSelectedPreset = useSelector(
diff --git a/web/js/components/layer/settings/band-selection/band-selection-parent-info-menu.js b/web/js/components/layer/settings/band-selection/band-selection-parent-info-menu.js
index c40101454..623179da1 100644
--- a/web/js/components/layer/settings/band-selection/band-selection-parent-info-menu.js
+++ b/web/js/components/layer/settings/band-selection/band-selection-parent-info-menu.js
@@ -7,9 +7,9 @@ import { toggleCustomContent } from '../../../../modules/modal/actions';
export default function BandSelectionParentInfoMenu({ layer }) {
const dispatch = useDispatch();
- const onCustomizeBandClick = (layer) => {
- const key = `BAND_SELECTION_MODAL_${layer.id}`;
- const title = `Customize Bands for the ${layer.title} layer`;
+ const onCustomizeBandClick = (layerObj) => {
+ const key = `BAND_SELECTION_MODAL_${layerObj.id}`;
+ const title = `Customize Bands for the ${layerObj.title} layer`;
dispatch(
toggleCustomContent(key, {
headerText: title,
@@ -20,7 +20,7 @@ export default function BandSelectionParentInfoMenu({ layer }) {
timeout: 150,
size: 'lg',
bodyComponentProps: {
- layer,
+ layerObj,
},
}),
);
diff --git a/web/js/components/layer/settings/imagery-search.js b/web/js/components/layer/settings/imagery-search.js
index a49042c40..905d40b05 100644
--- a/web/js/components/layer/settings/imagery-search.js
+++ b/web/js/components/layer/settings/imagery-search.js
@@ -60,7 +60,7 @@ export default function ImagerySearch({ layer }) {
return smallerExtent;
};
- const getOlderGranules = async (layer, refDate = selectedDate, pageNum = 1) => {
+ const getOlderGranules = async (layerArg, refDate = selectedDate, pageNum = 1) => {
const smallerExtent = getSmallerExtent();
try {
const olderUrl = `https://cmr.earthdata.nasa.gov/search/granules.json?collection_concept_id=${conceptID}&bounding_box=${smallerExtent.join(',')}&temporal=,${refDate.toISOString()}&sort_key=-start_date&pageSize=25&page_num=${pageNum}`;
@@ -74,7 +74,7 @@ export default function ImagerySearch({ layer }) {
}
};
- const getNewerGranules = async (layer, refDate = selectedDate, pageNum = 1) => {
+ const getNewerGranules = async (layerArg, refDate = selectedDate, pageNum = 1) => {
const smallerExtent = getSmallerExtent();
try {
const newerUrl = `https://cmr.earthdata.nasa.gov/search/granules.json?collection_concept_id=${conceptID}&bounding_box=${smallerExtent.join(',')}&temporal=${refDate.toISOString()},&sort_key=start_date&pageSize=25&page_num=${pageNum}`;
@@ -88,9 +88,9 @@ export default function ImagerySearch({ layer }) {
}
};
- const loadNewerDates = async (layer, pageNum = 1) => {
+ const loadNewerDates = async (layerArg, pageNum = 1) => {
setGranulesStartStatus('loading');
- const newerDates = await getNewerGranules(layer, newerGranuleDates[0], pageNum);
+ const newerDates = await getNewerGranules(layerArg, newerGranuleDates[0], pageNum);
const dates = [
...newerGranuleDates,
...newerDates,
@@ -99,9 +99,9 @@ export default function ImagerySearch({ layer }) {
setGranulesStartStatus('loaded');
};
- const loadOlderDates = async (layer, pageNum = 1) => {
+ const loadOlderDates = async (layerArg, pageNum = 1) => {
setGranulesEndStatus('loading');
- const olderDates = await getOlderGranules(layer, olderGranuleDates.at(-1), pageNum);
+ const olderDates = await getOlderGranules(layerArg, olderGranuleDates.at(-1), pageNum);
const dates = [
...olderGranuleDates,
...olderDates,
@@ -110,8 +110,8 @@ export default function ImagerySearch({ layer }) {
setGranulesEndStatus('loaded');
};
- const handleSelection = (date) => {
- selectDate(new Date(date));
+ const handleSelection = (dateArg) => {
+ selectDate(new Date(dateArg));
};
useEffect(() => {
@@ -132,10 +132,10 @@ export default function ImagerySearch({ layer }) {
...newerGranuleDates,
].sort((a, b) => Date.parse(b) - Date.parse(a));
const renderedDates = [
- ...new Set(granuleDates.map((date) => date.toLocaleDateString('en-US', dateOptions))),
- ].map((date, i) => (
- <li className="lazyload-list-item" key={date} onClick={() => handleSelection(date)}>
- {date}
+ ...new Set(granuleDates.map((granuleDate) => granuleDate.toLocaleDateString('en-US', dateOptions))),
+ ].map((granuleDate, i) => (
+ <li className="lazyload-list-item" key={granuleDate} onClick={() => handleSelection(granuleDate)}>
+ {granuleDate}
</li>
));
return renderedDates;
diff --git a/web/js/components/layer/settings/layer-settings.js b/web/js/components/layer/settings/layer-settings.js
index c5b4d1a91..b78f91180 100644
--- a/web/js/components/layer/settings/layer-settings.js
+++ b/web/js/components/layer/settings/layer-settings.js
@@ -18,14 +18,14 @@ import ImagerySearch from './imagery-search';
import {
- palettesTranslate,
+ palettesTranslate as palettesTranslateUtil,
} from '../../../modules/palettes/util';
import {
- getDefaultLegend,
- getCustomPalette,
- getPaletteLegends,
- getPalette,
- getPaletteLegend,
+ getDefaultLegend as getDefaultLegendSelector,
+ getCustomPalette as getCustomPaletteSelector,
+ getPaletteLegends as getPaletteLegendsSelector,
+ getPalette as getPaletteSelector,
+ getPaletteLegend as getPaletteLegendSelector,
isPaletteAllowed,
} from '../../../modules/palettes/selectors';
import {
@@ -34,8 +34,8 @@ import {
} from '../../../modules/layers/selectors';
import {
setThresholdRangeAndSquash,
- setCustomPalette,
- clearCustomPalette,
+ setCustomPalette as setCustomPaletteAction,
+ clearCustomPalette as clearCustomPaletteAction,
setToggledClassification,
refreshDisabledClassification,
} from '../../../modules/palettes/actions';
@@ -49,9 +49,9 @@ import {
getVectorStyle,
} from '../../../modules/vector-styles/selectors';
import {
- updateGranuleLayerOptions,
- resetGranuleLayerDates,
- setOpacity,
+ updateGranuleLayerOptions as updateGranuleLayerOptionsAction,
+ resetGranuleLayerDates as resetGranuleLayerDatesAction,
+ setOpacity as setOpacityAction,
} from '../../../modules/layers/actions';
import ClassificationToggle from './classification-toggle';
@@ -376,13 +376,18 @@ function mapStateToProps(state, ownProps) {
customPalettesIsActive: !!config.features.customPalettes,
globalTemperatureUnit,
palettedAllowed: isPaletteAllowed(ownProps.layer.id, config),
- palettesTranslate,
- getDefaultLegend: (layerId, index) => getDefaultLegend(layerId, index, state),
- getCustomPalette: (id) => getCustomPalette(id, custom),
- getPaletteLegend: (layerId, index) => getPaletteLegend(layerId, index, groupName, state),
- getPaletteLegends: (layerId) => getPaletteLegends(layerId, groupName, state),
- getPalette: (layerId, index) => getPalette(layerId, index, groupName, state),
- getVectorStyle: (layerId, index) => getVectorStyle(layerId, index, state),
+ palettesTranslate: palettesTranslateUtil,
+ getDefaultLegend: (layerId, index) => getDefaultLegendSelector(layerId, index, state),
+ getCustomPalette: (id) => getCustomPaletteSelector(id, custom),
+ getPaletteLegend: (layerId, index) => getPaletteLegendSelector(
+ layerId,
+ index,
+ groupName,
+ state,
+ ),
+ getPaletteLegends: (layerId) => getPaletteLegendsSelector(layerId, groupName, state),
+ getPalette: (layerId, index) => getPaletteSelector(layerId, index, groupName, state),
+ getVectorStyle: (layerId, index) => getVectorStyle(layerId, index, groupName, state),
vectorStyles: config.vectorStyles,
};
}
@@ -408,10 +413,10 @@ const mapDispatchToProps = (dispatch) => ({
);
},
setCustomPalette: (layerId, paletteId, index, groupName) => {
- dispatch(setCustomPalette(layerId, paletteId, index, groupName));
+ dispatch(setCustomPaletteAction(layerId, paletteId, index, groupName));
},
clearCustomPalette: (layerId, index, groupName) => {
- dispatch(clearCustomPalette(layerId, index, groupName));
+ dispatch(clearCustomPaletteAction(layerId, index, groupName));
},
setStyle: (layer, vectorStyleId, groupName) => {
dispatch(setStyle(layer, vectorStyleId, groupName));
@@ -420,13 +425,13 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(clearStyle(layer, vectorStyleId, groupName));
},
setOpacity: (id, opacity) => {
- dispatch(setOpacity(id, opacity));
+ dispatch(setOpacityAction(id, opacity));
},
updateGranuleLayerOptions: (dates, def, count) => {
- dispatch(updateGranuleLayerOptions(dates, def, count));
+ dispatch(updateGranuleLayerOptionsAction(dates, def, count));
},
resetGranuleLayerDates: (id) => {
- dispatch(resetGranuleLayerDates(id));
+ dispatch(resetGranuleLayerDatesAction(id));
},
});
diff --git a/web/js/components/location-search/location-search-modal.js b/web/js/components/location-search/location-search-modal.js
index 2dace2ecb..5a74ff921 100644
--- a/web/js/components/location-search/location-search-modal.js
+++ b/web/js/components/location-search/location-search-modal.js
@@ -15,19 +15,19 @@ import Alert from '../util/alert';
import HoverTooltip from '../util/hover-tooltip';
import { isValidCoordinates } from './util';
import {
- clearSuggestions,
- getSuggestions,
- setPlaceMarker,
- setSuggestion,
- toggleReverseGeocodeActive,
- toggleShowLocationSearch,
+ clearSuggestions as clearSuggestionsAction,
+ getSuggestions as getSuggestionsAction,
+ setPlaceMarker as setPlaceMarkerAction,
+ setSuggestion as setSuggestionAction,
+ toggleReverseGeocodeActive as toggleReverseGeocodeActiveAction,
+ toggleShowLocationSearch as toggleShowLocationSearchAction,
} from '../../modules/location-search/actions';
import {
areCoordinatesWithinExtent,
} from '../../modules/location-search/util';
import {
- processMagicKey,
- reverseGeocode,
+ processMagicKey as processMagicKeyUtil,
+ reverseGeocode as reverseGeocodeUtil,
} from '../../modules/location-search/util-api';
class LocationSearchModal extends Component {
@@ -430,8 +430,8 @@ const mapStateToProps = (state) => {
),
isCoordinateSearchActive,
isMobile,
- processMagicKey: (magicKey) => processMagicKey(magicKey, config),
- reverseGeocode: (coords) => reverseGeocode(coords, config),
+ processMagicKey: (magicKey) => processMagicKeyUtil(magicKey, config),
+ reverseGeocode: (coords) => reverseGeocodeUtil(coords, config),
suggestions,
suggestedPlace,
};
@@ -439,22 +439,22 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => ({
setPlaceMarker: (coordinates, addressAttributes) => {
- dispatch(setPlaceMarker(coordinates, addressAttributes, true));
+ dispatch(setPlaceMarkerAction(coordinates, addressAttributes, true));
},
toggleReverseGeocodeActive: (isActive) => {
- dispatch(toggleReverseGeocodeActive(isActive));
+ dispatch(toggleReverseGeocodeActiveAction(isActive));
},
toggleShowLocationSearch: () => {
- dispatch(toggleShowLocationSearch());
+ dispatch(toggleShowLocationSearchAction());
},
getSuggestions: (val) => {
- dispatch(getSuggestions(val));
+ dispatch(getSuggestionsAction(val));
},
clearSuggestions: () => {
- dispatch(clearSuggestions());
+ dispatch(clearSuggestionsAction());
},
setSuggestion: (suggestion) => {
- dispatch(setSuggestion(suggestion));
+ dispatch(setSuggestionAction(suggestion));
},
});
diff --git a/web/js/components/location-search/ol-coordinates-marker.js b/web/js/components/location-search/ol-coordinates-marker.js
index a22b78749..cf8139012 100644
--- a/web/js/components/location-search/ol-coordinates-marker.js
+++ b/web/js/components/location-search/ol-coordinates-marker.js
@@ -4,7 +4,8 @@ import PropTypes from 'prop-types';
import { transform } from 'ol/proj';
import Alert from '../util/alert';
import {
- setPlaceMarker, toggleReverseGeocodeActive,
+ setPlaceMarker as setPlaceMarkerAction,
+ toggleReverseGeocodeActive as toggleReverseGeocodeActiveAction,
} from '../../modules/location-search/actions';
import { getNormalizedCoordinate } from './util';
import { areCoordinatesWithinExtent } from '../../modules/location-search/util';
@@ -124,10 +125,10 @@ function mapStateToProps(state) {
const mapDispatchToProps = (dispatch) => ({
setPlaceMarker: (coordinates, reverseGeocodeResults) => {
- dispatch(setPlaceMarker(coordinates, reverseGeocodeResults));
+ dispatch(setPlaceMarkerAction(coordinates, reverseGeocodeResults));
},
toggleReverseGeocodeActive: (isActive) => {
- dispatch(toggleReverseGeocodeActive(isActive));
+ dispatch(toggleReverseGeocodeActiveAction(isActive));
},
});
CoordinatesMarker.propTypes = {
diff --git a/web/js/components/map/ol-coordinates.js b/web/js/components/map/ol-coordinates.js
index ae7825355..389d12d07 100644
--- a/web/js/components/map/ol-coordinates.js
+++ b/web/js/components/map/ol-coordinates.js
@@ -9,7 +9,7 @@ import { UncontrolledTooltip } from 'reactstrap';
import Coordinates from './coordinates';
import util from '../../util/util';
import { getNormalizedCoordinate } from '../location-search/util';
-import { changeCoordinateFormat } from '../../modules/settings/actions';
+import { changeCoordinateFormat as changeCoordinateFormatAction } from '../../modules/settings/actions';
import { MAP_MOUSE_MOVE, MAP_MOUSE_OUT } from '../../util/constants';
import { CRS } from '../../modules/map/constants';
@@ -172,7 +172,7 @@ function mapStateToProps (state) {
const mapDispatchToProps = (dispatch) => ({
changeCoordinateFormat: (value) => {
- dispatch(changeCoordinateFormat(value));
+ dispatch(changeCoordinateFormatAction(value));
},
});
diff --git a/web/js/components/map/ol-coordinates.test.js b/web/js/components/map/ol-coordinates.test.js
index c7a2dab62..41314d2ca 100644
--- a/web/js/components/map/ol-coordinates.test.js
+++ b/web/js/components/map/ol-coordinates.test.js
@@ -6,7 +6,7 @@ import OlCoordinates from './ol-coordinates';
import { registerProjections } from '../../fixtures';
import { MAP_MOUSE_MOVE, MAP_MOUSE_OUT } from '../../util/constants';
-jest.mock('react-redux', () => ({ connect: () => (OlCoordinates) => OlCoordinates }));
+jest.mock('react-redux', () => ({ connect: () => (OlCoordinatesMock) => OlCoordinatesMock }));
const { events } = util;
let container;
diff --git a/web/js/components/sidebar/charting-mode-options.js b/web/js/components/sidebar/charting-mode-options.js
index 2c663989c..c14633ce2 100644
--- a/web/js/components/sidebar/charting-mode-options.js
+++ b/web/js/components/sidebar/charting-mode-options.js
@@ -125,19 +125,19 @@ function ChartingModeOptions(props) {
function getLatLongFromPixelValue(pixelX, pixelY) {
const coordinate = olMap.getCoordinateFromPixel([Math.floor(pixelX), Math.floor(pixelY)]);
if (!coordinate) return [0, 0];
- const [x, y] = olProj.transform(coordinate, crs, CRS.GEOGRAPHIC);
+ const [olProjX, olProjY] = olProj.transform(coordinate, crs, CRS.GEOGRAPHIC);
- return [Number(x.toFixed(4)), Number(y.toFixed(4))];
+ return [Number(olProjX.toFixed(4)), Number(olProjY.toFixed(4))];
}
const [bottomLeftLatLong, setBottomLeftLatLong] = useState(getLatLongFromPixelValue(x, y2));
const [topRightLatLong, setTopRightLatLong] = useState(getLatLongFromPixelValue(x2, y));
function formatDateString(dateObj) {
- const date = new Date(dateObj);
- const year = date.getUTCFullYear();
- const month = date.toLocaleString('default', { month: 'short', timeZone: 'UTC' });
- const day = `0${date.getUTCDate()}`.slice(-2);
+ const dateString = new Date(dateObj);
+ const year = dateString.getUTCFullYear();
+ const month = dateString.toLocaleString('default', { month: 'short', timeZone: 'UTC' });
+ const day = `0${dateString.getUTCDate()}`.slice(-2);
return `${year} ${month} ${day}`;
}
@@ -217,10 +217,10 @@ function ChartingModeOptions(props) {
}, [fromButton]);
function formatDateForImageStat(dateObj) {
- const date = new Date(dateObj);
- const year = date.getUTCFullYear();
- const month = `0${date.getUTCMonth() + 1}`.slice(-2);
- const day = `0${date.getUTCDate()}`.slice(-2);
+ const dateString = new Date(dateObj);
+ const year = dateString.getUTCFullYear();
+ const month = `0${dateString.getUTCMonth() + 1}`.slice(-2);
+ const day = `0${dateString.getUTCDate()}`.slice(-2);
return `${year}-${month}-${day}`;
}
@@ -404,7 +404,8 @@ function ChartingModeOptions(props) {
return rechartsData;
}
- function combineData(inputArr) {
+ function combineData(input) {
+ const inputArr = input;
if (!inputArr || inputArr.length === 0) return inputArr;
if (inputArr.length === 1) {
if (inputArr[0].body && Object.prototype.hasOwnProperty.call(inputArr[0].body, 'errors')) {
@@ -644,15 +645,18 @@ function ChartingModeOptions(props) {
*
* @returns {null}
*/
- const onBoundaryUpdate = (boundaries) => {
+ const onBoundaryUpdate = (boundaryObj) => {
const {
- x, y, width, height,
- } = boundaries;
+ xBoundary = boundaryObj.x,
+ yBoundary = boundaryObj.y,
+ width,
+ height,
+ } = boundaryObj;
const newBoundaries = {
- x,
- y,
- x2: x + width,
- y2: y + height,
+ x: xBoundary,
+ y: yBoundary,
+ x2: xBoundary + width,
+ y2: yBoundary + height,
};
setBoundaries(newBoundaries);
const bottomLeft = getLatLongFromPixelValue(newBoundaries.x, newBoundaries.y2);
@@ -695,13 +699,13 @@ function ChartingModeOptions(props) {
if (!mapViewChecked) {
onLatLongChange(viewExtent);
} else {
- const boundaries = {
+ const boundariesObj = {
x: screenWidth / 2 - 100,
y: screenHeight / 2 - 100,
width: 200,
height: 200,
};
- onBoundaryUpdate(boundaries);
+ onBoundaryUpdate(boundariesObj);
}
setMapViewChecked(!mapViewChecked);
};
diff --git a/web/js/components/timeline/custom-interval-selector/interval-select.js b/web/js/components/timeline/custom-interval-selector/interval-select.js
index 3d3e6fa84..bef1d2f52 100644
--- a/web/js/components/timeline/custom-interval-selector/interval-select.js
+++ b/web/js/components/timeline/custom-interval-selector/interval-select.js
@@ -27,8 +27,8 @@ function IntervalSelect(props) {
const toggle = () => setDropdownOpen((prevState) => !prevState);
const handleChangeZoomLevel = (e) => {
- const zoomLevel = e.target.value;
- changeZoomLevel(zoomLevel);
+ const zoomLevelValue = e.target.value;
+ changeZoomLevel(zoomLevelValue);
};
const handleChangeZoomLevelMobile = (increment) => {
diff --git a/web/js/components/timeline/mobile-date-picker.js b/web/js/components/timeline/mobile-date-picker.js
index 74d172eaa..afa7d7d37 100644
--- a/web/js/components/timeline/mobile-date-picker.js
+++ b/web/js/components/timeline/mobile-date-picker.js
@@ -100,22 +100,22 @@ function MobileDatePicker(props) {
setIsOpen(false);
};
- const handleChange = (date) => {
- setTime(date);
+ const handleChange = (newDate) => {
+ setTime(newDate);
};
- const handleSelect = (time) => {
+ const handleSelect = (newTime) => {
setIsOpen(false);
- setTime(time);
+ setTime(newTime);
// convert date back to local time
- const date = convertToLocalDateObject(time);
- onDateChange(getISODateFormatted(date));
+ const newDate = convertToLocalDateObject(newTime);
+ onDateChange(getISODateFormatted(newDate));
};
- const getHeaderTime = (time, isSubdaily) => (
+ const getHeaderTime = (newTime, isSubdaily) => (
<div className="datepicker-header">
- {getDisplayDate(new Date(convertToLocalDateObject(time)), isSubdaily)}
+ {getDisplayDate(new Date(convertToLocalDateObject(newTime)), isSubdaily)}
</div>
);
diff --git a/web/js/components/timeline/timeline-coverage/coverage-item-container.js b/web/js/components/timeline/timeline-coverage/coverage-item-container.js
index 556c45eb6..b177302c6 100644
--- a/web/js/components/timeline/timeline-coverage/coverage-item-container.js
+++ b/web/js/components/timeline/timeline-coverage/coverage-item-container.js
@@ -128,7 +128,7 @@ class CoverageItemContainer extends Component {
// get line container dimensions
const containerLineDimensions = getMatchingCoverageLineDimensions(layer)
- .filter(({ visible }) => visible);
+ .filter(({ isVisible = visible }) => isVisible);
return (
<div
className="layer-coverage-line"
@@ -157,7 +157,7 @@ class CoverageItemContainer extends Component {
layer,
dateObj,
rangeDateEnd,
- ).filter(({ visible }) => visible);
+ ).filter(({ isVisible = visible }) => isVisible);
// create DOM line element
const key = `${id}-${multiIndex}`;
return (
diff --git a/web/js/containers/animation-widget/animation-widget.js b/web/js/containers/animation-widget/animation-widget.js
index 6cccf69f2..5973480f5 100644
--- a/web/js/containers/animation-widget/animation-widget.js
+++ b/web/js/containers/animation-widget/animation-widget.js
@@ -5,9 +5,9 @@ import { get as lodashGet } from 'lodash';
import util from '../../util/util';
import ErrorBoundary from '../error-boundary';
import PlayQueue from '../../components/animation-widget/play-queue';
-import { promiseImageryForTime } from '../../modules/map/util';
+import { promiseImageryForTime as promiseImageryForTimeUtil } from '../../modules/map/util';
import {
- selectDate,
+ selectDate as selectDateAction,
selectInterval,
toggleCustomModal,
} from '../../modules/date/actions';
@@ -27,7 +27,7 @@ import {
import { getSelectedDate } from '../../modules/date/selectors';
import {
play,
- onClose,
+ onClose as onCloseAction,
stop,
toggleLooping,
changeFrameRate,
@@ -221,10 +221,10 @@ function AnimationWidget (props) {
const onPushPlayFunc = () => {
const {
- startDate,
- endDate,
+ startDateZeroed = startDate,
+ endDateZeroed = endDate,
} = zeroDates();
- onUpdateStartAndEndDate(startDate, endDate);
+ onUpdateStartAndEndDate(startDateZeroed, endDateZeroed);
onPushPlay();
};
@@ -485,7 +485,7 @@ const mapStateToProps = (state) => {
looping: loop,
map,
proj,
- promiseImageryForTime: (date) => promiseImageryForTime(state, date),
+ promiseImageryForTime: (dateArg) => promiseImageryForTimeUtil(state, dateArg),
isEmbedModeActive,
playDisabled: !screenSize.isMobileDevice ? numberOfFrames >= maxFrames || numberOfFrames === 1
: numberOfFrames >= mobileMaxFrames || numberOfFrames === 1,
@@ -496,10 +496,10 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => ({
selectDate: (val) => {
- dispatch(selectDate(val));
+ dispatch(selectDateAction(val));
},
onClose: () => {
- dispatch(onClose());
+ dispatch(onCloseAction());
},
onPushPlay: () => {
dispatch(play());
diff --git a/web/js/containers/gif.js b/web/js/containers/gif.js
index 79dabe90c..3ba58546d 100644
--- a/web/js/containers/gif.js
+++ b/web/js/containers/gif.js
@@ -179,7 +179,7 @@ class GIF extends Component {
createGIF(width, height) {
const {
- getImageArray, startDate, endDate, url,
+ getImageArrayFunc = getImageArray, startDate, endDate, url,
} = this.props;
const { boundaries, showDates } = this.state;
const dimensions = {
@@ -198,7 +198,7 @@ class GIF extends Component {
boundaries,
showDates,
};
- const imageArray = getImageArray(options, { width, height });
+ const imageArray = getImageArrayFunc(options, { width, height });
if (!imageArray) return; // won't be true if there are too many frames
gifStream.createGIF(
@@ -457,7 +457,7 @@ function mapStateToProps(state) {
autoSelected,
layers.active.layers,
),
- getImageArray: (options, dimensions) => getImageArray(
+ getImageArrayFunc: (options, dimensions) => getImageArray(
options,
dimensions,
state,
@@ -481,7 +481,7 @@ GIF.propTypes = {
endDate: PropTypes.oneOfType([PropTypes.object, PropTypes.oneOf(['null'])]),
startDateStr: PropTypes.string,
endDateStr: PropTypes.string,
- getImageArray: PropTypes.func,
+ getImageArrayFunc: PropTypes.func,
increment: PropTypes.string,
map: PropTypes.oneOfType([PropTypes.object, PropTypes.oneOf(['null'])]),
numberOfFrames: PropTypes.number,
diff --git a/web/js/containers/image-download.js b/web/js/containers/image-download.js
index 5ab3ffb70..a3b4f4b43 100644
--- a/web/js/containers/image-download.js
+++ b/web/js/containers/image-download.js
@@ -14,7 +14,7 @@ import {
} from '../modules/image-download/util';
import util from '../util/util';
import {
- getLayers,
+ getLayers as getLayersSelector,
subdailyLayersActive,
} from '../modules/layers/selectors';
import { getSelectedDate } from '../modules/date/selectors';
@@ -25,7 +25,7 @@ import {
fileTypesPolar,
} from '../modules/image-download/constants';
import {
- onPanelChange,
+ onPanelChange as onPanelChangeAction,
updateBoundaries,
} from '../modules/image-download/actions';
import { getNormalizedCoordinate } from '../components/location-search/util';
@@ -271,7 +271,7 @@ function mapStateToProps(state) {
hasSubdailyLayers,
markerCoordinates,
date: getSelectedDate(state),
- getLayers: () => getLayers(
+ getLayers: () => getLayersSelector(
state,
{
reverse: true,
@@ -285,7 +285,7 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(onToggle());
},
onPanelChange: (type, value) => {
- dispatch(onPanelChange(type, value));
+ dispatch(onPanelChangeAction(type, value));
},
onBoundaryChange: (obj) => {
dispatch(updateBoundaries(obj));
diff --git a/web/js/containers/modal.js b/web/js/containers/modal.js
index c8ed94a63..f49398006 100644
--- a/web/js/containers/modal.js
+++ b/web/js/containers/modal.js
@@ -8,7 +8,7 @@ import {
} from 'reactstrap';
import Draggable from 'react-draggable';
import { Resizable } from 'react-resizable';
-import { onToggle } from '../modules/modal/actions';
+import { onToggle as onToggleAction } from '../modules/modal/actions';
import ErrorBoundary from './error-boundary';
import DetectOuterClick from '../components/util/detect-outer-click';
@@ -330,7 +330,7 @@ function mapStateToProps(state) {
}
const mapDispatchToProps = (dispatch) => ({
onToggle: () => {
- dispatch(onToggle());
+ dispatch(onToggleAction());
},
});
diff --git a/web/js/containers/projection.js b/web/js/containers/projection.js
index 4d9589e5b..90a681a9b 100644
--- a/web/js/containers/projection.js
+++ b/web/js/containers/projection.js
@@ -7,7 +7,7 @@ import changeProjection from '../modules/projection/actions';
import { onToggle } from '../modules/modal/actions';
import IconList from '../components/util/icon-list';
import {
- changeTimeScale,
+ changeTimeScale as changeTimeScaleAction,
selectInterval,
changeAutoInterval as changeAutoIntervalAction,
} from '../modules/date/actions';
@@ -116,7 +116,7 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(onToggle());
},
changeTimeScale: (val) => {
- dispatch(changeTimeScale(val));
+ dispatch(changeTimeScaleAction(val));
},
changeAutoInterval: (autoSelected) => {
dispatch(changeAutoIntervalAction(autoSelected));
diff --git a/web/js/containers/sidebar/layer-row.js b/web/js/containers/sidebar/layer-row.js
index 353e2f645..9c53e7468 100644
--- a/web/js/containers/sidebar/layer-row.js
+++ b/web/js/containers/sidebar/layer-row.js
@@ -15,16 +15,16 @@ import googleTagManager from 'googleTagManager';
import PaletteLegend from '../../components/sidebar/paletteLegend';
import util from '../../util/util';
import {
- getPalette,
+ getPalette as getPaletteSelector,
getPaletteLegends,
} from '../../modules/palettes/selectors';
import { toggleCustomContent, openCustomContent } from '../../modules/modal/actions';
import LayerInfo from '../../components/layer/info/info';
import LayerSettings from '../../components/layer/settings/layer-settings';
-import { requestPalette } from '../../modules/palettes/actions';
+import { requestPalette as requestPaletteAction } from '../../modules/palettes/actions';
import {
- toggleVisibility,
- removeLayer,
+ toggleVisibility as toggleVisibilityAction,
+ removeLayer as removeLayerAction,
} from '../../modules/layers/actions';
import OrbitTrack from './orbit-track';
import Zot from './zot';
@@ -41,7 +41,10 @@ import {
} from '../../modules/charting/actions';
import AlertUtil from '../../components/util/alert';
import {
- enableDDVZoomAlert, enableDDVLocationAlert, disableDDVLocationAlert, disableDDVZoomAlert,
+ enableDDVZoomAlert as enableDDVZoomAlertAction,
+ enableDDVLocationAlert as enableDDVLocationAlertAction,
+ disableDDVLocationAlert as disableDDVLocationAlertAction,
+ disableDDVZoomAlert as disableDDVZoomAlertAction,
} from '../../modules/alerts/actions';
const { events } = util;
@@ -187,28 +190,28 @@ function LayerRow (props) {
// hook that checks if the ddv layer zoom alert should be enabled or disabled
useEffect(() => {
- const { title } = layer;
+ const { layerTitle = title } = layer;
// if layer is ddv && layer IS NOT already in zoom alert list && zoom is at alertable level
if (isLayerNotificationDismissable && !ddvLayerZoomNoticeActive && showZoomAlert) {
- enableDDVZoomAlert(title);
+ enableDDVZoomAlert(layerTitle);
// if layer is ddv && layer IS already in zoom alert list && zoom is NOT at alertable level
} else if (isLayerNotificationDismissable && ddvLayerZoomNoticeActive && !showZoomAlert) {
- disableDDVZoomAlert(title);
+ disableDDVZoomAlert(layerTitle);
}
}, [showZoomAlert]);
// hook that checks if the ddv layer location alert should be enabled or disabled
useEffect(() => {
- const { title } = layer;
+ const { layerTitle = title } = layer;
// if layer is ddv && layer IS NOT already in location alert list
// && location is at alertable coordinates
if (isLayerNotificationDismissable && !ddvLayerLocationNoticeActive && showGranuleAlert) {
- enableDDVLocationAlert(title);
+ enableDDVLocationAlert(layerTitle);
// if layer is ddv && layer IS NOT already in location alert list
// && location is at alertable coordinates
} else if (isLayerNotificationDismissable
&& ddvLayerLocationNoticeActive && !showGranuleAlert) {
- disableDDVLocationAlert(title);
+ disableDDVLocationAlert(layerTitle);
}
}, [showGranuleAlert]);
@@ -272,12 +275,12 @@ function LayerRow (props) {
}
}, [layer.id]);
- const getDisabledTitle = (layer) => {
+ const getDisabledTitle = (layerArg) => {
const {
endDate,
period,
startDate,
- } = layer;
+ } = layerArg;
// start date
let layerStartDate;
@@ -306,14 +309,14 @@ function LayerRow (props) {
// function called on click when removing a layer
const removeLayer = () => {
- const { id, title } = layer;
+ const { id, layerTitle = title } = layer;
// remove ddv location alert
if (ddvLayerLocationNoticeActive) {
- disableDDVLocationAlert(title);
+ disableDDVLocationAlert(layerTitle);
}
// remove ddv zoom alert
if (ddvLayerZoomNoticeActive) {
- disableDDVZoomAlert(title);
+ disableDDVZoomAlert(layerTitle);
}
// remove layer
onRemoveClick(id);
@@ -403,20 +406,20 @@ function LayerRow (props) {
const classNames = hasClickableFeature
? 'layer-pointer-icon'
: 'layer-pointer-icon disabled';
- const title = hasClickableFeature
+ const titleStr = hasClickableFeature
? 'You can click the features of this layer to see associated metadata.'
: 'Zoom in further to click features.';
const layerVectorBtnId = `layer-vector-hand-btn-${encodedLayerId}`;
return (
<div
id={layerVectorBtnId}
- aria-label={title}
+ aria-label={titleStr}
className={runningDataObj ? `${classNames} running` : classNames}
onMouseDown={stopPropagation}
onClick={openVectorAlertModal}
>
<UncontrolledTooltip id="center-align-tooltip" placement="top" target={layerVectorBtnId}>
- {title}
+ {titleStr}
</UncontrolledTooltip>
<FontAwesomeIcon icon="hand-pointer" fixedWidth widthAuto />
</div>
@@ -424,17 +427,17 @@ function LayerRow (props) {
};
const renderChartingIcon = () => {
- const title = 'Select Start Charting to create time series charts or get statistics for this layer';
+ const titleStr = 'Select Start Charting to create time series charts or get statistics for this layer';
const layerChartableBtnId = `layer-chartable-btn-${encodedLayerId}`;
return (
<div
id={layerChartableBtnId}
- aria-label={title}
+ aria-label={titleStr}
className="layer-chartable-icon"
onMouseDown={stopPropagation}
>
<UncontrolledTooltip id="center-align-tooltip" placement="top" target={layerChartableBtnId}>
- {title}
+ {titleStr}
</UncontrolledTooltip>
<i />
</div>
@@ -495,9 +498,9 @@ function LayerRow (props) {
const collectionClass = collections?.type === 'NRT' ? 'collection-title badge rounded-pill bg-secondary' : 'collection-title badge rounded-pill text-dark bg-light';
- const makeActiveForCharting = (layer) => {
- if (layer !== activeChartingLayer) {
- updateActiveChartingLayer(layer);
+ const makeActiveForCharting = (layerArg) => {
+ if (layerArg !== activeChartingLayer) {
+ updateActiveChartingLayer(layerArg);
}
};
@@ -720,7 +723,7 @@ const makeMapStateToProps = () => {
hasClickableFeature: isVector && isVisible
&& isVectorLayerClickable(layer, mapRes, proj.id, isMobile),
hasPalette,
- getPalette: (layerId, i) => getPalette(layer.id, i, compareState, state),
+ getPalette: (layerId, i) => getPaletteSelector(layer.id, i, compareState, state),
paletteLegends,
palettes,
map,
@@ -733,7 +736,7 @@ const makeMapStateToProps = () => {
const mapDispatchToProps = (dispatch) => ({
toggleVisibility: (id, isVisible) => {
- dispatch(toggleVisibility(id, isVisible));
+ dispatch(toggleVisibilityAction(id, isVisible));
},
openVectorAlertModal: () => {
const { id, props } = vectorModalProps;
@@ -748,7 +751,7 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(openCustomContent(id, props));
},
onRemoveClick: (id) => {
- dispatch(removeLayer(id));
+ dispatch(removeLayerAction(id));
},
onOptionsClick: (layer, title, zot) => {
const key = `LAYER_OPTIONS_MODAL-${layer.id}`;
@@ -797,22 +800,22 @@ const mapDispatchToProps = (dispatch) => ({
);
},
requestPalette: (id) => {
- dispatch(requestPalette(id));
+ dispatch(requestPaletteAction(id));
},
updateActiveChartingLayer: (layersId) => {
dispatch(updateActiveChartingLayerAction(layersId));
},
enableDDVZoomAlert: (title) => {
- dispatch(enableDDVZoomAlert(title));
+ dispatch(enableDDVZoomAlertAction(title));
},
enableDDVLocationAlert: (title) => {
- dispatch(enableDDVLocationAlert(title));
+ dispatch(enableDDVLocationAlertAction(title));
},
disableDDVLocationAlert: (title) => {
- dispatch(disableDDVLocationAlert(title));
+ dispatch(disableDDVLocationAlertAction(title));
},
disableDDVZoomAlert: (title) => {
- dispatch(disableDDVZoomAlert(title));
+ dispatch(disableDDVZoomAlertAction(title));
},
});
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index cd572abbc..fcffed249 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -31,7 +31,7 @@ import {
} from '../../components/timeline/date-util';
import {
dateRange as getDateRange,
- hasSubDaily,
+ hasSubDaily as hasSubDailySelector,
subdailyLayersActive,
subdailyLayers,
getActiveLayers,
@@ -41,13 +41,13 @@ import {
import { getSelectedDate, getDeltaIntervalUnit } from '../../modules/date/selectors';
import {
selectDate as selectDateAction,
- changeTimeScale,
+ changeTimeScale as changeTimeScaleAction,
selectInterval,
changeCustomInterval as changeCustomIntervalAction,
changeAutoInterval as changeAutoIntervalAction,
- updateAppNow,
+ updateAppNow as updateAppNowAction,
toggleCustomModal,
- triggerTodayButton,
+ triggerTodayButton as triggerTodayButtonAction,
} from '../../modules/date/actions';
import {
checkHasFutureLayers,
@@ -55,11 +55,11 @@ import {
getNextTimeSelection,
getNextImageryDelta,
} from '../../modules/date/util';
-import { toggleActiveCompareState } from '../../modules/compare/actions';
-import { addGranuleDateRanges } from '../../modules/layers/actions';
+import { toggleActiveCompareState as toggleActiveCompareStateAction } from '../../modules/compare/actions';
+import { addGranuleDateRanges as addGranuleDateRangesAction } from '../../modules/layers/actions';
import {
- onActivate as openAnimation,
- onClose as closeAnimation,
+ onActivate as openAnimationAction,
+ onClose as closeAnimationAction,
changeStartAndEndDate,
changeStartDate,
changeEndDate,
@@ -1588,7 +1588,7 @@ function mapStateToProps(state) {
const projection = proj.id;
const activeLayersFiltered = filterProjLayersWithStartDate(activeLayers, projection);
const hasSubdailyLayers = isCompareModeActive
- ? hasSubDaily(layers.active.layers) || hasSubDaily(layers.activeB.layers)
+ ? hasSubDailySelector(layers.active.layers) || hasSubDailySelector(layers.activeB.layers)
: subdailyLayersActive(state);
const subDailyLayersList = isCompareModeActive
? [...getSubDaily(layers.active.layers), ...getSubDaily(layers.activeB.layers)]
@@ -1719,11 +1719,11 @@ function mapStateToProps(state) {
const mapDispatchToProps = (dispatch) => ({
// updates the relative application now to allow up to date coverage
updateAppNow: (date) => {
- dispatch(updateAppNow(date));
+ dispatch(updateAppNowAction(date));
},
// sets date to NOW based on state.date.appNow
triggerTodayButton: () => {
- dispatch(triggerTodayButton());
+ dispatch(triggerTodayButtonAction());
},
// changes date of active dragger 'selected' or 'selectedB'
selectDate: (val) => {
@@ -1739,7 +1739,7 @@ const mapDispatchToProps = (dispatch) => ({
},
// changes timescale (scale of grids vs. what LEFT/RIGHT arrow do)
changeTimeScale: (val) => {
- dispatch(changeTimeScale(val));
+ dispatch(changeTimeScaleAction(val));
},
// changes to non-custom timescale interval, sets customSelected to TRUE/FALSE
selectInterval: (delta, timeScale, customSelected) => {
@@ -1749,13 +1749,13 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(toggleCustomModal(open, toggleBy));
},
openAnimation: () => {
- dispatch(openAnimation());
+ dispatch(openAnimationAction());
},
closeAnimation: () => {
- dispatch(closeAnimation());
+ dispatch(closeAnimationAction());
},
toggleActiveCompareState: () => {
- dispatch(toggleActiveCompareState());
+ dispatch(toggleActiveCompareStateAction());
},
// update animation startDate
onUpdateStartDate: (date) => {
@@ -1777,7 +1777,7 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(pauseAnimation());
},
addGranuleDateRanges: (layer, dateRanges) => {
- dispatch(addGranuleDateRanges(layer, dateRanges));
+ dispatch(addGranuleDateRangesAction(layer, dateRanges));
},
});
diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js
index 384355377..e8d4af377 100644
--- a/web/js/containers/toolbar.js
+++ b/web/js/containers/toolbar.js
@@ -18,7 +18,7 @@ import Share from './share';
import HoverTooltip from '../components/util/hover-tooltip';
import ErrorBoundary from './error-boundary';
import {
- requestNotifications,
+ requestNotifications as requestNotificationsAction,
setNotifications,
} from '../modules/notifications/actions';
import { clearCustomsSnapshot, refreshPalettes } from '../modules/palettes/actions';
@@ -30,7 +30,10 @@ import { notificationWarnings } from '../modules/image-download/constants';
import Notify from '../components/image-download/notify';
import { hasCustomPaletteInActiveProjection } from '../modules/palettes/util';
import LocationSearch from '../components/location-search/location-search';
-import { toggleShowLocationSearch, toggleDialogVisible } from '../modules/location-search/actions';
+import {
+ toggleShowLocationSearch as toggleShowLocationSearchAction,
+ toggleDialogVisible as toggleDialogVisibleAction,
+} from '../modules/location-search/actions';
import { isLocationSearchFeatureEnabled } from '../modules/location-search/util';
import { getAllActiveLayers } from '../modules/layers/selectors';
import { hasNonDownloadableVisibleLayer, getNonDownloadableLayerWarning, getNonDownloadableLayers } from '../modules/image-download/util';
@@ -515,10 +518,10 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(toggleDistractionFreeMode());
},
toggleDialogVisible: (isVisible) => {
- dispatch(toggleDialogVisible(isVisible));
+ dispatch(toggleDialogVisibleAction(isVisible));
},
toggleShowLocationSearch: () => {
- dispatch(toggleShowLocationSearch());
+ dispatch(toggleShowLocationSearchAction());
},
refreshStateAfterImageDownload: (activePalettes, rotation, nonDownloadableLayers) => {
if (activePalettes) {
@@ -573,7 +576,7 @@ const mapDispatchToProps = (dispatch) => ({
}),
requestNotifications: (location) => {
const promise = dispatch(
- requestNotifications(location),
+ requestNotificationsAction(location),
);
promise.then((data) => {
const obj = JSON.parse(data);
diff --git a/web/js/containers/tour.js b/web/js/containers/tour.js
index e1fab639e..72793acd7 100644
--- a/web/js/containers/tour.js
+++ b/web/js/containers/tour.js
@@ -42,7 +42,7 @@ import { changeTab as changeTabAction } from '../modules/sidebar/actions';
import ErrorBoundary from './error-boundary';
import history from '../main';
import util from '../util/util';
-import { promiseImageryForTour } from '../modules/map/util';
+import { promiseImageryForTour as promiseImageryForTourUtil } from '../modules/map/util';
const { HIDE_TOUR } = safeLocalStorage.keys;
@@ -623,7 +623,7 @@ const mapStateToProps = (state) => {
layers,
dateString,
activeString,
- ) => promiseImageryForTour(state, layers, dateString, activeString),
+ ) => promiseImageryForTourUtil(state, layers, dateString, activeString),
};
};
diff --git a/web/js/map/compare/spy.js b/web/js/map/compare/spy.js
index 82f6934e5..98d1be381 100644
--- a/web/js/map/compare/spy.js
+++ b/web/js/map/compare/spy.js
@@ -109,8 +109,8 @@ const removeInverseListenersFromLayers = function(layers) {
const applyEventsToBaseLayers = function(layer, map, callback) {
const layers = layer.get('layers');
if (layers) {
- lodashEach(layers.getArray(), (layer) => {
- applyEventsToBaseLayers(layer, map, callback);
+ lodashEach(layers.getArray(), (layerArg) => {
+ applyEventsToBaseLayers(layerArg, map, callback);
});
} else {
callback(layer);
diff --git a/web/js/map/compare/swipe.js b/web/js/map/compare/swipe.js
index 703766434..703765246 100644
--- a/web/js/map/compare/swipe.js
+++ b/web/js/map/compare/swipe.js
@@ -59,7 +59,7 @@ const setRectClipMask = function(context, coordinates) {
context.clip();
};
-const dragLine = function(listenerObj, lineCase, map) {
+const dragLine = function(listenerObjArg, lineCase, map) {
const lineCaseEl = lineCase;
function move(evt) {
if (!dragging) {
@@ -67,10 +67,10 @@ const dragLine = function(listenerObj, lineCase, map) {
events.trigger(COMPARE_MOVE_START);
}
const windowWidth = window.innerWidth;
- if (listenerObj.type === 'default') evt.preventDefault();
+ if (listenerObjArg.type === 'default') evt.preventDefault();
evt.stopPropagation();
- if (listenerObj.type === 'touch') {
+ if (listenerObjArg.type === 'touch') {
swipeOffset = evt.touches[0].pageX;
} else {
swipeOffset = evt.clientX;
diff --git a/web/js/map/granule/util.js b/web/js/map/granule/util.js
index d9ac8fd54..0feab65d4 100644
--- a/web/js/map/granule/util.js
+++ b/web/js/map/granule/util.js
@@ -121,8 +121,8 @@ export const getGranuleFootprints = (layer) => {
const { endDate, startDate } = def;
const mostRecentGranuleDate = granuleDates[0];
const isMostRecentDateOutOfRange = new Date(mostRecentGranuleDate) > new Date(endDate);
- const reduceFunc = (granuleDates, { date, polygon }) => {
- const dates = granuleDates;
+ const reduceFunc = (granuleDatesArr, { date, polygon }) => {
+ const dates = granuleDatesArr;
const granuleDate = new Date(date);
if (!isMostRecentDateOutOfRange && isWithinDateRange(granuleDate, startDate, endDate)) {
dates[date] = polygon;
diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js
index 536fdaf55..2ba192bee 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -104,8 +104,8 @@ export default function mapLayerBuilder(config, cache, store) {
*/
const getUpdatedDateRanges = (def, callback, group) => {
const state = store.getState();
- const { config, proj } = state;
- const describeDomainsUrl = config?.features?.describeDomains?.url
+ const { config: stateConfig, proj } = state;
+ const describeDomainsUrl = stateConfig?.features?.describeDomains?.url
|| 'https://gibs.earthdata.nasa.gov';
const {
id,
@@ -149,11 +149,13 @@ export default function mapLayerBuilder(config, cache, store) {
worker.postMessage({ operation: 'requestDescribeDomains', args: [params] });
// While worker is running, format any problematic existing dateRanges
if (def.dateRanges && def.dateRanges.length > 0) {
- oldRanges = def.dateRanges.map(({ startDate, endDate, dateInterval }) => ({
- startDate,
- endDate: startDate === endDate
- ? new Date(new Date(endDate).getTime() + (Number(dateInterval) * 60000)).toISOString()
- : endDate,
+ oldRanges = def.dateRanges.map(({
+ startDate: startDateArg, endDate: endDateArg, dateInterval,
+ }) => ({
+ startDate: startDateArg,
+ endDate: startDateArg === endDateArg
+ ? new Date(new Date(endDateArg).getTime() + (Number(dateInterval) * 60000)).toISOString()
+ : endDateArg,
dateInterval,
}));
}
@@ -1055,7 +1057,7 @@ export default function mapLayerBuilder(config, cache, store) {
dateTimeTile.push('23:59:59Z');
const lastDateTile = dateTimeTile.join('T');
- const assets = [r, g, b, ...def.bandCombo.assets || []].filter((b) => b);
+ const assets = [r, g, b, ...def.bandCombo.assets || []].filter((bArg) => bArg);
const params = assets.map((asset) => `bands=${asset}`);
params.push(`expression=${encodeURIComponent(def?.bandCombo?.expression)}`);
diff --git a/web/js/map/runningdata.js b/web/js/map/runningdata.js
index fb23fbae5..417665a84 100644
--- a/web/js/map/runningdata.js
+++ b/web/js/map/runningdata.js
@@ -35,8 +35,8 @@ export default function MapRunningData(compareUi, store) {
// Determine if we should do anything with this vector layer
const shouldNotProcessVectorLayer = (layer) => {
- const state = store.getState();
- const { sidebar: { isCollapsed } } = state;
+ const storeState = store.getState();
+ const { sidebar: { isCollapsed } } = storeState;
const def = lodashGet(layer, 'wv.def');
if (!def) return true;
const { wrapX, wrapadjacentdays } = def;
@@ -100,8 +100,8 @@ export default function MapRunningData(compareUi, store) {
// Determine if we should do anything with this raster layer
const shouldNotProcessRasterLayer = (layer) => {
- const state = store.getState();
- const { sidebar: { isCollapsed } } = state;
+ const storeState = store.getState();
+ const { sidebar: { isCollapsed } } = storeState;
const type = lodashGet(layer, 'wv.def.type');
const isGranule = type === 'granule' && !layer.get('granuleGroup');
const hasPalette = !!lodashGet(layer, 'wv.def.palette');
diff --git a/web/js/mapUI/components/buffer-quick-animate/bufferQuickAnimate.js b/web/js/mapUI/components/buffer-quick-animate/bufferQuickAnimate.js
index 6482cdc8a..f1dc14f5e 100644
--- a/web/js/mapUI/components/buffer-quick-animate/bufferQuickAnimate.js
+++ b/web/js/mapUI/components/buffer-quick-animate/bufferQuickAnimate.js
@@ -4,7 +4,7 @@ import { connect } from 'react-redux';
import { getNumberStepsBetween, getNextDateTime } from '../../../modules/date/util';
import { getSelectedDate } from '../../../modules/date/selectors';
import { promiseImageryForTime } from '../../../modules/map/util';
-import { setPreload } from '../../../modules/date/actions';
+import { setPreload as setPreloadAction } from '../../../modules/date/actions';
function BufferQuickAnimate(props) {
const {
@@ -73,7 +73,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => ({
setPreload: (preloaded, lastPreloadDate) => {
- dispatch(setPreload(preloaded, lastPreloadDate));
+ dispatch(setPreloadAction(preloaded, lastPreloadDate));
},
});
diff --git a/web/js/mapUI/components/create-map/createMap.js b/web/js/mapUI/components/create-map/createMap.js
index 5395a0814..dac35fca5 100644
--- a/web/js/mapUI/components/create-map/createMap.js
+++ b/web/js/mapUI/components/create-map/createMap.js
@@ -21,8 +21,8 @@ import * as olProj from 'ol/proj';
import util from '../../../util/util';
import {
refreshRotation,
- updateRenderedState,
- updateMapUI,
+ updateRenderedState as updateRenderedStateAction,
+ updateMapUI as updateMapUIAction,
} from '../../../modules/map/actions';
import { saveRotation } from '../../../map/util';
import {
@@ -32,7 +32,11 @@ import {
MAP_MOVE_START,
MAP_ZOOMING,
} from '../../../util/constants';
-import { startLoading, stopLoading, MAP_LOADING } from '../../../modules/loading/actions';
+import {
+ startLoading as startLoadingAction,
+ stopLoading as stopLoadingAction,
+ MAP_LOADING,
+} from '../../../modules/loading/actions';
import { granuleFootprint } from '../../../map/granule/util';
const { events } = util;
@@ -248,16 +252,16 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(refreshRotation(rotation));
},
updateRenderedState: () => {
- dispatch(updateRenderedState());
+ dispatch(updateRenderedStateAction());
},
updateMapUI: (ui, rotation) => {
- dispatch(updateMapUI(ui, rotation));
+ dispatch(updateMapUIAction(ui, rotation));
},
startLoading: (key) => {
- dispatch(startLoading(key));
+ dispatch(startLoadingAction(key));
},
stopLoading: (key) => {
- dispatch(stopLoading(key));
+ dispatch(stopLoadingAction(key));
},
});
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 27f477758..1e44515d9 100644
--- a/web/js/mapUI/components/kiosk/tile-measurement/tile-measurement.js
+++ b/web/js/mapUI/components/kiosk/tile-measurement/tile-measurement.js
@@ -56,11 +56,11 @@ function TileMeasurement({ ui }) {
};
// returns the date of the first layer that has a best date
- function findBestDate(layers, bestDates) {
+ function findBestDate(layers, bestDatesArg) {
// eslint-disable-next-line no-restricted-syntax
for (const layer of layers) {
- if (bestDates[layer.id]) {
- return bestDates[layer.id].date;
+ if (bestDatesArg[layer.id]) {
+ return bestDatesArg[layer.id].date;
}
}
return undefined;
diff --git a/web/js/mapUI/components/markers/markers.js b/web/js/mapUI/components/markers/markers.js
index 63c48ab03..729e0c3a1 100644
--- a/web/js/mapUI/components/markers/markers.js
+++ b/web/js/mapUI/components/markers/markers.js
@@ -4,7 +4,10 @@ import { connect } from 'react-redux';
import { reverseGeocode } from '../../../modules/location-search/util-api';
import { getNormalizedCoordinate } from '../../../components/location-search/util';
import { animateCoordinates, areCoordinatesWithinExtent, getCoordinatesMarker } from '../../../modules/location-search/util';
-import { setGeocodeResults, removeMarker } from '../../../modules/location-search/actions';
+import {
+ setGeocodeResults as setGeocodeResultsAction,
+ removeMarker as removeMarkerAction,
+} from '../../../modules/location-search/actions';
import { getActiveLayers, getMaxZoomLevelLayerCollection } from '../../../modules/layers/selectors';
function Markers(props) {
@@ -190,10 +193,10 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => ({
setGeocodeResults: (value) => {
- dispatch(setGeocodeResults(value));
+ dispatch(setGeocodeResultsAction(value));
},
removeMarker: (value) => {
- dispatch(removeMarker(value));
+ dispatch(removeMarkerAction(value));
},
});
diff --git a/web/js/mapUI/components/mouse-move-events/mouseMoveEvents.js b/web/js/mapUI/components/mouse-move-events/mouseMoveEvents.js
index a7fc43962..f5dc2a126 100644
--- a/web/js/mapUI/components/mouse-move-events/mouseMoveEvents.js
+++ b/web/js/mapUI/components/mouse-move-events/mouseMoveEvents.js
@@ -59,10 +59,10 @@ function MouseMoveEvents(props) {
const mapStateToProps = (state) => {
const {
- events, locationSearch, sidebar, animation, measure, screenSize, map,
+ stateEvents = events, locationSearch, sidebar, animation, measure, screenSize, map,
} = state;
const { isCoordinateSearchActive } = locationSearch;
- const isEventsTabActive = typeof events !== 'undefined' && events.active;
+ const isEventsTabActive = typeof stateEvents !== 'undefined' && stateEvents.active;
const isMobile = screenSize.isMobileDevice;
const isMeasureActive = measure.isActive;
const isMapAnimating = animation.isPlaying;
diff --git a/web/js/mapUI/components/update-date/updateDate.js b/web/js/mapUI/components/update-date/updateDate.js
index 00714cfd0..61830b60e 100644
--- a/web/js/mapUI/components/update-date/updateDate.js
+++ b/web/js/mapUI/components/update-date/updateDate.js
@@ -77,9 +77,9 @@ function UpdateDate(props) {
const layerGroup = getActiveLayerGroup(layerState);
const mapLayerCollection = layerGroup.getLayers();
const layers = mapLayerCollection.getArray();
- const activeLayers = getAllActiveLayers(state);
+ const activeLayersArray = getAllActiveLayers(state);
- const visibleLayers = activeLayers.filter(({ id, visible }) => layers
+ const visibleLayers = activeLayersArray.filter(({ id, visible }) => layers
.findIndex(({ wv }) => wv?.def?.id === id) !== -1 && visible);
const layerPromises = visibleLayers.map(async (def) => {
diff --git a/web/js/mapUI/components/update-opacity/updateOpacity.js b/web/js/mapUI/components/update-opacity/updateOpacity.js
index ad3091617..d1269c86f 100644
--- a/web/js/mapUI/components/update-opacity/updateOpacity.js
+++ b/web/js/mapUI/components/update-opacity/updateOpacity.js
@@ -20,14 +20,14 @@ function UpdateOpacity(props) {
updateLayerVisibilities,
} = props;
- const updateGranuleLayerOpacity = (def, activeString, opacity, compare) => {
+ const updateGranuleLayerOpacity = (def, activeStringArg, opacity, compareArg) => {
const { id } = def;
const layers = ui.selected.getLayers().getArray();
lodashEach(Object.keys(layers), (index) => {
const layer = layers[index];
// eslint-disable-next-line no-underscore-dangle
if (layer.className_ === 'ol-layer') {
- if (compare && isCompareActive) {
+ if (compareArg && isCompareActive) {
const layerGroup = layer.getLayers().getArray();
lodashEach(Object.keys(layerGroup), (groupIndex) => {
const compareLayerGroup = layerGroup[groupIndex];
@@ -37,14 +37,14 @@ function UpdateOpacity(props) {
// inner first granule group tile layer
const firstTileLayer = tileLayer[0];
if (firstTileLayer.wv.id === id) {
- if (firstTileLayer.wv.group === activeString) {
+ if (firstTileLayer.wv.group === activeStringArg) {
compareLayerGroup.setOpacity(opacity);
}
}
}
});
} else if (layer.wv.id === id) {
- if (layer.wv.group === activeString) {
+ if (layer.wv.group === activeStringArg) {
layer.setOpacity(opacity);
}
}
@@ -54,12 +54,11 @@ function UpdateOpacity(props) {
/**
* Sets new opacity to layer
- * @param {object} def - layer Specs
- * @param {number} value - number value
+ * @param {object} actionObj - layer Specs
* @returns {void}
*/
- const updateOpacity = (action) => {
- const { id, opacity } = action;
+ const updateOpacity = (actionObj) => {
+ const { id, opacity } = actionObj;
const def = lodashFind(activeLayers, { id });
if (def.type === 'granule') {
updateGranuleLayerOpacity(def, activeString, opacity, compare);
diff --git a/web/js/mapUI/components/update-projection/updateProjection.js b/web/js/mapUI/components/update-projection/updateProjection.js
index 9e1572aae..e4f07d3bf 100644
--- a/web/js/mapUI/components/update-projection/updateProjection.js
+++ b/web/js/mapUI/components/update-projection/updateProjection.js
@@ -6,8 +6,8 @@ import {
get as lodashGet,
} from 'lodash';
import {
- fitToLeadingExtent,
- updateMapUI,
+ fitToLeadingExtent as fitToLeadingExtentAction,
+ updateMapUI as updateMapUIAction,
} from '../../../modules/map/actions';
import { getLeadingExtent } from '../../../modules/map/util';
import {
@@ -24,9 +24,9 @@ import * as vectorStyleConstants from '../../../modules/vector-styles/constants'
import { LOCATION_POP_ACTION } from '../../../redux-location-state-customs';
import { EXIT_ANIMATION, STOP_ANIMATION } from '../../../modules/animation/constants';
import { SET_SCREEN_INFO } from '../../../modules/screen-size/constants';
-import { requestPalette } from '../../../modules/palettes/actions';
+import { requestPalette as requestPaletteAction } from '../../../modules/palettes/actions';
import usePrevious from '../../../util/customHooks';
-import { addTEMPODateRanges } from '../../../modules/layers/actions';
+import { addTEMPODateRanges as addTEMPODateRangesAction } from '../../../modules/layers/actions';
function UpdateProjection(props) {
const {
@@ -187,12 +187,12 @@ function UpdateProjection(props) {
* @method hideMap
* @static
*
- * @param {object} map - Openlayers Map obj
+ * @param {object} mapObj - Openlayers Map obj
*
* @returns {void}
*/
- function hideMap(map) {
- const el = document.getElementById(`${map.getTarget()}`);
+ function hideMap(mapObj) {
+ const el = document.getElementById(`${mapObj.getTarget()}`);
if (el) el.style.display = 'none';
}
@@ -206,8 +206,8 @@ function UpdateProjection(props) {
*
* @returns {void}
*/
- function showMap(map) {
- const el = document.getElementById(`${map.getTarget()}`);
+ function showMap(mapObj) {
+ const el = document.getElementById(`${mapObj.getTarget()}`);
if (el) el.style.display = 'block';
}
@@ -237,10 +237,10 @@ function UpdateProjection(props) {
hideMap(ui.selected);
}
ui.selected = ui.proj[proj.id];
- const map = ui.selected;
+ const mapObj = ui.selected;
const isProjectionRotatable = proj.id !== 'geographic' && proj.id !== 'webmerc';
- const currentRotation = isProjectionRotatable ? map.getView().getRotation() : 0;
+ const currentRotation = isProjectionRotatable ? mapObj.getView().getRotation() : 0;
const rotationStart = isProjectionRotatable ? models.map.rotation : 0;
const rotation = start ? rotationStart : currentRotation;
@@ -251,9 +251,9 @@ function UpdateProjection(props) {
// If the browser was resized, the inactive map was not notified of
// the event. Force the update no matter what and reposition the center
// using the previous value.
- showMap(map);
+ showMap(mapObj);
- map.updateSize();
+ mapObj.updateSize();
if (ui.selected.previousCenter) {
ui.selected.setCenter(ui.selected.previousCenter);
@@ -268,19 +268,19 @@ function UpdateProjection(props) {
} else if (!models.map.extent && projId === 'geographic') {
extent = getLeadingExtent(config.pageLoadTime);
callback = () => {
- const view = map.getView();
- const extent = view.calculateExtent(map.getSize());
- fitToLeadingExtent(extent);
+ const view = mapObj.getView();
+ const calculatedExtent = view.calculateExtent(mapObj.getSize());
+ fitToLeadingExtent(calculatedExtent);
};
}
if (projId !== 'geographic') {
callback = () => {
- const view = map.getView();
+ const view = mapObj.getView();
view.setRotation(rotationStart);
};
}
if (extent) {
- map.getView().fit(extent, {
+ mapObj.getView().fit(extent, {
constrainResolution: false,
callback,
});
@@ -448,22 +448,22 @@ const mapStateToProps = (state) => {
proj,
map,
renderedPalettes,
- requestPalette,
+ requestPaletteAction,
};
};
const mapDispatchToProps = (dispatch) => ({
fitToLeadingExtent: (extent) => {
- dispatch(fitToLeadingExtent(extent));
+ dispatch(fitToLeadingExtentAction(extent));
},
updateMapUI: (ui, rotation) => {
- dispatch(updateMapUI(ui, rotation));
+ dispatch(updateMapUIAction(ui, rotation));
},
requestPalette: (id) => {
- dispatch(requestPalette(id));
+ dispatch(requestPaletteAction(id));
},
addTEMPODateRanges: (layer, dateRanges, activeString) => {
- dispatch(addTEMPODateRanges(layer, dateRanges, activeString));
+ dispatch(addTEMPODateRangesAction(layer, dateRanges, activeString));
},
});
diff --git a/web/js/modules/animation/gifstream.js b/web/js/modules/animation/gifstream.js
index bee37b774..63bbbeb36 100644
--- a/web/js/modules/animation/gifstream.js
+++ b/web/js/modules/animation/gifstream.js
@@ -168,9 +168,9 @@ export default class GifStream {
const reader = gifStream.getReader();
const chunks = [];
let processedImages = 1;
- const finished = (chunks) => {
+ const finished = (chunksArg) => {
const callbackObj = {
- blob: new Blob(chunks, { type: 'image/gif' }),
+ blob: new Blob(chunksArg, { type: 'image/gif' }),
error: '',
};
callback(callbackObj);
diff --git a/web/js/modules/layers/selectors.js b/web/js/modules/layers/selectors.js
index d6ec3c95c..e90ac2a5c 100644
--- a/web/js/modules/layers/selectors.js
+++ b/web/js/modules/layers/selectors.js
@@ -80,11 +80,11 @@ export function addLayer(
// TODO assuming first group in the array again here
const groupIdx = layers.findIndex(({ layergroup }) => layergroup === def.layergroup);
- const findLastRefLayer = (layers) => {
+ const findLastRefLayer = (layersArg) => {
let lastRefIndex = 0;
let index = 0;
- layers.forEach((layer) => {
+ layersArg.forEach((layer) => {
if (layer.layergroup === 'Reference' && layer.group !== 'baselayers') {
lastRefIndex = index;
index += 1;
diff --git a/web/js/modules/layers/util.js b/web/js/modules/layers/util.js
index 79ac6096e..8be4fbd41 100644
--- a/web/js/modules/layers/util.js
+++ b/web/js/modules/layers/util.js
@@ -1107,9 +1107,9 @@ export function dateOverlap(period, dateRanges) {
return 1;
});
- const result = sortedRanges.reduce(
- (resultObj, current, idx, arr) => {
- const result = resultObj;
+ const reducedRanges = sortedRanges.reduce(
+ (resultArg, current, idx, arr) => {
+ const result = resultArg;
// get the previous range
if (idx === 0) {
return result;
@@ -1166,7 +1166,7 @@ export function dateOverlap(period, dateRanges) {
);
// return the final results
- return result;
+ return reducedRanges;
}
// Permalink versions 1.0 and 1.1
export function layersParse11(str, config) {
diff --git a/web/js/modules/palettes/selectors.js b/web/js/modules/palettes/selectors.js
index 85deaf92c..1ed71a496 100644
--- a/web/js/modules/palettes/selectors.js
+++ b/web/js/modules/palettes/selectors.js
@@ -191,16 +191,16 @@ const updateLookup = function(layerId, palettesObj, state) {
const targetCount = target.length;
const appliedLegends = [];
const disabled = palette.disabled || [];
- lodashEach(source, (color, index) => {
+ lodashEach(source, (color, indexArg) => {
let targetColor;
- if (index < min || index > max || disabled.includes(index)) {
+ if (indexArg < min || indexArg > max || disabled.includes(indexArg)) {
targetColor = '00000000';
} else {
let sourcePercent; let
targetIndex;
if (palette.squash) {
- sourcePercent = (index - min) / (max - min);
- if (index === max) {
+ sourcePercent = (indexArg - min) / (max - min);
+ if (indexArg === max) {
sourcePercent = 1.0;
}
targetIndex = Math.floor(sourcePercent * targetCount);
@@ -208,12 +208,12 @@ const updateLookup = function(layerId, palettesObj, state) {
targetIndex = targetCount - 1;
}
} else {
- sourcePercent = index / sourceCount;
+ sourcePercent = indexArg / sourceCount;
targetIndex = Math.round(sourcePercent * targetCount);
}
targetColor = target[targetIndex];
}
- const colormapRef = entries.refs[index];
+ const colormapRef = entries.refs[indexArg];
const refIndex = refs.indexOf(colormapRef);
if (~refIndex && !appliedLegends.includes(colormapRef)) {
@@ -253,7 +253,7 @@ const toggleLookup = function(layerId, palettesObj, state) {
}
const lookup = {};
const active = newPalettes[layerId].maps;
- lodashEach(active, (palette, index) => {
+ lodashEach(active, (palette) => {
const { entries } = palette;
const { refs } = palette.legend;
const source = entries.colors;
@@ -299,15 +299,15 @@ const toggleLookup = function(layerId, palettesObj, state) {
return update(newPalettes, { [layerId]: { lookup: { $set: lookup } } });
};
-export function findIndex(layerId, value, indexInt, groupStr, state) {
- let index = indexInt;
+export function findIndex(layerId, value, indexArg, groupStr, state) {
+ let index = indexArg;
index = index || 0;
const { values } = getPalette(layerId, index, groupStr, state).entries;
let result;
- lodashEach(values, (check, index) => {
+ lodashEach(values, (check, indexLodash) => {
const min = getMinValue(check);
if (value === min) {
- result = index;
+ result = indexLodash;
return false;
}
return true;
diff --git a/web/js/modules/palettes/util.js b/web/js/modules/palettes/util.js
index e2713d86e..ee2bf71fb 100644
--- a/web/js/modules/palettes/util.js
+++ b/web/js/modules/palettes/util.js
@@ -176,7 +176,7 @@ export function drawTicksOnCanvas(ctx, legend, width) {
}
export function lookup(sourcePalette, targetPalette) {
- const lookup = {};
+ const lookupObj = {};
lodashEach(sourcePalette.colors, (sourceColor, index) => {
const source = `${parseInt(sourceColor.substring(0, 2), 16)
},${
@@ -192,9 +192,9 @@ export function lookup(sourcePalette, targetPalette) {
b: parseInt(targetColor.substring(4, 6), 16),
a: 255,
};
- lookup[source] = target;
+ lookupObj[source] = target;
});
- return lookup;
+ return lookupObj;
}
export function loadRenderedPalette(config, layerId) {
diff --git a/web/js/modules/projection/util.test.js b/web/js/modules/projection/util.test.js
index 2182ea17c..cd5bc636b 100644
--- a/web/js/modules/projection/util.test.js
+++ b/web/js/modules/projection/util.test.js
@@ -35,7 +35,7 @@ test('Default proj should be geographic [projection-default-geographic]', () =>
expect(initialState.id).toBe(response.id);
});
test('mapLocationToProjState: Update proj:id key onload [projection-update-id]', () => {
- const state = {
+ const stateMock = {
config,
proj: {
selected: {},
@@ -44,7 +44,7 @@ test('mapLocationToProjState: Update proj:id key onload [projection-update-id]',
const stateFromLocation = {
proj,
};
- const newState = mapLocationToProjState({}, stateFromLocation, state);
+ const newState = mapLocationToProjState({}, stateFromLocation, stateMock);
expect(newState.proj.id).toBe('some-test-projection');
});
diff --git a/web/js/modules/vector-styles/selectors.js b/web/js/modules/vector-styles/selectors.js
index 20ee8cb73..7281ce241 100644
--- a/web/js/modules/vector-styles/selectors.js
+++ b/web/js/modules/vector-styles/selectors.js
@@ -78,15 +78,15 @@ export function findIndex(layerId, type, value, indexInt, state) {
index = index || 0;
const { values } = getVectorStyle(layerId, index, state).entries;
let result;
- lodashEach(values, (check, index) => {
+ lodashEach(values, (check, indexArg) => {
const min = getMinValue(check);
const max = getMaxValue(check);
if (type === 'min' && value === min) {
- result = index;
+ result = indexArg;
return false;
}
if (type === 'max' && value === max) {
- result = index;
+ result = indexArg;
return false;
}
return true;
diff --git a/web/js/util/events.js b/web/js/util/events.js
index 41480cbfb..7a0741b52 100644
--- a/web/js/util/events.js
+++ b/web/js/util/events.js
@@ -5,24 +5,24 @@ export default (function events() {
const self = {};
// Object of event types. Each event type is an array of listeners.
- const events = {};
+ const eventTypes = {};
const allListeners = [];
self.on = function(event, callback) {
if (!callback) {
throw new Error('No listener specified');
}
- let listeners = events[event];
+ let listeners = eventTypes[event];
if (!listeners) {
listeners = [];
- events[event] = listeners;
+ eventTypes[event] = listeners;
}
listeners.push(callback);
return self;
};
self.off = function(event, callback) {
- const listeners = events[event];
+ const listeners = eventTypes[event];
if (listeners) {
lodashPull(listeners, callback);
}
@@ -38,12 +38,12 @@ export default (function events() {
self.trigger = function(...args) {
const [event] = args;
- const listeners = events[event];
+ const listeners = eventTypes[event];
if (!listeners && !allListeners) {
return undefined;
}
const eventArguments = args.slice(1);
- lodashEach(events[event], (listener) => {
+ lodashEach(eventTypes[event], (listener) => {
listener.apply(self, eventArguments);
});
lodashEach(allListeners, (listener) => {