From 9de3ee152c8791700a0332bbc6d1b1e8237af0b5 Mon Sep 17 00:00:00 2001 From: William French Date: Thu, 16 Jul 2026 10:00:36 -0700 Subject: [PATCH 1/2] Add .env.template and setup instructions --- .env.template | 1 + README.md | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 .env.template diff --git a/.env.template b/.env.template new file mode 100644 index 000000000..fd95ecac6 --- /dev/null +++ b/.env.template @@ -0,0 +1 @@ +GOOGLE_MAPS_API_KEY= diff --git a/README.md b/README.md index 5dbc1bc97..dae296249 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,14 @@ Try the examples out at [Google Maps JavaScript API documentation](https://devel Each example is one atomic unit, for which dependencies must be individually set up. +### Environment Setup + +1. Copy the `.env.template` file to `.env`: + ```bash + cp .env.template .env + ``` +2. Open `.env` and replace `` with your Google Maps API key. The `.env` file is already added to `.gitignore` to prevent accidentally committing your key. + ### Build samples 1. Run `npm i` to install dependencies. You only need to do this once, and From 46c994bdafdd23f709fc40e0037e47339139de9b Mon Sep 17 00:00:00 2001 From: William French Date: Thu, 16 Jul 2026 10:03:21 -0700 Subject: [PATCH 2/2] docs: add code quality checks section to README.md --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index dae296249..7c3f092ac 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,31 @@ also contains a `dist/` folder, but this is only used by Vite for live preview. - To test, navigate to project root and run `npx playwright test`. {# TODO: Expand this section. #} +### Code Quality Checks + +This repository strictly enforces code formatting and best practices using ESLint, Prettier, and custom validation scripts. + +#### Global Checks (`check-and-fix`) + +You can automatically check and fix issues across **all** samples at once from the root directory: + +```bash +npm run check-and-fix +``` + +This command will: +1. Run `eslint --fix` to catch and resolve JavaScript/TypeScript linting errors. +2. Run `prettier -w` to format all files (HTML, CSS, TS, JS, JSON) according to the repository's styling rules. +3. Run `tsc --noEmit` across all samples to verify TypeScript compilation passes. + +#### Build-time Checks (`build-single.sh`) + +When you build an individual sample using `npm run build`, the build is handled by `samples/build-single.sh`. This script enforces several Google Maps Platform best practices before compilation, including: +- Preventing synchronous `await google` calls in close proximity (suggesting `Promise.all()` instead). +- Verifying that `