Skip to content

Latest commit

 

History

History
84 lines (65 loc) · 2.38 KB

require-macro-variable-name.md

File metadata and controls

84 lines (65 loc) · 2.38 KB
pageClass sidebarDepth title description
rule-details
0
vue/require-macro-variable-name
require a certain macro variable name

vue/require-macro-variable-name

require a certain macro variable name

  • This rule has not been released yet.
  • 💡 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 for defineProps. default: props
  • defineEmits - The name of the macro variable for defineEmits. default: emit
  • defineSlots - The name of the macro variable for defineSlots. default: slots
  • useSlots - The name of the macro variable for useSlots. default: slots
  • useAttrs - The name of the macro variable for useAttrs. default: attrs

With custom macro variable names

<script setup>
const slotsCustom = defineSlots()
const attrsCustom = useAttrs()
</script>

🔍 Implementation