eslint-plugin-vue
eslint-plugin-vue copied to clipboard
Vuex and Pinia support
Tell us about your environment
- ESLint version: 7.x.x
- eslint-plugin-vue version: 7.20.0
- Node version: 14.x.x
The problem you want to solve.
When mapping props with Vuex's mapState & mapGetters and methods with mapMutations & mapActions, vue/no-unused-properties doesn't report those props/methods if they're unused. Also, vue/no-undef-properties reports those props as undefined if they're used.
Your take on the correct solution to problem. Considering Vuex is a core part of the Vue ecosystem & is widely used, the aforementioned rules should take mapped props & methods into account.
Additional context

Still hopeful for this, even though it's been sitting here for 5 months... Don't know if these would help?
I'm using a version of these with eslint-plugin-local-rules for now.
This issue is also applicable to Pinia v2 state management
I would definitely consider this as useful, so +1 :)
This also affects vue/no-computed-properties-in-data. Computed props defined using mapGetters() don't appear as errors when referenced in data().
I think this issue is just partially resolved, because https://github.com/vuejs/eslint-plugin-vue/pull/2276 only add support to Vuex, not Pinia. With Pinia you have to pass the store as first argument on its map methods (egg: mapState(useStoreName, ['state'])) and currently the plugin does not identify this use case.
Also Pinia has some additional methods like mapWritableState, mapStores.
This support would be very helpfull to me, how can I help?
A PR which adds support for Pinia's methods along with test cases would be appreciated :slightly_smiling_face: