# no-content-outside-block

Rule `vue/no-content-outside-block`. Disallow content outside of the top-level blocks

- Source: vue
- Technologies: Vue
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1825 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vue/no-content-outside-block` | no | suggestion | package `eslint-plugin-vue` | [docs](https://eslint.vuejs.org/rules/no-content-outside-block.html) |
| Biome | `nursery/noVueContentOutsideBlock` | no | unsafe | group nursery, since 2.6.10 | [docs](https://biomejs.dev/linter/rules/no-vue-content-outside-block/) |

## Code examples

### Incorrect: the rule reports this

```vue
<template>
  <div>Hello</div>
</template>

console.log('this never runs')

<script>
console.log('this runs')
</script>

hello world
```

### Correct: the rule accepts this

```vue
<template>
  <div>Hello</div>
</template>

<script>
console.log('this runs')
</script>

<docs>
Custom blocks are not reported.
</docs>
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import vue from "eslint-plugin-vue";

export default [
  {
    plugins: { vue },
    rules: {
      "vue/no-content-outside-block": "error",
    },
  },
];
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noVueContentOutsideBlock": "error"
      }
    }
  }
}
```

## Related rules

- [vue/no-constant-condition](https://lintradar.dev/rules/vue/no-constant-condition.md): Disallow constant expressions in conditions in `<template>`
- [vue/no-define-model-default](https://lintradar.dev/rules/vue/no-define-model-default.md): Disallow default values in `defineModel`
- [vue/no-console](https://lintradar.dev/rules/vue/no-console.md): Disallow the use of `console` in `<template>`
- [vue/no-implicit-coercion](https://lintradar.dev/rules/vue/no-implicit-coercion.md): Disallow shorthand type conversions in `<template>`
- [vue/match-component-file-name](https://lintradar.dev/rules/vue/match-component-file-name.md): Require component name property to match its file name
- [vue/no-multiple-objects-in-class](https://lintradar.dev/rules/vue/no-multiple-objects-in-class.md): Disallow passing multiple objects in an array to class

---

Web page: https://lintradar.dev/rules/vue/no-content-outside-block. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
