Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a4be0fc

Browse files
luizotcarvalhoLuiz Otávio Carvalho
and
Luiz Otávio Carvalho
authored
Support Pinia methods in vue/no-unused-properties (#2441)
Co-authored-by: Luiz Otávio Carvalho <luiz.carvalho@buser.com.br>
1 parent 52e0770 commit a4be0fc

File tree

2 files changed

+918
-190
lines changed

2 files changed

+918
-190
lines changed

‎lib/rules/no-unused-properties.js

Lines changed: 6 additions & 2 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /