Skip to content

Commit be72caf

Browse files
author
Luiz Otávio Carvalho
committed
Add support to pinia (vuejs#1675)
1 parent eadf0eb commit be72caf

File tree

2 files changed

+918
-190
lines changed

2 files changed

+918
-190
lines changed

lib/rules/no-unused-properties.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -496,12 +496,16 @@ module.exports = {
496496
let groupName = null
497497
if (/^mapMutations|mapActions$/u.test(node.callee.name)) {
498498
groupName = 'methods'
499-
} else if (/^mapState|mapGetters$/u.test(node.callee.name)) {
499+
} else if (
500+
/^mapState|mapGetters|mapWritableState$/u.test(node.callee.name)
501+
) {
500502
groupName = 'computed'
501503
}
502504

503505
if (!groupName || node.arguments.length === 0) return
504-
const arg = node.arguments[0]
506+
// On Pinia the store is always the first argument
507+
const arg =
508+
node.arguments.length === 2 ? node.arguments[1] : node.arguments[0]
505509
if (arg.type === 'ObjectExpression') {
506510
// e.g.
507511
// `mapMutations({ add: 'increment' })`

0 commit comments

Comments
 (0)