Skip to content

Commit 8836613

Browse files
committed
hasNode -> isDuplicateNode
1 parent ebf1537 commit 8836613

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/utils/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ module.exports = {
435435
const componentComments = []
436436
const foundNodes = []
437437

438-
function hasNode (node) {
438+
function isDuplicateNode (node) {
439439
return foundNodes.some(el => el.loc.start.line === node.loc.start.line)
440440
}
441441

@@ -451,18 +451,18 @@ module.exports = {
451451
componentComments.push(node)
452452
},
453453
ObjectExpression (node) {
454-
if (!componentComments.some(el => el.loc.end.line === node.loc.start.line - 1) || hasNode(node)) return
454+
if (!componentComments.some(el => el.loc.end.line === node.loc.start.line - 1) || isDuplicateNode(node)) return
455455
foundNodes.push(node)
456456
cb(node)
457457
},
458458
'ExportDefaultDeclaration:exit' (node) {
459459
// export default {} in .vue || .jsx
460-
if (!_this.isVueComponentFile(node, filePath, context) || hasNode(node)) return
460+
if (!_this.isVueComponentFile(node, filePath) || isDuplicateNode(node)) return
461461
cb(node.declaration)
462462
},
463463
'CallExpression:exit' (node) {
464464
// Vue.component('xxx', {}) || component('xxx', {})
465-
if (!_this.isVueComponent(node) || foundNodes.some(el => el.loc.start.line === node.loc.start.line)) return
465+
if (!_this.isVueComponent(node) || isDuplicateNode(node)) return
466466
cb(node.arguments.slice(-1)[0])
467467
}
468468
}

0 commit comments

Comments
 (0)