# 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...

# 🚀 Version

This rule was introduced in eslint-plugin-vue v5.2.0

# 🔍 Implementation

Last Updated: 12/24/2020, 2:51:18 AM