eslint-plugin-promise
Advanced tools
Comparing version 4.1.1 to 4.2.1
@@ -0,1 +1,5 @@ | ||
## 4.2.1 | ||
- Added more use cases to `no-return-wrap` | ||
## 4.0.1 | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "eslint-plugin-promise", | ||
"version": "4.1.1", | ||
"version": "4.2.1", | ||
"description": "Enforce best practices for JavaScript promises", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -13,6 +13,25 @@ /** | ||
function isInPromise(context) { | ||
const expression = context | ||
let functionNode = context | ||
.getAncestors() | ||
.filter(node => node.type === 'ExpressionStatement')[0] | ||
return expression && expression.expression && isPromise(expression.expression) | ||
.filter(node => { | ||
return ( | ||
node.type === 'ArrowFunctionExpression' || | ||
node.type === 'FunctionExpression' | ||
) | ||
}) | ||
.reverse()[0] | ||
while ( | ||
functionNode && | ||
functionNode.parent && | ||
functionNode.parent.type === 'MemberExpression' && | ||
functionNode.parent.object === functionNode && | ||
functionNode.parent.property.type === 'Identifier' && | ||
functionNode.parent.property.name === 'bind' && | ||
functionNode.parent.parent && | ||
functionNode.parent.parent.type === 'CallExpression' && | ||
functionNode.parent.parent.callee === functionNode.parent | ||
) { | ||
functionNode = functionNode.parent.parent | ||
} | ||
return functionNode && functionNode.parent && isPromise(functionNode.parent) | ||
} | ||
@@ -19,0 +38,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38346
911