vue/require-slots-as-functions
eslint-plugin-vue
No autofixRecommended
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/require-slots-as-functions": "error",
},
},
];<script>
export default {
render(h) {
var children = this.$slots.default
return h('div', children.filter(...))
}
}
</script><script>
export default {
render(h) {
var children = this.$slots.default()
return h('div', children)
}
}
</script>Examples from the Oxlint documentation.
vue/require-slots-as-functions
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/require-slots-as-functions": "error",
},
},
];vue/require-slots-as-functions
vue plugin · correctness
{
"plugins": [
"vue"
],
"rules": {
"vue/require-slots-as-functions": "error"
}
}nursery/useVueSlotsAsFunctions
nursery · since 2.6.5
{
"linter": {
"rules": {
"nursery": {
"useVueSlotsAsFunctions": "error"
}
}
}
}Enforce render function to always return value
Enforce that a return statement is present in computed property
Require prop type to be a constructor
Enforce that a return statement is present in emits validator
Enforce import from 'vue' instead of import from '@vue/*'
Enforce valid defineEmits compiler macro