Pinia · PINIA0002
Name store composables after their id
Name the variable that receives defineStore() use<Id>Store, matching the literal store id.
Run this rule
pnpm vite-doctor . --extends auto,pinia/strict --rules pinia/stores/store-name-matches-id
Why it matters
Pinia's convention is to name the defineStore() return value use followed by the store id and Store. When the composable name and the id drift apart, Devtools, SSR state keys, and HMR show an id that nobody can find by searching for the composable, and two stores can end up sharing an id unnoticed.
Recommended fix
Rename the composable to use<Id>Store, or change the id so it describes the store the composable returns. Kebab-case, snake_case, and camelCase ids map to the same PascalCase name, so 'shopping-cart' and 'shoppingCart' both expect useShoppingCartStore.
Useful links
Example
Match the composable name to the store id
Before
export const useBasket = defineStore('cart', () => {
/* ... */
})
After
export const useCartStore = defineStore('cart', () => {
/* ... */
})