@@ -268,6 +268,7 @@ module.exports = {
268268 }
269269 return container
270270 }
271+
271272 /**
272273 * @param {string[] } segments
273274 * @param {Expression } propertyValue
@@ -350,6 +351,7 @@ module.exports = {
350351 ) {
351352 continue
352353 }
354+
353355 if ( propertyReferences . hasProperty ( property . name ) ) {
354356 // used
355357 if (
@@ -453,8 +455,84 @@ module.exports = {
453455 }
454456 } ) ,
455457 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 )
458536
459537 for ( const watcherOrExpose of utils . iterateProperties (
460538 node ,
@@ -495,8 +573,10 @@ module.exports = {
495573 )
496574 }
497575 }
576+
498577 container . properties . push ( ...utils . iterateProperties ( node , groups ) )
499578 } ,
579+
500580 /** @param { (FunctionExpression | ArrowFunctionExpression) & { parent: Property } } node */
501581 'ObjectExpression > Property > :function[params.length>0]' (
502582 node ,
0 commit comments