optimise check of tryExecuteAndNotify

This commit is contained in:
Jacob Overgaard
2023-01-04 10:05:03 +01:00
parent fa9e436b68
commit c1e45deef7

View File

@@ -51,7 +51,7 @@ module.exports = {
// If methods called on *Resource classes are not already wrapped with `await tryExecuteAndNotify()`, then we should suggest to wrap them.
CallExpression: function (node) {
if (node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && node.callee.object.name.endsWith('Resource') && node.callee.property.type === 'Identifier' && node.callee.property.name !== 'constructor') {
const hasTryExecuteAndNotify = node.parent.callee.name === 'tryExecuteAndNotify';
const hasTryExecuteAndNotify = node.parent && node.parent.callee && node.parent.callee.name === 'tryExecuteAndNotify';
if (!hasTryExecuteAndNotify) {
context.report({
node,