Skip to content

Commit

Permalink
fix #49
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Nov 30, 2016
1 parent 803a4ab commit 81b2172
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions rules/no-return-wrap.js
Expand Up @@ -22,13 +22,15 @@ module.exports = {
return {
ReturnStatement: function (node) {
if (isInPromise(context)) {
if (node.argument.type === 'CallExpression') {
if (node.argument.callee.type === 'MemberExpression') {
if (node.argument.callee.object.name === 'Promise') {
if (node.argument.callee.property.name === 'resolve') {
context.report(node, resolveMessage)
} else if (node.argument.callee.property.name === 'reject') {
context.report(node, rejectMessage)
if (node.argument) {
if (node.argument.type === 'CallExpression') {
if (node.argument.callee.type === 'MemberExpression') {
if (node.argument.callee.object.name === 'Promise') {
if (node.argument.callee.property.name === 'resolve') {
context.report(node, resolveMessage)
} else if (node.argument.callee.property.name === 'reject') {
context.report(node, rejectMessage)
}
}
}
}
Expand Down

0 comments on commit 81b2172

Please sign in to comment.