noVueContentOutsideBlock (HTML)
Language HTML
Summary
Section titled “Summary”- Diagnostic Category:
lint/nursery/noVueContentOutsideBlock - This rule has an unsafe fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
- Same as
vue/no-content-outside-block
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noVueContentOutsideBlock": "error" } } }}Description
Section titled “Description”Disallow content outside of the top-level blocks in Vue components.
A Vue component file is made of top-level blocks, such as <template>,
<script>, <style>, and custom blocks like <docs>. Vue only reads
what is inside these blocks and drops everything between them. Text or
code placed outside of a block never renders or runs, so it is usually
a leftover or a mistake.
HTML comments outside of the blocks are allowed.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<template> <div>Hello</div></template>
console.log("hello");
<script>export default {};</script>code-block.vue:5:1 lint/nursery/noVueContentOutsideBlock FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ This content is outside of the top-level blocks.
3 │ </template>
4 │
> 5 │ console.log("hello");
│ ^^^^^^^^^^^^^^^^^^^^^
6 │
7 │ <script>
ℹ Vue only reads the top-level blocks of a component, such as <template>, <script>, and <style>. Anything outside of them is dropped, so it never renders or runs.
ℹ Move this content into a block, or remove it.
ℹ 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.
ℹ Unsafe fix: Remove the content outside of the top-level blocks.
2 2 │ <div>Hello</div>
3 3 │ </template>
4 │ -
5 │ - console.log("hello");
6 4 │
7 5 │ <script>
<!-- A comment between the blocks --><template> <div>Hello</div></template>
<script>console.log("hello");export default {};</script>
<docs> Some documentation.</docs>Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.