@@ -75,18 +75,6 @@ module.exports = Components.detect(function(context, components) {
75
75
}
76
76
} , context . options [ 0 ] ) ;
77
77
78
- /**
79
- * Checks if the component must be validated
80
- * @param {Object } component The component to process
81
- * @returns {Boolean } True if the component must be validated, false if not.
82
- */
83
- function mustBeValidated ( component ) {
84
- return (
85
- component &&
86
- ! component . hasDisplayName
87
- ) ;
88
- }
89
-
90
78
// --------------------------------------------------------------------------
91
79
// Public
92
80
// --------------------------------------------------------------------------
@@ -236,10 +224,14 @@ module.exports = Components.detect(function(context, components) {
236
224
* @returns {Array } Properties array.
237
225
*/
238
226
function getComponentProperties ( node ) {
239
- if ( node . type === 'ClassDeclaration' ) {
240
- return node . body . body ;
227
+ switch ( node . type ) {
228
+ case 'ClassDeclaration' :
229
+ return node . body . body ;
230
+ case 'ObjectExpression' :
231
+ return node . properties ;
232
+ default :
233
+ return [ ] ;
241
234
}
242
- return node . properties ;
243
235
}
244
236
245
237
/**
@@ -346,7 +338,7 @@ module.exports = Components.detect(function(context, components) {
346
338
'Program:exit' : function ( ) {
347
339
var list = components . list ( ) ;
348
340
for ( var component in list ) {
349
- if ( ! list . hasOwnProperty ( component ) || ! mustBeValidated ( list [ component ] ) ) {
341
+ if ( ! list . hasOwnProperty ( component ) ) {
350
342
continue ;
351
343
}
352
344
var properties = getComponentProperties ( list [ component ] . node ) ;
0 commit comments