unused-class-members FP: methods called only from Svelte <template> member expressions…
- 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 exampleresultState.pin(...)in markup) are reported asunused-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.addSkipRuleare each invoked from.sveltetemplates (resultState.pin(...)inResultActionsMenu.svelte) yet reported unused. The repo currently setsrules.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.
- Assistant
Investigating how template member-access is tracked for Vue/Angular and how Svelte templates are parsed so we can extend the same logic.
- Assistant
The basic pattern passes locally; checking hister for the specific binding pattern that triggers the false positive.
- Assistant
Reproduced the failure: props destructured from
$props()aren't mapped to their class type. Searching how similar patterns are handled elsewhere. - Assistant
Implementing typed destructuring support: mapping
$props()destructuring through interface/type annotations tobinding_target_names. - Assistant
Adding an integration test and a Svelte unit test, then running the broader test suite.
- Assistant
Fixed. The Svelte template scanner already handled member expressions like
resultState.pin(...)when the local was inbound_targets; the gap was that props destructured from$props()were never registered there.Root cause
In hister's
ResultActionsMenu.svelte,resultStatecomes from:typescriptinterface Props { resultState: ResultState; // ... } let { resultState, url }: Props = $props();Fallow only mapped typed bindings for simple identifiers (
const x: Foo), not object destructuring. SoresultStatenever becameresultState → ResultStateinbinding_target_names, and template member calls were dropped.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.