# html-comment-content-spacing

Rule `vue/html-comment-content-spacing`. Enforce unified spacing in HTML comments

- 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: #1596 by reach, #813 by growth

## Linters

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

## Code examples

### Incorrect: the rule reports this

```vue
  <!--comment-->
</template>
```

```vue
</template>
```

```vue
  <!--       comment      -->
</template>
```

### Correct: the rule accepts this

```vue
<!-- comment -->
<!--
  comment
-->
```

```vue
  <!--*******
    comment
    *******-->

  <!--*******✗ BAD*******-->
</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/html-comment-content-spacing": "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

- [vue/dot-location](https://lintradar.dev/rules/vue/dot-location.md): Enforce consistent newlines before and after dots in `<template>`
- [vue/key-spacing](https://lintradar.dev/rules/vue/key-spacing.md): Enforce consistent spacing between keys and values in object literal properties in `<template>`
- [vue/custom-event-name-casing](https://lintradar.dev/rules/vue/custom-event-name-casing.md): Enforce specific casing for custom event name
- [vue/keyword-spacing](https://lintradar.dev/rules/vue/keyword-spacing.md): Enforce consistent spacing before and after keywords in `<template>`
- [vue/component-name-in-template-casing](https://lintradar.dev/rules/vue/component-name-in-template-casing.md): Enforce specific casing for the component naming style in template
- [vue/no-restricted-syntax](https://lintradar.dev/rules/vue/no-restricted-syntax.md): Disallow specified syntax in `<template>`

---

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