Pinia · PINIA0001
Give every Pinia store a unique id
Report possible collisions between literal store ids across the project.
Run this rule
pnpm vite-doctor . --rules pinia/stores/unique-store-id
Why it matters
Pinia keys every store instance by its id. The first useStore() call for an id creates the store and caches it in the Pinia instance; every later useStore() call on that Pinia instance with the same id returns that cached instance without running its own setup or options. If both definitions use that instance, the second definition is silently ignored, so callers receive the first store's state, getters, and actions.
Recommended fix
Give each defineStore() call its own id. If both definitions describe the same store, delete one and import the remaining composable everywhere.
Useful links
Example
Use one id per store
Before
// stores/cart.ts
export const useCartStore = defineStore('cart', () => { /* ... */ })
// stores/checkout.ts
export const useCheckoutStore = defineStore('cart', () => { /* ... */ })
After
// stores/cart.ts
export const useCartStore = defineStore('cart', () => { /* ... */ })
// stores/checkout.ts
export const useCheckoutStore = defineStore('checkout', () => { /* ... */ })