Skip to content

vue/prefer-define-options

enforce use of defineOptions instead of default export

  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule aims to enforce use of defineOptions instead of default export in <script setup>.

The defineOptions() macro was officially introduced in Vue 3.3.

<script setup> /* ✓ GOOD */ defineOptions({ name: 'Foo' }) </script>
Now loading...
<script> /* ✗ BAD */ export default { name: 'Foo' } </script> <script setup> /* ... */ </script>
Now loading...

🔧 Options

Nothing.

📚 Further Reading

🚀 Version

This rule was introduced in eslint-plugin-vue v9.13.0

🔍 Implementation