JS.VUE.NO.EXPORT.IN.SCRIPT.SETUP

ES module exports in `<script setup>`

Rule Details

This rule warns ES module exports in <script setup>.

The previous version of <script setup> RFC used export to define variables used in templates, but the new <script setup> RFC has been updated to define without using export. See Vue RFCs - 0040-script-setup for more details.

{'vue/no-export-in-script-setup': ['error']}

Copy
<script setup>
/* GOOD */
let msg = 'Hello!'
</script>

{'vue/no-export-in-script-setup': ['error']}

Copy
<script setup>
/* BAD */
export let msg = 'Hello!'
</script>

Options

Nothing.

Further Reading

  • https://github.com/vuejs/rfcs/blob/master/active-rfcs/0040-script-setup.md

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/