Skip to content

Linter throws missing_gsap_script false positive on nested compositions #392

@vlycser

Description

@vlycser

Describe the bug

When creating nested compositions to be loaded via data-composition-src, the @hyperframes/core/lint tool evaluates the nested HTML file in isolation. If the nested file contains a GSAP animation but omits the GSAP <script> tag (because it is already being loaded by the Root/Host composition), the linter throws a missing_gsap_script error.
Adding the script to the nested composition to satisfy the linter is not an ideal workaround, as it leads to redundant script loading or compiler conflicts.

Link to reproduction

https://github.com/heygen-com/hyperframes

Steps to reproduce

  1. Create a nested composition file (compositions/intro.html) wrapped in a <template> tag, containing a GSAP timeline but no GSAP script tag:
<template id="intro-template">
  <div data-composition-id="intro" data-width="3840" data-height="2160" data-start="0">
    <div class="title">Hello</div>
    <script>
        window.__timelines = window.__timelines || {};
        const tl = gsap.timeline({ paused: true });
        tl.from(".title", { opacity: 0, duration: 2 });
        window.__timelines["intro"] = tl;
    </script>
  </div>
</template>
  1. Run the npx hyperframes lint or render command.
  2. See the error:
    ✗[compositions/intro.html] missing_gsap_script: Composition uses GSAP but no GSAP script is loaded. The animation will not run.

Expected behavior

The linter should detect when an HTML file is intended to be a nested module (for example, by checking if the root element is a <template>) and bypass the missing_gsap_script rule, assuming the host composition provides the library.

Actual behavior

✗[compositions/intro.html] missing_gsap_script: Composition uses GSAP but no GSAP script is loaded. The animation will not run.

Environment

- Framework: HyperFrames (0.4.12)
- OS: WSL - Ubuntu 24.04.4 LTS

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions