Closed
Description
Checklist
- I have tried restarting my IDE and the issue persists.
- I have read the FAQ and my problem is not listed.
Tell us about your environment
- ESLint version: 8.55.0
- eslint-plugin-vue version: 9.19.2
- Node version: not applied, repro in playground
- Operating System: not applied, repro in playground
Please show your full configuration:
{
"rules": {
'vue/no-unused-properties': 'error',
}
}
What did you do?
<template>
<div :class="$props.class"></div>
<div>{{$props.for}}</div>
</template>
<script lang="ts" setup>
defineProps<{
class: string
for: number
}>()
</script>
What did you expect to happen?
props: class
and for
not reported as unused
What actually happened?
props: class
and for
reported as unused
Repository to reproduce this issue
Bug description:
When we want to define a prop name as a js keyword (for example: class, for, ...) it is required to use them as $props.PROP
, because using simply as PROP
will lead to parsing error.
Another option is to use as props.PROP
with props variable declaration
<template>
<div :class="props.class"></div>
<div>{{props.for}}</div>
</template>
<script lang="ts" setup>
const props = defineProps<{
class: string
for: number
}>()
</script>
but the rule doesn't support it too #2193