Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Revert "WV-2819: ESLint - no-param-reassign (#6367)" (#6379)

christof-wittreicha2ef202c26dc
diff --git a/web/.eslintrc b/web/.eslintrc
index acd02a174..92fed5948 100644
--- a/web/.eslintrc
+++ b/web/.eslintrc
@@ -89,6 +89,12 @@
"no-shadow": "warn", // 110 errors across 40 files
"max-len": "error",
"no-underscore-dangle": "error",
+ "no-param-reassign": [ // 198 errors across 46 files
+ "warn",
+ {
+ "props": false
+ }
+ ],
// Import rules overrides
"import/no-cycle": "warn",
// Accesibility rules overrides
diff --git a/web/js/components/date-selector/date-input-column.js b/web/js/components/date-selector/date-input-column.js
index e7a913c6a..2fd702790 100644
--- a/web/js/components/date-selector/date-input-column.js
+++ b/web/js/components/date-selector/date-input-column.js
@@ -180,40 +180,39 @@ class DateInputColumn extends Component {
const {
date, type, minDate, maxDate, updateTimeUnitInput,
} = this.props;
- let inputValue = value;
let newDate;
const validateDate = (dateParam) => dateParam > minDate && dateParam <= maxDate && dateParam;
switch (type) {
case 'year':
- newDate = yearValidation(inputValue, date, validateDate);
+ newDate = yearValidation(value, date, validateDate);
break;
case 'month':
- newDate = monthValidation(inputValue, date, validateDate);
+ newDate = monthValidation(value, date, validateDate);
// transform month number to string (e.g., 3 -> 'MAR')
// eslint-disable-next-line no-restricted-globals
- if (newDate !== null && !isNaN(inputValue)) {
- inputValue = MONTH_STRING_ARRAY[inputValue - 1];
+ if (newDate !== null && !isNaN(value)) {
+ value = MONTH_STRING_ARRAY[value - 1];
}
break;
case 'day':
- newDate = dayValidation(inputValue, date, validateDate);
+ newDate = dayValidation(value, date, validateDate);
break;
case 'hour':
- newDate = hourValidation(inputValue, date, validateDate);
+ newDate = hourValidation(value, date, validateDate);
break;
case 'minute':
- newDate = minuteValidation(inputValue, date, validateDate);
+ newDate = minuteValidation(value, date, validateDate);
break;
default:
break;
}
// add leading '0' to single string number
- if (newDate !== null && inputValue.length === 1) {
- inputValue = `0${inputValue}`;
+ if (newDate !== null && value.length === 1) {
+ value = `0${value}`;
}
- // update parent level time unit type inputValue
+ // update parent level time unit type value
if (newDate !== null) {
- updateTimeUnitInput(type, inputValue);
+ updateTimeUnitInput(type, value);
}
return newDate;
};
diff --git a/web/js/components/layer/product-picker/browse/category-grid.js b/web/js/components/layer/product-picker/browse/category-grid.js
index 33326846b..4d1935fff 100644
--- a/web/js/components/layer/product-picker/browse/category-grid.js
+++ b/web/js/components/layer/product-picker/browse/category-grid.js
@@ -31,9 +31,7 @@ function CategoryGrid(props) {
gutter: 10,
};
categories.forEach((item) => {
- let { sortOrder } = item;
- sortOrder = item.placement === 'first' ? 1 : item.placement === 'last' ? 3 : 2;
- return sortOrder;
+ item.sortOrder = item.placement === 'first' ? 1 : item.placement === 'last' ? 3 : 2;
});
const orderedCategories = lodashOrderBy(
categories,
diff --git a/web/js/components/layer/settings/layer-settings.js b/web/js/components/layer/settings/layer-settings.js
index c5b4d1a91..d939b45c3 100644
--- a/web/js/components/layer/settings/layer-settings.js
+++ b/web/js/components/layer/settings/layer-settings.js
@@ -382,7 +382,7 @@ function mapStateToProps(state, ownProps) {
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),
+ getVectorStyle: (layerId, index) => getVectorStyle(layerId, index, groupName, state),
vectorStyles: config.vectorStyles,
};
}
diff --git a/web/js/components/projection/util.js b/web/js/components/projection/util.js
index acc3e7fca..266811a8a 100644
--- a/web/js/components/projection/util.js
+++ b/web/js/components/projection/util.js
@@ -1,25 +1,16 @@
export default function parse(state, errors, config) {
- let newState = { ...state };
-
// Permalink version 1.0 - 1.1
- if (newState.switch) {
- newState = {
- ...newState,
- p: newState.switch,
- };
- delete newState.switch;
+ if (state.switch) {
+ state.p = state.switch;
+ delete state.switch;
}
-
- const projId = newState.p;
+ const projId = state.p;
if (projId) {
if (!config.projections[projId]) {
- newState = { ...newState };
- delete newState.p;
+ delete state.p;
errors.push({
message: `Unsupported projection: ${projId}`,
});
}
}
-
- return newState;
}
diff --git a/web/js/components/range-selection/range-selection.js b/web/js/components/range-selection/range-selection.js
index fc233e17b..6c8b1ac4a 100644
--- a/web/js/components/range-selection/range-selection.js
+++ b/web/js/components/range-selection/range-selection.js
@@ -226,31 +226,29 @@ class TimelineRangeSelector extends React.Component {
const startDate = new Date(animationStartLocationDate);
const endDate = new Date(animationEndLocationDate);
- let newDraggerEndLocation = draggerEndLocation;
- let newDraggerStartLocation = draggerStartLocation;
// prevent draggers to be dragger BEFORE start date limit
if (endDate < startDateLimit) {
- newDraggerEndLocation = endLocation;
+ draggerEndLocation = endLocation;
animationEndLocationDate = startDateLimit;
}
if (startDate < startDateLimit) {
- newDraggerStartLocation = startLocation;
+ draggerStartLocation = startLocation;
animationStartLocationDate = startDateLimit;
}
// prevent draggers to be dragger AFTER end date limit
if (endDate > endDateLimit) {
- newDraggerEndLocation = endLocation;
+ draggerEndLocation = endLocation;
animationEndLocationDate = endDateLimit;
}
if (startDate > endDateLimit) {
- newDraggerStartLocation = startLocation;
+ draggerStartLocation = startLocation;
animationStartLocationDate = endDateLimit;
}
updateAnimationDateAndLocation(
animationStartLocationDate,
animationEndLocationDate,
- newDraggerStartLocation,
- newDraggerEndLocation,
+ draggerStartLocation,
+ draggerEndLocation,
isDragging,
);
};
@@ -375,5 +373,3 @@ TimelineRangeSelector.propTypes = {
};
export default TimelineRangeSelector;
-
-
diff --git a/web/js/components/timeline/timeline-axis/date-calc.js b/web/js/components/timeline/timeline-axis/date-calc.js
index a2abbdbce..544e680c7 100644
--- a/web/js/components/timeline/timeline-axis/date-calc.js
+++ b/web/js/components/timeline/timeline-axis/date-calc.js
@@ -9,15 +9,14 @@ const limitCache = {};
/**
* get range of consecutive time units based on start/end dates and timescale
*
- * @param {Object} beginDate - moment date object - start of requested time range
+ * @param {Object} startDate - moment date object - start of requested time range
* @param {Object} endDate - moment date object - end of requested time range
* @param {String} timeScale - timescale of time units (ex: 'day', 'month', etc.)
* @param {startDateLimit} startDateLimit - min date within timeline range
* @param {endDateLimit} endDateLimit - max date within timeline range
* @returns {Array} timeRange - consecutive time units based on range
*/
-export default function getTimeRange(beginDate, endDate, timeScale, startDateLimit, endDateLimit) {
- let startDate = beginDate;
+export default function getTimeRange(startDate, endDate, timeScale, startDateLimit, endDateLimit) {
const timeRange = [];
const { format } = timeScaleOptions[timeScale].timeAxis;
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..a506de74e 100644
--- a/web/js/components/timeline/timeline-coverage/coverage-item-container.js
+++ b/web/js/components/timeline/timeline-coverage/coverage-item-container.js
@@ -57,8 +57,7 @@ class CoverageItemContainer extends Component {
getDateRangeToDisplay = (dateRanges) => {
const { getMaxEndDate, getDatesInDateRange, layer } = this.props;
- const multiDateToDisplay = dateRanges.reduce((dates, range, innerIndex) => {
- const multiCoverageDates = { ...dates };
+ const multiDateToDisplay = dateRanges.reduce((multiCoverageDates, range, innerIndex) => {
const { dateInterval, startDate, endDate } = range;
const isLastInRange = innerIndex === dateRanges.length - 1;
const rangeInterval = Number(dateInterval);
diff --git a/web/js/components/tour/joyride-wrapper.js b/web/js/components/tour/joyride-wrapper.js
index a22bca9bd..7004f1b06 100644
--- a/web/js/components/tour/joyride-wrapper.js
+++ b/web/js/components/tour/joyride-wrapper.js
@@ -86,11 +86,10 @@ export default function JoyrideWrapper ({
/**
* Set a placeholder DOM element's position based on map coords
- * @param {*} el
+ * @param {*} element
* @param {*} targetCoordinates
*/
- function setPlaceholderLocation (el, targetCoordinates) {
- const element = { ...el };
+ function setPlaceholderLocation (element, targetCoordinates) {
const { topLeft, bottomRight } = targetCoordinates;
let [x1, y1] = map.getPixelFromCoordinate(topLeft) || [0, 0];
let [x2, y2] = map.getPixelFromCoordinate(bottomRight) || [0, 0];
diff --git a/web/js/containers/tour.js b/web/js/containers/tour.js
index e1fab639e..8bb89a0d7 100644
--- a/web/js/containers/tour.js
+++ b/web/js/containers/tour.js
@@ -508,8 +508,8 @@ class Tour extends React.Component {
}
const mapDispatchToProps = (dispatch) => ({
- processStepLink: (currentStoryId, currentStep, totalSteps, s, config, rendered) => {
- const search = s.split('/?').pop();
+ processStepLink: (currentStoryId, currentStep, totalSteps, search, config, rendered) => {
+ search = search.split('/?').pop();
const location = update(history.location, {
search: { $set: search },
});
@@ -553,8 +553,8 @@ const mapDispatchToProps = (dispatch) => ({
dispatch({ type: LOCATION_POP_ACTION, payload: location });
}
},
- preProcessStepLink: async (s, config, promiseImageryForTour) => {
- const search = s.split('/?').pop();
+ preProcessStepLink: async (search, config, promiseImageryForTour) => {
+ search = search.split('/?').pop();
const parameters = util.fromQueryString(search);
let layersA = [];
let layersB = [];
diff --git a/web/js/debug.js b/web/js/debug.js
index 6dc011012..d12214d5b 100644
--- a/web/js/debug.js
+++ b/web/js/debug.js
@@ -3,8 +3,7 @@ import lodashIsNaN from 'lodash/isNaN';
import lodashParseInt from 'lodash/parseInt';
// eslint-disable-next-line import/prefer-default-export
-export function debugConfig(c) {
- const config = c;
+export function debugConfig(config) {
if (config.parameters.debug === 'tiles') {
const tileSize = lodashParseInt(config.parameters.tileSize);
if (lodashIsNaN(tileSize)) {
diff --git a/web/js/main.js b/web/js/main.js
index 775738cf1..0d99f287b 100644
--- a/web/js/main.js
+++ b/web/js/main.js
@@ -42,11 +42,10 @@ const errors = [];
/**
*
- * @param {*} configObj
+ * @param {*} config
* @param {*} legacyState
*/
-function render (configObj, legacyState) {
- const config = configObj;
+function render (config, legacyState) {
config.parameters = parameters;
debugConfig(config);
@@ -103,8 +102,7 @@ window.onload = () => {
}
return response.json();
})
- .then((c) => {
- const config = c;
+ .then((config) => {
// Perform check to see if app was in the midst of a tour
const hasTour = lodashGet(config, `stories[${parameters.tr}]`);
if (hasTour) {
diff --git a/web/js/map/compare/swipe.js b/web/js/map/compare/swipe.js
index 703766434..771f2d208 100644
--- a/web/js/map/compare/swipe.js
+++ b/web/js/map/compare/swipe.js
@@ -59,8 +59,7 @@ const setRectClipMask = function(context, coordinates) {
context.clip();
};
-const dragLine = function(listenerObj, lineCase, map) {
- const lineCaseEl = lineCase;
+const dragLine = function(listenerObj, lineCaseEl, map) {
function move(evt) {
if (!dragging) {
dragging = true;
diff --git a/web/js/map/granule/granule-layer-builder.js b/web/js/map/granule/granule-layer-builder.js
index 7b66d142d..adbf9d82b 100644
--- a/web/js/map/granule/granule-layer-builder.js
+++ b/web/js/map/granule/granule-layer-builder.js
@@ -116,11 +116,10 @@ export default function granuleLayerBuilder(cache, store, createLayerWMTS) {
* Create collection of granule TileLayers from range of granule times
* @param {array} granueDates - array of dates (already sorted)
* @param {object} def - Layer specs
- * @param {object} attributesObj - Layer specs
+ * @param {object} attributes - Layer specs
* @returns {array} collection of OpenLayers TileLayers
*/
- const createGranuleTileLayers = (granules, def, attributesObj) => {
- const attributes = attributesObj;
+ const createGranuleTileLayers = (granules, def, attributes) => {
const { period, id } = def;
const { group, proj } = attributes;
diff --git a/web/js/map/granule/util.js b/web/js/map/granule/util.js
index d9ac8fd54..36f22bc33 100644
--- a/web/js/map/granule/util.js
+++ b/web/js/map/granule/util.js
@@ -121,8 +121,7 @@ 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 = (dates, { date, polygon }) => {
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 8fbf07903..8a7368f42 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -230,11 +230,10 @@ export default function mapLayerBuilder(config, cache, store) {
* @method createLayer
* @static
* @param {object} def - Layer Specs
- * @param {object} optionsObj - Layer options
+ * @param {object} options - Layer options
* @returns {object} OpenLayers layer
*/
- const createLayer = async (def, optionsObj = {}) => {
- const options = optionsObj;
+ const createLayer = async (def, options = {}) => {
const state = store.getState();
const { compare: { activeString } } = state;
const { ui: { isKioskModeActive, displayStaticMap } } = state;
@@ -1197,15 +1196,14 @@ export default function mapLayerBuilder(config, cache, store) {
/**
* Create a new OpenLayers Layer
- * @param {object} definition
+ * @param {object} def
* @param {object} key
* @param {object} options
* @param {object} dateOptions
* @param {object} granuleAttributes
* @returns {object} Openlayers TileLayer or LayerGroup
*/
- const createLayerWrapper = async (definition, key, options, dateOptions) => {
- let def = definition;
+ const createLayerWrapper = async (def, key, options, dateOptions) => {
const state = store.getState();
const { sidebar: { activeTab } } = state;
const proj = state.proj.selected;
diff --git a/web/js/map/map.js b/web/js/map/map.js
index 68fb72347..f43b69b79 100644
--- a/web/js/map/map.js
+++ b/web/js/map/map.js
@@ -14,13 +14,12 @@ export const CRS_WGS_84_QUERY_EXTENT = [-180, -60, 180, 60];
* @method isExtentValid
* @static
*
- * @param extentBound {OpenLayers.Bound} The extent to check.
+ * @param extent {OpenLayers.Bound} The extent to check.
*
* @return {boolean} False if any of the values is NaN, otherwise returns
* true.
*/
-export function mapIsExtentValid(extentBound) {
- let extent = extentBound;
+export function mapIsExtentValid(extent) {
if (lodashIsUndefined(extent)) {
return false;
}
@@ -44,20 +43,19 @@ export function mapIsExtentValid(extentBound) {
* then it is changed from a string to an array which is then
* made a global object.
*
- * @method mapParser
+ * @method parse
* @static
*
- * @param {object} stateObj object
+ * @param {string} extents string
*
- * @param {object} errors
+ * @param {obj} Error
*
* @returns {void}
*
* @todo would benefit by returning the array instead of attaching it to a global var
*/
-export function mapParser(stateObj, errors) {
+export function mapParser(state, errors) {
// 1.1 support
- const state = stateObj;
if (state.map) {
state.v = state.map;
delete state.map;
@@ -84,11 +82,10 @@ export function mapParser(stateObj, errors) {
* @method setOpacity
* @static
*
- * @param olLayer {OpenLayers.Layer} The layer to set the opacity
+ * @param layer {OpenLayers.Layer} The layer to set the opacity
* @param opacity {float} A value from 0 (transparent) to 1 (opaque).
*/
-export function setOpacity(olLayer, opacity) {
- const layer = olLayer;
+export function setOpacity(layer, opacity) {
layer.setOpacity(opacity);
if (opacity === 1) {
const effect = layer.originalTransitionEffect || 'resize';
@@ -107,7 +104,7 @@ export function setOpacity(olLayer, opacity) {
* @method setVisibility
* @static
*
- * @param olLayer {OpenLayers.Layer} The layer to set the visibility.
+ * @param layer {OpenLayers.Layer} The layer to set the visibility.
*
* @param visible {boolean} True if the layer should be visible, otherwise
* false.
@@ -115,8 +112,7 @@ export function setOpacity(olLayer, opacity) {
* @param opacity {float} The opacity that this layer should be if it
* is visible. A value from 0 (transparent) to 1 (opaque).
*/
-export function setVisibility(olLayer, visible, opacity) {
- const layer = olLayer;
+export function setVisibility(layer, visible, opacity) {
if (layer.isControl) {
layer.setVisibility(visible);
} else {
diff --git a/web/js/map/model.js b/web/js/map/model.js
index 60a4942ec..68f071c0c 100644
--- a/web/js/map/model.js
+++ b/web/js/map/model.js
@@ -113,13 +113,12 @@ export default function mapModel(models, config) {
* @method save
* @static
*
- * @param stateObj {object} map state object from permalink
+ * @param state {object} map state object from permalink
*
*
* @returns {void}
*/
- self.save = function(stateObj) {
- const state = stateObj;
+ self.save = function(state) {
state.v = lodashClone(self.extent);
if (
self.rotation !== 0.0
diff --git a/web/js/map/natural-events/cluster.js b/web/js/map/natural-events/cluster.js
index 6e0c092f9..93d10ba17 100644
--- a/web/js/map/natural-events/cluster.js
+++ b/web/js/map/natural-events/cluster.js
@@ -13,8 +13,7 @@ export const naturalEventsClusterCreateObject = (proj) => new Supercluster({
radius: proj.selected.id === 'geographic' ? 0 : 60, // pixel radius where points are clustered
maxZoom: 12,
map: (props) => ({ startDate: props.date, endDate: props.date }),
- reduce: (accumulator, properties) => {
- const accumulated = accumulator;
+ reduce: (accumulated, properties) => {
const newDate = properties.startDate;
const pastStartDate = accumulated.startDate;
const pastEndDate = accumulated.endDate;
diff --git a/web/js/map/util.js b/web/js/map/util.js
index dfa89c0c4..12ef880bf 100644
--- a/web/js/map/util.js
+++ b/web/js/map/util.js
@@ -141,12 +141,11 @@ const getBestZoom = function(distance, start, end, view) {
/**
* Moves the map with a "flying" animation
*
- * @param {Array} endPointArray Ending coordinates
+ * @param {Array} endPoint Ending coordinates
* @param {integer} endZoom Ending Zoom Level
* @return {Promise} Promise that is fulfilled when animation completes
*/
-export function fly (map, proj, endPointArray, endZoom = 5, rotation = 0, isKioskModeActive) {
- let endPoint = endPointArray;
+export function fly (map, proj, endPoint, endZoom = 5, rotation = 0, isKioskModeActive) {
const view = map.getView();
const polarProjectionCheck = proj.selected.id !== 'geographic'; // boolean if current projection is polar
view.cancelAnimations();
diff --git a/web/js/mapUI/components/create-map/createMap.js b/web/js/mapUI/components/create-map/createMap.js
index 5395a0814..1e716b78f 100644
--- a/web/js/mapUI/components/create-map/createMap.js
+++ b/web/js/mapUI/components/create-map/createMap.js
@@ -64,16 +64,15 @@ function CreateMap(props) {
/**
* Create map object
*
- * @method mapCreation
+ * @method createMap
* @static
*
* @param {object} proj - Projection properties
- * @param {object} uiCopyObj
+ * @param {object} dateSelected
*
* @returns {object} OpenLayers Map Object
*/
- const mapCreation = (proj, uiCopyObj) => {
- const uiCopy = uiCopyObj;
+ const mapCreation = (proj, uiCopy) => {
const mapContainerEl = document.getElementById('wv-map');
const mapEl = document.createElement('div');
const id = `wv-map-${proj.id}`;
diff --git a/web/js/modules/animation/gifstream.js b/web/js/modules/animation/gifstream.js
index bee37b774..a2e8e2fec 100644
--- a/web/js/modules/animation/gifstream.js
+++ b/web/js/modules/animation/gifstream.js
@@ -234,11 +234,10 @@ export default class GifStream {
/**
* Generate GIF-creating Stream
* @param {Array} frames Array of GIF image objects
- * @param {Object} context 2d Canvas Context
+ * @param {Object} ctx 2d Canvas Cntext
* @return {Object} Returns GifWriter Stream
*/
- getStream(frames, context) {
- let ctx = context;
+ getStream(frames, ctx) {
const { options } = this;
const width = options.gifWidth;
const height = options.gifHeight;
diff --git a/web/js/modules/animation/util.js b/web/js/modules/animation/util.js
index 6bcaef552..99646f0f5 100644
--- a/web/js/modules/animation/util.js
+++ b/web/js/modules/animation/util.js
@@ -73,12 +73,11 @@ export function getNumberOfSteps(start, end, interval, delta = 1, maxToCheck) {
export function getStampProps(
stampWidthRatio,
breakPoint,
- stampWidthInt,
+ stampWidth,
dimensions,
width,
height,
) {
- let stampWidth = stampWidthInt;
const dateStamp = {};
let stampHeight;
let stampHeightByImageWidth;
@@ -125,11 +124,10 @@ export function svgToPng(svgURL, stampHeight) {
export function mapLocationToAnimationState(
parameters,
- stateFromLocationObj,
+ stateFromLocation,
state,
config,
) {
- let stateFromLocation = stateFromLocationObj;
const startDate = lodashGet(stateFromLocation, 'animation.startDate');
const endDate = lodashGet(stateFromLocation, 'animation.endDate');
if (parameters.playanim && parameters.ab) {
diff --git a/web/js/modules/charting/util.js b/web/js/modules/charting/util.js
index 9fccf6116..963d81b64 100644
--- a/web/js/modules/charting/util.js
+++ b/web/js/modules/charting/util.js
@@ -2,8 +2,7 @@ import update from 'immutability-helper';
import { initialChartingState } from './reducers';
import { formatDisplayDate } from '../date/util';
-export function mapLocationToChartingState(parameters, stateFromLocationObj) {
- let stateFromLocation = stateFromLocationObj;
+export function mapLocationToChartingState(parameters, stateFromLocation) {
if (parameters.cha === 'true') {
stateFromLocation = update(stateFromLocation, {
charting: {
diff --git a/web/js/modules/combine-reducers.js b/web/js/modules/combine-reducers.js
index 3bf3bf05f..af3c4948f 100644
--- a/web/js/modules/combine-reducers.js
+++ b/web/js/modules/combine-reducers.js
@@ -134,8 +134,7 @@ const appReducer = combineReducers(reducers);
/**
* Top level reducer function w/ option to reset state
*/
-export default (stateObj, action) => {
- let state = stateObj;
+export default (state, action) => {
if (action.type === 'APP_RESET') {
state = undefined;
}
diff --git a/web/js/modules/compare/util.js b/web/js/modules/compare/util.js
index 3cb508e26..f318c7942 100644
--- a/web/js/modules/compare/util.js
+++ b/web/js/modules/compare/util.js
@@ -2,8 +2,7 @@ import update from 'immutability-helper';
import { initialCompareState } from './reducers';
import { formatDisplayDate } from '../date/util';
-export function mapLocationToCompareState(parameters, stateFromLocationObj) {
- let stateFromLocation = stateFromLocationObj;
+export function mapLocationToCompareState(parameters, stateFromLocation) {
if (parameters.ca !== undefined) {
stateFromLocation = update(stateFromLocation, {
compare: {
diff --git a/web/js/modules/date/util.js b/web/js/modules/date/util.js
index 5049aa0eb..675ac2ead 100644
--- a/web/js/modules/date/util.js
+++ b/web/js/modules/date/util.js
@@ -272,11 +272,10 @@ export function getLayersActiveAtDate(layers, date) {
*/
export function mapLocationToDateState(
parameters,
- stateFromLocationObj,
+ stateFromLocation,
state,
config,
) {
- let stateFromLocation = stateFromLocationObj;
const appNow = get(state, 'date.appNow');
// legacy time permalink
diff --git a/web/js/modules/embed/util.js b/web/js/modules/embed/util.js
index 85d904f30..f898ded7c 100644
--- a/web/js/modules/embed/util.js
+++ b/web/js/modules/embed/util.js
@@ -13,9 +13,8 @@ import { getOverlayGroups } from '../layers/util';
// eslint-disable-next-line import/prefer-default-export
export function mapLocationToEmbedState(
parameters,
- stateFromLocationObj,
+ stateFromLocation,
) {
- let stateFromLocation = stateFromLocationObj;
if (parameters.em === 'true') {
const { layers } = stateFromLocation;
const layersClone = lodashCloneDeep(layers);
diff --git a/web/js/modules/layers/actions.js b/web/js/modules/layers/actions.js
index c4fb29d15..bca0d54ec 100644
--- a/web/js/modules/layers/actions.js
+++ b/web/js/modules/layers/actions.js
@@ -55,10 +55,7 @@ export function activateLayersForEventCategory(category) {
const overlayGroups = getOverlayGroups(newLayers);
const newEventLayers = findEventLayers(originalLayers, newLayers);
- overlayGroups.forEach((groupObj) => {
- const group = groupObj;
- group.collapsed = true;
- });
+ overlayGroups.forEach((group) => { group.collapsed = true; });
dispatch({
type: ADD_LAYERS_FOR_EVENT,
@@ -228,8 +225,7 @@ export function toggleGroupVisibility(ids, visible) {
return (dispatch, getState) => {
const { compare } = getState();
const activeLayers = getActiveLayersSelector(getState());
- activeLayers.forEach((layerObj) => {
- const layer = layerObj;
+ activeLayers.forEach((layer) => {
if (ids.includes(layer.id)) {
layer.visible = visible;
}
diff --git a/web/js/modules/layers/selectors.js b/web/js/modules/layers/selectors.js
index 193d71d37..303054499 100644
--- a/web/js/modules/layers/selectors.js
+++ b/web/js/modules/layers/selectors.js
@@ -485,8 +485,7 @@ export function getLayers(state, spec = {}, layersParam) {
* @param {*} date
* @param {*} state
*/
-export function isRenderable(id, layers, dateString, bLayers, state) {
- let date = dateString;
+export function isRenderable(id, layers, date, bLayers, state) {
const { parameters } = state.config || {};
date = date || getSelectedDate(state);
const def = lodashFind(layers, { id });
diff --git a/web/js/modules/layers/selectors.test.js b/web/js/modules/layers/selectors.test.js
index d3356c684..b68a1f0ca 100644
--- a/web/js/modules/layers/selectors.test.js
+++ b/web/js/modules/layers/selectors.test.js
@@ -232,8 +232,7 @@ test('move overlay before', () => {
});
// Date Ranges
-function getDateRangesTestState(stateObj) {
- let state = stateObj;
+function getDateRangesTestState(state) {
const today = new Date(Date.UTC(2010, 0, 1));
util.now = () => today;
const layers = {
diff --git a/web/js/modules/layers/util.js b/web/js/modules/layers/util.js
index 79ac6096e..19a1942cc 100644
--- a/web/js/modules/layers/util.js
+++ b/web/js/modules/layers/util.js
@@ -1108,8 +1108,7 @@ export function dateOverlap(period, dateRanges) {
});
const result = sortedRanges.reduce(
- (resultObj, current, idx, arr) => {
- const result = resultObj;
+ (result, current, idx, arr) => {
// get the previous range
if (idx === 0) {
return result;
@@ -1172,8 +1171,7 @@ export function dateOverlap(period, dateRanges) {
export function layersParse11(str, config) {
const layers = [];
const ids = str.split(/[~,.]/);
- lodashEach(ids, (idString) => {
- let id = idString;
+ lodashEach(ids, (id) => {
if (id === 'baselayers' || id === 'overlays') {
return;
}
@@ -1454,8 +1452,7 @@ export function adjustStartDates(layers) {
.subtract(days * 24, 'hours')
.format('YYYY-MM-DDThh:mm:ss')}Z`;
- const applyDateAdjustment = (layerObj) => {
- const layer = layerObj;
+ const applyDateAdjustment = (layer) => {
const { availability, dateRanges, endDate } = layer;
if (!availability) {
return;
@@ -1519,8 +1516,7 @@ export const getCacheOptions = (period, date, state) => {
*/
export function adjustActiveDateRanges(layers, appNow) {
const appNowYear = appNow.getUTCFullYear();
- const applyDateRangeAdjustment = (layerObj) => {
- const layer = layerObj;
+ const applyDateRangeAdjustment = (layer) => {
const { dateRanges } = layer;
const { ongoing, period } = layer;
const failConditions = !ongoing
@@ -1610,8 +1606,7 @@ export function adjustActiveDateRanges(layers, appNow) {
* @returns {Array} array of layers
*/
export function adjustEndDates(layers) {
- const applyDateAdjustment = (layerObj) => {
- const layer = layerObj;
+ const applyDateAdjustment = (layer) => {
const { futureTime, dateRanges } = layer;
if (!futureTime) {
return;
@@ -1637,8 +1632,7 @@ export function adjustEndDates(layers) {
* @param {String} mockFutureLayerParameters 'targetLayerId, mockFutureTime'
* @returns {Void}
*/
-export function mockFutureTimeLayerOptions(layersObj, mockFutureLayerParameters) {
- const layers = layersObj;
+export function mockFutureTimeLayerOptions(layers, mockFutureLayerParameters) {
const urlParameters = mockFutureLayerParameters.split(',');
const [targetLayerId, mockFutureTime] = urlParameters;
@@ -1659,8 +1653,7 @@ export function getLayersFromGroups (state, groups) {
export function adjustMeasurementsValidUnitConversion(config) {
const { measurements, layers } = config;
- const applyDisableUnitConversionCheck = (layerObj) => {
- const layer = layerObj;
+ const applyDisableUnitConversionCheck = (layer) => {
const { layergroup } = layer;
if (!layergroup || !measurements[layergroup]) {
return;
diff --git a/web/js/modules/location-search/util.js b/web/js/modules/location-search/util.js
index e8a526de3..e76b4a431 100644
--- a/web/js/modules/location-search/util.js
+++ b/web/js/modules/location-search/util.js
@@ -121,10 +121,9 @@ export function getLocalStorageCollapseState() {
*/
export function mapLocationToLocationSearchState(
parameters,
- stateFromLocationObj,
+ stateFromLocation,
state,
) {
- let stateFromLocation = stateFromLocationObj;
const { s } = parameters;
const coordinatesArray = s ? s.split('+') : [];
const isValid = coordinatesArray.length >= 1;
diff --git a/web/js/modules/map/util.js b/web/js/modules/map/util.js
index 3403da3ec..509842335 100644
--- a/web/js/modules/map/util.js
+++ b/web/js/modules/map/util.js
@@ -56,16 +56,15 @@ export function getRotatedExtent(map) {
/**
* Determines if an exent object contains valid values.
*
- * @method mapIsExtentValid
+ * @method isExtentValid
* @static
*
- * @param extentBound {OpenLayers.Bound} The extent to check.
+ * @param extent {OpenLayers.Bound} The extent to check.
*
* @return {boolean} False if any of the values is NaN, otherwise returns
* true.
*/
-export function mapIsExtentValid(extentBound) {
- let extent = extentBound;
+export function mapIsExtentValid(extent) {
if (lodashIsUndefined(extent)) {
return false;
}
@@ -112,8 +111,7 @@ export function getMapParameterSetup(
}
return extent;
},
- serialize: (currentItemStateObj, currentState) => {
- let currentItemState = currentItemStateObj;
+ serialize: (currentItemState, currentState) => {
const rotation = lodashGet(currentState, 'map.rotation');
if (rotation) {
diff --git a/web/js/modules/palettes/selectors.js b/web/js/modules/palettes/selectors.js
index 85deaf92c..f942015d6 100644
--- a/web/js/modules/palettes/selectors.js
+++ b/web/js/modules/palettes/selectors.js
@@ -29,20 +29,15 @@ export function getRenderedPalette(layerId, index, state) {
* Gets a single colormap (entries / legend combo)
*
*
- * @method getPalette
+ * @method get
* @static
- * @param layerIdStr {string} The ID of the layer
- * @param indexNum {Number} The index of the colormap for this layer, default 0
+ * @param str {string} The ID of the layer
+ * @param number {Number} The index of the colormap for this layer, default 0
* object.
- * @param groupStr {String}
- * @param stateObj {Object}
* @return {object} object including the entries and legend
*/
-export function getPalette(layerIdStr, indexNum, groupStr, state) {
- const layerId = layerIdStr;
- let index = indexNum;
- let group = groupStr;
- group = group || state.compare.activeString;
+export function getPalette(layerId, index, groupStr, state) {
+ groupStr = groupStr || state.compare.activeString;
index = lodashIsUndefined(index) ? 0 : index;
const renderedPalette = lodashGet(
state,
@@ -50,7 +45,7 @@ export function getPalette(layerIdStr, indexNum, groupStr, state) {
);
const customPalette = lodashGet(
state,
- `palettes['${group}']['${layerId}'].maps[${index}]`,
+ `palettes['${groupStr}']['${layerId}'].maps[${index}]`,
);
if (customPalette) {
@@ -122,8 +117,7 @@ export function getCustomPalette(paletteId, customsPaletteConfig) {
const useLookup = function(layerId, palettesObj, state) {
let use = false;
const active = palettesObj[layerId].maps;
- lodashEach(active, (paletteObj, index) => {
- const palette = paletteObj;
+ lodashEach(active, (palette, index) => {
if (palette.custom) {
use = true;
return false;
@@ -149,8 +143,7 @@ const useLookup = function(layerId, palettesObj, state) {
};
// Looks up options/colormaps/layer.xml colormap entry
-export function getLookup(layerId, group, state) {
- let groupstr = group;
+export function getLookup(layerId, groupstr, state) {
groupstr = groupstr || state.compare.activeString;
return state.palettes[groupstr][layerId].lookup;
}
@@ -299,8 +292,7 @@ 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, index, groupStr, state) {
index = index || 0;
const { values } = getPalette(layerId, index, groupStr, state).entries;
let result;
@@ -333,9 +325,8 @@ function prepare(layerId, palettesObj, state) {
return newPalettes;
}
-export function setCustomSelector(layerId, paletteId, indexObj, groupName, state) {
+export function setCustomSelector(layerId, paletteId, index, groupName, state) {
const { config, palettes } = state;
- let index = indexObj;
if (!config.layers[layerId]) {
throw new Error(`Invalid layer: ${layerId}`);
}
@@ -350,19 +341,18 @@ export function setCustomSelector(layerId, paletteId, indexObj, groupName, state
return updateLookup(layerId, newPalettes, state);
}
-export function isActive(layerId, groupStr, state) {
- let group = groupStr;
+export function isActive(layerId, group, state) {
group = group || state.compare.activeString;
return state.palettes[group][layerId];
}
export function getKey(layerId, groupStr, state) {
- const group = groupStr || state.compare.activeString;
- if (!isActive(layerId, group, state)) {
+ groupStr = groupStr || state.compare.activeString;
+ if (!isActive(layerId, groupStr, state)) {
return '';
}
- const def = getPalette(layerId, undefined, group, state);
- const { values } = getPalette(layerId, 0, group, state).entries;
+ const def = getPalette(layerId, undefined, groupStr, state);
+ const { values } = getPalette(layerId, 0, groupStr, state).entries;
const keys = [];
if (def.custom) {
keys.push(`palette=${def.custom}`);
@@ -456,8 +446,7 @@ export function setDisabledSelector(
return updateLookup(layerId, newPalettes, state);
}
-export function setRange(layerId, props, indexInt, palettes, state) {
- let index = indexInt;
+export function setRange(layerId, props, index, palettes, state) {
let { min } = props;
let { max } = props;
const { squash } = props;
@@ -493,8 +482,7 @@ export function setRange(layerId, props, indexInt, palettes, state) {
return updateLookup(layerId, newPalettes, state);
}
-export function clearCustomSelector(layerId, indexInt, palettes, state) {
- let index = indexInt;
+export function clearCustomSelector(layerId, index, palettes, state) {
index = lodashIsUndefined(index) ? 0 : index;
const active = palettes[layerId];
if (!active) {
diff --git a/web/js/modules/palettes/util.js b/web/js/modules/palettes/util.js
index e2713d86e..bc1592c5a 100644
--- a/web/js/modules/palettes/util.js
+++ b/web/js/modules/palettes/util.js
@@ -233,11 +233,10 @@ export function getMaxValue(v) {
*/
export function parseLegacyPalettes(
parameters,
- stateFromLocationObj,
+ stateFromLocation,
state,
config,
) {
- let stateFromLocation = stateFromLocationObj;
const parts = parameters.palettes.split('~');
parts.forEach((part) => {
const items = part.split(',');
@@ -265,8 +264,7 @@ export function parseLegacyPalettes(
return stateFromLocation;
}
-const createPaletteAttributeObject = function(def, valueArray, attrObj, count) {
- let value = valueArray;
+const createPaletteAttributeObject = function(def, value, attrObj, count) {
const { key } = attrObj;
const attrArray = attrObj.array;
let hasAtLeastOnePair = attrObj.isActive;
@@ -377,8 +375,7 @@ export function getPaletteAttributeArray(layerId, palettes, state) {
* @param {Object} permlinkState | parameters parsed from permalink
* @param {Object} state
*/
-export function loadPalettes(permlinkState, stateObject) {
- let state = stateObject;
+export function loadPalettes(permlinkState, state) {
let stateArray = [{ stateStr: 'l', groupStr: 'active' }];
if (permlinkState.l1) {
stateArray = [
@@ -494,11 +491,10 @@ export function loadPalettes(permlinkState, stateObject) {
export function mapLocationToPaletteState(
parameters,
- stateFromLocationObj,
+ stateFromLocation,
state,
config,
) {
- let stateFromLocation = stateFromLocationObj;
if (parameters.l1 || parameters.l) {
stateFromLocation = loadPalettes(
parameters,
@@ -527,8 +523,7 @@ export function mapLocationToPaletteState(
* @param {Boolean} customLoaded
* @returns {Promise}
*/
-export function preloadPalettes(layersArray, renderedPalettes, customLoadedBool) {
- let customLoaded = customLoadedBool;
+export function preloadPalettes(layersArray, renderedPalettes, customLoaded) {
const rendered = renderedPalettes || {};
customLoaded = customLoaded || false;
let preloadedCustom = false;
diff --git a/web/js/modules/product-picker/format-config.js b/web/js/modules/product-picker/format-config.js
index ff8ba5f4a..ce2cd0610 100644
--- a/web/js/modules/product-picker/format-config.js
+++ b/web/js/modules/product-picker/format-config.js
@@ -14,8 +14,7 @@ function capitalizeFirstLetter(string) {
return !string ? '' : string.charAt(0).toUpperCase() + string.slice(1);
}
-function setLayerProp (layerObj, prop, value) {
- const layer = layerObj;
+function setLayerProp (layer, prop, value) {
const featuredMeasurement = prop === 'measurements' && (value && value.includes('Featured'));
if (!layer || featuredMeasurement || !value) {
return;
@@ -68,8 +67,7 @@ function setMeasurementCategoryProps(layers, { measurements, categories }) {
return layers;
}
-function setCoverageFacetProp(layerObj, selectedDate) {
- const layer = layerObj;
+function setCoverageFacetProp(layer, selectedDate) {
const {
id, startDate, endDate, dateRanges,
} = layer;
@@ -81,8 +79,7 @@ function setCoverageFacetProp(layerObj, selectedDate) {
}
}
-function setTypeProp(layerObj) {
- const layer = layerObj;
+function setTypeProp(layer) {
const { type } = layer;
const rasterTypes = ['wms', 'wmts', 'xyz', 'composite:wmts'];
const vectorTypes = ['vector', 'indexedVector'];
@@ -102,8 +99,7 @@ function setTypeProp(layerObj) {
return layer;
}
-function setChartableProp(layerObj) {
- const layer = layerObj;
+function setChartableProp(layer) {
if (!(Object.prototype.hasOwnProperty.call(layer, 'palette') && Object.prototype.hasOwnProperty.call(layer, 'colormapType') && layer.colormapType === 'continuous' && layer.layerPeriod === 'Daily') || layer.disableCharting) {
return;
}
@@ -118,8 +114,7 @@ export default function buildLayerFacetProps(config, selectedDate) {
let layers = lodashCloneDeep(config.layers);
layers = setMeasurementCategoryProps(layers, config);
- return lodashMap(layers, (layerObj) => {
- const layer = layerObj;
+ return lodashMap(layers, (layer) => {
setCoverageFacetProp(layer, selectedDate);
setLayerProp(layer, 'sources', layer.subtitle);
setTypeProp(layer);
diff --git a/web/js/modules/product-picker/search-config.js b/web/js/modules/product-picker/search-config.js
index 81147aa76..c4bc0c4fe 100644
--- a/web/js/modules/product-picker/search-config.js
+++ b/web/js/modules/product-picker/search-config.js
@@ -138,8 +138,7 @@ function updateCoverageFilter (filters, selectedDate) {
const formattedDate = formatDisplayDate(selectedDate);
const oldValueMatch = (value) => !value.includes(formattedDate) && !value.includes('Always');
- filters.forEach((filter) => {
- const f = filter;
+ filters.forEach((f) => {
if (f.field !== 'coverage') return;
f.values = f.values.map(
(value) => (oldValueMatch(value) ? `Available ${formattedDate}` : value),
diff --git a/web/js/modules/product-picker/selectors.js b/web/js/modules/product-picker/selectors.js
index 25204e7b6..2c36fe153 100644
--- a/web/js/modules/product-picker/selectors.js
+++ b/web/js/modules/product-picker/selectors.js
@@ -19,8 +19,7 @@ export const getLayersForProjection = createSelector(
const layersWithFacetProps = buildLayerFacetProps(config, selectedDate)
// Only use the layers for the active projection
.filter((layer) => layer.projections && layer.projections[projection])
- .map((layerObj) => {
- const layer = layerObj;
+ .map((layer) => {
// If there is metadata for the current projection, use that
const projectionMeta = layer.projections[projection];
if (projectionMeta.title) layer.title = projectionMeta.title;
diff --git a/web/js/modules/projection/util.js b/web/js/modules/projection/util.js
index cd330ea5f..7e6a79266 100644
--- a/web/js/modules/projection/util.js
+++ b/web/js/modules/projection/util.js
@@ -23,8 +23,7 @@ export function parseProjection(str, config) {
* @param {Object} stateFromLocation | State derived from permalink parsers
* @param {Object} state | initial state before location POP action
*/
-export function mapLocationToProjState(parameters, stateFromLocationObj, state) {
- let stateFromLocation = stateFromLocationObj;
+export function mapLocationToProjState(parameters, stateFromLocation, state) {
const projId = lodashGet(stateFromLocation, 'proj.id');
if (parameters.p) {
const selected = lodashGet(state, `config.projections.${projId}`);
diff --git a/web/js/modules/sidebar/util.js b/web/js/modules/sidebar/util.js
index 4e1d03994..7245b4a5c 100644
--- a/web/js/modules/sidebar/util.js
+++ b/web/js/modules/sidebar/util.js
@@ -10,11 +10,10 @@ import update from 'immutability-helper';
*/
export default function mapLocationToSidebarState(
parameters,
- stateFromLocationObj,
+ stateFromLocation,
state,
config,
) {
- let stateFromLocation = stateFromLocationObj;
let activeTab;
if (parameters.e) {
activeTab = 'events';
diff --git a/web/js/modules/tour/util.js b/web/js/modules/tour/util.js
index a06ce32c4..16f9995ce 100644
--- a/web/js/modules/tour/util.js
+++ b/web/js/modules/tour/util.js
@@ -14,11 +14,10 @@ const { HIDE_TOUR } = safeLocalStorage.keys;
*/
export function mapLocationToTourState(
parameters,
- stateFromLocationObj,
+ stateFromLocation,
state,
config,
) {
- let stateFromLocation = stateFromLocationObj;
const isEmbedModeActive = parameters.em && parameters.em === 'true';
if (parameters.tr && isEmbedModeActive) {
stateFromLocation = update(stateFromLocation, {
diff --git a/web/js/modules/vector-styles/selectors.js b/web/js/modules/vector-styles/selectors.js
index 20ee8cb73..1fafba2e4 100644
--- a/web/js/modules/vector-styles/selectors.js
+++ b/web/js/modules/vector-styles/selectors.js
@@ -56,13 +56,14 @@ export function getAllVectorStyles(layerId, index, state) {
/**
* Gets a single colormap (entries / legend combo)
*
- * @param layerId {string} The ID of the layer
- * @param index {Number} The index of the colormap for this layer, default 0
+ * @param str {string} The ID of the layer
+ * @param number {Number} The index of the colormap for this layer, default 0
* object.
* @return {object} object including the entries and legend
*/
-export function getVectorStyle(layerId, indexInt, state) {
- const index = lodashIsUndefined(indexInt) ? 0 : indexInt;
+export function getVectorStyle(layerId, index, groupStr, state) {
+ groupStr = groupStr || state.compare.activeString;
+ index = lodashIsUndefined(index) ? 0 : index;
const renderedVectorStyle = lodashGet(
state,
`vectorStyles.${layerId}.layers.${index}`,
@@ -73,10 +74,9 @@ export function getVectorStyle(layerId, indexInt, state) {
return getAllVectorStyles(layerId, index, state);
}
-export function findIndex(layerId, type, value, indexInt, state) {
- let index = indexInt;
+export function findIndex(layerId, type, value, index, groupStr, state) {
index = index || 0;
- const { values } = getVectorStyle(layerId, index, state).entries;
+ const { values } = getVectorStyle(layerId, index, groupStr, state).entries;
let result;
lodashEach(values, (check, index) => {
const min = getMinValue(check);
@@ -249,8 +249,7 @@ export function setStyleFunction(opts) {
return vectorStyleId;
}
-export function isActive(layerId, groupObj, state) {
- let group = groupObj;
+export function isActive(layerId, group, state) {
group = group || state.compare.activeString;
if (state.vectorStyles.custom[layerId]) {
return state.vectorStyles[group][layerId];
@@ -258,13 +257,12 @@ export function isActive(layerId, groupObj, state) {
return undefined;
}
-export function getKey(layerId, group, state) {
- let groupStr = group;
+export function getKey(layerId, groupStr, state) {
groupStr = groupStr || state.compare.activeString;
if (!isActive(layerId, groupStr, state)) {
return '';
}
- const def = getVectorStyle(layerId, undefined, state);
+ const def = getVectorStyle(layerId, undefined, groupStr, state);
const keys = [];
if (def.custom) {
keys.push(`style=${def.custom}`);
@@ -278,8 +276,7 @@ export function getKey(layerId, group, state) {
return keys.join(',');
}
-export function clearStyleFunction(def, vectorStyleId, vectorStyles, layerObj, state) {
- let layer = layerObj;
+export function clearStyleFunction(def, vectorStyleId, vectorStyles, layer, state) {
const layerId = def.id;
const glStyle = vectorStyles[layerId];
const olMap = lodashGet(state, 'legacy.map.ui.selected');
diff --git a/web/js/modules/vector-styles/util.js b/web/js/modules/vector-styles/util.js
index e58f56a35..1112cc6dc 100644
--- a/web/js/modules/vector-styles/util.js
+++ b/web/js/modules/vector-styles/util.js
@@ -328,8 +328,7 @@ export function onMapClickGetVectorFeatures(pixels, map, state, swipeOffset, mod
};
}
-export function updateVectorSelection(selectionObj, lastSelectionObj, layers, type, state) {
- const lastSelection = lastSelectionObj;
+export function updateVectorSelection(selectionObj, lastSelection, layers, type, state) {
const { config: { vectorStyles } } = state;
const vectorLayers = getVectorLayers(state);
diff --git a/web/js/redux-location-state-customs.js b/web/js/redux-location-state-customs.js
index c98b01136..6134ea725 100644
--- a/web/js/redux-location-state-customs.js
+++ b/web/js/redux-location-state-customs.js
@@ -41,8 +41,7 @@ export function stateToParams(initialState, currentState, location) {
}
const shouldPush = false;
// check the original config for values
- const newQueryParams = Object.keys(pathConfig).reduce((previous, curr) => {
- const prev = previous;
+ const newQueryParams = Object.keys(pathConfig).reduce((prev, curr) => {
const {
stateKey,
options = {},
diff --git a/web/js/util/load.js b/web/js/util/load.js
index fda54562b..6215fd4f1 100644
--- a/web/js/util/load.js
+++ b/web/js/util/load.js
@@ -5,8 +5,7 @@ export default (function() {
const self = {};
const configPromises = {};
- self.config = function(rootObj, attr, url) {
- const root = rootObj;
+ self.config = function(root, attr, url) {
let promise = Promise;
// If a request is already outstanding, chain to that one
diff --git a/web/js/util/util.js b/web/js/util/util.js
index 0b20a9295..e1589ee42 100644
--- a/web/js/util/util.js
+++ b/web/js/util/util.js
@@ -9,8 +9,7 @@ import safeLocalStorage from './local-storage';
const { COORDINATE_FORMAT } = safeLocalStorage.keys;
-export default (function(selfObj) {
- const self = selfObj;
+export default (function(self) {
let canvas = null;
// Export other util methods
@@ -26,8 +25,7 @@ export default (function(selfObj) {
return result;
};
- self.pad = function(valueStr, width, padding) {
- let value = valueStr;
+ self.pad = function(value, width, padding) {
value = `${value}`;
if (value.length < width) {
const add = width - value.length;
@@ -56,8 +54,7 @@ export default (function(selfObj) {
* object.
* @return {object} object representation of the query string.
*/
- self.fromQueryString = function(queryStringValue) {
- let queryString = queryStringValue;
+ self.fromQueryString = function(queryString) {
if (!queryString) {
return {};
}
@@ -240,8 +237,7 @@ export default (function(selfObj) {
* @param {Boolean} shouldRemoveTime if the time should be removed from the date
* @return {string} ISO string in the form of `YYYY-MM-DDThh:mm:ssZ`.
*/
- self.toISOStringSeconds = function(dateToConvert, shouldRemoveTime = false) {
- let date = dateToConvert;
+ self.toISOStringSeconds = function(date, shouldRemoveTime = false) {
const isString = typeof date === 'string' || date instanceof String;
if (shouldRemoveTime) date = self.clearTimeUTC(date);
const dateString = isString ? date : date.toISOString();
@@ -590,8 +586,7 @@ export default (function(selfObj) {
DOWN: 40,
};
- function formatDegrees(degreeValue, type, withSeconds) {
- let value = degreeValue;
+ function formatDegrees(value, type, withSeconds) {
let width; let
signs;
if (type === 'longitude') {
@@ -677,8 +672,7 @@ export default (function(selfObj) {
return formatted;
};
- self.toArray = function(nonArrayValue) {
- let value = nonArrayValue;
+ self.toArray = function(value) {
if (!value) {
return [];
}