Skip to content

Commit 281f230

Browse files
committed
Distinct executeOnVueInstance with executeOnVueComponent
1 parent 5e72586 commit 281f230

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

lib/rules/order-in-components.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function create (context) {
8080
const extendedOrder = order.map(property => groups[property] || property)
8181
const orderMap = getOrderMap(extendedOrder)
8282

83-
return utils.executeOnVueComponent(context, (properties) => {
83+
return utils.executeOnVueInstance(context, (properties) => {
8484
checkOrder(properties, orderMap, context)
8585
})
8686
}

lib/utils/index.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,18 @@ module.exports = {
297297
node.arguments[0].type === 'ObjectExpression'
298298
},
299299

300+
executeOnVueInstance (context, cb) {
301+
const _this = this
302+
303+
return Object.assign({}, {
304+
'NewExpression:exit' (node) {
305+
// new Vue({})
306+
if (!_this.isVueInstance(node)) return
307+
cb(node.arguments[0].properties)
308+
}
309+
}, this.executeOnVueComponent(context, cb))
310+
},
311+
300312
executeOnVueComponent (context, cb) {
301313
const filePath = context.getFilename()
302314
const _this = this
@@ -311,11 +323,6 @@ module.exports = {
311323
// Vue.component('xxx', {}) || component('xxx', {})
312324
if (!_this.isVueComponent(node)) return
313325
cb(node.arguments.slice(-1)[0].properties)
314-
},
315-
'NewExpression:exit' (node) {
316-
// new Vue({})
317-
if (!_this.isVueInstance(node)) return
318-
cb(node.arguments[0].properties)
319326
}
320327
}
321328
},

0 commit comments

Comments
 (0)