Prettier scope depends on .gitignore to stay out of dot-directories; make the exclusion explicit #33
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Since #12,
script/fmtandscript/fmt-checkuse'**/*.md'and'**/*.css'. That glob descends into dot-directories — verified duringreview of PR #32 by planting
.probe-nested/deep/bad.md, which prettierflagged.
.claude/is out of scope today only as a side effect: prettier 3 reads.gitignorein addition to.prettierignore, and.claude/is in.gitignore(added by #8). Nothing in.prettierignoreexcludes it.So the protection is real but indirect. If
.claude/is ever removed from.gitignore— or if a future prettier release changes that default, or a--no-ignore-path-style flag is added —make fmtwould begin rewritingmarkdown inside sibling agent worktrees under
.claude/worktrees/. That iswriting to other checkouts of this repo from a formatting command, which is
both surprising and hard to attribute when it happens.
The same indirection is what currently keeps
public/out of scope inside theimage.
Fix
Add
.claude/to.prettierignoreexplicitly, so the exclusion does notdepend on
.gitignorecontents or on prettier's default ignore-filebehaviour. One line plus a comment recording why.
While in there, consider whether any other dot-directory should be named
explicitly rather than inherited.
Definition of done
.prettierignoreexcludes.claude/directly, with a comment stating thatit must not depend on
.gitignore..claude/probe/x.mdand confirmingmake fmtleaves it untouched with.claude/temporarily removed from.gitignore— that is the condition being defended against. Restore.gitignoreafterwards and delete the probe file.make fmtis a no-op on a clean tree;make checkpasses.TODO.mdupdated.Also in scope — the duplicated prettier settings
.prettierrcsetstabWidth: 4andproseWrap: always, and both scripts alsopass
--tab-width 4 --prose-wrap always. This duplication is deliberate andis being kept: CLI flags take precedence, so the scripts format identically
in a tree where the dotfile is missing or has drifted, which is what a gate
should do.
The hazard is that editing
.prettierrcalone silently changes what editors dowhile
make fmt-checkignores the change, with no error — the gate and theeditors disagree and nothing says so.
Add a one-line comment to each of
script/fmtandscript/fmt-checkstatingthat the flags intentionally mirror
.prettierrcand that both must be changedtogether. Do not remove the flags; dropping them would make the scripts
silently misformat in any tree missing the dotfile.
Out of scope
content/is excludedby measurement, Go templates because prettier cannot parse them).
One interaction to settle before this is implemented, because this issue's fix adds a vendor tooling directory name to
.prettierignorewhile #43 is about removing that name from this repo's prose.They do not conflict. The distinction ruled there applies here: an ignore-file path is load-bearing — it must match a real directory on disk or it does nothing — so it is functional configuration, not documentation, and it stays. Prose about it is what gets scrubbed.
So: add the path entry as this issue describes. Write the accompanying comment in terms of what is being excluded and why (agent working directories, i.e. entire sibling checkouts of this repo) rather than naming the product, and the two issues stay consistent.
Everything else in the definition of done stands. Note the negative control in item 2 is the whole point of the change and is not optional: the exclusion must be shown to hold with the
.gitignoreentry temporarily removed, since inheriting it from.gitignoreis exactly the dependency being eliminated.