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

vue/no-side-effects-in-computed-properties does not work with defineNuxtComponent() #512

Open
mbrocks1337 opened this issue Oct 17, 2024 · 2 comments
Labels

Comments

@mbrocks1337
Copy link

Environment


  • Operating System: Linux
  • Node Version: v18.19.1
  • Nuxt Version: 3.13.2
  • CLI Version: 3.14.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Package

@nuxt/eslint

Reproduction

https://stackblitz.com/edit/github-h9xb1n?file=components%2FComponentWithNuxtComponent.vue,components%2FComponentWithComponent.vue,app.vue,package.json

run "npm run lint"

Describe the bug

Using the Options API with the vue wrapper defineComponent gives you an eslint error:
"ESLint: Unexpected side effect in "bar" computed property.(vue/no-side-effects-in-computed-properties)"

Consuming the same component with defineNuxtComponent disables this feature completly

Additional context

No response

Logs

No response

@antfu
Copy link
Member

antfu commented Nov 16, 2024

Yeah, this is a limitation of eslint-plugin-vue that hard-coded the support of defineComponent - it's not Nuxt aware.

/cc @ota-meshi do you think it makes sense for eslint-plugin-vue to support detecting defineNuxtComponent? If so, do you think it needs to be configurable, or it's fine we just hard-coded and have it always on?

@antfu antfu changed the title Unexpected side effect not working with defineNuxtComponent() vue/no-side-effects-in-computed-properties does not work with defineNuxtComponent() Nov 16, 2024
@ota-meshi
Copy link

Yeah! We plan to do that in the next major version. But we don't have the time to work on a major version 😓
vuejs/eslint-plugin-vue#2311

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

No branches or pull requests

3 participants