Skip to content

useVueRenderReturn (JavaScript)

Language JavaScript (and super languages)
biome.json
{
"linter": {
"rules": {
"nursery": {
"useVueRenderReturn": "error"
}
}
}
}

Require the render function of a Vue component to return a value.

A render function describes what a component displays, and Vue uses the value it returns. When the function ends without a return statement, or uses return; without a value, the component renders nothing.

The rule reports a render function when at least one way through the function ends without returning a value.

<script>
import { h } from "vue";
export default {
render() {
if (this.visible) {
return h("div", "hello");
}
},
};
</script>
code-block.vue:5:3 lint/nursery/useVueRenderReturn ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ This render function doesn't always return a value.

4 │ export default {
> 5 │ render() {
│ ^^^^^^
6 │ if (this.visible) {
7 │ return h("div", "hello");

ℹ Vue displays what the render function returns. When the function ends without returning a value, the component displays nothing.

ℹ Return a value at the end of every path through the function. Return null if the component should display nothing.

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<script>
export default {
render: function () {
return;
},
};
</script>
code-block.vue:3:3 lint/nursery/useVueRenderReturn ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ This render function doesn't always return a value.

1 │ <script>
2 │ export default {
> 3 │ render: function () {
│ ^^^^^^
4 │ return;
5 │ },

ℹ Vue displays what the render function returns. When the function ends without returning a value, the component displays nothing.

ℹ Return a value at the end of every path through the function. Return null if the component should display nothing.

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<script>
import { h } from "vue";
export default {
render() {
if (this.visible) {
return h("div", "hello");
}
return null;
},
};
</script>