require-prop-types
Angular templatesHTMLVue / SvelteVue / Sveltesuspiciousno fixdefault: warnhtml/eslint-plugin-vue-recommended
What it does
Section titled “What it does”Reports a prop in the array form (defineProps(['a'])), and an object with no type or validator.
Why it matters
Section titled “Why it matters”A prop with no type accepts anything, so a wrong value is shown only as a failure far from the cause, and the component has no documentation of what it takes.
To fix, write the prop as an object with a type.
Example
Section titled “Example”... c: { required: true, type: Number }, d: Boolean,... f: {},... }, data() {...</script>
<script setup>defineProps(['x', 'y'])const ok = 1const model = defineModel()</script>Configuration
Section titled “Configuration”angular: lint: rules: require-prop-types: warn # off, warn (default), errorhtml: lint: rules: require-prop-types: warn # off, warn (default), errorsvelte: lint: rules: require-prop-types: warn # off, warn (default), errorvue: lint: rules: require-prop-types: warn # off, warn (default), errorEnabled by the presets: html/eslint-plugin-vue-recommended.
Suppress one line with sudsy-disable-next-line require-prop-types in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| eslint-plugin-vue | require-prop-types |
partial | a type it cannot resolve in the file is skipped, a component object only at the top level as for no-dupe-keys |