# max-template-depth

Rule `vue/max-template-depth`. Enforce maximum depth of template

- Source: vue
- Technologies: Vue
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #2053 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vue/max-template-depth` | no | no | package `eslint-plugin-vue` | [docs](https://eslint.vuejs.org/rules/max-template-depth.html) |

## Code examples

### Incorrect: the rule reports this

```vue
<template>
  <main-container>
    <child-component>
      <div />
    </child-component>
    <child-component>
      <nested-component>
        <div>
          <div />
        </div>
      </nested-component>
    </child-component>
  </main-container>
</template>
```

### Correct: the rule accepts this

```vue
<template>
  <main-container>
    <child-component>
      <div />
    </child-component>
  </main-container>
</template>
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { vue },
    rules: {
      "vue/max-template-depth": "error",
    },
  },
];
```

## Related rules

- [vue/max-lines-per-block](https://lintradar.dev/rules/vue/max-lines-per-block.md): Enforce maximum number of lines in Vue SFC blocks
- [vue/multiline-ternary](https://lintradar.dev/rules/vue/multiline-ternary.md): Enforce newlines between operands of ternary expressions in `<template>`
- [vue/max-len](https://lintradar.dev/rules/vue/max-len.md): Enforce a maximum line length in `.vue` files
- [vue/new-line-between-multi-line-property](https://lintradar.dev/rules/vue/new-line-between-multi-line-property.md): Enforce new lines between multi-line properties in Vue components
- [vue/match-component-import-name](https://lintradar.dev/rules/vue/match-component-import-name.md): Require the registered component name to match the imported component name
- [vue/no-bare-strings-in-template](https://lintradar.dev/rules/vue/no-bare-strings-in-template.md): Disallow the use of bare strings in `<template>`

---

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