Skip to content

build(chore): give the repo a prettier config that matches its own style - #402

Merged
Ducksss merged 1 commit into
devfrom
claude/prettier-config
Jul 29, 2026
Merged

Ducksss merged 1 commit into
devfrom
claude/prettier-config

Conversation

@Ducksss

@Ducksss Ducksss commented Jul 28, 2026

Copy link
Copy Markdown
Owner

The repo had no prettier config of any kind — no .prettierrc*, no prettier.config.*, no prettier key in package.json — and eslint.config.mjs only extends next/core-web-vitals and next/typescript, neither of which carries a style rule. So the single-quote, no-semicolon house style was enforced by nothing.

That's a trap, not a preference. npx prettier --write <file> falls through to prettier's defaults and rewrites the entire file to double quotes and semicolons — and because the change is purely cosmetic, it passes every test and lint check, surfacing only in review. It caught me doing exactly that earlier today on three files during #399.

The config is derived, not chosen

Every value was measured against the codebase:

option value evidence
semi false 32 semicolon-terminated lines in all of src
singleQuote true dominant throughout
jsxSingleQuote false JSX attributes are double-quoted
trailingComma all already present in multiline literals
printWidth 100 p95 line length is 103; swept below

printWidth sweep — files that would change at each width:

80 90 100 110 120
266 230 188 237 245

100 is the repo's actual width, and it stays the minimum on the pinned version. objectWrap: preserve and experimentalTernaries were both tested and made it worse (188 → 188, 210).

Pinned to 3.9.6, the current release. Pinning a minor behind invites a Dependabot bump that changes formatting output and turns a routine dependency PR into a repo-wide reflow.

Deliberately does not reformat anything

format:check currently reports 188 files (93 tsx, 69 ts, 11 md, 11 css, 2 html, 1 mjs, 1 json). That reflow is a separate mechanical change — it would conflict with every open PR, so it shouldn't ride along with the config. This PR only makes running prettier safe, and no check is gated on formatting yet.

Two ignores that are choices, not housekeeping

Beyond the generated trees (.next, .source, public/r, test-results, lockfile):

  • payload-components/ — payload-components add copies these files into a consumer's project verbatim, so their formatting is part of the product surface, and the built registry embeds these exact bytes. Reformatting it should be a product decision.
  • content/ and *.mdx — Fumadocs serialises MDX into the /llms.txt and geo surfaces, and tests/e2e/geo.e2e.spec.ts pins exact substrings from them. Reflowing prose there could fail the gate for cosmetic reasons.

Verification

  • eslint clean, tsc clean
  • 379/380 integration tests pass (1 pre-existing skip) — confirms the pnpm-lock.yaml change doesn't trip the install-state patchedFiles assertion
  • ignore rules verified to actually exclude their targets

The repo had no prettier config of any kind, and eslint.config.mjs only extends
next/core-web-vitals and next/typescript — neither of which carries a style rule.
The single-quote, no-semicolon house style was therefore enforced by nothing, so
"npx prettier --write" fell through to prettier's defaults and rewrote whole
files to double quotes and semicolons. That is a trap rather than a preference:
the reformat is invisible to the tests, so it survives every check and only shows
up in review.

The config is derived from the codebase, not chosen: 32 semicolons in all of src
(semi: false), single quotes throughout with double quotes in JSX
(jsxSingleQuote: false), trailing commas already present, and a p95 line length
of 103. printWidth was swept — 80/90/100/110/120 touch 266/230/188/237/245 files
respectively, so 100 is the repo's actual width, and it stays the minimum on the
pinned prettier version.

Pinned to 3.9.6, the current release: pinning a minor behind invites a Dependabot
bump that would change formatting output and turn a dependency PR into a
repo-wide reflow.

Nothing is reformatted here and no check is gated on formatting — "format:check"
reports 188 files, which is a separate mechanical change that would conflict with
every open PR. This commit only makes running prettier safe.

.prettierignore excludes generated trees, plus two that are excluded on purpose:
payload-components/ ships to consumers verbatim via "payload-components add" and
its bytes are embedded in the built registry, and content/ + *.mdx feed the
/llms.txt and geo surfaces whose exact substrings geo.e2e.spec.ts pins.

Verified: eslint clean, tsc clean, 379/380 int tests pass (1 pre-existing skip)
with the lockfile change.

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 28, 2026 10:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vercel

vercel Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
payload-components Ready Ready Preview, Comment Jul 28, 2026 11:01am
payload-components-97bf Ready Ready Preview, Comment Jul 28, 2026 11:01am

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Ducksss, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e506073d-59ae-473e-b240-9e7e548747c8

📥 Commits

Reviewing files that changed from the base of the PR and between 5f1376f and 74bc2e4.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • .prettierignore
  • .prettierrc.json
  • package.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/prettier-config

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Ducksss
Ducksss merged commit 354ac46 into dev Jul 29, 2026
12 checks passed
Ducksss added a commit that referenced this pull request Jul 29, 2026
#402 added a prettier config matched to the house style but reformatted nothing,
leaving format:check red on 188 files and therefore ungateable. This runs it and
turns the check on, in both places the gate is enforced: the test:release chain
and the workflow's lint-and-type-check step.

Mechanical, with two exceptions that are not.

Eleven eslint-disable directives went stale. Every mobile-nav header wrote its
effect as a single line — useEffect(() => { setOpen(false) }, [pathname]) — with
"// eslint-disable-next-line react-hooks/set-state-in-effect" above it. Prettier
expands the body, so the directive came to sit above "useEffect(() => {" while
the setState it suppresses moved two lines down: eleven unused-directive warnings
and eleven now-unsuppressed errors. Each directive moved to the line it actually
governs, which is also a narrower suppression than before.

One integration assertion pinned a line break rather than a fact.
fumadocs-site.int.spec.ts asserts the blog routes re-declare
"twitter: { card: 'summary_large_image'", guarding a real trap — Next does not
inherit nested openGraph/twitter fields from the root layout, and no e2e covers
those fields. In [slug]/page.tsx that literal was 126 columns, so prettier split
it and the assertion failed while the metadata it guards was untouched. It now
matches against whitespace-collapsed source, so it tests the re-declaration
instead of the formatting.

Nothing else changed behaviour. The full release gate passed on this tree —
391 e2e tests across all five batches, including every visual baseline
(102 template snapshots, the blog and landing sets), so the JSX reflow is
render-neutral and no baseline needs re-minting on either platform.
379/380 int tests pass, eslint clean, tsc clean, format:check clean.

Co-authored-by: Claude Opus 5 <[email protected]>
Ducksss added a commit that referenced this pull request Jul 29, 2026
…r adoption, template a11y (#409)

Brings main level with dev (137 commits). Headline items:

- the component wall no longer crops blocks: per-breakpoint zoom pins the twins'
  inner layout width at 1280px (#392), and the 640-1023px band gets a 256px frame
  plus a widened fade (#399). Production was cutting content-quote,
  content-feature-media and content-feature-split by 88/79/78px on a tablet;
  measured on the live site, not inferred. Three viewport tests now assert the fit
  so a curated-at-one-width regression cannot recur silently.
- prettier is adopted: config matched to the house style (#402), the tree
  formatted, and format:check gated in test:release and the CI lint step (#408).
- template a11y and layout fixes (#394, #398, #404), consent gate split by
  provider (#400), axe now waits for the consent banner (#405), CodeQL
  double-escaping fix (#391).

Tree is identical to dev by construction: branched from dev, reparented onto main,
so the diff is exactly the main..dev delta with no squash-divergence conflicts.
Ducksss added a commit that referenced this pull request Jul 29, 2026
format:check gates on prettier as of #402/#408, and `pnpm lint` does not cover
it — so the privacy page landed unformatted. Reformatted.

The intro also still claimed "Nothing loads until you accept", which the
cookieless split made false: Vercel Analytics and Speed Insights load for
everyone. Now scoped to "nothing that stores anything on your device".

Co-Authored-By: Claude Opus 5 <[email protected]>
Ducksss added a commit that referenced this pull request Jul 29, 2026
* privacy(fix): delete GA's cookies when consent is withdrawn

Found by checking the live site rather than the code: after resetting consent to
a first-visit state, GA4 correctly did not load — but `_ga` and
`_ga_EMGRZ0H9R9` were still sitting in the browser from the earlier opt-in.

Withdrawal stopped collection and cleared our own pc_distinct_id, but never
touched GA's cookies, so the visitor stayed identifiable to Google on their next
visit. That is the cookie analogue of the stale-identifier bug fixed earlier, and
under GDPR withdrawal should remove the identifiers rather than merely stop
processing.

clearAnalyticsCookies() expires the `_ga` / `_ga_*` pair (plus legacy `_gid` /
`_gat*`) on both denial paths: explicit withdrawal and a GPC/DNT signal arriving
after an opt-in. A cookie can only be removed by re-setting it with a matching
domain and path, and script cannot read which domain a cookie came from — GA
writes `_ga` on the registrable domain — so each plausible domain is tried and
the misses are inert. It runs before the existing reload so the tag cannot
re-set them on the way out.

The spec seeds the cookies by hand instead of waiting for a real
googletagmanager fetch, which keeps it deterministic rather than network-flaky,
and asserts an unrelated cookie on the same domain survives so the sweep cannot
grow into deleting everything.

/privacy and contributing.mdx now say withdrawal deletes rather than just stops.

Verified: lint clean, tsc clean, 379 int tests, consent + a11y e2e 20/20.

Co-Authored-By: Claude Opus 5 <[email protected]>

* style(privacy): satisfy prettier and correct the page intro

format:check gates on prettier as of #402/#408, and `pnpm lint` does not cover
it — so the privacy page landed unformatted. Reformatted.

The intro also still claimed "Nothing loads until you accept", which the
cookieless split made false: Vercel Analytics and Speed Insights load for
everyone. Now scoped to "nothing that stores anything on your device".

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
@Ducksss
Ducksss deleted the claude/prettier-config branch August 3, 2026 08:49

This branch was successfully deployed

2 active deployments
Preview – payload-components-97bf — 74bc2e41 Deployed Jul 28, 2026 by vercel[bot]
Preview – payload-components — 74bc2e41 Deployed Jul 28, 2026 by vercel[bot]
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.

2 participants