Skip to content

Commit c0c5d07

Browse files
committed
some linting
1 parent aabc3ad commit c0c5d07

File tree

2 files changed

+50
-50
lines changed

2 files changed

+50
-50
lines changed

site/assets/js/details.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable no-undef */
1+
22
const openDetailsOnLoad = function openDetailsOnLoad() {
33
const target = window.location.hash;
44
let qTarget = null;

site/assets/js/map.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ const CONST_LODES_JOB_SEGMENTS_LABELS = {
5656
};
5757

5858
const
59-
URL_TILES = `https://data.lodesmap.com/tiles`,
60-
URL_LODES = `https://data.lodesmap.com/lodes`;
59+
URL_TILES = "https://data.lodesmap.com/tiles",
60+
URL_LODES = "https://data.lodesmap.com/lodes";
6161

6262
const FIPS_TO_TIGER_GEO_STATE_ABBR = {
6363
"02": "ak",
@@ -111,7 +111,7 @@ const FIPS_TO_TIGER_GEO_STATE_ABBR = {
111111
"55": "wi",
112112
"54": "wv",
113113
"56": "wy"
114-
}
114+
};
115115

116116
const
117117
MAP_CENTER = [-87.967, 43.064],
@@ -134,7 +134,6 @@ let validOrigin = true,
134134
validCountySubdivisionId= true;
135135

136136
const getTilesUrl = function getTilesUrl({
137-
year = LODES_YEAR,
138137
geography = LODES_GEOGRAPHY
139138
} = {}) {
140139
// We always use 2020 tiles as all years of LODES data for Version 8
@@ -151,7 +150,7 @@ const getLodesUrl = function getLodesUrl({
151150
} = {}) {
152151

153152
if(state !== null) {
154-
state = FIPS_TO_TIGER_GEO_STATE_ABBR[state]
153+
state = FIPS_TO_TIGER_GEO_STATE_ABBR[state];
155154
}
156155

157156
return `${URL_LODES}/year=${year}/geography=${geography}/origin=${origin}/` +
@@ -231,7 +230,7 @@ class ColorScale {
231230
option.value = opt;
232231

233232
if(paramLabels[opt]) {
234-
option.textContent = paramLabels[opt]
233+
option.textContent = paramLabels[opt];
235234
} else {
236235
option.textContent = opt.split("_").
237236
map(word => word.charAt(0).toUpperCase() +
@@ -318,23 +317,23 @@ class ColorScale {
318317

319318
getLabelsForGeography(geography) {
320319
switch (geography) {
321-
case "county":
322-
return ["1", "2-100", "101-1,000", "1,001-9,999", "10,000+"];
323-
case "county_subdivision":
324-
return ["1", "2-50", "51-150", "150-499", "500+"];
325-
default:
326-
return ["1", "2-10", "11-20", "21-29", "30+"];
320+
case "county":
321+
return ["1", "2-100", "101-1,000", "1,001-9,999", "10,000+"];
322+
case "county_subdivision":
323+
return ["1", "2-50", "51-150", "150-499", "500+"];
324+
default:
325+
return ["1", "2-10", "11-20", "21-29", "30+"];
327326
}
328327
}
329328

330329
getThresholdsForGeography(geography) {
331330
switch (geography) {
332-
case "county":
333-
return [1, 2, 101, 1001, 10000];
334-
case "county_subdivision":
335-
return [1, 2, 51, 151, 500];
336-
default:
337-
return [1, 2, 11, 21, 30];
331+
case "county":
332+
return [1, 2, 101, 1001, 10000];
333+
case "county_subdivision":
334+
return [1, 2, 51, 151, 500];
335+
default:
336+
return [1, 2, 11, 21, 30];
338337
}
339338
}
340339

@@ -506,8 +505,8 @@ class Map {
506505
},
507506
{ hover: true }
508507
);
509-
const displayId = feature.properties.name ? feature.properties.name : feature.properties.id
510-
this.updateGeoIdDisplay(displayId, this.processor.previousResults[geographyParam][feature.properties.id]?.count)
508+
const displayId = feature.properties.name ? feature.properties.name : feature.properties.id;
509+
this.updateGeoIdDisplay(displayId, this.processor.previousResults[geographyParam][feature.properties.id]?.count);
511510
} else {
512511
this.map.getCanvas().style.cursor = "";
513512
this.geoIdDisplay.style.display = "none";
@@ -549,17 +548,18 @@ class Map {
549548

550549
const [couSubFeature] = this.map.queryRenderedFeatures(
551550
feat.point,
552-
{ layers: [`geo_fill_county_subdivision`] }
551+
{ layers: ["geo_fill_county_subdivision"] }
553552
);
554553

554+
555555
if(couSubFeature) {
556-
countySubdivisionIdParam = couSubFeature?.properties.id
556+
countySubdivisionIdParam = couSubFeature?.properties.id;
557557
validCountySubdivisionId = validIdInput(countySubdivisionIdParam);
558558
setUrlParam("countySubdivisionId", countySubdivisionIdParam);
559559
}
560560

561561
if(geometryFeature) {
562-
this.updateSelectedFeature(geometryFeature.properties.id)
562+
this.updateSelectedFeature(geometryFeature.properties.id);
563563
}
564564

565565
if (geometryFeature && feature) {
@@ -573,8 +573,8 @@ class Map {
573573
idParam.substring(0, 2), geometryFeature.properties.id
574574
);
575575

576-
const displayId = geometryFeature.properties.name ? geometryFeature.properties.name : geometryFeature.properties.id
577-
this.updateGeoIdDisplay(displayId, this.processor.previousResults[geographyParam][geometryFeature.properties.id]?.count)
576+
const displayId = geometryFeature.properties.name ? geometryFeature.properties.name : geometryFeature.properties.id;
577+
this.updateGeoIdDisplay(displayId, this.processor.previousResults[geographyParam][geometryFeature.properties.id]?.count);
578578
}
579579
}
580580
});
@@ -653,14 +653,14 @@ class Map {
653653
}
654654
// getThresholdsForGeography(geography)
655655
for (const geography of LODES_GEOGRAPHIES) {
656-
const thresholds = this.colorScale.getThresholdsForGeography(geography)
656+
const thresholds = this.colorScale.getThresholdsForGeography(geography);
657657
const colors = [
658658
"rgb(253, 231, 37)",
659659
"rgb(122, 209, 81)",
660660
"rgb(34, 168, 132)",
661661
"rgb(42, 120, 142)",
662662
"rgb(65, 68, 135)"
663-
]
663+
];
664664

665665
const thresholds_colors = thresholds.map((k, i) => [k, colors[i]]).flat();
666666

@@ -670,13 +670,13 @@ class Map {
670670
layout: { visibility: "none" },
671671
paint: {
672672
"fill-color": [
673-
'interpolate',
674-
['linear'],
675-
['feature-state', 'geoValue'],
673+
"interpolate",
674+
["linear"],
675+
["feature-state", "geoValue"],
676676
...thresholds_colors
677677
],
678678
"fill-opacity": [
679-
'case',
679+
"case",
680680
["==", ["feature-state", "geoValue"], null], 0.0,
681681
0.4,
682682
],
@@ -831,8 +831,8 @@ class ParquetProcessor {
831831
processParquetRowGroup(map, id, geography, data, results, origin) {
832832
data.forEach(row => {
833833
// w_tract, h_tract
834-
const source = origin == "w_geo" ? 0 : 1
835-
const destination = origin == "w_geo" ? 1 : 0
834+
const source = origin == "w_geo" ? 0 : 1;
835+
const destination = origin == "w_geo" ? 1 : 0;
836836

837837
if (row[source] === id) {
838838
map.map.setFeatureState(
@@ -849,7 +849,7 @@ class ParquetProcessor {
849849
}
850850

851851
saveResultState(map, results, geography) {
852-
const filteredPreviousResults = this.previousResults[geography]
852+
const filteredPreviousResults = this.previousResults[geography];
853853
Object.keys(results).forEach(key => delete(filteredPreviousResults[key]));
854854
map.wipeMapPreviousState(Object.keys(filteredPreviousResults), geography);
855855
this.previousResults[geography] = results;
@@ -864,7 +864,7 @@ class ParquetProcessor {
864864
// Get the count of files given the geography, origin, and state
865865
const results = await this.updateMapOnQuery(map, queryUrl, truncId, geography, job_segment, origin);
866866
this.saveResultState(map, results, geography);
867-
map.updateSelectedFeature(truncId)
867+
map.updateSelectedFeature(truncId);
868868
map.isProcessing = false;
869869
map.spinner.hide();
870870
}
@@ -884,7 +884,7 @@ class ParquetProcessor {
884884
}
885885

886886
async updateMapOnQuery(map, url, id, geography, job_segment, origin) {
887-
const urls = [url]
887+
const urls = [url];
888888
const results = {};
889889
let totalGroups = 0;
890890

@@ -969,17 +969,17 @@ class ParquetProcessor {
969969
validId = validIdInput(idParam);
970970
validCountySubdivisionId = validIdInput(countySubdivisionIdParam);
971971

972-
const valid = geographyParam == "county_subdivision" ? countySubdivisionIdParam && validCountySubdivisionId : idParam && validId
972+
const valid = geographyParam == "county_subdivision" ? countySubdivisionIdParam && validCountySubdivisionId : idParam && validId;
973973

974974
if (valid) {
975-
const id = geographyParam == "county_subdivision" ? countySubdivisionIdParam : idParam
975+
const id = geographyParam == "county_subdivision" ? countySubdivisionIdParam : idParam;
976976
await processor.runQuery(
977977
map, originParam, jobSegmentParam, yearParam, geographyParam,
978978
idParam.substring(0, 2), id
979979
);
980980

981981
if(map.hoveredPolygonId[geographyParam]) {
982-
map.updateGeoIdDisplay(map.hoveredPolygonId[geographyParam], map.processor.previousResults[geographyParam][map.hoveredPolygonId[geographyParam]]?.count)
982+
map.updateGeoIdDisplay(map.hoveredPolygonId[geographyParam], map.processor.previousResults[geographyParam][map.hoveredPolygonId[geographyParam]]?.count);
983983
}
984984
}
985985
}
@@ -999,7 +999,7 @@ class ParquetProcessor {
999999
validId = validIdInput(idParam);
10001000
validCountySubdivisionId = validIdInput(countySubdivisionIdParam);
10011001

1002-
const valid = geographyParam == "county_subdivision" ? countySubdivisionIdParam && validCountySubdivisionId : idParam && validId
1002+
const valid = geographyParam == "county_subdivision" ? countySubdivisionIdParam && validCountySubdivisionId : idParam && validId;
10031003

10041004
if (valid) {
10051005
const id = geographyParam == "county_subdivision" ? countySubdivisionIdParam : idParam;
@@ -1009,7 +1009,7 @@ class ParquetProcessor {
10091009
);
10101010

10111011
if(map.hoveredPolygonId[geographyParam]) {
1012-
map.updateGeoIdDisplay(map.hoveredPolygonId[geographyParam], map.processor.previousResults[geographyParam][map.hoveredPolygonId[geographyParam]]?.count)
1012+
map.updateGeoIdDisplay(map.hoveredPolygonId[geographyParam], map.processor.previousResults[geographyParam][map.hoveredPolygonId[geographyParam]]?.count);
10131013
}
10141014
}
10151015
}
@@ -1031,7 +1031,7 @@ class ParquetProcessor {
10311031
validId = validIdInput(idParam);
10321032
validCountySubdivisionId = validIdInput(countySubdivisionIdParam);
10331033

1034-
const valid = geographyParam == "county_subdivision" ? countySubdivisionIdParam && validCountySubdivisionId : idParam && validId
1034+
const valid = geographyParam == "county_subdivision" ? countySubdivisionIdParam && validCountySubdivisionId : idParam && validId;
10351035

10361036
if (valid) {
10371037
const id = geographyParam == "county_subdivision" ? countySubdivisionIdParam : idParam;
@@ -1041,7 +1041,7 @@ class ParquetProcessor {
10411041
);
10421042

10431043
if(map.hoveredPolygonId[geographyParam]) {
1044-
map.updateGeoIdDisplay(map.hoveredPolygonId[geographyParam], map.processor.previousResults[geographyParam][map.hoveredPolygonId[geographyParam]]?.count)
1044+
map.updateGeoIdDisplay(map.hoveredPolygonId[geographyParam], map.processor.previousResults[geographyParam][map.hoveredPolygonId[geographyParam]]?.count);
10451045
}
10461046
}
10471047
}
@@ -1061,7 +1061,7 @@ class ParquetProcessor {
10611061
validId = validIdInput(idParam);
10621062
validCountySubdivisionId = validIdInput(countySubdivisionIdParam);
10631063

1064-
const valid = geographyParam == "county_subdivision" ? countySubdivisionIdParam && validCountySubdivisionId : idParam && validId
1064+
const valid = geographyParam == "county_subdivision" ? countySubdivisionIdParam && validCountySubdivisionId : idParam && validId;
10651065

10661066
if (valid) {
10671067
const id = geographyParam == "county_subdivision" ? countySubdivisionIdParam : idParam;
@@ -1071,7 +1071,7 @@ class ParquetProcessor {
10711071
);
10721072

10731073
if(map.hoveredPolygonId[geographyParam]) {
1074-
map.updateGeoIdDisplay(map.hoveredPolygonId[geographyParam], map.processor.previousResults[geographyParam][map.hoveredPolygonId[geographyParam]]?.count)
1074+
map.updateGeoIdDisplay(map.hoveredPolygonId[geographyParam], map.processor.previousResults[geographyParam][map.hoveredPolygonId[geographyParam]]?.count);
10751075
}
10761076
}
10771077
}
@@ -1108,17 +1108,17 @@ class ParquetProcessor {
11081108

11091109
document.getElementById("year").value = yearParam;
11101110

1111-
const valid = geographyParam == "county_subdivision" ? countySubdivisionIdParam && validCountySubdivisionId : idParam && validId
1111+
const valid = geographyParam == "county_subdivision" ? countySubdivisionIdParam && validCountySubdivisionId : idParam && validId;
11121112

11131113
if (valid) {
1114-
const id = geographyParam == "county_subdivision" ? countySubdivisionIdParam : idParam
1114+
const id = geographyParam == "county_subdivision" ? countySubdivisionIdParam : idParam;
11151115
await processor.runQuery(
11161116
map, originParam, jobSegmentParam, yearParam, geographyParam,
11171117
idParam.substring(0, 2), id
11181118
);
11191119

1120-
const truncId = map.truncateId(geographyParam, id)
1121-
map.updateGeoIdDisplay(idParam, map.processor.previousResults[geographyParam][truncId]?.count)
1120+
const truncId = map.truncateId(geographyParam, id);
1121+
map.updateGeoIdDisplay(idParam, map.processor.previousResults[geographyParam][truncId]?.count);
11221122
}
11231123
}
11241124
});

0 commit comments

Comments
 (0)