Note

This is a documentation for version 7.0.0-alpha.9.
To check version 6.2.2 go here. To check previous releases go here.

# vue/require-direct-export

require the component to be directly exported

# 📖 Rule Details

This rule aims to require that the component object be directly exported.

<script> /* ✓ GOOD */ export default { name: 'ComponentA', data() { return { state: 1 } } } </script>
Now loading...
<script> const ComponentA = { name: 'ComponentA', data() { return { state: 1 } } } /* ✗ BAD */ export default ComponentA </script>
Now loading...

# 🔧 Options

{
  "vue/require-direct-export": ["error", {
    "disallowFunctionalComponentFunction": false
  }]
}
  • "disallowFunctionalComponentFunction" ... If true, disallow functional component functions, available in Vue 3.x. default false

# "disallowFunctionalComponentFunction": false

<script> /* ✓ GOOD */ export default props => h('div', props.msg) </script>
Now loading...

# "disallowFunctionalComponentFunction": true

<script> /* ✗ BAD */ export default props => h('div', props.msg) </script>
Now loading...

# 🔍 Implementation