Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/sxzz/eslint-plugin-vuekit. Modern ESLint plugin for Vue 3 eslint-plugin-vuekit.sxzz.dev
eslint plugin vue
Something went wrong. Try again.
2.4 kB · 89 lines
Markdown
at main
pageClass: rule-details sidebarDepth: 0 title: vue/require-macro-variable-name description: require a certain macro variable name since: v9.15.0 #
vue/require-macro-variable-name #
require a certain macro variable name
- 💡 Some problems reported by this rule are manually fixable by editor suggestions.
📖 Rule Details #
This rule reports macro variables not corresponding to the specified name.
<!-- ✓ GOOD -->
<script setup>
const props = defineProps({ msg: String })
const emit = defineEmits(['update:msg'])
</script>
<!-- ✗ BAD -->
<script setup>
const propsDefined = defineProps({ msg: String })
const emitsDefined = defineEmits(['update:msg'])
</script>
🔧 Options #
{
"vue/require-macro-variable-name": ["error", {
"defineProps": "props",
"defineEmits": "emit",
"defineSlots": "slots",
"useSlots": "slots",
"useAttrs": "attrs"
}]
}
defineProps- The name of the macro variable fordefineProps. default:propsdefineEmits- The name of the macro variable fordefineEmits. default:emitdefineSlots- The name of the macro variable fordefineSlots. default:slotsuseSlots- The name of the macro variable foruseSlots. default:slotsuseAttrs- The name of the macro variable foruseAttrs. default:attrs
With custom macro variable names #
<script setup>
const slotsCustom = defineSlots()
const attrsCustom = useAttrs()
</script>
🚀 Version #
This rule was introduced in eslint-plugin-vue v9.15.0