Description
What rule do you want to change?
vue/no-unused-properties
Does this change cause the rule to produce more or fewer warnings?
Fewer
How will the change be implemented? (New option, new default behavior, etc.)?
It can either be the new default behavior, or enabled via a ignorePublicMembers
option that is false
by default.
Please provide some example code that this change will affect:
<template>
<div>(nothing is used here)</div>
</template>
<script>
export default {
name: 'MySampleComponent',
data() {
return {
/** @public */
publicData: 'someData',
};
},
computed: {
/**
* @public
*/
publicComputed() {
return 'someComputedValue';
},
},
methods: {
/**
* @public
*/
publicMethod() {
},
},
};
</script>
What does the rule currently do for this code?
It warns that neither publicData
nor publicComputed
nor publicMethod
are used.
What will the rule do after it's changed?
Not warn, because they are marked as @public
in the respective JSDoc comments.
Additional context
Marking them as public can be used to specify that they are not used inside the component, but from outside via $ref
:
<template>
<MySampleComponent ref="sample" />
</template>
<script>
export default {
mounted() {
console.log(this.$refs.sample.publicData); // 'someData'
console.log(this.$refs.sample.publicComputed); // 'someComputedValue'
console.log(this.$refs.sample.publicMethod); // function
},
}
</script>