Interactive interface for browsing global, full-resolution satellite imagery
Fix eslint standard config lint errors
ZachTRicec7b5265c342d
diff --git a/e2e/browserstack.conf.js b/e2e/browserstack.conf.jsindex ccb55f132..f3dc00aae 100644--- a/e2e/browserstack.conf.js+++ b/e2e/browserstack.conf.js@@ -76,11 +76,11 @@ environments.forEach(e => {// Merge common_capabilities with each test_settings keyfor (var i in nightwatchConfig.test_settings) {var config = nightwatchConfig.test_settings[i];- config['selenium_host'] = nightwatchConfig.selenium.host;- config['selenium_port'] = nightwatchConfig.selenium.port;- config['desiredCapabilities'] = config['desiredCapabilities'] || {};+ config.selenium_host = nightwatchConfig.selenium.host;+ config.selenium_port = nightwatchConfig.selenium.port;+ config.desiredCapabilities = config.desiredCapabilities || {};for (var j in nightwatchConfig.common_capabilities) {- config['desiredCapabilities'][j] = config['desiredCapabilities'][j] || nightwatchConfig.common_capabilities[j];+ config.desiredCapabilities[j] = config.desiredCapabilities[j] || nightwatchConfig.common_capabilities[j];}}module.exports = nightwatchConfig;diff --git a/tasks/link-check/natural-event-url-extract.js b/tasks/link-check/natural-event-url-extract.jsindex 0b9ca81bc..91d06f32c 100644--- a/tasks/link-check/natural-event-url-extract.js+++ b/tasks/link-check/natural-event-url-extract.js@@ -17,7 +17,7 @@ const findProp = async (obj, keys, out) => {if (hasOwn(i)) {if (keys.includes(i)) {// handle different title formats from EONET- const title = obj['title'] ? obj['title'] : obj['id'];+ const title = obj.title ? obj.title : obj.id;if (title) {out.push({ [title]: obj[i] });}diff --git a/tasks/link-check/url-check.js b/tasks/link-check/url-check.jsindex bd6e6ca24..d10751a73 100644--- a/tasks/link-check/url-check.js+++ b/tasks/link-check/url-check.js@@ -21,14 +21,14 @@ const requestCheck = async (urls) => {await fetch(url, { timeout: 10000 }).then(async (res) => {const statusCode = await res.status;- if (!parsedUrls['STATUSCODE'][statusCode]) {- parsedUrls['STATUSCODE'][statusCode] = [];+ if (!parsedUrls.STATUSCODE[statusCode]) {+ parsedUrls.STATUSCODE[statusCode] = [];}- parsedUrls['STATUSCODE'][statusCode].push({ [linkName]: url });+ parsedUrls.STATUSCODE[statusCode].push({ [linkName]: url });}).then(sleeper(500)).catch((err) => { // eslint-disable-line handle-callback-err- parsedUrls['ERROR'].push({ [linkName]: url });+ parsedUrls.ERROR.push({ [linkName]: url });});}return parsedUrls;@@ -41,16 +41,16 @@ const getURLStatusCodeCollection = async function(urls) {console.log(`URL STATUSCODE RESULTS:${'-'.repeat(66)}- ERRORS: \x1b[31m${checkStatus['ERROR'].length}\x1b[0m+ ERRORS: \x1b[31m${checkStatus.ERROR.length}\x1b[0mSTATUSCODE:`);- for (const code in checkStatus['STATUSCODE']) {+ for (const code in checkStatus.STATUSCODE) {let preColor = '\x1b[33m';if (code === '200') {preColor = '\x1b[32m';} else if (Number(code) >= 400) {preColor = '\x1b[31m';}- console.log(` ${code}: ${preColor + checkStatus['STATUSCODE'][code].length}\x1b[0m`);+ console.log(` ${code}: ${preColor + checkStatus.STATUSCODE[code].length}\x1b[0m`);}return checkStatus;};diff --git a/web/js/components/layer/product-picker/list.js b/web/js/components/layer/product-picker/list.jsindex ceaf51f3d..1589dbd72 100644--- a/web/js/components/layer/product-picker/list.js+++ b/web/js/components/layer/product-picker/list.js@@ -125,7 +125,7 @@ class LayerList extends React.Component {categoryConfig} = this.props;- const categoryToUse = category || categoryConfig['All'];+ const categoryToUse = category || categoryConfig.All;return (<div id={categoryToUse.id + '-list'}>{categoryToUse.measurements.map((measurement, index) => {diff --git a/web/js/components/layer/settings/vector-style.js b/web/js/components/layer/settings/vector-style.jsindex 15f5f0ea2..8529eab97 100644--- a/web/js/components/layer/settings/vector-style.js+++ b/web/js/components/layer/settings/vector-style.js@@ -82,7 +82,7 @@ class VectorStyleSelect extends React.Component {const { index, vectorStyles, layer } = this.props;var vectorStyleId = layer.vectorStyle.id;var vectorStyle = vectorStyles[vectorStyleId];- var vectorStyleLayers = vectorStyle['layers'];+ var vectorStyleLayers = vectorStyle.layers;var uniqueStyleLayers = vectorStyleLayers.filter(function(a) {if (!this[a.id]) {diff --git a/web/js/components/projection/util.js b/web/js/components/projection/util.jsindex d9c933ffd..3dfafbd6b 100644--- a/web/js/components/projection/util.js+++ b/web/js/components/projection/util.js@@ -1,8 +1,8 @@export function parse(state, errors, config) {// Permalink version 1.0 - 1.1- if (state['switch']) {- state.p = state['switch'];- delete state['switch'];+ if (state.switch) {+ state.p = state.switch;+ delete state.switch;}var projId = state.p;if (projId) {diff --git a/web/js/components/tour/modal-tour-in-progress.js b/web/js/components/tour/modal-tour-in-progress.jsindex 35a75066b..1e8bd5d46 100644--- a/web/js/components/tour/modal-tour-in-progress.js+++ b/web/js/components/tour/modal-tour-in-progress.js@@ -19,13 +19,13 @@ class ModalInProgress extends React.Component {onClosed={this.props.showTourAlert}wrapClassName="tour tour-in-progress"className={- this.props.className + ' ' + this.props.currentStory['type']+ this.props.className + ' ' + this.props.currentStory.type}backdrop={false}keyboard={false}><ModalHeader toggle={this.props.endTour} charCode="">- {this.props.currentStory['title']}+ {this.props.currentStory.title}<i className="modal-icon" aria-hidden="true" /></ModalHeader><ModalBody>diff --git a/web/js/components/vector-metadata/table.js b/web/js/components/vector-metadata/table.jsindex 60320dcca..308e77088 100644--- a/web/js/components/vector-metadata/table.js+++ b/web/js/components/vector-metadata/table.js@@ -23,9 +23,9 @@ export default class VectorMetaTable extends React.Component {) {header = Object.entries(metaFeatures).map(([featureId, i], x) => {var tooltipDescription;- Object.values(metaLegend['mvt_properties']).forEach(property => {- if (property && property['Description'] && (property['Identifier'].toLowerCase() === featureId.toLowerCase())) {- tooltipDescription = property['Description'];+ Object.values(metaLegend.mvt_properties).forEach(property => {+ if (property && property.Description && (property.Identifier.toLowerCase() === featureId.toLowerCase())) {+ tooltipDescription = property.Description;}});return (diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.jsindex 8b96b67aa..8e0c8eb62 100644--- a/web/js/containers/timeline/timeline.js+++ b/web/js/containers/timeline/timeline.js@@ -1134,7 +1134,7 @@ function mapStateToProps(state) {let endTime;if (isCompareModeActive) {- hasSubdailyLayers = hasSubDaily(layers['active']) || hasSubDaily(layers['activeB']);+ hasSubdailyLayers = hasSubDaily(layers.active) || hasSubDaily(layers.activeB);endTime = getEndTime(layers, config);} else {hasSubdailyLayers = hasSubDaily(layers[compare.activeString]);@@ -1314,8 +1314,8 @@ const getOffsetValues = (innerWidth, hasSubDaily) => {};const getEndTime = (layers, config) => {- const endDateA = layersLastDateTime(layers['active'], config);- const endDateB = layersLastDateTime(layers['activeB'], config);+ const endDateA = layersLastDateTime(layers.active, config);+ const endDateB = layersLastDateTime(layers.activeB, config);return endDateA > endDateB ? endDateA : endDateB;};/**diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.jsindex 6face5afd..9f2bd4273 100644--- a/web/js/containers/toolbar.js+++ b/web/js/containers/toolbar.js@@ -96,7 +96,7 @@ class toolbarContainer extends Component {).then(() => {openModal('TOOLBAR_SNAPSHOT',- CUSTOM_MODAL_PROPS['TOOLBAR_SNAPSHOT']+ CUSTOM_MODAL_PROPS.TOOLBAR_SNAPSHOT);});});@@ -145,7 +145,7 @@ class toolbarContainer extends Component {onClick={() =>openModal('TOOLBAR_SHARE_LINK',- CUSTOM_MODAL_PROPS['TOOLBAR_SHARE_LINK']+ CUSTOM_MODAL_PROPS.TOOLBAR_SHARE_LINK)}>@@ -159,7 +159,7 @@ class toolbarContainer extends Component {onClick={() =>openModal('TOOLBAR_PROJECTION',- CUSTOM_MODAL_PROPS['TOOLBAR_PROJECTION']+ CUSTOM_MODAL_PROPS.TOOLBAR_PROJECTION)}>@@ -192,7 +192,7 @@ class toolbarContainer extends Component {title="Information"className={'wv-toolbar-button' + notificationClass}onClick={() =>- openModal('TOOLBAR_INFO', CUSTOM_MODAL_PROPS['TOOLBAR_INFO'])+ openModal('TOOLBAR_INFO', CUSTOM_MODAL_PROPS.TOOLBAR_INFO)}data-content={notificationContentNumber}>diff --git a/web/js/containers/tour.js b/web/js/containers/tour.jsindex 732909d2a..71e443e41 100644--- a/web/js/containers/tour.js+++ b/web/js/containers/tour.js@@ -93,14 +93,14 @@ class Tour extends React.Component {currentStoryId,1,currentStory.steps.length,- storyStep['stepLink'] + '&tr=' + currentStoryId + transition,+ storyStep.stepLink + '&tr=' + currentStoryId + transition,this.props.config,this.props.renderedPalettes);}fetchMetadata(currentStory, stepIndex) {- var description = currentStory.steps[stepIndex]['description'];+ var description = currentStory.steps[stepIndex].description;var { origin, pathname } = window.location;var errorMessage = '<p>There was an error loading this description.</p>';var uri = `${origin}${pathname}config/metadata/stories/${@@ -188,7 +188,7 @@ class Tour extends React.Component {currentStoryId,newStep,currentStory.steps.length,- currentStory.steps[newStep - 1]['stepLink'] ++ currentStory.steps[newStep - 1].stepLink +'&tr=' +currentStoryId +transition,@@ -217,7 +217,7 @@ class Tour extends React.Component {currentStoryId,newStep,currentStory.steps.length,- currentStory.steps[newStep - 1]['stepLink'] ++ currentStory.steps[newStep - 1].stepLink +'&tr=' +currentStoryId +transition,diff --git a/web/js/map/datelinebuilder.js b/web/js/map/datelinebuilder.jsindex d0a83a339..c56458dd1 100644--- a/web/js/map/datelinebuilder.js+++ b/web/js/map/datelinebuilder.js@@ -44,7 +44,7 @@ export function mapDateLineBuilder(models, config, store, ui) {const subscribeToStore = function(action) {switch (action.type) {case SELECT_DATE:- case COMPARE_CHANGE_STATE:+ case COMPARE_CHANGE_STATE: {const state = store.getState();const selectedDateStr = state.compare.isCompareA ? 'selected' : 'selectedB';const date = state.date[selectedDateStr];@@ -53,6 +53,7 @@ export function mapDateLineBuilder(models, config, store, ui) {return updateDate(date);}break;+ }case CHANGE_PROJECTION:proj = action.id;}diff --git a/web/js/map/natural-events/ui.js b/web/js/map/natural-events/ui.jsindex a85a127af..dea47c0e1 100644--- a/web/js/map/natural-events/ui.js+++ b/web/js/map/natural-events/ui.js@@ -410,7 +410,7 @@ export default function naturalEventsUI(ui, config, store, models) {const currentProjection = proj.selected.id;// Turn on the relevant layers for the event type based on projection and categoryvar activeLayers = self.layers[currentProjection][category];- if (!activeLayers) activeLayers = self.layers[currentProjection]['Default'];+ if (!activeLayers) activeLayers = self.layers[currentProjection].Default;store.dispatch(activateLayersForEventCategory(activeLayers));};diff --git a/web/js/map/ui.js b/web/js/map/ui.jsindex abbae0ab2..3ed104b31 100644--- a/web/js/map/ui.js+++ b/web/js/map/ui.js@@ -96,12 +96,13 @@ export function mapui(models, config, store, ui) {*/const subscribeToStore = function(action) {switch (action.type) {- case layerConstants.ADD_LAYER:+ case layerConstants.ADD_LAYER: {const def = lodashFind(action.layers, { id: action.id });return addLayer(def);+ }case CLEAR_ROTATE:return rotation.reset(self.selected);- case LOCATION_POP_ACTION:+ case LOCATION_POP_ACTION: {const newState = util.fromQueryString(action.payload.search);const extent = lodashGet(action, 'payload.query.map.extent');const rotate =@@ -111,6 +112,7 @@ export function mapui(models, config, store, ui) {flyToNewExtent(extent, rotate);}return;+ }case layerConstants.REMOVE_LAYER:return removeLayer(action);case layerConstants.TOGGLE_LAYER_VISIBILITY:@@ -1011,7 +1013,7 @@ export function mapui(models, config, store, ui) {});var uniqueMeta = metaArray- .map(e => e['layer'])+ .map(e => e.layer).map((e, i, final) => final.indexOf(e) === i && i).filter(e => metaArray[e]).map(e => metaArray[e]);diff --git a/web/js/modules/compare/reducers.js b/web/js/modules/compare/reducers.jsindex df5f70d61..ff5318283 100644--- a/web/js/modules/compare/reducers.js+++ b/web/js/modules/compare/reducers.js@@ -15,12 +15,13 @@ export const initialCompareState = {};export function compareReducer(state = initialCompareState, action) {switch (action.type) {- case CHANGE_STATE:+ case CHANGE_STATE: {const newIsCompareA = !state.isCompareA;return lodashAssign({}, state, {isCompareA: newIsCompareA,activeString: newIsCompareA ? 'active' : 'activeB'});+ }case TOGGLE_ON_OFF:return lodashAssign({}, state, {active: !state.activediff --git a/web/js/modules/date/reducers.js b/web/js/modules/date/reducers.jsindex 8d6b413f5..111b04af5 100644--- a/web/js/modules/date/reducers.js+++ b/web/js/modules/date/reducers.js@@ -57,13 +57,14 @@ export function dateReducer(state = dateReducerState, action) {return lodashAssign({}, state, {[action.activeString]: action.value});- case TOGGLE_CUSTOM_MODAL:+ case TOGGLE_CUSTOM_MODAL: {const timelineToggle = action.toggleBy === customModalType.TIMELINE;const animationToggle = action.toggleBy === customModalType.ANIMATION;return lodashAssign({}, state, {timelineCustomModalOpen: animationToggle ? false : action.value,animationCustomModalOpen: timelineToggle ? false : action.value});+ }case UPDATE_APP_NOW:return lodashAssign({}, state, {appNow: action.valuediff --git a/web/js/modules/image-download/reducers.js b/web/js/modules/image-download/reducers.jsindex 2a1b86940..37474cb28 100644--- a/web/js/modules/image-download/reducers.js+++ b/web/js/modules/image-download/reducers.js@@ -32,13 +32,14 @@ export function imageDownloadReducer(state = defaultState, action) {return lodashAssign({}, state, {resolution: action.value});- case CHANGE_PROJECTION:+ case CHANGE_PROJECTION: {const fileType =action.selected !== 'geographic' &&!lodashFind(fileTypesPolar.values, { value: state.fileType })? 'image/jpeg': state.fileType;return lodashAssign({}, defaultState, { fileType });+ }default:return state;}diff --git a/web/js/modules/layers/actions.test.js b/web/js/modules/layers/actions.test.jsindex 96671a4d4..532c93a1d 100644--- a/web/js/modules/layers/actions.test.js+++ b/web/js/modules/layers/actions.test.js@@ -9,7 +9,7 @@ const config = fixtures.config();function getState(layers) {return {config,- proj: { id: 'geographic', selected: config.projections['geographic'] },+ proj: { id: 'geographic', selected: config.projections.geographic },layers: {active: layers},diff --git a/web/js/modules/layers/reducers.js b/web/js/modules/layers/reducers.jsindex 55becb994..7985d63fe 100644--- a/web/js/modules/layers/reducers.js+++ b/web/js/modules/layers/reducers.js@@ -67,8 +67,8 @@ export function layerReducer(state = initialState, action) {[action.index]: { visible: { $set: action.visible } }}});- case SET_THRESHOLD_RANGE_AND_SQUASH:- let layerIndex = lodashFindIndex(state[layerGroupStr], {+ case SET_THRESHOLD_RANGE_AND_SQUASH: {+ const layerIndex = lodashFindIndex(state[layerGroupStr], {id: action.layerId});return update(state, {@@ -78,8 +78,9 @@ export function layerReducer(state = initialState, action) {}}});- case CLEAR_CUSTOM_PALETTE:- layerIndex = lodashFindIndex(state[layerGroupStr], {+ }+ case CLEAR_CUSTOM_PALETTE: {+ const layerIndex = lodashFindIndex(state[layerGroupStr], {id: action.layerId});@@ -92,8 +93,9 @@ export function layerReducer(state = initialState, action) {}}});- case SET_CUSTOM_PALETTE:- layerIndex = lodashFindIndex(state[layerGroupStr], {+ }+ case SET_CUSTOM_PALETTE: {+ const layerIndex = lodashFindIndex(state[layerGroupStr], {id: action.layerId});return update(state, {@@ -105,8 +107,9 @@ export function layerReducer(state = initialState, action) {}}});- case SET_FILTER_RANGE:- layerIndex = lodashFindIndex(state[layerGroupStr], {+ }+ case SET_FILTER_RANGE: {+ const layerIndex = lodashFindIndex(state[layerGroupStr], {id: action.layerId});return update(state, {@@ -116,8 +119,9 @@ export function layerReducer(state = initialState, action) {}}});- case CLEAR_VECTORSTYLE:- layerIndex = lodashFindIndex(state[layerGroupStr], {+ }+ case CLEAR_VECTORSTYLE: {+ const layerIndex = lodashFindIndex(state[layerGroupStr], {id: action.layerId});@@ -130,8 +134,9 @@ export function layerReducer(state = initialState, action) {}}});- case SET_VECTORSTYLE:- layerIndex = lodashFindIndex(state[layerGroupStr], {+ }+ case SET_VECTORSTYLE: {+ const layerIndex = lodashFindIndex(state[layerGroupStr], {id: action.layerId});return update(state, {@@ -143,6 +148,7 @@ export function layerReducer(state = initialState, action) {}}});+ }case REMOVE_LAYER:return update(state, {[layerGroupStr]: { $splice: [[action.index, 1]] }diff --git a/web/js/modules/layers/selectors.test.js b/web/js/modules/layers/selectors.test.jsindex 8f3725147..e1f434b93 100644--- a/web/js/modules/layers/selectors.test.js+++ b/web/js/modules/layers/selectors.test.js@@ -13,7 +13,7 @@ const config = fixtures.config();function getState(layers) {return {config,- proj: { id: 'geographic', selected: config.projections['geographic'] },+ proj: { id: 'geographic', selected: config.projections.geographic },layers: {active: layers},diff --git a/web/js/modules/natural-events/reducers.js b/web/js/modules/natural-events/reducers.jsindex 94b69d474..cc1224ec2 100644--- a/web/js/modules/natural-events/reducers.js+++ b/web/js/modules/natural-events/reducers.js@@ -82,12 +82,13 @@ export function eventsReducer(state = eventsReducerState, action) {return lodashAssign({}, state, {showAll: false});- case CHANGE_SIDEBAR_TAB:+ case CHANGE_SIDEBAR_TAB: {const isActive = action.activeTab === 'events';if (isActive === state.active) return state;return lodashAssign({}, state, {active: isActive});+ }case FINISHED_ANIMATING_TO_EVENT:return lodashAssign({}, state, {isAnimatingToEvent: false@@ -116,7 +117,7 @@ export function eventsRequestReducer(actionName, state, action) {isLoading: true,response: null});- case SUCCESS:+ case SUCCESS: {const key =actionName === REQUEST_EVENTS? 'events'@@ -131,6 +132,7 @@ export function eventsRequestReducer(actionName, state, action) {actionName === REQUEST_EVENTS ? sortEvents(filtered) : filtered,isLoading: false});+ }case FAILURE:return eventRequestResponse({response: null,diff --git a/web/js/modules/palettes/reducers.js b/web/js/modules/palettes/reducers.jsindex 4d4ad3297..fdf77d424 100644--- a/web/js/modules/palettes/reducers.js+++ b/web/js/modules/palettes/reducers.js@@ -47,7 +47,7 @@ export function paletteReducer(state = defaultPaletteState, action) {return update(state, {rendered: { $merge: action.rendered || {} }});- case REQUEST_PALETTE_SUCCESS:+ case REQUEST_PALETTE_SUCCESS: {const isLoading = update(state.isLoading, { $unset: [action.id] });return lodashAssign({}, state, {rendered: lodashAssign({}, state.rendered, {@@ -55,6 +55,7 @@ export function paletteReducer(state = defaultPaletteState, action) {}),isLoading});+ }case INIT_SECOND_LAYER_GROUP:if (!isEmpty(state.activeB)) return state;return lodashAssign({}, state, {diff --git a/web/js/modules/palettes/reducers.test.js b/web/js/modules/palettes/reducers.test.jsindex 6970f5348..41b865aed 100644--- a/web/js/modules/palettes/reducers.test.js+++ b/web/js/modules/palettes/reducers.test.js@@ -58,8 +58,8 @@ test('INIT_SECOND_LAYER_GROUP action updates active palette Object', () => {groupName: 'active',palettes: { 'terra-aod': config.palettes.rendered['terra-aod'] }});- expect(previousState.activeB['test']).toBeUndefined();- expect(response.activeB['test']).toEqual('tests');+ expect(previousState.activeB.test).toBeUndefined();+ expect(response.activeB.test).toEqual('tests');});test('REQUEST_PALETTE_START action updates active palette Object', () => {const initialPaletteState = getInitialPaletteState(config);@@ -67,8 +67,8 @@ test('REQUEST_PALETTE_START action updates active palette Object', () => {type: REQUEST_PALETTE_START,id: 'test'});- expect(initialPaletteState.isLoading['test']).toBeUndefined();- expect(response.isLoading['test']).toBeTruthy();+ expect(initialPaletteState.isLoading.test).toBeUndefined();+ expect(response.isLoading.test).toBeTruthy();});test('REQUEST_PALETTE_SUCCESS action updates active palette Object', () => {const initialPaletteState = getInitialPaletteState(config);@@ -77,8 +77,8 @@ test('REQUEST_PALETTE_SUCCESS action updates active palette Object', () => {id: 'test',response: 'test-response'});- expect(initialPaletteState.rendered['test']).toBeUndefined();- expect(response.rendered['test']).toEqual('test-response');+ expect(initialPaletteState.rendered.test).toBeUndefined();+ expect(response.rendered.test).toEqual('test-response');});test('BULK_PALETTE_RENDERING_SUCCESS action merges rendered palettes with new palettes from action', () => {diff --git a/web/js/modules/vector-styles/selectors.js b/web/js/modules/vector-styles/selectors.jsindex 59817cb2b..dd09aaaa8 100644--- a/web/js/modules/vector-styles/selectors.js+++ b/web/js/modules/vector-styles/selectors.js@@ -162,7 +162,7 @@ export function getKey(layerId, groupStr, state) {}export function isActive(layerId, group, state) {group = group || state.compare.activeString;- if (state.vectorStyles['custom'][layerId]) {+ if (state.vectorStyles.custom[layerId]) {return state.vectorStyles[group][layerId];}}