@@ -268,6 +268,7 @@ module.exports = {
268
268
}
269
269
return container
270
270
}
271
+
271
272
/**
272
273
* @param {string[] } segments
273
274
* @param {Expression } propertyValue
@@ -350,6 +351,7 @@ module.exports = {
350
351
) {
351
352
continue
352
353
}
354
+
353
355
if ( propertyReferences . hasProperty ( property . name ) ) {
354
356
// used
355
357
if (
@@ -453,8 +455,84 @@ module.exports = {
453
455
}
454
456
} ) ,
455
457
utils . defineVueVisitor ( context , {
456
- onVueObjectEnter ( node ) {
457
- const container = getVueComponentPropertiesContainer ( node )
458
+ /**
459
+ * e.g. `mapMutations({ add: 'increment' })`
460
+ * @param {Property } node
461
+ * @param {VueObjectData } vueData
462
+ */
463
+ 'CallExpression[callee.name=/^(mapMutations|mapActions)$/][arguments] ObjectExpression Property' (
464
+ node ,
465
+ vueData
466
+ ) {
467
+ const container = getVueComponentPropertiesContainer ( vueData . node )
468
+
469
+ container . properties . push ( {
470
+ type : 'array' ,
471
+ name : utils . getStaticPropertyName ( node ) ,
472
+ groupName : 'methods' ,
473
+ node
474
+ } )
475
+ } ,
476
+
477
+ /**
478
+ * e.g. `mapMutations(['add'])`
479
+ * @param {Literal } node
480
+ * @param {VueObjectData } vueData
481
+ */
482
+ 'CallExpression[callee.name=/^(mapMutations|mapActions)$/][arguments] ArrayExpression Literal' (
483
+ node ,
484
+ vueData
485
+ ) {
486
+ const container = getVueComponentPropertiesContainer ( vueData . node )
487
+
488
+ container . properties . push ( {
489
+ type : 'array' ,
490
+ name : utils . getStringLiteralValue ( node ) ,
491
+ groupName : 'methods' ,
492
+ node
493
+ } )
494
+ } ,
495
+
496
+ /**
497
+ * e.g. `mapState({ count: state => state.todosCount })`
498
+ * @param {Property } node
499
+ * @param {VueObjectData } vueData
500
+ */
501
+ 'CallExpression[callee.name=/^(mapState|mapGetters)$/][arguments] ObjectExpression Property' (
502
+ node ,
503
+ vueData
504
+ ) {
505
+ const container = getVueComponentPropertiesContainer ( vueData . node )
506
+
507
+ container . properties . push ( {
508
+ type : 'array' ,
509
+ name : utils . getStaticPropertyName ( node ) ,
510
+ groupName : 'computed' ,
511
+ node
512
+ } )
513
+ } ,
514
+
515
+ /**
516
+ * e.g. `mapState(['count'])`
517
+ * @param {Literal } node
518
+ * @param {VueObjectData } vueData
519
+ */
520
+ 'CallExpression[callee.name=/^(mapState|mapGetters)$/][arguments] ArrayExpression Literal' (
521
+ node ,
522
+ vueData
523
+ ) {
524
+ const container = getVueComponentPropertiesContainer ( vueData . node )
525
+
526
+ container . properties . push ( {
527
+ type : 'array' ,
528
+ name : utils . getStringLiteralValue ( node ) ,
529
+ groupName : 'computed' ,
530
+ node
531
+ } )
532
+ } ,
533
+
534
+ onVueObjectEnter ( node , vueNode ) {
535
+ const container = getVueComponentPropertiesContainer ( vueNode . node )
458
536
459
537
for ( const watcherOrExpose of utils . iterateProperties (
460
538
node ,
@@ -495,8 +573,10 @@ module.exports = {
495
573
)
496
574
}
497
575
}
576
+
498
577
container . properties . push ( ...utils . iterateProperties ( node , groups ) )
499
578
} ,
579
+
500
580
/** @param { (FunctionExpression | ArrowFunctionExpression) & { parent: Property } } node */
501
581
'ObjectExpression > Property > :function[params.length>0]' (
502
582
node ,
0 commit comments