Skip to content
Fallow home
All docs pages

Docs home

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

FactValue
Issue typeunused-store-member
Rule id in SARIF outputfallow/unused-store-member
Commandfallow dead-code
Default severitywarn
Config key in rulesunused-store-members
Filter option--unused-store-members
Suppression comment// fallow-ignore-next-line unused-store-member
Fixable with fallow fixNo
Opt-inNo

When to keep the code

  • A Pinia plugin, $onAction or 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 as mapState and mapActions. A parameter typed as ReturnType<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.