Repository navigation
fix(lint): validate composition variables on every declaring element - #4391
Closed
leorivastech wants to merge 1 commit into
Closed
leorivastech wants to merge 1 commit into
leorivastech wants to merge 1 commit into
Conversation
invalid_composition_variables_declaration only read data-composition-variables from <html>. The runtime also reads it from composition roots and template roots, so broken JSON or an invalid declaration there dropped the defaults with no diagnostic. Run the existing JSON and shape checks on each element that carries the attribute, the same set the binding check already unions. Each finding points at its own element (elementId + snippet, so it gets that element's line), and a non-<html> declaration names its element in the message so two broken ones are reported separately. Messages for <html> are unchanged. Fixes heygen-com#4383
miguel-heygen
approved these changes
Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Broken
data-composition-variablesJSON was only caught on<html>. If you put the same broken attribute on a composition root div or a template root, lint said nothing, even though the runtime reads it from there too and silently drops the defaults.Why
A typo in the variables declaration on a root element meant defaults just disappeared, with no hint from lint. The binding check already looks at every declaring element, so this rule was the odd one out.
How
The rule now runs its existing checks (JSON, array shape, entry shape, and the unloadable media default check that lives in the same body) on every element that carries the attribute, not just
<html>. Most of the diff is moving that body into a small helper so it can run per element.Each finding points at its own element, so the line number is right. When the declaration isn't on
<html>, the message names the element, so two broken declarations show up as two findings instead of being merged. Messages for<html>are exactly the same as before.Test plan
composition.test.ts: broken JSON on a full-document root and on a template root (checking element and line), bad entry shapes on a template root,<html>and root checked independently, and a valid template declaration that stays clean. 4 of them fail onmain.html,rootandtemplatenow all reportinvalid_composition_variables_declaration.bun run --cwd packages/lint test(704 passing), lint typecheck, oxlint and oxfmt.Fixes #4383