vue/no-undef-properties
eslint-plugin-vue
No autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-undef-properties": "error",
},
},
]; <div>{{ label }}: {{ cnt }}</div>
</template>
<script setup>
const prop = defineProps(['name', 'def'])
let count = 0
/* ✓ GOOD */
watch(() => prop.def, () => console.log('Updated!'))
/* ✗ BAD */
watch(() => prop.undef, () => console.log('Updated!'))
</script> <div>{{ label }}: {{ cnt }}</div>
</template>
<script>
export default {
props: ['name'],
data() {
return {
count: 0
}
},
methods: {
click() {
/* ✓ GOOD */
this.count++
/* ✗ BAD */
this.cnt++
}
}
}
</script><div>{{ name }}: {{ count }}</div><div>{{ name }}: {{ count }}</div> <div>{{ $t('foo') }}</div>
</template>
<script>
export default {
mounted() {
/* ✓ GOOD */
const hash = this.$route.hash
}
}
</script>Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
vue/no-undef-properties
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-undef-properties": "error",
},
},
];Oxlint does not have this rule.
nursery/noVueUndeclaredProperties
nursery · since 2.6.5
{
"linter": {
"rules": {
"nursery": {
"noVueUndeclaredProperties": "error"
}
}
}
}Disallow using v-else-if/v-else on the same element as v-for
Disallow target="_blank" attribute without rel="noopener noreferrer"
Disallow unnecessary concatenation of literals or template literals in <template>
Disallow the use of event names that collide with native web event names