Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deepData option to vue/no-unused-properties rule #1387

Merged
merged 4 commits into from Dec 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 29 additions & 1 deletion docs/rules/no-unused-properties.md
Expand Up @@ -54,7 +54,8 @@ This rule cannot be checked for use in other components (e.g. `mixins`, Property
```json
{
"vue/no-unused-properties": ["error", {
"groups": ["props"]
"groups": ["props"],
"deepData": false
}]
}
```
Expand All @@ -65,6 +66,7 @@ This rule cannot be checked for use in other components (e.g. `mixins`, Property
- `"computed"`
- `"methods"`
- `"setup"`
- `"deepData"` (`boolean`) If `true`, the object of the property defined in `data` will be searched deeply. Default is `false`. Include `"data"` in `groups` to use this option.

### `"groups": ["props", "data"]`

Expand Down Expand Up @@ -108,6 +110,32 @@ This rule cannot be checked for use in other components (e.g. `mixins`, Property

</eslint-code-block>

### `{ "groups": ["props", "data"], "deepData": true }`

<eslint-code-block :rules="{'vue/no-unused-properties': ['error', {groups: ['props', 'data'], deepData: true}]}">

```vue
<template>
<Foo :param="state.used">
</template>
<script>
export default {
data() {
return {
state: {
/* ✓ GOOD */
used: null,
/* ✗ BAD (`state.unused` data not used) */
unused: null
}
}
}
}
</script>
```

</eslint-code-block>

### `"groups": ["props", "computed"]`

<eslint-code-block :rules="{'vue/no-unused-properties': ['error', {groups: ['props', 'computed']}]}">
Expand Down