fix(lefthook): run prettier before markdownlint, and match root-level files #41

Sammanfogat
supernaut sammanfogade 1 incheckning från fix/lefthook-glob-and-order in i main 2026-08-11 13:00:30 +00:00
Ägare

Fixes three lefthook defects that share one root cause: lefthook's **/ does not match at
depth 0, and package.json, README.md and the tool configs all live at the repository root.

The defects

  • **/package.json matched nothing, so the "Sort package.json" job had never run, anywhere
    it was defined. Verified directly: with a real staged change to the root package.json the job
    reports "no matching staged files" while format (which has no glob) runs — the control that
    shows the test harness was sound and the glob was not.
  • **/*.md skipped every root-level markdown file, so README.md, CLAUDE.md and
    CONTRIBUTING.md were never linted on commit.
  • eslint's glob skipped the root config files (eslint.config.mjs, tsconfig.json,
    vitest.config.ts).

Every glob now carries both a depth-0 and a nested pattern.

The ordering

markdownlint now runs after prettier. That matches CI, which already runs the prettier check
first, and the markdownlint config's own stated policy: "Disabled = Prettier owns it or noise;
kept = structural/semantic rules Prettier does not handle."
Linting before formatting
contradicted it — a hand-written table failed MD060 on the first commit attempt and passed on
the second, once prettier had realigned it.

Reproduced in both directions on identical input:

config exit MD060 errors
lint then format 1 (commit rejected) 1
format then lint 0 0

Checked before switching anything on

  • root markdown lints clean everywhere, so enabling that glob blocks nobody
  • root config files pass eslint cleanly
  • package.json is sorted in this commit, so the newly-live job does not rewrite it inside some
    unrelated change later; the reordering is semantically identical, verified by comparing the
    parsed objects rather than the text

The three shared jobs are now byte-identical across every repository. Repo-specific jobs are
unchanged.

Fixes three lefthook defects that share one root cause: lefthook's `**/` does not match at depth 0, and `package.json`, `README.md` and the tool configs all live at the repository root. ## The defects - **`**/package.json` matched nothing**, so the "Sort package.json" job had never run, anywhere it was defined. Verified directly: with a real staged change to the root `package.json` the job reports "no matching staged files" while `format` (which has no glob) runs — the control that shows the test harness was sound and the glob was not. - **`**/*.md` skipped every root-level markdown file**, so `README.md`, `CLAUDE.md` and `CONTRIBUTING.md` were never linted on commit. - **eslint's glob skipped the root config files** (`eslint.config.mjs`, `tsconfig.json`, `vitest.config.ts`). Every glob now carries both a depth-0 and a nested pattern. ## The ordering markdownlint now runs **after** prettier. That matches CI, which already runs the prettier check first, and the markdownlint config's own stated policy: _"Disabled = Prettier owns it or noise; kept = structural/semantic rules Prettier does not handle."_ Linting before formatting contradicted it — a hand-written table failed `MD060` on the first commit attempt and passed on the second, once prettier had realigned it. Reproduced in both directions on identical input: | config | exit | MD060 errors | | -------------------- | ------------------- | ------------ | | lint then format | 1 (commit rejected) | 1 | | format then lint | 0 | 0 | ## Checked before switching anything on - root markdown lints clean everywhere, so enabling that glob blocks nobody - root config files pass eslint cleanly - `package.json` is sorted in this commit, so the newly-live job does not rewrite it inside some unrelated change later; the reordering is semantically identical, verified by comparing the parsed objects rather than the text The three shared jobs are now byte-identical across every repository. Repo-specific jobs are unchanged.
supernaut lade till 1 incheckning 2026-08-11 12:57:38 +00:00
fix(lefthook): run prettier before markdownlint, and match root-level files
Alla kontroller lyckades
ci / ci (pull_request) Successful in 33s
cac3e26f40
Three defects with one root cause: lefthook's `**/` does not match at depth 0, and
package.json, README.md and the tool configs all live at the repository root.

- `**/package.json` matched nothing, so the "Sort package.json" job had never run
  anywhere it was defined. The glob is now ["package.json", "**/package.json"], and it
  takes {staged_files} so a workspace's nested manifests are sorted too.
- `**/*.md` skipped every root-level markdown file, so README.md and friends were never
  linted on commit. Now ["*.md", "**/*.md"]. Checked first that the root markdown is
  already clean, so switching this on blocks nobody.
- eslint's glob skipped the root config files (eslint.config.mjs, tsconfig.json,
  vitest.config.ts). Verified they pass before enabling it.

Ordering: markdownlint now runs AFTER prettier, matching CI and the markdownlint config's
own stated policy ("Disabled = Prettier owns it or noise; kept = structural/semantic rules
Prettier does not handle"). Linting before formatting contradicted that: a hand-written
table failed MD060 on the first attempt and passed on the second, once prettier had
realigned it. Reproduced both ways — the old order exits 1 on a near-aligned table, the
new order exits 0 and stages the aligned result.

package.json is sorted in this commit so the newly-live job does not rewrite it inside
some unrelated change later. The reordering is semantically identical, verified by
comparing the parsed objects.

The three shared jobs are now byte-identical across every repository; repo-specific jobs
are unchanged.
supernaut sammanfogade incheckning 5094de690f till main 2026-08-11 13:00:30 +00:00
supernaut tog bort grenen fix/lefthook-glob-and-order 2026-08-11 13:00:30 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-09-29 13:54:28 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-10-02 17:57:03 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-auth-reconciler!41
Ingen beskrivning angiven.