From 0220d95915a54e96e0a90b3093db37c8c541ef1c Mon Sep 17 00:00:00 2001
From: Mike Hays
Date: Mon, 21 Oct 2024 18:35:39 -0700
Subject: [PATCH] Add Prettier (#304)
* Update ferrostar version
* Add prettier
* Run Prettier
* Update guide
* Rename format to format:fix, add format:check script
* Add format:check to GitHub workflow
---
.github/workflows/wasm-js.yml | 3 +
guide/src/dev-env-setup.md | 5 ++
web/.prettierignore | 1 +
web/.prettierrc | 4 ++
web/index.html | 46 ++++++++++-----
web/package-lock.json | 18 +++++-
web/package.json | 7 ++-
web/src/arrival-view.ts | 24 ++++++--
web/src/ferrostar-map.ts | 104 +++++++++++++++++++++++-----------
web/src/instructions-view.ts | 14 ++++-
web/src/location.ts | 42 +++++++++-----
web/src/main.ts | 6 +-
web/src/maneuver-image.ts | 11 +++-
web/vite.config.site.ts | 5 +-
web/vite.config.ts | 15 ++---
15 files changed, 217 insertions(+), 88 deletions(-)
create mode 100644 web/.prettierignore
create mode 100644 web/.prettierrc
diff --git a/.github/workflows/wasm-js.yml b/.github/workflows/wasm-js.yml
index 44fc009c..fc4837b6 100644
--- a/.github/workflows/wasm-js.yml
+++ b/.github/workflows/wasm-js.yml
@@ -28,6 +28,9 @@ jobs:
- run: npm ci
working-directory: web
+
+ - run: npm run format:check
+ working-directory: web
- run: npm run build
working-directory: web
diff --git a/guide/src/dev-env-setup.md b/guide/src/dev-env-setup.md
index f6e1db5b..da45a280 100644
--- a/guide/src/dev-env-setup.md
+++ b/guide/src/dev-env-setup.md
@@ -60,6 +60,11 @@ npm run dev
npm run build
```
+#### PR checklist
+
+Run `npm run format:fix` from the `web` directory before committing
+to ensure consistent formatting.
+
### iOS
1. Install the latest version of Xcode.
diff --git a/web/.prettierignore b/web/.prettierignore
new file mode 100644
index 00000000..1521c8b7
--- /dev/null
+++ b/web/.prettierignore
@@ -0,0 +1 @@
+dist
diff --git a/web/.prettierrc b/web/.prettierrc
new file mode 100644
index 00000000..fba65977
--- /dev/null
+++ b/web/.prettierrc
@@ -0,0 +1,4 @@
+{
+ "quoteProps": "consistent",
+ "trailingComma": "all"
+}
diff --git a/web/index.html b/web/index.html
index 80d2aba8..d0a8b1f4 100644
--- a/web/index.html
+++ b/web/index.html
@@ -1,4 +1,4 @@
-
+
@@ -12,7 +12,7 @@
-
+
@@ -30,8 +30,12 @@
>