--- phase: 13-real-lint-gate-eslint verified: 2026-06-11T21:00:00Z status: passed score: 9/9 must-haves verified overrides_applied: 0 re_verification: null gaps: [] human_verification: - test: "Open a PR to main from a branch with a deliberately introduced lint violation and confirm the Gitea CI fast-checks job fails" expected: "The Lint step in fast-checks exits non-zero; PR cannot be merged" why_human: "Cannot trigger a real PR-to-main CI run programmatically in this verification context; SC-2 blocking behavior is only observable on an actual Gitea PR" - test: "Open a PR to main from a branch with a deliberately introduced format violation and confirm the Format check step fails" expected: "The Format check step in fast-checks exits non-zero; PR cannot be merged" why_human: "Same as above — SC-2 live CI blocking is a one-time operator observation on the next real PR" --- # Phase 13: Real Lint Gate (ESLint) Verification Report **Phase Goal:** The CI lint gate actually fails on lint violations. A real ESLint flat config (eslint.config.js, typescript-eslint; React + react-hooks plugins for apps/pwa) plus a package-level lint script in apps/api and apps/pwa makes the existing root `pnpm -r --if-present lint` run a real linter, replacing the hollow no-op gate. Also adds Prettier + a `prettier --check` CI format gate. **Verified:** 2026-06-11T21:00:00Z **Status:** passed (with 2 human-verify items for SC-2 live CI observation) **Re-verification:** No — initial verification --- ## Note on Phase History This phase required two post-verification correction commits after the executor initially reported completion: 1. **Commit `3f2e3ea`** (Plan 02 correction): A residual `@typescript-eslint/no-unnecessary-type-assertion` error in `apps/pwa/src/components/SyncStateToast.test.tsx` line 29 was missed. The fix restructured the `vi.hoisted()` callback to use an explicitly-typed const (`const mockLastSyncedUid: { value: string | null } = { value: 'test-uid-123' }`) rather than an inline type assertion, satisfying both ESLint and tsc. 2. **Commit `743c7d9`** (Plan 03 correction): After the Prettier reformat (commit `982438d`), `.planning/` was not excluded from Prettier scope. GSD planning tools rewrite `.planning/` files on every run without applying Prettier, so `pnpm format:check` would fail perpetually on any workflow run. The fix added `.planning/` to `.prettierignore` with an explanatory comment. Both corrections are resolved — all gates now exit 0. --- ## Goal Achievement ### Observable Truths | # | Truth | Status | Evidence | |---|-------|--------|----------| | 1 | ESLint flat config exists and loads: recommendedTypeChecked + projectService:true (D-13-01); no strict presets (D-13-03) | VERIFIED | `eslint.config.js` line 29: `tseslint.configs.recommendedTypeChecked`; line 32: `projectService: true`. Node import check confirmed package resolves. | | 2 | React + react-hooks rules apply ONLY to `apps/pwa/**` (D-13-02); api receives no React config | VERIFIED | Block 3 in `eslint.config.js` (lines 47-81): `files: ['apps/pwa/**/*.{ts,tsx}']` only. `apps/api` has no React block. | | 3 | Every lint invocation bakes `--max-warnings 0` (D-13-04) | VERIFIED | `apps/api/package.json` line 12: `"eslint src/ tests/ --max-warnings 0"`; `apps/pwa/package.json` line 10: `"eslint src/ e2e/ --max-warnings 0"` | | 4 | disableTypeChecked override covers config files + apps/api/tests (D-13-10) | VERIFIED | Block 4 in `eslint.config.js` (lines 83-105): lists `apps/api/tests/**/*.ts`, `apps/pwa/e2e/**/*.ts`, all config files, `eslint.config.js` itself; `extends: [tseslint.configs.disableTypeChecked]` | | 5 | Prettier wired as standalone gate; eslint-config-prettier/flat imported LAST (D-13-07) | VERIFIED | `package.json` has `"format": "prettier --write ."` and `"format:check": "prettier --check ."`; `eslint.config.js` line 11 imports `eslint-config-prettier/flat`; line 111 `prettierConfig` is the final array element | | 6 | `pnpm lint` exits 0 across both apps — baseline green (SC-3) | VERIFIED | Independently run: exit code 0, both apps clean under `--max-warnings 0` | | 7 | `pnpm format:check` exits 0 — baseline green (SC-3) | VERIFIED | Independently run: exit code 0, "All matched files use Prettier code style!" | | 8 | CI fast-checks job has a Format check step (`pnpm format:check`) after Lint; stale no-op comment removed (SC-2) | VERIFIED | `.gitea/workflows/ci.yml` lines 31-32: `- name: Format check` / `run: pnpm format:check`; grep for "no-op\|out of this phase" returns empty; step order is Lint (28-29) → Format check (31-32) → Typecheck (34-35) | | 9 | Throwaway SC-1 smoke files are NOT present in repo (never committed) | VERIFIED | `test ! -e apps/api/src/_lint-gate-test.ts && test ! -e _format-gate-test.ts` and `git ls-files` both confirmed absent | **Score:** 9/9 truths verified --- ### Required Artifacts | Artifact | Expected | Status | Details | |----------|----------|--------|---------| | `eslint.config.js` | Root flat ESLint config: 5 blocks in order (ignores, base, pwa-react, disableTypeChecked, prettier-last) | VERIFIED | 112 lines; all 5 blocks present in correct order; all D-13-0x decisions honored | | `.prettierrc` | Prettier defaults: singleQuote, semi, tabWidth:2, trailingComma:all, printWidth:100 | VERIFIED | All 5 options confirmed | | `.prettierignore` | Excludes dist/, node_modules/, pnpm-lock.yaml, migrations/, *.html, .planning/ | VERIFIED | All exclusions present; `.planning/` added in correction commit 743c7d9 with explanatory comment | | `package.json` (root) | `"type": "module"` + format/format:check scripts + lint delegates to -r | VERIFIED | Lines: `"type": "module"`, `"format": "prettier --write ."`, `"format:check": "prettier --check ."`, `"lint": "pnpm -r --if-present lint"` | | `apps/api/package.json` | lint script with --max-warnings 0 | VERIFIED | `"lint": "eslint src/ tests/ --max-warnings 0"` | | `apps/pwa/package.json` | lint script with --max-warnings 0 | VERIFIED | `"lint": "eslint src/ e2e/ --max-warnings 0"` | | `.gitea/workflows/ci.yml` | fast-checks job with Format check step; stale comment removed | VERIFIED | `Format check` / `pnpm format:check` present; no stale comment; branch-protection job IDs (`fast-checks`, `api`, `harness`) unchanged | --- ### Key Link Verification | From | To | Via | Status | Details | |------|-----|-----|--------|---------| | root `pnpm lint` | apps/api + apps/pwa lint scripts | `pnpm -r --if-present lint` | WIRED | Running `pnpm lint` invoked both package lint scripts; both exited 0 | | root `pnpm format:check` | prettier binary in root devDeps | `prettier --check .` | WIRED | Confirmed prettier@3.8.4 in root devDependencies; `pnpm format:check` executed and exited 0 | | `eslint.config.js` | apps/api/tsconfig.json + apps/pwa/tsconfig.json | `projectService: true` + `tsconfigRootDir: import.meta.dirname` | WIRED | projectService auto-discovers tsconfigs; `pnpm typecheck` exits 0 confirming no cross-contamination | | CI fast-checks | root lint + format:check scripts | `pnpm lint` / `pnpm format:check` steps | WIRED | ci.yml lines 28-32 confirmed; `name: CI` and `fast-checks` job ID preserved (branch-protection contexts intact) | --- ### Data-Flow Trace (Level 4) Not applicable — this is a dev-tooling/CI-config phase; no dynamic data rendering components were produced. --- ### Behavioral Spot-Checks | Behavior | Command | Result | Status | |----------|---------|--------|--------| | `pnpm lint` exits 0 on clean tree | `pnpm lint` (run independently) | exit 0; both apps clean | PASS | | `pnpm format:check` exits 0 on clean tree | `pnpm format:check` (run independently) | exit 0; "All matched files use Prettier code style!" | PASS | | `pnpm typecheck` exits 0 (no regressions) | `pnpm typecheck` (run independently) | exit 0; both apps + e2e tsconfig clean | PASS | | PWA unit tests unbroken by lint fixes | `pnpm --filter @familysync/pwa test` | 191/191 passing | PASS | | Throwaway smoke files absent from repo | `test ! -e` + `git ls-files` checks | THROWAWAYS_ABSENT_AND_UNTRACKED | PASS | --- ### Probe Execution No conventional probe scripts (`scripts/*/tests/probe-*.sh`) declared or expected for this phase. Behavioral spot-checks above serve as the equivalent gate. --- ### Requirements Coverage No formal REQ-IDs — this phase was promoted from backlog 999.16. Verified against the 3 ROADMAP Success Criteria: | Criterion | Description | Status | Evidence | |-----------|-------------|--------|----------| | SC-1 | `pnpm lint` exits non-zero on an introduced violation; `pnpm format:check` exits non-zero on an unformatted file | SATISFIED | SC-1 was demonstrated during Plan 01 execution: lint gate reported exit 1 with `@typescript-eslint/no-floating-promises` on the deliberate file; format gate reported exit 1 with the unformatted throwaway listed. Throwaways deleted and confirmed untracked. (Indirect — SUMMARY evidence; gates work as proven by Plan 01 commits `df62d33` + `7a255ea`) | | SC-2 | CI fast-checks lint step blocks a PR to main on violations; new format:check step blocks on format violations | SATISFIED (code); NEEDS HUMAN (live observation) | `pnpm format:check` step wired in ci.yml at the correct position; stale no-op comment removed; branch-protection job IDs preserved. Live blocking behavior requires operator observation on next real PR. | | SC-3 | First run's existing violations resolved; baseline `pnpm lint` AND `pnpm format:check` both exit 0 across both apps | SATISFIED | Independently verified: both exit 0. | --- ### D-13-0x Decision Compliance | Decision | Requirement | Status | Evidence | |----------|-------------|--------|----------| | D-13-01 | `recommendedTypeChecked` + `projectService:true` | VERIFIED | `eslint.config.js` lines 29, 32 | | D-13-02 | React/hooks plugins scoped to `apps/pwa` only | VERIFIED | Block 3 `files: ['apps/pwa/**/*.{ts,tsx}']` | | D-13-03 | No strict/strictTypeChecked presets | VERIFIED | Only `recommendedTypeChecked` used; comment on line 25 explicitly documents this | | D-13-04 | `--max-warnings 0` in both lint scripts | VERIFIED | Both package.json files confirmed | | D-13-05 | Fix all violations now | VERIFIED | `pnpm lint` exits 0 with `--max-warnings 0` | | D-13-06 | Fixes address violations, not mask them | VERIFIED | All `eslint-disable-next-line` occurrences carry adjacent justification comments (spot-checked sync.ts, sw.ts, EventForm.tsx); no blanket file-level disables found | | D-13-07 | `eslint-config-prettier/flat` last + standalone prettier --check | VERIFIED | Import on line 11; last entry in config array on line 111; `prettier --check .` in root scripts | | D-13-08 | Isolated reformat commit | VERIFIED | Commit `982438d` is a single mechanical commit (398 files, 19125+/16457- lines); commit message and diff stat confirm no logic changes mixed in | | D-13-09 | Lint all TS/TSX including tests, e2e, config files | VERIFIED | api lint script covers `src/ tests/`; pwa script covers `src/ e2e/`; config files (drizzle.config.ts, vitest.config.ts, etc.) in disableTypeChecked override (still linted, just non-type-aware) | | D-13-10 | disableTypeChecked override for non-project files | VERIFIED | Block 4 covers all config files + `apps/api/tests/**/*.ts` + `apps/pwa/e2e/**/*.ts` + `eslint.config.js` | --- ### Anti-Patterns Found | File | Pattern | Severity | Impact | |------|---------|----------|--------| | None | — | — | — | No TBD/FIXME/XXX markers found in `eslint.config.js` or `.gitea/workflows/ci.yml`. No blanket `eslint-disable` file-level directives in any modified source. All `eslint-disable-next-line` comments carry adjacent justifying text. --- ### Human Verification Required #### 1. SC-2: Live CI Lint Blocking on PR to Main **Test:** Create a branch with a deliberate lint violation (e.g., an unhandled `Promise.resolve()` in any `apps/api/src/*.ts` file), push it, and open a PR to main in Gitea. **Expected:** The `fast-checks` job `Lint` step exits non-zero; Gitea marks the PR as blocked; the merge button is disabled. **Why human:** Cannot trigger a real Gitea PR-to-main CI run in this verification context. The step is correctly wired in `ci.yml` and `pnpm lint` exits non-zero on violations (proven by SC-1), but the live blocking behavior is only observable on an actual PR. #### 2. SC-2: Live CI Format Blocking on PR to Main **Test:** Create a branch with a deliberately unformatted file (double quotes in a `.ts` file), push it, and open a PR to main in Gitea. **Expected:** The `fast-checks` job `Format check` step exits non-zero; Gitea marks the PR as blocked. **Why human:** Same reason as above. `pnpm format:check` exits non-zero on unformatted files (proven by SC-1 smoke test in Plan 01), and the CI step runs that command — but live observation requires an actual PR. --- ### Gaps Summary No gaps. All 9 must-have truths are verified. The phase goal is achieved: the CI lint gate is real, type-aware, and green. The two human-verify items above are one-time operator observations on the next live PR — they do not represent defects in the delivered code. --- _Verified: 2026-06-11T21:00:00Z_ _Verifier: Claude (gsd-verifier)_