Skip to content

vue/no-export-in-script-setup Correctness

What it does

Disallow export in <script setup>

Why is this bad?

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.

Examples

Examples of incorrect code for this rule:

vue
<script setup>
export let msg = "Hello!";
</script>

Examples of correct code for this rule:

vue
<script setup>
let msg = "Hello!";
</script>

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny vue/no-export-in-script-setup --vue-plugin
json
{
  "plugins": ["vue"],
  "rules": {
    "vue/no-export-in-script-setup": "error"
  }
}

References

Released under the MIT License.