Vue API should be called with the correct number of arguments

  • VUE_MISMATCHED_COUNT_OF_ARGS
  • Error
  • Medium
  • cwe, vue

This rule applies when Vue API is called with the wrong number of arguments.

Because Vue API has the specification for its arguments, arguments are useless or cause undefined behavior if the number of arguments does not match.

Noncompliant Code Example

View with compliant examples side by side
<script>
export default {
  methods: {
    handleClick() {
      this.$nextTick(doSomething, 0); // VUE_MISMATCHED_COUNT_OF_ARGS alarm because '$nextTick()' does not take the second argument.
    }
  }
}
</script>

Compliant Code Example

View with noncompliant examples side by side
<script>
export default {
  methods: {
    handleClick() {
      this.$nextTick(doSomething);
    }
  }
}
</script>

Version

This rule was introduced in DeepScan 1.39.0.

See

Was this documentation helpful?