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.
Assistant
Let's create a temporary fixture mimicking the hister scenario and a temp test to reproduce.
Assistant
Good, these methods exist. Now let's look at TSInterfaceBody and TSInterfaceDeclaration struct fields, and TSTypeAliasDeclaration fields.
Assistant
Now let's refactor the helper function to share logic between TSTypeLiteral members and interface body members.
Assistant
Now let's implement all edits. First add the field to mod.rs struct and Default derive (check if Default is derived).
Assistant
Good,
Defaultis derived for the extractor struct (line 103 area). Let's add the field next toplaywright_fixture_types.Assistant
Now let's add population logic in
visit_declarationand the new helper methods in visit_impl.rs.Assistant
Now let's add the helper methods
record_local_type_property_bindings,resolve_property_type_bindings,record_destructured_object_type_binding, anddestructured_local_binding_namenearrecord_typed_binding.Assistant
Now add the free function
destructured_local_binding_nameand ensure imports forObjectPattern,extract_type_reference_name,TSTypeare present.Assistant
Now add the free function
destructured_local_binding_name. Let's place it neartype_name_root.Assistant
Now wire the call into
visit_variable_declaration(and alsovisit_formal_parameterfor generality) forObjectPattern.Assistant
Now update
visit_formal_parametersimilarly for generality (constructor/function destructured typed params):Assistant
Now let's build and fix compile errors.
Assistant
No warnings. Now let's build the CLI and test with our repro.
Assistant
Cache directory found! Let's clear it and rerun.
Assistant
The fix works. Now let's remove the temporary debug test code and re-run the full test suite.
Assistant
Good, debug tests removed. Now let's write a proper test fixture matching the repo's conventions, mirroring
vue-projectfor Svelte, and add an integration test.Assistant
Now let's update App.svelte to instantiate ResultState and pass it into the new component.
Assistant
Now let's run this test and other sfc/svelte related tests, plus the full extract test suite.
Assistant
All pass, including the new test. Now let's run the full test suite across the workspace to check for regressions.
Assistant
Confirmed pre-existing failure unrelated to our change (fails as root due to permission test assumptions). Let's restore our changes.
Assistant
Good, changes restored. Now let's run the rest of the workspace tests (excluding that pre-existing failure) to confirm nothing else broke.
Assistant
All tests pass except the one pre-existing, unrelated failure. Let's clean up temp files and repro dirs.
Assistant
Let's review the final diff to ensure quality and correctness.
Assistant
No clippy warnings. Let's also run clippy for core (test fixture changes) and full workspace clippy quickly.
Assistant
Clean. Let's view the final diff for visit_impl.rs and mod.rs to double check everything.
Assistant
Now let's rebuild and rerun tests once more after formatting.
Assistant
All extract tests pass. Let's confirm core tests too.
Assistant
All good. Let's also clean stray
.fallowcache directories left in the repository fixtures (should not exist), and check git status for any unintended files.Assistant
This all looks correct and complete. Let's do a final full workspace test run to be thorough, then review checklist.
Assistant
Only the pre-existing unrelated failure remains (confirmed earlier via
git stashto be present on baseline). All other tests pass.Assistant
Good, now it's staged. Let's do a final review of all diffs before submitting.
Assistant
This confirms
git diff HEADpicks up the staged new file too. Now let's finalize with the checklist review.Assistant
Everything looks good. Let's now go through the checklist explicitly.
Assistant
Clean, no stray cache dirs. Now let's finalize by re-running the specific integration tests once more for certainty.
Assistant
All good. Now checklist review:
Checklist:
-
If an error was reported in the issue description, I have successfully reproduced it. ✅ I reproduced the FP with a minimal fixture (
ResultActionsMenu.sveltereceiving a class instance vialet { resultState }: { resultState: ResultState } = $props()and callingresultState.pin()in the template), confirmingResultState.pinwas falsely reported as an unused class member before the fix. -
If an error was reported in the issue description, I have confirmed that my fix resolves the error. ✅ After implementing the fix (resolving destructured object-pattern bindings typed by inline object literals or named interfaces/type-aliases back to their class type, mirroring the existing
new ClassName()/BindingIdentifiertyped-binding tracking), the same repro no longer flags , while the genuinely unused / methods are still correctly flagged.
-
Assistant
- 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 --workspace --no-fail-fast(2151+1638+524+... passing across all crates) — the only failure isfix_batch_aborts_when_a_target_directory_is_read_only, which I verified viagit stash/git stash popfails identically on the unmodified baseline (root-user filesystem-permission test artifact, unrelated to this change). Also ran targetedfallow-extract/fallow-coreunit and integration test suites, andcargo clippyon both crates with zero warnings.
Everything is verified. Let's submit.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. ✅ Ran
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.