Skip to content

build: add prettier tooling and formatting config - #128

Merged
Cyclodex merged 3 commits into
mainfrom
chore/prettier-tooling
Aug 5, 2026
Merged

build: add prettier tooling and formatting config#128
Cyclodex merged 3 commits into
mainfrom
chore/prettier-tooling

Conversation

@Cyclodex

@Cyclodex Cyclodex commented Aug 5, 2026

Copy link
Copy Markdown
Member

Phase A of two. No file in this PR was reformatted.

This adds the Prettier tooling only. The repo has had a .prettierrc checked in for a long time, but Prettier itself was never installed anywhere — so the config was only ever honoured by whoever happened to have the editor extension switched on.

Design doc: docs/superpowers/specs/2026-08-05-prettier-format-sweep-design.md

What's in here

  • prettier@3.9.6 pinned as an exact root devDependency (.npmrc sets save-exact=true, so no caret). This is the one intended package-lock.json change.
  • format / format:check scripts in the root package.json, right after typecheck.
  • .prettierignore — build/test output (Prettier 3 does not read .gitignore), package-lock.json, CHANGELOG.md, and the captured bexio HTML fixtures. manifest.json and .release-please-manifest.json are not excluded: updateManifest.js edits them by regex replacement, so a formatted version survives a release untouched.
  • .gitattributes with * text=auto eol=lf. Git for Windows ships core.autocrlf=true in its system config, so without this a fresh Windows clone gets CRLF working files and format:check flags every file locally while CI stays happy. The index is already 100% LF, so git add --renormalize . is a no-op and this file changes no content.
  • Format-on-save with Prettier scoped per language, not globally — a global editor.defaultFormatter would also claim Build.ps1 / CreateRelease.ps1, which Prettier cannot format. Plus a .vscode/extensions.json recommending the extension.

Deliberately not added: eslint-config-prettier (the one ESLint config here has no stylistic rules, so there is nothing to turn off) and any pre-commit hook framework (the repo has none today).

npm run format:check fails by design

That is expected until Phase B. It reports 108 files and exits 1.

A note on the numbers: this was planned against a figure of "173 files, exit 2". That figure is reproducible, but only at commit e06f6c2 (two commits behind main) and on a CRLF working tree, where Prettier flags every file it can parse purely because of the line endings. On main, with the LF checkout that .gitattributes now guarantees, the real number is 108. The exit code did drop from 2 to 1 as expected, because the two unparseable bexio fixtures are now ignored. The "Provenance" section of the design doc has the full arithmetic.

Why Phase B is held back

Phase B is style: format repo with prettier (a single formatting-only commit) followed by ci: enforce prettier formatting (the CI step plus the sweep's SHA in .git-blame-ignore-revs). Adding the CI check now would make CI red, and the sweep would conflict with every open branch.

It is gated on the unmerged work in claude/bexio-extension-issue-12-4ad9db landing on main — three commits, all inside packages/sidePanel-import/src/components/ImportEntries/, squarely in the sweep's path.

Both style: and ci: are configured as hidden in release-please-config.json, so the cosmetic commit stays out of the release notes.

Verification

Check Result
npm ci --workspaces --include-workspace-root passes
npx prettier --version 3.9.6, resolved from node_modules/prettier
npm run format:check 108 files, exit 1 — expected, this is what Phase B fixes
npm run typecheck passes (exit 0)
npm test 39 files, 277 tests, all passed
npm run test:e2e 7 passed
git diff --stat origin/main...HEAD 7 files, additions only, no source file reformatted

Phase A of the prettier rollout: the tooling only. No file is reformatted
and no CI check is added, so this cannot turn CI red and cannot conflict
with open branches.

- pin prettier 3.9.6 as an exact root devDependency
- add `format` / `format:check` scripts
- add .prettierignore (build output, package-lock.json, CHANGELOG.md, the
  captured bexio HTML fixtures)
- add .gitattributes so a Windows checkout gets LF working files; without
  it core.autocrlf=true makes format:check flag every file locally
- wire up format-on-save with prettier scoped per language, so the default
  formatter does not claim the .ps1 build scripts

See docs/superpowers/specs/2026-08-05-prettier-format-sweep-design.md.
@Cyclodex
Cyclodex merged commit 0e3129c into main Aug 5, 2026
4 checks passed
Cyclodex pushed a commit that referenced this pull request Aug 5, 2026
Commit hashes should stay stable. A merge commit is the only one of GitHub's
three merge methods that lets a branch's commits reach `main` with the SHAs
they already had, and rewritten hashes invalidate anything that points at them.

Squash merging is disabled on this repository, which reads as an invitation to
rebase-merge instead — it is not. That is how #128 landed as a new SHA, and the
same mistake on the prettier sweep would have left `.git-blame-ignore-revs`
naming a commit that does not exist on `main`.
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