Repository navigation
fix(lint): a scene may use Three.js or Lottie loaded by the parent document - #6961
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Approving at 6def8ed5. I found no blockers.
- Fails without the fix: I verified this. With
adapters.tsreverted to the merge-base, both named cases fail (missing_three_scriptandmissing_lottie_script). With the fix, the whole lint package passes: 23 files, 1246 tests. - Same rule as GSAP:
inheritsLibrariesFromHostuses the same condition asmissing_gsap_script,missing_gsap_pluginandmissing_timeline_registry:isSubComposition, or a source that starts with<template. Project lint passesisSubComposition: truefor everycompositions/*.html. A root composition is still reported. - Non-blocking:
- The same trade-off as GSAP applies. A scene that uses Three.js or Lottie is no longer flagged, even when the parent document doesn't load the library either. A later improvement could check, at the project level, whether the host loads the library a scene relies on.
- The
<template>/sub-composition condition now appears in four rules. A shared helper incontext/utilswould keep them in sync.
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 112 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (2)
|
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
checkandlintreportedmissing_three_script(and would reportmissing_lottie_script) on a scene whose parent document already loads the library, so the only way to pass was to load it again inside the scene.A sub-composition shares its parent's document at render time, so a library the parent loads is available to it.
missing_gsap_scriptand the GSAP plugin rule already skip sub-compositions and<template>scenes; the Three.js and Lottie rules now follow the same rule through one helper inadapters.ts. A root composition with no library is still reported.Why
Reported from 0.8.226: "a scene using a library loaded in the parent document should pass dependency detection; the checker required the library in the scene itself."
Test
New test, run for both rules: a
<template>scene usingTHREE.orlottie.loadAnimationis not reported, whether or not it is flagged as a sub-composition. The existing tests that a root composition without the library is reported still pass. The whole lint package (1246 tests) passes 3 runs in a row.fails without the fix: packages/lint/src/rules/adapters.test.ts › adapter rules › does not report missing_three_script in a scene, since the parent document loads the library
fails without the fix: packages/lint/src/rules/adapters.test.ts › adapter rules › does not report missing_lottie_script in a scene, since the parent document loads the library
Size
Under 100 changed lines.