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 setup>
import { provide } from 'vue';

const message = 'Hello World';
provide(message); // VUE_MISMATCHED_COUNT_OF_ARGS alarm because 'provide()' takes two arguments.
</script>

Compliant Code Example

View with noncompliant examples side by side
<script setup>
import { provide } from 'vue';

const message = 'Hello World';
provide('message', message);
</script>

Version

This rule was introduced in DeepScan 1.39.0.

See

Was this documentation helpful?