Skip to content

feat(lint): flag duplicate data-composition-id values [P2]#2074

Open
miguel-heygen wants to merge 1 commit into
mainfrom
fix/lint-duplicate-composition-id
Open

feat(lint): flag duplicate data-composition-id values [P2]#2074
miguel-heygen wants to merge 1 commit into
mainfrom
fix/lint-duplicate-composition-id

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Bug

Declaring data-composition-id on 2+ elements (commonly the <meta> tag from the quickstart template AND the root <div> added to satisfy root_missing_composition_id) is a silent collision: compositions --json returns two entries for one id (one duration:0) and inspect/snapshot crash with 'Cannot read properties of undefined (reading totalDuration)'. Lint passed clean. Reported on 0.7.42.

Fix

New rule duplicate_composition_id: groups elements by data-composition-id, errors on any value shared by 2+ elements, names the id + count, and calls out the meta-vs-root collision in the fixHint.

Tests

+3 (dup fires; single id passes; two distinct ids don't collide). 111 lint tests pass; oxfmt/oxlint clean.

Declaring data-composition-id on more than one element (commonly the <meta>
tag from the quickstart template AND the root <div> added to satisfy
root_missing_composition_id) is a silent collision: `compositions --json`
returns two entries for the same id (one duration:0) and inspect/snapshot
crash with "Cannot read properties of undefined (reading totalDuration)".
Lint passed clean through all of it.

New rule `duplicate_composition_id`: group elements by data-composition-id
value and error on any value shared by 2+ elements, naming the id and calling
out the meta-vs-root collision in the fixHint. 3 tests: dup fires, single id
passes, two distinct ids don't collide. (Implemented via Codex; verified
independently: 111 lint tests pass, oxfmt/oxlint clean.)
@miguel-heygen miguel-heygen marked this pull request as ready for review July 8, 2026 21:40
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