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 add the same credit for Svelte member expressions.
- Assistant
Running a quick reproducer to see what's failing:
- Assistant
Adding a reproducer test, then implementing the fix.
- Assistant
Implementing binding resolution for typed object destructuring (e.g. Svelte 5
$props()). - Assistant
SFC reads
binding_target_namesbefore finalize runs. Resolving binding targets before the template scan. - Assistant
Fixed. Svelte template member-expression tracking was already wired up; the gap was that props destructuring never populated
binding_target_names, and the SFC pipeline read that map before deferred resolution ran.Root cause
Two issues stacked:
- Typed props destructuring wasn’t resolved — patterns like hister’s:
interface Props { resultState: ResultState; } let { resultState }: Props = $props();never mapped
resultState→ResultState. Onlyconst x = new Class()was tracked.- SFC read bindings too early —
merge_script_into_modulecopiedbinding_target_namesbeforemerge_into’s finalize pass, so even deferred bindings (destructuring, factory calls, object-literal aliases) never reached the template scanner.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.