# prefer-template

Rule `vue/prefer-template`. Require template literals instead of string concatenation in `<template>`

- Source: vue
- Technologies: Vue
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 758.7K weekly downloads of presets that enable it
- Trend: +49.9% last quarter
- Rank: #1584 by reach, #801 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vue/prefer-template` | no | safe | package `eslint-plugin-vue` | [docs](https://eslint.vuejs.org/rules/prefer-template.html) |
| Biome | `style/useTemplate` | yes | unsafe | group style, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/use-template/) |

## Code examples

### Incorrect: the rule reports this

```js
const s = foo + "baz";
```

```js
const s = 1 + 2 + "foo" + 3;
```

```js
const s = 1 * 2 + "foo";
```

### Correct: the rule accepts this

```js
let s = "foo" + "bar" + `baz`;
```

```js
let s = `value: ${1}`;
```

Examples from the Biome documentation.

## Enable it

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

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

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

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "useTemplate": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |

## Related rules

- [eslint/prefer-template](https://lintradar.dev/rules/eslint/prefer-template.md): Require template literals instead of string concatenation
- [vue/object-shorthand](https://lintradar.dev/rules/vue/object-shorthand.md): Require or disallow method and property shorthand syntax for object literals in `<template>`
- [vue/array-bracket-spacing](https://lintradar.dev/rules/vue/array-bracket-spacing.md): Enforce consistent spacing inside array brackets in `<template>`
- [vue/no-useless-v-bind](https://lintradar.dev/rules/vue/no-useless-v-bind.md): Disallow unnecessary `v-bind` directives
- [vue/arrow-spacing](https://lintradar.dev/rules/vue/arrow-spacing.md): Enforce consistent spacing before and after the arrow in arrow functions in `<template>`
- [vue/no-unused-refs](https://lintradar.dev/rules/vue/no-unused-refs.md): Disallow unused refs

---

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