An ESLint plugin that enforces best practices for writing Pinia stores in Vue.js applications. Current stable version is 0.4.2, released in November 2025, with a focus on store structure and common pitfalls. It provides a recommended configuration that includes rules like never-export-initialized-store, no-duplicate-store-ids, no-return-global-properties, and no-store-to-refs-in-store, plus optional rules like prefer-single-store-per-file. Ships TypeScript types, requires ESLint >=8.0.0 and @typescript-eslint/utils >=7.5, and supports both legacy ESLint config and flat config.
npm install eslint-plugin-piniaVerified import paths — ran on the pinned version, not inferred.
Shows how to import and configure the plugin in ESLint flat config, including rules and recommended preset.
Use pinia.configs["recommended-flat"] instead of pinia.configs["recommended"].
Consider migrating to flat config (eslint.config.js) with pinia.configs["recommended-flat"].
Explicitly enable the rule if desired: "pinia/prefer-single-store-per-file": "warn".
Upgrade ESLint to 8.0.0 or higher, and Node to 18+.
Remove storeToRefs calls from inside defineStore; use the store's reactive properties directly.
Run: npm install eslint-plugin-pinia --save-dev and ensure plugin name is 'pinia' (without 'eslint-plugin-') in legacy config.
Use dynamic import: const pinia = await import('eslint-plugin-pinia'); or switch to ESM.Replace pinia.configs['recommended'] with pinia.configs['recommended-flat'].
Add import { defineStore } from 'pinia' to your store file.