Repository navigation
build(chore): give the repo a prettier config that matches its own style - #402
Conversation
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]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 47 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
#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]>
…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.
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]>
* 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]>
The repo had no prettier config of any kind — no
.prettierrc*, noprettier.config.*, noprettierkey inpackage.json— andeslint.config.mjsonly extendsnext/core-web-vitalsandnext/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:
semifalsesrcsingleQuotetruejsxSingleQuotefalsetrailingCommaallprintWidth100printWidth sweep — files that would change at each width:
100 is the repo's actual width, and it stays the minimum on the pinned version.
objectWrap: preserveandexperimentalTernarieswere 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:checkcurrently 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 addcopies 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.txtand geo surfaces, andtests/e2e/geo.e2e.spec.tspins exact substrings from them. Reflowing prose there could fail the gate for cosmetic reasons.Verification
pnpm-lock.yamlchange doesn't trip the install-statepatchedFilesassertion