# no-undef-directives

Rule `vue/no-undef-directives`. Disallow use of undefined custom directives

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vue/no-undef-directives` | no | no | package `eslint-plugin-vue` | [docs](https://eslint.vuejs.org/rules/no-undef-directives.html) |
| Biome | `nursery/noVueUndeclaredDirectives` | no | no | group nursery, since 2.5.14 | [docs](https://biomejs.dev/linter/rules/no-vue-undeclared-directives/) |

## Code examples

### Incorrect: the rule reports this

```vue
  <div v-foo></div>
</template>
```

```vue
  <div v-foo></div>
</template>

<script>
import vFocus from './vFocus';

export default {
  directives: {
    focus: vFocus
  }
}
</script>
```

### Correct: the rule accepts this

```vue
<input v-focus>
```

```vue
<input v-focus>
```

```vue
  <div v-foo></div>
</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/no-undef-directives": "error",
    },
  },
];
```

### Biome: `biome.json`

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

## Related rules

- [vue/no-template-target-blank](https://lintradar.dev/rules/vue/no-template-target-blank.md): Disallow target="_blank" attribute without rel="noopener noreferrer"
- [vue/no-undef-properties](https://lintradar.dev/rules/vue/no-undef-properties.md): Disallow undefined properties
- [vue/no-shadow-native-events](https://lintradar.dev/rules/vue/no-shadow-native-events.md): Disallow the use of event names that collide with native web event names
- [vue/no-use-v-else-with-v-for](https://lintradar.dev/rules/vue/no-use-v-else-with-v-for.md): Disallow using `v-else-if`/`v-else` on the same element as `v-for`
- [vue/no-setup-props-reactivity-loss](https://lintradar.dev/rules/vue/no-setup-props-reactivity-loss.md): Disallow usages that lose the reactivity of `props` passed to `setup`
- [vue/no-useless-concat](https://lintradar.dev/rules/vue/no-useless-concat.md): Disallow unnecessary concatenation of literals or template literals in `<template>`

---

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