ISSUE DESCRIPTION unused-class-members FP: methods called only from Svelte <template>…
- User
ISSUE DESCRIPTION
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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /fallow, current file: none) bash-$
Assistant
Let's replicate with a main.ts entry point.
Assistant
Now let's add the ObjectPattern branch right after this.
Assistant
Now add the helper method
record_typed_object_pattern_bindingsnearrecord_typed_binding.Assistant
Now let's check ObjectPattern is imported in visit_impl.rs.
Assistant
Good,
ObjectPatternis already used elsewhere so it's imported. Let's build.Assistant
Builds fine. Now let's rebuild the CLI and re-run the reproduction.
Assistant
Found the cache directory. Let's clear it and re-run.
Assistant
Good, clean now (no diff for sfc.rs). Let's rebuild and verify the full flow, plus test the original typed-BindingIdentifier scenario still works, and a case where the method is truly unused stays reported.
Assistant
Now let's check that truly-unused methods are still detected, and non-arrow direct call in markup (like
{resultState.pin()}without event handler) also works.Assistant
All four used methods (including plain markup interpolation calls, not just event handlers) are correctly credited, and the truly unused method is still correctly flagged. Now let's run the existing test suite to make sure nothing broke.
Assistant
All extract tests pass. Now let's run the broader test suite including core integration tests, sfc_parsing, svelte tests, and cli tests.
Assistant
All pass. Now run full workspace test suite to catch anything else affected.
Assistant
Confirmed pre-existing failure unrelated to our change (likely due to running as root, where read-only permissions don't block writes). Let's restore our changes.
Assistant
Now let's run the rest of the workspace tests excluding that known-broken test to make sure everything else passes.
Assistant
All other tests pass. Let's also scroll up to confirm no failures earlier in the run.
Assistant
All green except the pre-existing unrelated failure. Now let's clean up the temp test directory and double check final diff.
Assistant
Renamed destructuring works correctly too (only the genuinely unused method is flagged). Let's clean up.
Assistant
The diff is clean, containing only the intended fix. Let me review the checklist:
Checklist review:
-
If an error was reported in the issue description, I have successfully reproduced it. ✅ I built a minimal Svelte fixture mirroring the reported scenario (a class
ResultStatewith methodsonOpen/pin/updateLabel/addSkipRule, instantiated in a parent component and passed as a prop toResultActionsMenu.svelte, whose template callsresultState.pin(...)etc.). Using the Svelte 5 rune-stylelet { resultState }: { resultState: ResultState } = $props();prop declaration pattern (a very common idiom in modern Svelte 5 codebases), I confirmedfallow dead-code --unused-class-membersfalsely reported all four methods as unused. -
If an error was reported in the issue description, I have confirmed that my fix resolves the error. ✅ After patching
crates/extract/src/visitor/visit_impl.rsto handle destructuring-pattern type annotations (mapping each destructured local to its class via the matching field in the type literal, mirroring the existingrecord_typed_bindinglogic for single-identifier bindings), the same reproduction now reports "No issues found" for the used methods, while a genuinely-unused method added to the same class is still correctly flagged. -
I have thought about edge cases and made sure my fix handles them as well. ✅ Verified: (1) plain-identifier prop typing (
export let x: T) still works (pre-existing path, untouched), (2) direct method calls in markup interpolation (not just event-handler arrows) are credited, (3) renamed destructured bindings ({ resultState: rs }) are correctly resolved, (4) truly-unused methods remain reported (no over-crediting), (5) the fix is additive and narrowly scoped to theObjectPattern+ whole-pattern type-annotation shape, reusing existing helpers (extract_object_pattern_bindings,extract_nested_type_bindings,resolve_class_type_param) so it also benefits Vue (which shares the samebinding_target_names/bound_targetspipeline) without new bespoke code paths. -
I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. ✅ Ran
cargo test -p fallow-extract,cargo test -p fallow-core, andcargo test --workspace. All pass except one pre-existing, unrelated failure (fix_batch_aborts_when_a_target_directory_is_read_only), which I confirmed also fails on the unmodified codebase (viagit stash) — it's an environment artifact (tests run as root, so read-only-directory permission checks don't actually block writes), not something introduced by this change.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →