Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(lint): upgrade bare composition HTML to error - #242

Merged
miguel-heygen merged 1 commit into
mainfrom
lint/bare-composition-html
Apr 11, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
lint/bare-composition-html

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Apr 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Upgrades root_composition_missing_html_wrapper from warning to error — a bare <div data-composition-id> as index.html without <!DOCTYPE html>/<html>/<body> causes browsers to quirks-mode, the preview server to fail, and the bundler to silently skip runtime injection
  • Improves the error message to explain why this is bad, and includes a snippet of the offending root element
  • Skips <template>-wrapped compositions (already caught by the separate standalone_composition_wrapped_in_template rule)
  • Adds 8 tests covering the exact screenshot scenario, proper HTML, sub-compositions, plain HTML, and template wrappers

Test plan

  • All 441 existing tests pass (vitest run)
  • 8 new tests for root_composition_missing_html_wrapper and standalone_composition_wrapped_in_template
  • TypeScript build clean (tsc --noEmit)
  • oxlint + oxfmt pass
  • Run npx hyperframes lint on a bare composition index.html and verify it now reports an error

A composition index.html that starts with a raw <div data-composition-id>
instead of <!DOCTYPE html><html> is a hard failure — browsers quirks-mode
it, the preview server cannot load it, and the bundler cannot inject
runtime scripts. Upgraded from warning to error with a clearer message.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@miguel-heygen
miguel-heygen merged commit 794b021 into main Apr 11, 2026
21 checks passed

Copy link
Copy Markdown
Collaborator Author

Merge activity

dahans-msft2 pushed a commit to dahans-msft2/hyperframes that referenced this pull request Aug 6, 2026
## Summary

- Upgrades `root_composition_missing_html_wrapper` from **warning** to **error** — a bare `<div data-composition-id>` as `index.html` without `<!DOCTYPE html>/<html>/<body>` causes browsers to quirks-mode, the preview server to fail, and the bundler to silently skip runtime injection
- Improves the error message to explain _why_ this is bad, and includes a snippet of the offending root element
- Skips `<template>`\-wrapped compositions (already caught by the separate `standalone_composition_wrapped_in_template` rule)
- Adds 8 tests covering the exact screenshot scenario, proper HTML, sub-compositions, plain HTML, and template wrappers

## Test plan

- [x] All 441 existing tests pass (`vitest run`)
- [x] 8 new tests for `root_composition_missing_html_wrapper` and `standalone_composition_wrapped_in_template`
- [x] TypeScript build clean (`tsc --noEmit`)
- [x] oxlint + oxfmt pass
- [x] Run `npx hyperframes lint` on a bare composition `index.html` and verify it now reports an error
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