Skip to content

Commit

Permalink
Support Pinia methods in vue/no-unused-properties (#2441)
Browse files Browse the repository at this point in the history
Co-authored-by: Luiz Otávio Carvalho <luiz.carvalho@buser.com.br>
  • Loading branch information
luizotcarvalho and Luiz Otávio Carvalho committed Apr 14, 2024
1 parent 52e0770 commit a4be0fc
Show file tree
Hide file tree
Showing 2 changed files with 918 additions and 190 deletions.
8 changes: 6 additions & 2 deletions lib/rules/no-unused-properties.js
Expand Up @@ -496,12 +496,16 @@ module.exports = {
let groupName = null
if (/^mapMutations|mapActions$/u.test(node.callee.name)) {
groupName = 'methods'
} else if (/^mapState|mapGetters$/u.test(node.callee.name)) {
} else if (
/^mapState|mapGetters|mapWritableState$/u.test(node.callee.name)
) {
groupName = 'computed'
}

if (!groupName || node.arguments.length === 0) return
const arg = node.arguments[0]
// On Pinia the store is always the first argument
const arg =
node.arguments.length === 2 ? node.arguments[1] : node.arguments[0]
if (arg.type === 'ObjectExpression') {
// e.g.
// `mapMutations({ add: 'increment' })`
Expand Down

0 comments on commit a4be0fc

Please sign in to comment.