Skip to content

vue/max-props Restriction

What it does

Enforce maximum number of props in Vue component.

Why is this bad?

This rule enforces a maximum number of props in a Vue SFC, in order to aid in maintainability and reduce complexity.

Examples

Examples of incorrect code for this rule with the default { maxProps: 1 } option:

js
<script setup>
defineProps({
  prop1: String,
  prop2: String,
})
</script>

Examples of correct code for this rule with the default { maxProps: 1 } option:

js
<script setup>
defineProps({
  prop1: String,
})
</script>

Configuration

This rule accepts a configuration object with the following properties:

maxProps

type: integer

default: 1

The maximum number of props allowed in a Vue Single File Component (SFC).

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny vue/max-props --vue-plugin
json
{
  "plugins": ["vue"],
  "rules": {
    "vue/max-props": "error"
  }
}

References

Released under the MIT License.