vue/no-unused-properties
disallow unused properties
📖 Rule Details
This rule is aimed at eliminating unused properties.
Note
This rule cannot check for use of properties by other components (e.g. mixins
, property access via $refs
) and use in places where the scope cannot be determined. Some access to properties might be implied, for example accessing data or computed via a variable such as this[varName]
. In this case, the default is to assume all properties, methods, etc. are 'used'. See the unreferencedOptions
for a more strict interpretation of 'use' in these cases.
🔧 Options
json
{
"vue/no-unused-properties": ["error", {
"groups": ["props"],
"deepData": false,
"ignorePublicMembers": false,
"unreferencedOptions": []
}]
}
groups
(string[]
) Array of groups to search for properties. Default is["props"]
. The value of the array is some of the following strings:"props"
"data"
"computed"
"methods"
"setup"
deepData
(boolean
) Iftrue
, the object of the property defined indata
will be searched deeply. Default isfalse
. Include"data"
ingroups
to use this option.ignorePublicMembers
(boolean
) Iftrue
, members marked with a JSDoc/** @public */
tag will be ignored. Default isfalse
.unreferencedOptions
(string[]
) Array of access methods that should be interpreted as leaving properties unreferenced. Currently, two such methods are available:unknownMemberAsUnreferenced
, andreturnAsUnreferenced
. See examples below.
"groups": ["props", "data"]
{ "groups": ["props", "data"], "deepData": true }
"groups": ["props", "computed"]
{ "groups": ["props", "methods"], "ignorePublicMembers": true }
{ "groups": ["computed"], "unreferencedOptions": ["unknownMemberAsUnreferenced"] }
{ "groups": ["computed"], "unreferencedOptions": ["returnAsUnreferenced"] }
🚀 Version
This rule was introduced in eslint-plugin-vue v7.0.0