Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

fix `no-multi-assign` errors

Jason Kente985c6f369c8
diff --git a/.eslintrc b/.eslintrc
index 2312cdaf4..479070995 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -80,10 +80,9 @@
"no-shadow": "warn",
"prefer-const": "warn",
"class-methods-use-this": "warn",
- "no-plusplus": "warn", // 50 errors (set to WARN)
-
+ "no-plusplus": "warn",
"max-len": "off",
- "no-multi-assign": "off",
+
"consistent-return": "off",
"no-underscore-dangle": "off",
"vars-on-top": "off",
diff --git a/test-env.js b/test-env.js
index 5d0defda6..2c77b4e86 100644
--- a/test-env.js
+++ b/test-env.js
@@ -3,5 +3,6 @@ import $ from 'jquery';
import fetchMock from 'fetch-mock';
import 'jest-canvas-mock';
+// eslint-disable-next-line no-multi-assign
global.$ = global.jQuery = $;
global.fetch = fetchMock;
diff --git a/web/js/components/layer/product-picker/product-picker.js b/web/js/components/layer/product-picker/product-picker.js
index aa8df1059..eb583c550 100644
--- a/web/js/components/layer/product-picker/product-picker.js
+++ b/web/js/components/layer/product-picker/product-picker.js
@@ -324,7 +324,8 @@ class ProductPicker extends React.Component {
listHeight = selectedLayer ? bodyHeight * 0.4 : bodyHeight;
listMinHeight = listHeight;
} else {
- detailHeight = listHeight = bodyHeight - 80;
+ listHeight = bodyHeight - 80;
+ detailHeight = listHeight;
listMinHeight = 300;
}
diff --git a/web/js/map/data/ui.js b/web/js/map/data/ui.js
index 6ed1f30ea..6b8488390 100644
--- a/web/js/map/data/ui.js
+++ b/web/js/map/data/ui.js
@@ -216,7 +216,7 @@ export function dataUi(store, ui, config) {
downloadListPanel.refresh();
}
};
- const onActivate = self.onActivate = function() {
+ const onActivate = function() {
self.active = true;
self.events.trigger('activate');
if (!mapController) {
@@ -224,6 +224,7 @@ export function dataUi(store, ui, config) {
}
query();
};
+ self.onActivate = onActivate;
const onDeactivate = function() {
self.active = false;
diff --git a/web/js/map/layerbuilder.js b/web/js/map/layerbuilder.js
index 108f38550..0d70a7180 100644
--- a/web/js/map/layerbuilder.js
+++ b/web/js/map/layerbuilder.js
@@ -51,7 +51,9 @@ export function mapLayerBuilder(models, config, cache, ui, store) {
}
const layerNext = createLayerFunc(def, options, 1, state);
const layerPrior = createLayerFunc(def, options, -1, state);
- layer.wv = layerPrior.wv = layerNext.wv = attributes;
+ layer.wv = attributes;
+ layerPrior.wv = attributes;
+ layerNext.wv = attributes;
return new OlLayerGroup({
layers: [layer, layerNext, layerPrior],
});
diff --git a/web/js/map/model.js b/web/js/map/model.js
index fa6b8e07c..07dfd4614 100644
--- a/web/js/map/model.js
+++ b/web/js/map/model.js
@@ -75,7 +75,8 @@ export function mapModel(models, config) {
let { maxExtent } = proj;
if (proj.id === 'geographic') {
- proj.wrapExtent = maxExtent = [-250, -90, 250, 90];
+ maxExtent = [-250, -90, 250, 90];
+ proj.wrapExtent = maxExtent;
}
if (intersects(extent, maxExtent)) {
self.extent = state.v;
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index ae0646563..b027ad4a2 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -58,19 +58,16 @@ import { updateVectorSelection } from '../modules/vector-styles/util';
import { faIconPlusSVGDomEl, faIconMinusSVGDomEl } from './fa-map-icons';
export function mapui(models, config, store, ui) {
- let layerBuilder; let
- createLayer;
const id = 'wv-map';
const selector = `#${id}`;
const animationDuration = 250;
- const self = {};
- let cache;
+ const cache = new Cache(400);
const rotation = new MapRotate(self, models, store);
const dateline = mapDateLineBuilder(models, config, store, ui);
const precache = mapPrecacheTile(models, config, cache, self);
const compareMapUi = mapCompare(config, store);
const measureTools = {};
- const dataRunner = self.runningdata = new MapRunningData(
+ const dataRunner = new MapRunningData(
models,
compareMapUi,
store,
@@ -78,23 +75,34 @@ export function mapui(models, config, store, ui) {
const doubleClickZoom = new OlInteractionDoubleClickZoom({
duration: animationDuration,
});
- cache = self.cache = new Cache(400);
- self.mapIsbeingDragged = false;
- self.mapIsbeingZoomed = false;
- self.proj = {}; // One map for each projection
- self.selected = null; // The map for the selected projection
- self.events = util.events();
- layerBuilder = self.layerBuilder = mapLayerBuilder(
+ const layerBuilder = mapLayerBuilder(
models,
config,
cache,
ui,
store,
);
- self.layerKey = layerBuilder.layerKey;
- createLayer = self.createLayer = layerBuilder.createLayer;
- self.promiseDay = precache.promiseDay;
- self.selectedVectors = {};
+
+ const { createLayer, layerKey } = layerBuilder;
+ const { promiseDay } = precache;
+
+ const self = {
+ cache,
+ createLayer,
+ layerKey,
+ runningdata: dataRunner,
+ layerBuilder,
+ mapIsbeingDragged: false,
+ mapIsbeingZoomed: false,
+ promiseDay,
+ proj: {}, // One map for each projection
+ selected: null, // The map for the selected projection
+ events: util.events(),
+ selectedVectirs: {},
+ reloadLayers,
+ updateDate,
+ };
+
/**
* Suscribe to redux store and listen for
* specific action types
@@ -342,6 +350,7 @@ export function mapui(models, config, store, ui) {
removeGraticule('activeB');
cache.clear();
};
+
/*
* get layers from models obj
* and add each layer to the map
@@ -353,7 +362,7 @@ export function mapui(models, config, store, ui) {
*
* @returns {void}
*/
- const reloadLayers = self.reloadLayers = function(map) {
+ const reloadLayers = function(map) {
map = map || self.selected;
const state = store.getState();
const { layers, proj } = state;
@@ -601,7 +610,7 @@ export function mapui(models, config, store, ui) {
*
* @returns {void}
*/
- const updateDate = self.updateDate = function() {
+ const updateDate = function() {
const state = store.getState();
const { compare } = state;
const layerState = state.layers;