useVueRenderReturn (JavaScript)
Language JavaScript (and super languages)
Summary
Section titled “Summary”- Rule available since:
v2.6.5 - Diagnostic Category:
lint/nursery/useVueRenderReturn - This rule doesn’t have a fix.
- The default severity of this rule is error.
- This rule belongs to the following domains:
- Sources:
- Inspired from
vue/require-render-return
- Inspired from
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useVueRenderReturn": "error" } } }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<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>Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.