@@ -25,8 +25,7 @@ module.exports = {
25
25
* this generates a warning.
26
26
*
27
27
* @param {RuleContext } context The rule context to use parser services.
28
- * @param {object } visitor The visitor.
29
- * @returns {void }
28
+ * @param {Object } visitor The visitor.
30
29
*/
31
30
registerTemplateBodyVisitor ( context , visitor ) {
32
31
if ( context . parserServices . registerTemplateBodyVisitor == null ) {
@@ -175,11 +174,11 @@ module.exports = {
175
174
)
176
175
} ,
177
176
178
- /**
179
- * Check whether the previous sibling element has `if` or `else-if` directive.
180
- * @param {ASTNode } node The element node to check.
181
- * @returns {boolean } `true` if the previous sibling element has `if` or `else-if` directive.
182
- */
177
+ /**
178
+ * Check whether the previous sibling element has `if` or `else-if` directive.
179
+ * @param {ASTNode } node The element node to check.
180
+ * @returns {boolean } `true` if the previous sibling element has `if` or `else-if` directive.
181
+ */
183
182
prevElementHasIf ( node ) {
184
183
assert ( node && node . type === 'VElement' )
185
184
@@ -193,11 +192,11 @@ module.exports = {
193
192
)
194
193
} ,
195
194
196
- /**
197
- * Check whether the given node is a custom component or not.
198
- * @param {ASTNode } node The start tag node to check.
199
- * @returns {boolean } `true` if the node is a custom component.
200
- */
195
+ /**
196
+ * Check whether the given node is a custom component or not.
197
+ * @param {ASTNode } node The start tag node to check.
198
+ * @returns {boolean } `true` if the node is a custom component.
199
+ */
201
200
isCustomComponent ( node ) {
202
201
assert ( node && node . type === 'VElement' )
203
202
@@ -404,13 +403,23 @@ module.exports = {
404
403
node . arguments [ 0 ] . type === 'ObjectExpression'
405
404
} ,
406
405
406
+ /**
407
+ * Check if current file is a Vue instance or component and call callback
408
+ * @param {RuleContext } context The ESLint rule context object.
409
+ * @param {Function } cb Callback function
410
+ */
407
411
executeOnVue ( context , cb ) {
408
412
return Object . assign (
409
413
this . executeOnVueComponent ( context , cb ) ,
410
414
this . executeOnVueInstance ( context , cb )
411
415
)
412
416
} ,
413
417
418
+ /**
419
+ * Check if current file is a Vue instance (new Vue) and call callback
420
+ * @param {RuleContext } context The ESLint rule context object.
421
+ * @param {Function } cb Callback function
422
+ */
414
423
executeOnVueInstance ( context , cb ) {
415
424
const _this = this
416
425
@@ -423,6 +432,11 @@ module.exports = {
423
432
}
424
433
} ,
425
434
435
+ /**
436
+ * Check if current file is a Vue component and call callback
437
+ * @param {RuleContext } context The ESLint rule context object.
438
+ * @param {Function } cb Callback function
439
+ */
426
440
executeOnVueComponent ( context , cb ) {
427
441
const filePath = context . getFilename ( )
428
442
const _this = this
0 commit comments