Unused store members
What an unused-store-member finding of fallow dead-code means, why it matters and how to fix it.
What it reports
Store member is never accessed by any consumer.
Dead code explains how fallow finds it.
Why it matters
Pinia store members (a state / getters / actions key, or a setup-store returned key) declared but never accessed by any consumer project-wide. The store binding is imported (so the module is reachable) yet a specific member is dead. Defaults to warn, not error: a store has an open declaration surface (plugins, dynamic dispatch) so confidence is lower. Activates only when pinia or @pinia/nuxt is a declared dependency.
Example
useCartStore declares a discountTotal getter that no component, composable, or other store ever reads.
Fix
Remove the unused state property, getter, or action. If it is consumed reflectively (a Pinia plugin, $onAction, or dynamic dispatch), suppress the line with // fallow-ignore-next-line unused-store-member.
Facts
| Fact | Value |
|---|---|
| Issue type | unused-store-member |
| Rule id in SARIF output | fallow/unused-store-member |
| Command | fallow dead-code |
| Default severity | warn |
Config key in rules | unused-store-members |
| Filter option | --unused-store-members |
| Suppression comment | // fallow-ignore-next-line unused-store-member |
Fixable with fallow fix | No |
| Opt-in | No |
When to keep the code
- A Pinia plugin,
$onActionor a call with a computed name uses the member. Fallow cannot see these uses: suppress the line.
Notes
- Fallow counts a read through the store instance, a destructured key,
storeToRefs, and the map helpers such asmapStateandmapActions. A parameter typed asReturnType<typeof useCartStore>counts too. - A write to a state key is not a read, so a state key that code only writes stays reported.
- Fallow does not check names that start with
$, and it does not check a setup store that returns a spread object.