From 5c284884d3055f96d50c2d93e174f53f59ead738 Mon Sep 17 00:00:00 2001
From: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date: Sat, 27 Jul 2024 11:25:40 -0400
Subject: [PATCH] Upgrade to Prettier 3.3 (#260)
---
index.html | 2 +-
package-lock.json | 13 +++++------
package.json | 2 +-
scripts/add-city.ts | 10 ++++-----
scripts/base.ts | 24 ++++++++++-----------
scripts/update-city-boundaries.ts | 6 +++---
scripts/update-lots.ts | 4 ++--
src/js/CitySelectionState.ts | 2 +-
src/js/about.ts | 2 +-
src/js/dropdown.ts | 2 +-
src/js/fontAwesome.ts | 2 +-
src/js/iframe.ts | 2 +-
src/js/map.ts | 6 +++---
src/js/scorecard.ts | 10 ++++-----
src/js/setUpSite.ts | 8 +++----
src/js/share.ts | 6 +++---
tests/app/cityId.test.ts | 26 +++++++++++-----------
tests/app/communityMaps.test.ts | 4 ++--
tests/app/setUpSite.test.ts | 14 ++++++------
tests/scripts/base.test.ts | 36 +++++++++++++++----------------
tests/scripts/dataFolder.test.ts | 2 +-
21 files changed, 92 insertions(+), 91 deletions(-)
diff --git a/index.html b/index.html
index ce55d91..6000347 100644
--- a/index.html
+++ b/index.html
@@ -1,4 +1,4 @@
-
+
Parking Lot Map - Parking Reform Network
diff --git a/package-lock.json b/package-lock.json
index 6cda5f9..e2723bb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -31,7 +31,7 @@
"http-server": "^14.1.1",
"parcel": "^2.10.3",
"playwright": "^1.34.3",
- "prettier": "^2.8.7",
+ "prettier": "^3.3.3",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
}
@@ -5950,15 +5950,16 @@
}
},
"node_modules/prettier": {
- "version": "2.8.8",
- "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
- "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
+ "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
"dev": true,
+ "license": "MIT",
"bin": {
- "prettier": "bin-prettier.js"
+ "prettier": "bin/prettier.cjs"
},
"engines": {
- "node": ">=10.13.0"
+ "node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
diff --git a/package.json b/package.json
index b26b201..efe7c38 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,7 @@
"http-server": "^14.1.1",
"parcel": "^2.10.3",
"playwright": "^1.34.3",
- "prettier": "^2.8.7",
+ "prettier": "^3.3.3",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
},
diff --git a/scripts/add-city.ts b/scripts/add-city.ts
index 29ee32d..3e67454 100644
--- a/scripts/add-city.ts
+++ b/scripts/add-city.ts
@@ -5,7 +5,7 @@ import { CityId } from "../src/js/types.ts";
const addScoreCard = async (
cityId: CityId,
- cityName: string
+ cityName: string,
): Promise> => {
const newEntry = {
name: cityName,
@@ -27,7 +27,7 @@ const addScoreCard = async (
} catch (err: unknown) {
const { message } = err as Error;
return results.Err(
- `Issue reading the score card file path ${originalFilePath}: ${message}`
+ `Issue reading the score card file path ${originalFilePath}: ${message}`,
);
}
@@ -54,7 +54,7 @@ const main = async () => {
cityId,
true,
"data/city-boundaries.geojson",
- "city-update.geojson"
+ "city-update.geojson",
)
).unwrap();
@@ -63,7 +63,7 @@ const main = async () => {
cityId,
true,
"parking-lots-update.geojson",
- `data/parking-lots/${cityId}.geojson`
+ `data/parking-lots/${cityId}.geojson`,
)
).unwrap();
@@ -73,7 +73,7 @@ const main = async () => {
console.log(
`Almost done! Now, fill in the score card values in data/score-cards.json. Then,
run 'npm run fmt'. Then, 'npm start' and see if the site is what you expect.
- `
+ `,
);
};
diff --git a/scripts/base.ts b/scripts/base.ts
index d7c17af..3b1fbc2 100644
--- a/scripts/base.ts
+++ b/scripts/base.ts
@@ -11,13 +11,13 @@ import { CityId } from "../src/js/types";
const determineArgs = (
scriptCommand: string,
- processArgv: string[]
+ processArgv: string[],
): results.Result<{ cityName: string; cityId: CityId }, string> => {
if (processArgv.length !== 1) {
return new results.Err(
`Must provide exactly one argument (the city/state name). For example,
npm run ${scriptCommand} -- 'Columbus, OH'
- `
+ `,
);
}
const cityName = processArgv[0];
@@ -30,7 +30,7 @@ const updateCoordinates = async (
cityId: CityId,
addCity: boolean,
originalFilePath: string,
- updateFilePath: string
+ updateFilePath: string,
): Promise> => {
let newData: FeatureCollection;
try {
@@ -39,13 +39,13 @@ const updateCoordinates = async (
} catch (err: unknown) {
const { message } = err as Error;
return results.Err(
- `Issue reading the update file path ${updateFilePath}: ${message}`
+ `Issue reading the update file path ${updateFilePath}: ${message}`,
);
}
if (!Array.isArray(newData.features) || newData.features.length !== 1) {
return results.Err(
- "The script expects exactly one entry in `features` because you can only update one city at a time."
+ "The script expects exactly one entry in `features` because you can only update one city at a time.",
);
}
@@ -60,7 +60,7 @@ const updateCoordinates = async (
} catch (err: unknown) {
const { message } = err as Error;
return results.Err(
- `Issue reading the original data file path ${originalFilePath}: ${message}`
+ `Issue reading the original data file path ${originalFilePath}: ${message}`,
);
}
@@ -73,11 +73,11 @@ const updateCoordinates = async (
originalData.features.push(newEntry);
} else {
const cityOriginalData = originalData.features.find(
- (feature) => feature?.properties?.id === cityId
+ (feature) => feature?.properties?.id === cityId,
);
if (!cityOriginalData) {
return results.Err(
- `City not found in ${originalFilePath}. To add a new city, run again with the '--add' flag, e.g. npm run ${scriptCommand} -- 'My City, AZ' --add`
+ `City not found in ${originalFilePath}. To add a new city, run again with the '--add' flag, e.g. npm run ${scriptCommand} -- 'My City, AZ' --add`,
);
}
cityOriginalData.geometry.coordinates = newCoordinates;
@@ -102,7 +102,7 @@ const updateParkingLots = async (
cityId: CityId,
addCity: boolean,
originalFilePath: string,
- updateFilePath: string
+ updateFilePath: string,
): Promise> => {
let newData;
try {
@@ -111,13 +111,13 @@ const updateParkingLots = async (
} catch (err: unknown) {
const { message } = err as Error;
return results.Err(
- `Issue reading the update file path parking-lots-update.geojson: ${message}`
+ `Issue reading the update file path parking-lots-update.geojson: ${message}`,
);
}
if (!Array.isArray(newData.features) || newData.features.length !== 1) {
return results.Err(
- "The script expects exactly one entry in `features` because you can only update one city at a time."
+ "The script expects exactly one entry in `features` because you can only update one city at a time.",
);
}
@@ -132,7 +132,7 @@ const updateParkingLots = async (
} catch (err: unknown) {
const { message } = err as Error;
return results.Err(
- `Issue reading the original data file path ${updateFilePath}: ${message}`
+ `Issue reading the original data file path ${updateFilePath}: ${message}`,
);
}
originalData.geometry.coordinates = newCoordinates;
diff --git a/scripts/update-city-boundaries.ts b/scripts/update-city-boundaries.ts
index 633021a..26479dd 100644
--- a/scripts/update-city-boundaries.ts
+++ b/scripts/update-city-boundaries.ts
@@ -3,7 +3,7 @@ import { determineArgs, updateCoordinates } from "./base.js";
const main = async (): Promise => {
const { cityId } = determineArgs(
"update-city-boundaries",
- process.argv.slice(2)
+ process.argv.slice(2),
)
.mapErr((err) => new Error(`Argument error: ${err}`))
.unwrap();
@@ -13,7 +13,7 @@ const main = async (): Promise => {
cityId,
false,
"data/city-boundaries.geojson",
- "city-update.geojson"
+ "city-update.geojson",
)
).unwrap();
@@ -21,7 +21,7 @@ const main = async (): Promise => {
console.log(
`${value} Now, run 'npm run fmt'. Then, 'npm start' and
see if the site is what you expect.
- `
+ `,
);
};
diff --git a/scripts/update-lots.ts b/scripts/update-lots.ts
index 48b7ba1..200af79 100644
--- a/scripts/update-lots.ts
+++ b/scripts/update-lots.ts
@@ -9,7 +9,7 @@ const main = async (): Promise => {
cityId,
false,
"parking-lots-update.geojson",
- `data/parking-lots/${cityId}.geojson`
+ `data/parking-lots/${cityId}.geojson`,
)
).unwrap();
@@ -17,7 +17,7 @@ const main = async (): Promise => {
console.log(
`${value} Now, run 'npm run fmt'. Then, 'npm start' and
see if the site is what you expect.
- `
+ `,
);
};
diff --git a/src/js/CitySelectionState.ts b/src/js/CitySelectionState.ts
index c15aede..4ac1958 100644
--- a/src/js/CitySelectionState.ts
+++ b/src/js/CitySelectionState.ts
@@ -12,7 +12,7 @@ type CitySelectionObservable = Observable;
function initCitySelectionState(
initialCityId: CityId | null,
- fallBackCityId: CityId
+ fallBackCityId: CityId,
): CitySelectionObservable {
const startingCity =
initialCityId && Object.keys(scoreCardsData).includes(initialCityId)
diff --git a/src/js/about.ts b/src/js/about.ts
index b016f6c..7d6d490 100644
--- a/src/js/about.ts
+++ b/src/js/about.ts
@@ -17,7 +17,7 @@ function setUpAbout(): void {
const closeIcon = document.querySelector(".about-popup-close-icon-container");
headerIcon?.addEventListener("click", () =>
- isVisible.setValue(!isVisible.getValue())
+ isVisible.setValue(!isVisible.getValue()),
);
closeIcon?.addEventListener("click", () => isVisible.setValue(false));
diff --git a/src/js/dropdown.ts b/src/js/dropdown.ts
index 10a1be3..b59c67d 100644
--- a/src/js/dropdown.ts
+++ b/src/js/dropdown.ts
@@ -35,7 +35,7 @@ function createDropdown(): Choices {
} else {
officialCities.push(entry);
}
- }
+ },
);
dropdown.setChoices([
diff --git a/src/js/fontAwesome.ts b/src/js/fontAwesome.ts
index a428aab..9739569 100644
--- a/src/js/fontAwesome.ts
+++ b/src/js/fontAwesome.ts
@@ -24,7 +24,7 @@ function setUpIcons(): void {
faLink,
faUpRightFromSquare,
faCheck,
- faTriangleExclamation
+ faTriangleExclamation,
);
dom.watch();
}
diff --git a/src/js/iframe.ts b/src/js/iframe.ts
index 6c03813..2968ede 100644
--- a/src/js/iframe.ts
+++ b/src/js/iframe.ts
@@ -16,7 +16,7 @@ function isIFrame(): boolean {
function maybeDisableFullScreenIcon(): void {
if (isIFrame()) return;
const iconContainer = document.querySelector(
- ".header-full-screen-icon-container"
+ ".header-full-screen-icon-container",
);
if (!iconContainer) return;
iconContainer.style.display = "none";
diff --git a/src/js/map.ts b/src/js/map.ts
index edbd5b4..469ab31 100644
--- a/src/js/map.ts
+++ b/src/js/map.ts
@@ -13,14 +13,14 @@ const BASE_LAYERS = {
subdomains: "abcd",
minZoom: 0,
maxZoom: MAX_ZOOM,
- }
+ },
),
"Google Maps": new TileLayer(
"https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}",
{
attribution: `© OpenStreetMap © Google Maps`,
maxZoom: MAX_ZOOM,
- }
+ },
),
};
@@ -49,7 +49,7 @@ export function createMap(): Map {
layers: [BASE_LAYERS["High contrast"]],
});
map.attributionControl.setPrefix(
- 'Parking Reform Network'
+ 'Parking Reform Network',
);
new Control.Layers(BASE_LAYERS).addTo(map);
diff --git a/src/js/scorecard.ts b/src/js/scorecard.ts
index 6e8b3f2..4694754 100644
--- a/src/js/scorecard.ts
+++ b/src/js/scorecard.ts
@@ -18,13 +18,13 @@ function generateScorecard(entry: ScoreCardDetails): string {
const listEntries = [];
if (entry.parkingScore) {
listEntries.push(
- `${entry.parkingScore}/100 parking score (lower is better)`
+ `${entry.parkingScore}/100 parking score (lower is better)`,
);
}
listEntries.push(`City type: ${entry.cityType}`);
listEntries.push(`${entry.population} residents - city proper`);
listEntries.push(
- `${entry.urbanizedAreaPopulation} residents - urbanized area`
+ `${entry.urbanizedAreaPopulation} residents - urbanized area`,
);
let reformsLine = `Parking reforms ${entry.reforms}`;
@@ -35,7 +35,7 @@ function generateScorecard(entry: ScoreCardDetails): string {
if ("contribution" in entry) {
listEntries.push(
- `Email data maintainer`
+ `Email data maintainer`,
);
}
@@ -70,7 +70,7 @@ function generateScorecard(entry: ScoreCardDetails): string {
function updateScorecardAccordionUI(expanded: boolean): void {
const toggle = document.querySelector(".scorecard-accordion-toggle");
const content = document.querySelector(
- "#scorecard-accordion-content"
+ "#scorecard-accordion-content",
);
const upIcon = toggle?.querySelector(".fa-chevron-up");
const downIcon = toggle?.querySelector(".fa-chevron-down");
@@ -104,7 +104,7 @@ function setUpScorecardAccordion(): void {
export default function addScorecardSubscriber(
observable: CitySelectionObservable,
- cities: ScoreCards
+ cities: ScoreCards,
): void {
observable.subscribe(({ cityId }) => {
const scorecardContainer = document.querySelector(".scorecard-container");
diff --git a/src/js/setUpSite.ts b/src/js/setUpSite.ts
index 517f23e..d614580 100644
--- a/src/js/setUpSite.ts
+++ b/src/js/setUpSite.ts
@@ -36,7 +36,7 @@ function snapToCity(map: Map, layer: ImageOverlay): void {
function addSnapToCitySubscriber(
observable: CitySelectionObservable,
map: Map,
- cities: ScoreCards
+ cities: ScoreCards,
): void {
observable.subscribe((state) => {
if (!state.shouldSnapMap) return;
@@ -53,7 +53,7 @@ function setCityByMapPosition(
observable: CitySelectionObservable,
map: Map,
cities: ScoreCards,
- parkingLotLoader: ParkingLotLoader
+ parkingLotLoader: ParkingLotLoader,
): void {
map.on("moveend", () => {
let centralCityDistance: number | null = null;
@@ -106,7 +106,7 @@ function createCitiesLayer(map: Map): [GeoJSON, ScoreCards] {
function setCityOnBoundaryClick(
observable: CitySelectionObservable,
map: Map,
- cityBoundaries: GeoJSON
+ cityBoundaries: GeoJSON,
): void {
cityBoundaries.addEventListener("click", (e) => {
const currentZoom = map.getZoom();
@@ -130,7 +130,7 @@ async function setUpSite(): Promise {
const initialCityId = extractCityIdFromUrl(window.location.href);
const citySelectionObservable = initCitySelectionState(
initialCityId,
- "atlanta-ga"
+ "atlanta-ga",
);
setUpDropdown(citySelectionObservable);
diff --git a/src/js/share.ts b/src/js/share.ts
index 9e03a42..6a29b7a 100644
--- a/src/js/share.ts
+++ b/src/js/share.ts
@@ -25,14 +25,14 @@ function switchShareIcons(shareIcon: HTMLAnchorElement): void {
}
export default function addShareLinkSubscriber(
- observable: CitySelectionObservable
+ observable: CitySelectionObservable,
): void {
observable.subscribe(({ cityId }) => {
const shareIcon = document.querySelector(
- ".header-share-icon-container"
+ ".header-share-icon-container",
);
const fullScreenIcon = document.querySelector(
- ".header-full-screen-icon-container"
+ ".header-full-screen-icon-container",
);
if (!shareIcon || !fullScreenIcon) return;
diff --git a/tests/app/cityId.test.ts b/tests/app/cityId.test.ts
index 7582c20..f5a3cda 100644
--- a/tests/app/cityId.test.ts
+++ b/tests/app/cityId.test.ts
@@ -11,26 +11,26 @@ test.describe("extractCityIdFromUrl()", () => {
expect(extractCityIdFromUrl("https://parking.org")).toBeNull();
expect(extractCityIdFromUrl("https://parking.org#shoup")).toBeNull();
expect(
- extractCityIdFromUrl("https://parking.org#parking-reform-map")
+ extractCityIdFromUrl("https://parking.org#parking-reform-map"),
).toBeNull();
});
test("extracts the city id", () => {
expect(
- extractCityIdFromUrl("https://parking.org#parking-reform-map=city")
+ extractCityIdFromUrl("https://parking.org#parking-reform-map=city"),
).toEqual("city");
expect(
- extractCityIdFromUrl("https://parking.org#parking-reform-map=CITY")
+ extractCityIdFromUrl("https://parking.org#parking-reform-map=CITY"),
).toEqual("city");
expect(
extractCityIdFromUrl(
- "https://parking.org#parking-reform-map=city-of-shoup"
- )
+ "https://parking.org#parking-reform-map=city-of-shoup",
+ ),
).toEqual("city-of-shoup");
expect(
extractCityIdFromUrl(
- "https://parking.org#parking-reform-map=CITY-OF-SHOUP"
- )
+ "https://parking.org#parking-reform-map=CITY-OF-SHOUP",
+ ),
).toEqual("city-of-shoup");
});
});
@@ -39,7 +39,7 @@ test("parseCityIdFromJson() extracts the city", () => {
expect(parseCityIdFromJson("City, AZ")).toEqual("city-az");
expect(parseCityIdFromJson("CITY, AZ")).toEqual("city-az");
expect(parseCityIdFromJson("Saint Shoup Village, AZ")).toEqual(
- "saint-shoup-village-az"
+ "saint-shoup-village-az",
);
expect(parseCityIdFromJson("No state")).toEqual("no-state");
});
@@ -47,10 +47,10 @@ test("parseCityIdFromJson() extracts the city", () => {
test.describe("determineShareUrl()", () => {
test("adds #parking-reform-map= if not yet present", () => {
expect(determineShareUrl("https://parking.org", "city-az")).toEqual(
- "https://parking.org#parking-reform-map=city-az"
+ "https://parking.org#parking-reform-map=city-az",
);
expect(
- determineShareUrl("https://parking.org", "saint-shoup-village-az")
+ determineShareUrl("https://parking.org", "saint-shoup-village-az"),
).toEqual("https://parking.org#parking-reform-map=saint-shoup-village-az");
});
@@ -58,13 +58,13 @@ test.describe("determineShareUrl()", () => {
// We may want to make this more intelligent to preserve existing hashes. But we currently
// don't have any use for hashes other than pre-defining the city. So this is simpler.
expect(
- determineShareUrl("https://parking.org#already-hash", "city-az")
+ determineShareUrl("https://parking.org#already-hash", "city-az"),
).toEqual("https://parking.org#parking-reform-map=city-az");
expect(
determineShareUrl(
"https://parking.org#parking-reform-map=another-city-ny",
- "city-az"
- )
+ "city-az",
+ ),
).toEqual("https://parking.org#parking-reform-map=city-az");
});
});
diff --git a/tests/app/communityMaps.test.ts b/tests/app/communityMaps.test.ts
index fd01b63..6fce4e2 100644
--- a/tests/app/communityMaps.test.ts
+++ b/tests/app/communityMaps.test.ts
@@ -10,8 +10,8 @@ test("there are exactly 103 official city maps", async ({ page }) => {
".choices__list [role='listbox']",
(element: HTMLElement) =>
Array.from(element.children).map(
- (child: Element) => (child as HTMLElement).innerText
- )
+ (child: Element) => (child as HTMLElement).innerText,
+ ),
);
const communityMapIndex = toggleValues.indexOf("Community Maps");
diff --git a/tests/app/setUpSite.test.ts b/tests/app/setUpSite.test.ts
index b4e952c..3c6582e 100644
--- a/tests/app/setUpSite.test.ts
+++ b/tests/app/setUpSite.test.ts
@@ -23,7 +23,7 @@ test("every city is in the toggle", async ({ page }) => {
await page.waitForSelector(".choices");
const toggleValues = await page.$$eval(".choices__item--choice", (elements) =>
- Array.from(elements.map((opt) => opt.textContent?.trim()))
+ Array.from(elements.map((opt) => opt.textContent?.trim())),
);
toggleValues.sort();
@@ -66,12 +66,12 @@ test("correctly load the city score card", async ({ page }) => {
const lines = Array.from(
document.querySelectorAll(
- ".scorecard-container p, .scorecard-container li"
- )
+ ".scorecard-container p, .scorecard-container li",
+ ),
)
.filter(
(el) =>
- el instanceof HTMLParagraphElement || el instanceof HTMLLIElement
+ el instanceof HTMLParagraphElement || el instanceof HTMLLIElement,
)
.map((p) => p.textContent?.trim() || "");
return [lines, cityToggleValue2];
@@ -101,7 +101,7 @@ test.describe("the share feature", () => {
await page.click(".header-share-icon-container");
const firstCityClipboardText = await page.evaluate(() =>
- navigator.clipboard.readText()
+ navigator.clipboard.readText(),
);
expect(firstCityClipboardText).toContain("/#parking-reform-map=atlanta-ga");
@@ -120,10 +120,10 @@ test.describe("the share feature", () => {
await page.click(".header-share-icon-container");
const secondCityClipboardText = await page.evaluate(() =>
- navigator.clipboard.readText()
+ navigator.clipboard.readText(),
);
expect(secondCityClipboardText).toContain(
- "/#parking-reform-map=anchorage-ak"
+ "/#parking-reform-map=anchorage-ak",
);
// Also ensure the full-screen icon link is updated.
diff --git a/tests/scripts/base.test.ts b/tests/scripts/base.test.ts
index 2742467..ff721c9 100644
--- a/tests/scripts/base.test.ts
+++ b/tests/scripts/base.test.ts
@@ -19,7 +19,7 @@ test.describe("determineArgs()", () => {
[[], ["My City", "--bad"], ["My City", "AZ"]].forEach((args, index) => {
test(`${index}) requires exactly 1 argument`, () => {
expect(() => determineArgs("my-script", args).unwrap()).toThrow(
- /exactly one argument/
+ /exactly one argument/,
);
});
});
@@ -49,7 +49,7 @@ test.describe("updateCoordinates()", () => {
cityId,
false,
originalFilePath,
- updateFilePath
+ updateFilePath,
);
expect(result.ok).toBe(true);
@@ -61,7 +61,7 @@ test.describe("updateCoordinates()", () => {
const resultData: FeatureCollection = JSON.parse(rawResultData);
const cityTargetData = resultData.features.find(
- (feature) => feature?.properties?.id === cityId
+ (feature) => feature?.properties?.id === cityId,
);
expect(cityTargetData?.geometry.coordinates).toEqual(updatedCoordinates);
});
@@ -75,7 +75,7 @@ test.describe("updateCoordinates()", () => {
cityId,
true,
originalFilePath,
- updateFilePath
+ updateFilePath,
);
expect(result.ok).toBe(true);
@@ -87,12 +87,12 @@ test.describe("updateCoordinates()", () => {
const resultData = JSON.parse(rawResultData);
const resultCityIds = resultData.features.map(
- (feature: Feature) => feature.properties?.id
+ (feature: Feature) => feature.properties?.id,
);
expect(resultCityIds).toEqual(["honolulu-hi", cityId, "shoup-ville-az"]);
const cityTargetData = resultData.features.find(
- (feature: Feature) => feature.properties?.id === cityId
+ (feature: Feature) => feature.properties?.id === cityId,
);
expect(cityTargetData.properties).toEqual({
id: cityId,
@@ -107,7 +107,7 @@ test.describe("updateCoordinates()", () => {
"bad-city",
false,
originalFilePath,
- validUpdateFilePath
+ validUpdateFilePath,
);
expect(() => result.unwrap()).toThrow(/To add a new city,/);
});
@@ -118,10 +118,10 @@ test.describe("updateCoordinates()", () => {
"shoup-ville-az",
false,
originalFilePath,
- "tests/scripts/data/too-many-updates.geojson"
+ "tests/scripts/data/too-many-updates.geojson",
);
expect(() => result.unwrap()).toThrow(
- /expects exactly one entry in `features`/
+ /expects exactly one entry in `features`/,
);
result = await updateCoordinates(
@@ -129,10 +129,10 @@ test.describe("updateCoordinates()", () => {
"shoup-ville-az",
false,
originalFilePath,
- "tests/scripts/data/empty-update.geojson"
+ "tests/scripts/data/empty-update.geojson",
);
expect(() => result.unwrap()).toThrow(
- /expects exactly one entry in `features`/
+ /expects exactly one entry in `features`/,
);
});
@@ -142,10 +142,10 @@ test.describe("updateCoordinates()", () => {
"shoup-ville-az",
false,
originalFilePath,
- "tests/scripts/data/does-not-exist"
+ "tests/scripts/data/does-not-exist",
);
expect(() => result.unwrap()).toThrow(
- /tests\/scripts\/data\/does-not-exist/
+ /tests\/scripts\/data\/does-not-exist/,
);
});
@@ -155,10 +155,10 @@ test.describe("updateCoordinates()", () => {
"shoup-ville-az",
false,
"tests/scripts/data/does-not-exist",
- validUpdateFilePath
+ validUpdateFilePath,
);
expect(() => result.unwrap()).toThrow(
- /tests\/scripts\/data\/does-not-exist/
+ /tests\/scripts\/data\/does-not-exist/,
);
});
});
@@ -190,7 +190,7 @@ test.describe("updateParkingLots()", () => {
});
expect(updatedData.geometry.type).toEqual("MultiPolygon");
expect(parsedOriginalData.features[0].geometry.coordinates).toEqual(
- updatedCoordinates
+ updatedCoordinates,
);
};
@@ -200,7 +200,7 @@ test.describe("updateParkingLots()", () => {
cityId,
true,
parkingLotData,
- addDataPath
+ addDataPath,
);
expect(result.ok).toBe(true);
@@ -218,7 +218,7 @@ test.describe("updateParkingLots()", () => {
cityId,
true,
parkingLotData,
- existingDataPath
+ existingDataPath,
);
expect(result.ok).toBe(true);
diff --git a/tests/scripts/dataFolder.test.ts b/tests/scripts/dataFolder.test.ts
index 3386080..d976c10 100644
--- a/tests/scripts/dataFolder.test.ts
+++ b/tests/scripts/dataFolder.test.ts
@@ -5,7 +5,7 @@ const assertSortedGeojson = async (filePath: string) => {
const rawData = await fs.readFile(filePath, "utf8");
const data = JSON.parse(rawData);
const sortedFeatures = [...data.features].sort((a, b) =>
- a.properties.id.localeCompare(b.properties.id)
+ a.properties.id.localeCompare(b.properties.id),
);
expect(data.features).toEqual(sortedFeatures);
};