Skip to content

fix(lint): detect optional managed media calls - #5210

Merged
jrusso1020 merged 1 commit into
heygen-com:mainfrom
user-github-me:fix/lint-optional-media-controls
Oct 8, 2026
Merged

jrusso1020 merged 1 commit into
heygen-com:mainfrom
user-github-me:fix/lint-optional-media-controls

Conversation

@user-github-me

Copy link
Copy Markdown
Contributor

Optional chaining currently bypasses imperative_media_control: video?.play(), video.play?.(), and optional calls on direct DOM lookups pass lint even though HyperFrames must own managed-media playback. The same rule also reports ordinary calls printed inside strings, comments, templates, or regular expressions.

Extend the existing play/pause matchers to optional property access and optional calls. Use the existing JavaScript code mask to check that bindings and controls begin in executable code, retaining real calls inside template interpolations. Existing finding messages, snippets for ordinary calls, and media IDs are preserved.

Validation:

  • 21 regression cases cover variables, direct ID/selector lookups, optional calls, template interpolation, quoted examples, and non-media controls. The initial 17 cases produced 15 failures on main.
  • Full lint suite: 855 passed. CLI project/command/format suites: 99 passed.
  • All 214 shipped example/block compositions produce byte-identical findings to main.
  • Built CLI rejects optional calls with the expected error and accepts the quoted-example control. Its strict Chrome check passes with no findings and all five contrast samples passing.
  • Lint and CLI builds/typechecks, repository lint, formatting, pre-commit gates, comment checks, deletion guard, and test reachability passed.

No new dependency or runtime playback change.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Confirmed that video?.play() and video.play?.() slip past imperative_media_control on main, even though the plain call is an error. Widening the existing matchers and using the existing JS code mask is a small, consistent fix, and the quoted-example controls are a good addition. The new cases fail on main, and the full lint suite passes.

— Rames

@jrusso1020
jrusso1020 enabled auto-merge October 8, 2026 20:01
@jrusso1020
jrusso1020 added this pull request to the merge queue Oct 8, 2026
Merged via the queue into heygen-com:main with commit c03aa92 Oct 8, 2026
78 checks passed
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