Skip to content

Lint: tight-leading display type overlapping its neighbor (rule 36) - #51

Merged
kurenn merged 1 commit into
mainfrom
feat/lint-tight-leading-overlap
Jul 31, 2026
Merged

Lint: tight-leading display type overlapping its neighbor (rule 36)#51
kurenn merged 1 commit into
mainfrom
feat/lint-tight-leading-overlap

Conversation

@kurenn

@kurenn kurenn commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Bug class

An oversized display heading / wordmark set with a tight line-height (< ~1) — leading-none, leading-[0.8], line-height: .85, etc. — reserves less vertical space than its glyph ink actually occupies. Descenders (p, y, g, q, j, comma, period) overflow below the line box, and ascenders overflow above it, so the vertically-adjacent block (next paragraph/section) overlaps the glyphs when no clearance is reserved. Observed on a real generated page.

This is distinct from:

  • horizontal overflow of long unbroken strings (rule 24)
  • all-caps cap-collision-on-wrap (rule 25)

Tight leading is not the bug by itself — tight leading with a flush neighbor and no reserved clearance is.

Changes

checks/builtin-lint.md

  • Adds rule 36, "Tight-leading display type overlaps its neighbor," under a new ## Vertical rhythm section, following the existing rule format (rationale, honest part-heuristic detection like rules 29/33/35, grep, fix).
  • Detection greps for tight-leading Tailwind classes (HTML) and tight line-height values (CSS), with an explicit caveat that confirming the actual glyph/box overlap needs a screenshot or DOM read (claude-in-chrome), not grep alone.
  • Bumps the report template's **Rules checked:** from 35 to 36 (the only place that count appears in the repo — grepped to confirm).

reference/build.md

  • Adds a one-line build-guidance bullet in Step 6, next to the spacing/squint-test bullet: oversized display type with tight leading must reserve vertical clearance (padding-bottom for descender overhang) so it doesn't collide with the next block.

Testing

Ran both new greps against templates/scaffold-base/:

  • leading-none / leading-[0.x] class grep → no matches (scaffold's hero <h1> uses leading-tight, not tight-none).
  • line-height: 0.x CSS grep → no matches (scaffold's two line-height: 1; declarations are on .chip and .proto-seg, not display headings, and 1 isn't < 1).

Also verified both greps fire correctly against a synthetic tight-leading display-heading test case, so the patterns aren't dead weight.

Docs-only change — SKILL.md untouched per instructions (no token headroom).

🤖 Generated with Claude Code

An oversized display heading/wordmark with line-height < ~1 (leading-none,
leading-[0.8], line-height: .85, etc.) reserves less vertical space than its
glyph ink occupies — descenders and ascenders spill outside the line box and
overlap the next block when no clearance is reserved. This is distinct from
horizontal overflow (rule 24) and all-caps cap-collision-on-wrap (rule 25).

Adds rule 36 to checks/builtin-lint.md with grep detection for tight-leading
classes/CSS (tested clean against templates/scaffold-base/, which uses
leading-tight/leading-relaxed and only line-height: 1 on chips/buttons — no
false positives), an honest note that confirming actual glyph overlap needs a
screenshot/DOM read, and a fix (padding-bottom/margin-bottom clearance or
raising line-height toward 1). Bumps the report template's rule count 35 -> 36.

Adds a matching one-line build note in reference/build.md near the spacing/
squint-test guidance in Step 6.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kurenn
kurenn merged commit d22a770 into main Jul 31, 2026
1 check passed
@kurenn
kurenn deleted the feat/lint-tight-leading-overlap branch July 31, 2026 02:50
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.

1 participant