Skip to content

fix(lint): report invalid data-duration and data-track-index values as errors - #7323

Closed
wanjinhao1 wants to merge 1 commit into
heygen-com:mainfrom
wanjinhao1:agent/fix-7272-duration-lint
Closed

wanjinhao1 wants to merge 1 commit into
heygen-com:mainfrom
wanjinhao1:agent/fix-7272-duration-lint

Conversation

@wanjinhao1

Copy link
Copy Markdown

What

Adds two lint rules to packages/lint/src/rules/composition.ts that surface the parser's invalid-duration and invalid-track-index diagnostics as lint errors (invalid_data_duration, invalid_track_index), with the element and the bad attribute value in the message.

Why

The parser already marks values like data-duration="2s" or "-3" as invalid-duration (compositionContract.ts ~L268), but the linter only turned deprecated-layer/deprecated-end/conflicting-end into findings, so these values linted clean and the clip silently got a different duration than the author wrote.

Fixes #7272

Related work

Refs #7272 (mentor @jrusso1020). Separate from #7291 (different rule, different issue).

How

New rule block iterating tags, reading each tag's timing via readTagTiming, and mapping invalid-duration / invalid-track-index diagnostics to error findings following the existing deprecated_data_layer/deprecated_data_end pattern (elementId, fixHint, snippet). No parser changes.

Test plan

  • Unit tests added/updated: three new tests in composition.test.ts — invalid "2s" and "-3" durations report two invalid_data_duration errors; a valid 3.5 duration reports none; a 1.5 track index reports invalid_track_index. npx vitest run packages/lint/src/rules/composition.test.ts -t "invalid timing" → 3 passed.
  • Manual testing performed — not run: the 42 invalid_composition_variables_declaration failures and the lefthook typecheck failure (missing generated runtime-inline, bun unavailable locally) reproduce on a clean checkout of origin/main and are unrelated to this change.
  • Documentation updated — no docs changes needed; codes follow the existing snake_case finding scheme.
  • Comments follow CONTRIBUTING.md "Comments".

This PR was prepared with AI assistance and reviewed by the contributor.

@jrusso1020

Copy link
Copy Markdown
Collaborator

Thanks for contributing this fix. I reviewed the competing submissions and selected #7286, which includes the parser-based duration checks, element/value/severity regression cases, and documentation for both new lint codes. Closing this as a duplicate so the issue has one implementation to take through CI and merge: #7286. This is consolidation of overlapping work, not a rejection of your contribution.

@jrusso1020 jrusso1020 closed this Nov 7, 2026
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.

Lint: report data-duration values the parser rejects

2 participants