@@ -2479,10 +2479,11 @@ function isVueComponentFile(node, path) {
24792479/**
24802480 * Get the Vue component definition type from given node
24812481 * Vue.component('xxx', {}) || component('xxx', {})
2482+ * @param {RuleContext } context The rule context to use parser services.
24822483 * @param {ObjectExpression } node Node to check
24832484 * @returns {'component' | 'mixin' | 'extend' | 'createApp' | 'defineComponent' | null }
24842485 */
2485- function getVueComponentDefinitionType ( node ) {
2486+ function getVueComponentDefinitionType ( context , node ) {
24862487 const parent = getParent ( node )
24872488 if ( parent . type === 'CallExpression' ) {
24882489 const callee = parent . callee
@@ -2527,6 +2528,23 @@ function getVueComponentDefinitionType(node) {
25272528 if ( callee . name === 'createApp' ) {
25282529 // for Vue.js 3.x
25292530 // createApp({})
2531+
2532+ const variable = findVariable ( context . getScope ( ) , callee )
2533+
2534+ // only lint the createApp function that import from vue
2535+ if ( variable !== null && variable . defs . length === 1 ) {
2536+ const def = variable . defs [ 0 ]
2537+ if (
2538+ def . type === 'ImportBinding' &&
2539+ def . node . type === 'ImportSpecifier' &&
2540+ def . node . imported . type === 'Identifier' &&
2541+ def . node . parent . type === 'ImportDeclaration' &&
2542+ def . node . parent . source . value !== 'vue'
2543+ ) {
2544+ return null
2545+ }
2546+ }
2547+
25302548 const isAppVueComponent = isObjectArgument ( parent )
25312549 return isAppVueComponent ? 'createApp' : null
25322550 }
@@ -2603,7 +2621,7 @@ function getVueObjectType(context, node) {
26032621 case 'CallExpression' : {
26042622 // Vue.component('xxx', {}) || component('xxx', {})
26052623 if (
2606- getVueComponentDefinitionType ( node ) != null &&
2624+ getVueComponentDefinitionType ( context , node ) != null &&
26072625 skipTSAsExpression ( parent . arguments . slice ( - 1 ) [ 0 ] ) === node
26082626 ) {
26092627 return 'definition'
0 commit comments