Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

build(server): lint:mcp-zod counts a z. call that a line break splits from its dot

Maurice5c198f28488c
diff --git a/server/scripts/mcp-inline-zod-baseline.json b/server/scripts/mcp-inline-zod-baseline.json
index 7130307d1..5a9292b79 100644
--- a/server/scripts/mcp-inline-zod-baseline.json
+++ b/server/scripts/mcp-inline-zod-baseline.json
@@ -3,14 +3,15 @@
"src/nest/accommodations/accommodations.mcp.ts": 28,
"src/nest/airports/airports.mcp.ts": 3,
"src/nest/assignments/assignments.mcp.ts": 10,
- "src/nest/atlas/atlas.mcp.ts": 22,
+ "src/nest/atlas/atlas.mcp.ts": 23,
"src/nest/budget/budget.mcp.ts": 36,
"src/nest/collab/collab.mcp.ts": 20,
"src/nest/collections/collections.mcp.ts": 14,
"src/nest/day-notes/day-notes.mcp.ts": 10,
"src/nest/days/days.mcp.ts": 2,
+ "src/nest/doc-sync/doc-sync.mcp.ts": 1,
"src/nest/files/files.mcp.ts": 4,
- "src/nest/help/help.mcp.ts": 3,
+ "src/nest/help/help.mcp.ts": 4,
"src/nest/integrations/airtrail.mcp.ts": 2,
"src/nest/integrations/dawarich.mcp.ts": 13,
"src/nest/journey/journey.mcp.ts": 66,
@@ -30,7 +31,7 @@
"src/nest/share/share.mcp.ts": 7,
"src/nest/tags/tags.mcp.ts": 4,
"src/nest/todo/todo.mcp.ts": 14,
- "src/nest/transit/transit.mcp.ts": 14,
+ "src/nest/transit/transit.mcp.ts": 16,
"src/nest/trips/trips.mcp.ts": 24,
"src/nest/vacay/vacay.mcp.ts": 25,
"src/nest/weather/weather.mcp.ts": 8
diff --git a/server/scripts/mcp-inline-zod.mjs b/server/scripts/mcp-inline-zod.mjs
index edbae4bb7..29a9373da 100644
--- a/server/scripts/mcp-inline-zod.mjs
+++ b/server/scripts/mcp-inline-zod.mjs
@@ -18,7 +18,9 @@
*/
import { cliMain } from './lib/count-ratchet.mjs';
-const ZOD_CALL = /\bz\./g;
+// Whitespace before the dot counts too: Prettier breaks a long chain into `z`
+// on one line and `.object(` on the next.
+const ZOD_CALL = /\bz\s*\./g;
/** The inline zod calls in one file's text, comments included. */
export function countInlineZod(text) {
diff --git a/server/tests/unit/scripts/error-envelope-ratchets.test.ts b/server/tests/unit/scripts/error-envelope-ratchets.test.ts
index 966a8bd70..cdcfe0173 100644
--- a/server/tests/unit/scripts/error-envelope-ratchets.test.ts
+++ b/server/tests/unit/scripts/error-envelope-ratchets.test.ts
@@ -65,6 +65,12 @@ describe('the counters', () => {
expect(countInlineZod(`${Z}object({ a: ${Z}string(), b: idSchema, c: fizz.x })`)).toBe(2);
});
+ it('ENV-RATCHET-001b: counts a z. call Prettier broke across lines', () => {
+ expect(countInlineZod(`const s = z
+ .object({ a: idSchema })
+ .strict();`)).toBe(1);
+ });
+
it('ENV-RATCHET-002: counts the result envelope and HTTP in a service, not a 2xx status', () => {
expect(
countServiceIdioms(`return { error: 'x', ${STATUS} };\nthrow ${HTTP}{}, 400);\nreturn { status: 200 };`),