Skip to content

T-STP8-the-repo-adopts-the-shared-prettier-config

State: closed/done · Impact: high · Complexity: medium

No TypeScript or JavaScript project in the repo has a formatting gate except 8 Tauri apps (frontend-format-check); zero libraries have one. About 2,500 source files currently fail @sksizer/prettier-config (624 under packages/ts, 1,896 under solutions, per the M-3MGB survey). This task reformats the whole tree in one pass and adds a pre-commit hook that keeps it formatted, so the reformat does not rot the way an unenforced style rule always does.

LocationRole today
.prettierignoreRoot ignore file. Deliberately empty of real entries — a comment explains that ignoring a generated path here would make prettier emit nothing for it and truncate the file.
apps/agentpants/src-nuxt/.prettierignoreNested ignore file protecting agentpants’ generated Nuxt sources from reformatting.
apps/pumice/src-nuxt/.prettierignoreNested ignore file protecting pumice’s generated Nuxt sources.
apps/ontological-legacy/src-nuxt/.prettierignoreNested ignore file for ontological-legacy’s generated Nuxt sources.
apps/zoo/src-nuxt/.prettierignoreNested ignore file for zoo’s generated Nuxt sources.
apps/legacy-polish/src-nuxt/.prettierignoreNested ignore file for legacy-polish’s generated Nuxt sources.
solutions/augmented/apps/learn_web/.prettierignoreNested ignore file for learn_web’s generated/vendored sources.
solutions/ontological/desktop/src-nuxt/.prettierignoreNested ignore file protecting sdf’s generated Nuxt sources.
lefthook.ymlHas markdown-fmt (rumdl) and mdx-fmt (prettier) pre-commit commands, both auto-fixing and re-staging. No equivalent command exists for .ts/.tsx/.js/.vue/.json source, so a commit can currently land unformatted source.
packages/ts/624 files fail bunx prettier@3.9.6 --check against the shared config.
solutions/1,896 files fail the same check.
.moon/tasks/tauri.ymlDeclares frontend-format-check (prettier, no writes) for the 8 Tauri apps — the only formatting gate anywhere in the moon graph.

Every file under packages/ts/ and solutions/ that @sksizer/prettier-config can format is formatted, verified per tree with bunx prettier@3.9.6 --check exiting 0. lefthook.yml gains a source-format command, modelled exactly on markdown-fmt, that runs prettier --write on staged source files and re-stages the fixes on every commit — the primary enforcement. fmt-check (landing per-project in tasks 3/4/6 of M-3MGB) is the CI backstop for commits that bypass the hook. The four codegen-drift targets (sdf, foreman, agentpants, pumice) still pass after the reformat, proving the generated TypeScript these projects protect via their own nested .prettierignore (or via build.rs/codegen_drift.sh invoking prettier internally) was untouched. If any residue remains that prettier genuinely cannot format, it is recorded in a baseline file rather than left silently unformatted.

  1. Enumerate the trees to reformat: packages/ts/ and solutions/ (the two root directories the file-count survey covers), each formatted with its own bunx prettier@3.9.6 --write <tree> invocation run with that tree — or, for the 7 nested-.prettierignore subtrees, their own directory — as the working directory. Never invoke prettier from the repo root: the root .prettierignore protects nothing, so a root-level write would reformat (and potentially truncate) the generated files the 7 nested ignore files exist to protect.
  2. Run each --write pass, then confirm bunx prettier@3.9.6 --check exits 0 for that same tree before moving to the next one.
  3. Verify the four codegen-drift targets are unaffected: moon run sdf:codegen-drift, moon run foreman:codegen-drift, moon run agentpants:codegen-drift, moon run pumice:codegen-drift.
  4. If any file fails --write cleanly (parses but keeps failing --check, or prettier errors on it outright), record it in a new baseline file (.claude/skills/project-check/prettier_baseline.json, following the shape of the existing util_redeclarations_baseline.json) rather than leaving it silently unformatted. Skip this step if no such residue exists.
  5. Add a prettier-fmt command to lefthook.yml’s pre-commit.commands, modelled on markdown-fmt: bunx prettier@3.9.6 --write {staged_files} scoped to source globs (.ts, .tsx, .js, .jsx, .vue, .json, excluding .md/.mdx, which markdown-fmt/mdx-fmt already own), with stage_fixed: true, and any of the existing hook’s directory exclusions (fixture corpora under apps/legacy-polish/fixtures/, packages/rust/wikilink/tests/fixtures/vault/, packages/ts/obsidian-editor/test/fixtures/corpus/) that carry byte-exact TypeScript/JSON test fixtures a reformat would corrupt.
  6. Confirm the new hook re-stages a deliberately unformatted staged file by testing it locally (stage a one-line change to an existing .ts file with bad formatting, run lefthook run pre-commit, confirm the fix lands staged).
LocationKindChange
packages/ts/modifyReformat every file to @sksizer/prettier-config.
solutions/modifyReformat every file to @sksizer/prettier-config, respecting the 7 nested .prettierignore files.
lefthook.ymlmodifyAdd a prettier-fmt pre-commit command that writes and re-stages staged source files, modelled on markdown-fmt.
  • AC-1: cd packages/ts && bunx prettier@3.9.6 --check . exits 0.
  • AC-2: cd solutions && bunx prettier@3.9.6 --check . exits 0.
  • AC-3: moon run sdf:codegen-drift, moon run foreman:codegen-drift, moon run agentpants:codegen-drift, and moon run pumice:codegen-drift all exit 0.
  • AC-4: lefthook.yml contains a pre-commit command that runs prettier --write {staged_files} over source globs with stage_fixed: true.
  • AC-5: Staging a deliberately misformatted .ts file and running lefthook run pre-commit leaves the fix staged (git diff --cached shows the corrected formatting, not the original).
  • AC-6: git diff --stat for this change touches no file under any of the 7 nested .prettierignore directories’ ignored patterns, and none of the 8 Tauri apps’ frontend-format-check targets regress.
  • Adding format/format:check scripts to individual package.json files — that is T-076A and T-9FH9.
  • Wiring per-project fmt-check moon tasks — that is tasks 6-8 of M-3MGB (the Layer B aspects).
  • Rust formatting (cargo fmt) — already gated via .moon/tasks/rust.yml and unaffected by this task.
  • The conformance guard rejecting mutating lint/format:check scripts — that is task 11 of M-3MGB.
  • T-076A and T-9FH9 land the format/format:check scripts this task’s reformat and hook build on.

T-076A-the-script-vocabulary-lands-in-packages-apps-and-sites, T-9FH9-the-script-vocabulary-lands-across-solutions


← Back to Tasks