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
I’ll trace the Svelte template/reference pipeline and the existing Vue/Angular member-access logic, then implement the analogous resolution and add a focused regression test.
- Assistant
rgis unavailable in this checkout, so I’m usingfind/grep. I’ve confirmed this is the Rust monorepo and am narrowing the relevant analyzer and fixture tests before editing. - Assistant
The current tree already contains a partial Svelte remapping path for direct constructions such as
const counter = new Counter(). I found the remaining gap relevant to real Svelte 5 code: destructured$props()bindings (especiallylet { resultState }: Props = $props()) are not registered as class-typed locals, so template member calls cannot be credited. I’m extending the binding resolution to cover that shape and testing the exact direct-call form. - Assistant
The implementation now resolves destructured locals through local interface/type-alias property types before scanning the Svelte markup. The regression fixture uses
let { resultState }: Props = $props()and callsresultState.pin()only from markup; I’m running formatting plus extractor and end-to-end analyzer tests now. - Assistant
The end-to-end regression passes even with
ResultStateimported type-only and thePropsinterface declared after the destructuring, confirming the resolution is source-order independent. I’m doing the final lint and diff review now.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.