vue/no-import-compiler-macros Restriction
What it does
Disallow importing Vue compiler macros.
Why is this bad?
Compiler Macros like:
definePropsdefineEmitsdefineExposewithDefaultsdefineModeldefineOptionsdefineSlots
are globally available in Vue 3's <script setup> and do not require explicit imports.
Examples
Examples of incorrect code for this rule:
vue
<script setup>
import { defineProps, withDefaults } from "vue";
</script>Examples of correct code for this rule:
vue
<script setup>
import { ref } from "vue";
</script>How to use
To enable this rule using the config file or in the CLI, you can use:
json
{
"plugins": ["vue"],
"rules": {
"vue/no-import-compiler-macros": "error"
}
}bash
oxlint --deny vue/no-import-compiler-macros --vue-plugin