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

Rule improvement: no-side-effects-in-computed-properties #97

Closed
michalsnik opened this issue Jul 19, 2017 · 3 comments
Closed

Rule improvement: no-side-effects-in-computed-properties #97

michalsnik opened this issue Jul 19, 2017 · 3 comments

Comments

@michalsnik
Copy link
Member

michalsnik commented Jul 19, 2017

As @armano2 pointed in #58 we should consider supporting few more cases in this rule:

1. Plugins provided by vuejs team, like:

Vue-router

export default {
  computed: {
    foo () {
      this.$router.go(-1)
      this.$router.push({})
      this.$router.replace({})
      return true
    }
  }
}

or Vuex

export default {
  computed: {
    foo () {
      this.$store.commit({}) // Mutations
      this.$store.dispatch('', {}) // Actions
      return true
    }
  }
}

2. Prototype methods

return Array.prototype.unshift.apply(this.object, data) // i know this is invalid
return Object.assign(this.object, data);

There are probably more cases. We should gather them all here in this topic, discuss and choose which one are we going to support. Supporting different cases is good, but too many edge cases - not necessarily. We need to be smart about this.

@michalsnik
Copy link
Member Author

Not a priority now. Current solution seems to be good enough.

@ylc395
Copy link
Contributor

ylc395 commented Sep 3, 2024

This issue should be re-opened. Would you accept a PR about this proposal ? @michalsnik

We can add a option to this rule, for example: {checkFloatingCall: true} to report errors of this kind.

@FloEdelmann
Copy link
Member

Please open a new issue following the issue template and link to this issue from there, rather than commenting on an issue closed 7 years ago.

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

No branches or pull requests

3 participants