• 
      

    Add a rule for detecting static access inside of @spina-wrapped classes.

    Review Request #14640 — Created Oct. 17, 2025 and submitted — Latest diff uploaded

    Information

    beanbag-eslint-plugin
    master

    Reviewers

    We discovered a confusing bug where accessing static members within a
    class that was wrapped with the @spina decorator would end up getting
    members on the inner class rather than the wrapper. This caused an issue
    with tests where the tests were setting a static attribute on the
    wrapper, and the inner class had a different value.

    The fix is a surprising, unintuitive change to use this.constructor
    for any static accesses within the class itself. Because this is
    something I'll immediately forget, I wanted to have an eslint rule to
    detect this situation in the future.

    This change adds the new rule. It specifically only operates on classes
    decorated with @spina (at least for now). It will detect static member
    accesses within member functions and static functions. It also includes
    a fixer that will add the declare ['constructor'] line to the
    beginning of the class (if it's needed and not already present) and then
    replace said accesses with this.constructor or this as appropriate.

    • Ran unit tests.
    • Saw that this correctly flagged the issue, and that asking my LSP to
      apply the fix worked correctly.

    Commits

    Files