vue/define-props-declaration
eslint-plugin-vue
No autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/define-props-declaration": "error",
},
},
];// "vue/define-props-declaration": ["error", "type-based"]
<script setup lang="ts">
const props = defineProps({
kind: { type: String },
})
</script>
// "vue/define-props-declaration": ["error", "runtime"]
<script setup lang="ts">
const props = defineProps<{
kind: string;
}>()
</script>// "vue/define-props-declaration": ["error", "type-based"]
<script setup lang="ts">
const props = defineProps<{
kind: string;
}>()
</script>
// "vue/define-props-declaration": ["error", "runtime"]
<script setup lang="ts">
const props = defineProps({
kind: { type: String },
})
</script>Examples from the Oxlint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
vue/define-props-declaration
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/define-props-declaration": "error",
},
},
];vue/define-props-declaration
vue plugin · style
{
"plugins": [
"vue"
],
"rules": {
"vue/define-props-declaration": "error"
}
}style/useVueConsistentDefinePropsDeclaration
style · since 2.3.11
{
"linter": {
"rules": {
"style": {
"useVueConsistentDefinePropsDeclaration": "error"
}
}
}
}Enforce declaration style of defineEmits
Enforce consistent style for props destructuring
Disallow this usage in a beforeRouteEnter method
Require components to be the default export
Require ref and shallowRef functions to be strongly typed