Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vuex and Pinia support #1675

Closed
inker opened this issue Oct 22, 2021 · 6 comments · Fixed by #2276 or #2441
Closed

Vuex and Pinia support #1675

inker opened this issue Oct 22, 2021 · 6 comments · Fixed by #2276 or #2441

Comments

@inker
Copy link

inker commented Oct 22, 2021

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
image

@dsl101
Copy link
Contributor

dsl101 commented Apr 20, 2022

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.

@Ornhoj
Copy link

Ornhoj commented Jun 24, 2022

This issue is also applicable to Pinia v2 state management

@FloEdelmann FloEdelmann changed the title Vuex support Vuex and Pinia support Jun 24, 2022
@Thomas-1985
Copy link

I would definitely consider this as useful, so +1 :)

@haysmike
Copy link

This also affects vue/no-computed-properties-in-data. Computed props defined using mapGetters() don't appear as errors when referenced in data().

@FloEdelmann FloEdelmann linked a pull request Nov 14, 2023 that will close this issue
@luizotcarvalho
Copy link
Contributor

I think this issue is just partially resolved, because #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?

@FloEdelmann
Copy link
Member

A PR which adds support for Pinia's methods along with test cases would be appreciated 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants