Skip to content

feat(lint): warn when a url() in a linked stylesheet does not resolve beside it - #6844

Merged
miguel-heygen merged 2 commits into
mainfrom
fix/lint-linked-css-asset
Oct 30, 2026
Merged

miguel-heygen merged 2 commits into
mainfrom
fix/lint-linked-css-asset

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

hyperframes lint now warns (missing_stylesheet_asset) when a url() in a linked local stylesheet does not resolve beside that stylesheet. The message names the path it tried; if the file exists in a parent folder, the hint gives the working relative path (for example ../assets/fonts/x.ttf).

Why

A project with styles/main.css containing src: url("assets/fonts/x.ttf") and the font at assets/fonts/x.ttf linted clean (ok: true, no findings). Browsers resolve url() from the stylesheet's folder, so the font 404s. check reports the 404, but render exits 0 and silently falls back to a default font (frame 1 differs from the same project with the corrected path). Lint is the one place that can say so before a render.

Related work

Same area as the linked-stylesheet reads in the font and external-script lint PRs. mask-image urls keep their existing error rule and are skipped here.

How

lintLinkedStylesheetAssets walks the declarations of each linked local stylesheet (reusing collectLocalStylesheets, CSS_URL_RE, cleanAssetUrl), skips remote, data, fragment, absolute and placeholder urls, and resolves against the stylesheet's own folder. nearestAncestorMatch looks up parent folders for the hint. One finding per stylesheet and url.

Size

About 125 added lines (64 code, 56 tests, 5 docs).

Test plan

missing_stylesheet_asset tests in packages/lint/src/project.test.ts, 3 runs in a row green. Full lint package: 23 files, 1238 tests green. tsc --noEmit and the comment ratchet clean.

fails without the fix: "names the path that exists when a url() is relative to the wrong folder" and "asks for the file when it exists nowhere" fail with the rule switched off (the call removed, confirmed to match one line).

What I measured

Lint on a project with the wrong-base font url (before: ok: true, 0 findings, on 0.8.221); render of it vs the corrected path (different frame 1). Tests above, run on a Linux dev box.

What I did NOT execute

Warning only inside linked local stylesheets: <style> blocks and inline styles are not checked. @import url() is not checked. Did not run the CLI end to end on the new build after this change; the CLI calls the same lintProject.

@mintlify

mintlify Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Oct 30, 2026, 2:39 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES · 1 blocker · 0 important · 0 nits · head 6d8c8765

The new rule warns about a percent-encoded url() that resolves fine and tells the author the file will 404. ↓ inline

Scope

Read lintLinkedStylesheetAssets / nearestAncestorMatch. Compared them with the bundler (inlineCssFile → rebaseCssUrls rebases against the stylesheet folder, so the premise holds) and with the sibling texture_mask_asset_not_found rule. Ran project.test.ts: 82/82 pass at head, and 82/82 still pass with the suggested change, which also clears the probe. CI was still running when I posted; the verdict doesn't depend on it.

Comment thread packages/lint/src/project.ts Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 125 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

Unstable (1)

  • seqplainkeys-none-center-r0-root-z100: tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo false, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: APPROVE — 1 resolved, 0 open, 0 new · 6d8c876 → 843d0b0. CI green on this head.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 6cddd1a Oct 30, 2026
82 checks passed
@miguel-heygen
miguel-heygen deleted the fix/lint-linked-css-asset branch October 30, 2026 15:13
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