# require-direct-export

Rule `vue/require-direct-export`. Require the component to be directly exported

- 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: #1766 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vue/require-direct-export` | no | no | package `eslint-plugin-vue` | [docs](https://eslint.vuejs.org/rules/require-direct-export.html) |
| Oxlint | `vue/require-direct-export` | no | no | plugin `vue`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/vue/require-direct-export.html) |

## Code examples

### Incorrect: the rule reports this

```vue
<script>
const A = {};
export default A;
</script>
```

```vue
<script>
export default function () {}
</script>
```

```vue
<script>
export default (props) => h('div', props.msg)
</script>
```

### Correct: the rule accepts this

```vue
<script>
export default {};
</script>
```

```vue
<script>
export default function (props) {
  return h('div', props.msg);
}
</script>
```

Examples from the Oxlint documentation.

## Enable it

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

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

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

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "vue"
  ],
  "rules": {
    "vue/require-direct-export": "error"
  }
}
```

## Related rules

- [vue/block-lang](https://lintradar.dev/rules/vue/block-lang.md): Disallow use other than available `lang`
- [vue/camelcase](https://lintradar.dev/rules/vue/camelcase.md): Enforce camelcase naming convention in `<template>`
- [vue/component-api-style](https://lintradar.dev/rules/vue/component-api-style.md): Enforce component API style
- [vue/html-button-has-type](https://lintradar.dev/rules/vue/html-button-has-type.md): Disallow usage of button without an explicit type attribute
- [vue/match-component-file-name](https://lintradar.dev/rules/vue/match-component-file-name.md): Require component name property to match its file name
- [vue/no-console](https://lintradar.dev/rules/vue/no-console.md): Disallow the use of `console` in `<template>`

---

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