# no-unused-components

Rule `vue/no-unused-components`. Disallow registering components that are not used inside templates

- Source: vue
- Technologies: Vue
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 11.8M weekly downloads of presets that enable it
- Trend: +49.7% last quarter
- Rank: #843 by reach, #846 by growth

## Linters

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

## Code examples

### Incorrect: the rule reports this

```vue
<template>
  <div>
    <h2>Lorem ipsum</h2>
    <TheModal />
  </div>
</template>

<script>
import TheButton from 'components/TheButton.vue'
import TheModal from 'components/TheModal.vue'

export default {
  components: {
    TheButton, // Unused component
    'the-modal': TheModal // Unused component
  }
}
</script>
```

```vue
<template>
  <div>
    <h2>Lorem ipsum</h2>
    <component :is="computedComponent" />
  </div>
</template>

<script>
import TheButton from 'components/TheButton.vue'
import TheSelect from 'components/TheSelect.vue'
import TheInput from 'components/TheInput.vue'

export default {
  components: {
    TheButton, // <- not used
    TheSelect, // <- not used
    TheInput, // <- not used
  },
  computed: {
    computedComponent() {}
  }
}
</script>
```

### Correct: the rule accepts this

```vue
<template>
  <div>
    <h2>Lorem ipsum</h2>
    <the-modal>
      <component is="TheInput" />
      <component :is="'TheDropdown'" />
      <TheButton>CTA</TheButton>
    </the-modal>
  </div>
</template>

<script>
import TheButton from 'components/TheButton.vue'
import TheModal from 'components/TheModal.vue'
import TheInput from 'components/TheInput.vue'
import TheDropdown from 'components/TheDropdown.vue'

export default {
  components: {
    TheButton,
    TheModal,
    TheInput,
    TheDropdown,
  }
}
</script>
```

```vue
<template>
  <div>
    <h2>Lorem ipsum</h2>
    <TheButton v-if="" />
    <TheSelect v-else-if="" />
    <TheInput v-else="" />
  </div>
</template>

<script>
import TheButton from 'components/TheButton.vue'
import TheSelect from 'components/TheSelect.vue'
import TheInput from 'components/TheInput.vue'

export default {
  components: {
    TheButton,
    TheSelect,
    TheInput,
  },
}
</script>
```

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-unused-components": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Vue recommended](https://lintradar.dev/presets/vue-recommended.md) | ESLint | `eslint-plugin-vue` | 118 | 9.5M | +46.6% |
| [Vue essential](https://lintradar.dev/presets/vue-essential.md) | ESLint | `eslint-plugin-vue` | 85 | 9.5M | +46.6% |
| [Vue strongly recommended](https://lintradar.dev/presets/vue-strongly-recommended.md) | ESLint | `eslint-plugin-vue` | 110 | 9.5M | +46.6% |
| [Nuxt](https://lintradar.dev/presets/nuxt.md) | ESLint | `@nuxt/eslint-config` | 188 | 1.5M | +72.8% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |

## Related rules

- [vue/no-parsing-error](https://lintradar.dev/rules/vue/no-parsing-error.md): Disallow parsing errors in `<template>`
- [vue/component-definition-name-casing](https://lintradar.dev/rules/vue/component-definition-name-casing.md): Enforce specific casing for component definition name
- [vue/jsx-uses-vars](https://lintradar.dev/rules/vue/jsx-uses-vars.md): Prevent variables used in JSX to be marked as unused
- [vue/v-on-event-hyphenation](https://lintradar.dev/rules/vue/v-on-event-hyphenation.md): Enforce v-on event naming style on custom components in template
- [vue/comment-directive](https://lintradar.dev/rules/vue/comment-directive.md): Support comment-directives in `<template>`
- [vue/first-attribute-linebreak](https://lintradar.dev/rules/vue/first-attribute-linebreak.md): Enforce the location of first attribute

---

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