@@ -62,19 +62,18 @@ function getComponentProperties(node) {
62
62
case 'ClassExpression' :
63
63
return node . body . body ;
64
64
case 'ObjectExpression' :
65
- // return node.properties;
66
65
return node . properties ;
67
66
default :
68
67
return [ ] ;
69
68
}
70
69
}
71
70
72
71
/**
73
- * Checks if the node is the first in its line, excluding whitespace.
74
- * @param {Object } context The node to check
75
- * @param {ASTNode } node The node to check
76
- * @return {Boolean } true if its the first node in its line
77
- */
72
+ * Checks if the node is the first in its line, excluding whitespace.
73
+ * @param {Object } context The node to check
74
+ * @param {ASTNode } node The node to check
75
+ * @return {Boolean } true if it's the first node in its line
76
+ */
78
77
function isNodeFirstInLine ( context , node ) {
79
78
const sourceCode = context . getSourceCode ( ) ;
80
79
let token = node ;
@@ -94,11 +93,20 @@ function isNodeFirstInLine(context, node) {
94
93
return startLine !== endLine ;
95
94
}
96
95
96
+ /**
97
+ * Checks if the node is a function or arrow function expression.
98
+ * @param {Object } context The node to check
99
+ * @return {Boolean } true if it's a function-like expression
100
+ */
101
+ function isFunctionLikeExpression ( node ) {
102
+ return node . type === 'FunctionExpression' || node . type === 'ArrowFunctionExpression' ;
103
+ }
97
104
98
105
module . exports = {
99
106
findReturnStatement : findReturnStatement ,
100
107
getPropertyName : getPropertyName ,
101
108
getPropertyNameNode : getPropertyNameNode ,
102
109
getComponentProperties : getComponentProperties ,
103
- isNodeFirstInLine : isNodeFirstInLine
110
+ isNodeFirstInLine : isNodeFirstInLine ,
111
+ isFunctionLikeExpression : isFunctionLikeExpression
104
112
} ;
0 commit comments