feat(lint): flag duplicate data-composition-id values [P2]#2074
Open
miguel-heygen wants to merge 1 commit into
Open
feat(lint): flag duplicate data-composition-id values [P2]#2074miguel-heygen wants to merge 1 commit into
miguel-heygen wants to merge 1 commit into
Conversation
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.)
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.
Bug
Declaring
data-composition-idon 2+ elements (commonly the<meta>tag from the quickstart template AND the root<div>added to satisfyroot_missing_composition_id) is a silent collision:compositions --jsonreturns two entries for one id (oneduration:0) andinspect/snapshotcrash with 'Cannot read properties of undefined (reading totalDuration)'. Lint passed clean. Reported on 0.7.42.Fix
New rule
duplicate_composition_id: groups elements bydata-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.