Skip to content

ci: check formatting in the lint job - #35

Merged
stevendborrelli merged 1 commit into
mainfrom
ci-format-check
Aug 29, 2026
Merged

ci: check formatting in the lint job#35
stevendborrelli merged 1 commit into
mainfrom
ci-format-check

Conversation

@stevendborrelli

Copy link
Copy Markdown
Member

Follow-up to #34.

The lint job runs npm run lint and npm run typecheck, but never npm run format:check — so nothing enforced the Prettier config the repo already ships. That is how the serve module (#32) reached main unformatted; it was only noticed and fixed when v0.7.0 was cut.

The change

One step added to the lint job:

      # Last, because a step that fails stops the job: a formatting nit should
      # not hide a real lint or type error. Run `npm run format` to fix.
      - name: Format
        run: npm run format:check

It goes last deliberately. A failing step stops the job, so putting the formatting check first would mean a stray space masks a genuine lint or type error until someone fixes the whitespace and pushes again.

No new job, so no change to what publish waits on — it already needs lint.

Verification

  • npm run format:check passes on main as it stands, so this does not land red
  • Confirmed the step actually gates rather than just running: with deliberately misformatted code in src/serve/serve.ts it exits 1, and 0 once reverted
  • Workflow YAML parses, and the lint job's steps resolve to Checkout → Install → npm ci → Lint → Typecheck → Format

One gap this does not close

format and format:check both target src/**/*.{ts,tsx,json,md}. README.md and USAGE.md live at the repo root and stay unchecked. Widening the glob would reformat both files in one go, which felt like it belonged in its own PR rather than riding along with a CI fix — happy to do that separately if you want the docs covered too.

The lint job ran eslint and tsc but never `npm run format:check`, so nothing
enforced the Prettier config the repo already ships. The serve module reached
main unformatted as a result, and was only reformatted when v0.7.0 was cut.

Add the check as the last step of the lint job. Last rather than first because
a failing step stops the job, and a whitespace nit should not hide a real lint
or type error.

Note this covers `src/**/*.{ts,tsx,json,md}`, which is what the existing
`format` and `format:check` scripts target — README.md and USAGE.md sit at the
repo root and remain unchecked.

Signed-off-by: Steven Borrelli <steve@borrelli.org>
@stevendborrelli
stevendborrelli merged commit 17a878e into main Aug 29, 2026
7 checks passed
@stevendborrelli
stevendborrelli deleted the ci-format-check branch August 29, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant