Skip to content
TheChatArchiveThe Chat Archive
composer-2.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

unused-class-members FP: methods called only from Svelte <template> member expressions…

  1. User

    unused-class-members FP: methods called only from Svelte member expressions False positive on 2.84.0. Class methods called only from a Svelte <template> via a member expression (for example resultState.pin(...) in markup) are reported as unused-class-member. Fallow tracks template-visible identifiers but not member-expression method calls on a bound instance inside Svelte markup.

    Repro (2.84.0): asciimoo/hister. ResultState.onOpen, .pin, .updateLabel, and .addSkipRule are each invoked from .svelte templates (resultState.pin(...) in ResultActionsMenu.svelte) yet reported unused. The repo currently sets rules.unused-class-members: "off" to work around it.

    Expected: credit a method called as <local>.<method>(...) inside a Svelte <template> when <local> resolves to an instance of the class, parallel to the existing Vue/Angular template member-access tracking.

    Interface

    No new interfaces are introduced.

  2. Assistant

    I'll trace how Vue/Angular template member-access is credited and how Svelte templates are parsed, then add the same tracking for Svelte member expressions.

  3. Assistant

    Confirming the issue: $props() destructuring doesn't register typed bindings in binding_target_names. Implementing the fix.

  4. Assistant

    Adding tests and running them:

  5. Assistant

    Fixed. Svelte 5 $props() destructuring wasn’t registering typed instance bindings in binding_target_names, so template calls like resultState.pin(...) never mapped to ResultState.pin.

    Root cause: The template scanner already remaps member accesses through bound_targets (same path as counter.bump() from new Counter()), but resultState from:

    let { resultState }: Props = $props();
    

    was never added to binding_target_names. Only patterns like const x = new Class() were tracked.

    Fix: In the visitor:

    1. Store local type shapes — interface/type-alias property→type mappings (e.g. Props.resultState → ResultState)
    2. Detect props destructuring — let { ... }: Props = $props() (also defineProps() for Vue parity)
    3. Register bindings — map each destructured local to its annotated class type in binding_target_names

    Template scanning then remaps resultState.pin(...) → ResultState.pin, and the existing unused-class-member analysis credits the method.

    Tests added:

    • svelte_props_destructure_template_member_call_marks_class_member_usage — hister-style Props interface + $props()
    • svelte_props_destructure_inline_type_marks_class_member_usage — inline { resultState: ResultState }
    • template_member_call_maps_props_instance_to_class — template scanner unit test

    All 65 Svelte template tests and 305 visitor tests pass; clippy is clean.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.