Skip to content

fix(lint): stop false root findings on template-wrapped sub-compositions#2447

Open
miguel-heygen wants to merge 1 commit into
mainfrom
fix/lint-template-subcomposition
Open

fix(lint): stop false root findings on template-wrapped sub-compositions#2447
miguel-heygen wants to merge 1 commit into
mainfrom
fix/lint-template-subcomposition

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

hyperframes lint no longer reports root_missing_dimensions or multiple_root_compositions false positives on template-wrapped mountable sub-composition files, the registry's shipped pattern for components mounted via data-composition-src.

Why

A mountable sub-composition keeps its renderable content inside <body><template>, and its root is deliberately elastic (position: absolute; inset: 0, no data-width/data-height) because the host clip sizes it. The linter treated that intentional shape as two defects: the elastic root fired root_missing_dimensions, and the project-level multiple_root_compositions scan double-counted a demo host plus its mounted sub-composition sitting in the same directory. Both findings are noise on correct-by-design files and train users to ignore the linter.

How

  • packages/lint/src/utils.ts: new shared resolveRootStructure() helper (extracted from the template-unwrap logic already in context.ts), exposing isTemplateWrappedRoot.
  • packages/lint/src/context.ts: uses the shared helper and threads isTemplateWrappedRoot onto LintContext.
  • packages/lint/src/rules/core.ts: root_missing_dimensions skips template-wrapped elastic roots; root_missing_composition_id behavior unchanged.
  • packages/lint/src/project.ts: lintMultipleRootCompositions excludes template-wrapped sub-composition files from the root count (except index.html).
  • Housekeeping surfaced by the audit ratchet on touched files: stripHtmlComments un-exported (internal-only after the refactor), pre-existing complexity/duplication findings suppressed with documented rationale following existing repo precedent.

Test plan

  • Failing-first reproduction tests for both false positives using a minimal template-wrapped fixture, made green by the fix.
  • Guard tests assert a standalone composition missing dimensions STILL fires root_missing_dimensions, and genuine duplicate roots still fire multiple_root_compositions.
  • packages/lint: 367/367 tests pass. Repo root build, lint, and typecheck pass.

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