Repository navigation
lint: report parser-rejected data-duration and data-track-index values - #7319
Closed
wanjinhao1 wants to merge 1 commit into
Closed
wanjinhao1 wants to merge 1 commit into
wanjinhao1 wants to merge 1 commit into
Conversation
…ack-index values in lint
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. |
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
The linter now reports
invalid-durationandinvalid-track-indextiming diagnostics (already produced by the parser incompositionContract.ts) as findings, so values likedata-duration="2s"ordata-duration="-3"no longer lint clean.Why
The parser marks some
data-duration/data-track-indexvalues as invalid, but the linter only turneddeprecated-layer,deprecated-endandconflicting-endinto findings, so a clip silently got a different duration/track than the author wrote.Fixes #7272
Related work
Fixes #7272 (mentor @jrusso1020; claimed in the issue before starting, as requested).
How
Added a rule in
packages/lint/src/rules/composition.tsthat walksreadTagTiming(tag.raw).diagnosticsand mapsinvalid-duration→invalid_data_durationandinvalid-track-index→invalid_data_track_index(bothseverity: "error"). Messages include the element (tag +idwhen present) and the rejected attribute/value;fixHintsays what a valid value looks like. No parser changes.Test plan
composition.test.ts:"2s"and"-3"reportinvalid_data_duration, a validdata-duration="2"reports nothing, anddata-track-index="1.5"reportsinvalid_data_track_index(vitest run packages/lint/src/rules/composition.test.ts: all new tests pass)