Skip to content

Commit

Permalink
refactor: removed a unnecessary if/else
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaPontrandolfo committed Nov 20, 2022
1 parent 70461ef commit bd42395
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions lib/rules/ensure-matching-remove-event-listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,10 @@ module.exports = {
}
if (hasAddEventListener) {
if (!hasRemoveEventListener) {
if (!hasReturnStatement) {
const messageId = 'requiredCleanup';

report(context, messages, messageId, {
node,
});
} else {
const messageId = 'requiredRemoveEventListener';

report(context, messages, messageId, {
node,
});
}
const messageID = hasReturnStatement ? 'requiredRemoveEventListener' : 'requiredCleanup';
report(context, messages[messageID], messageID, {
node,
});
}
}
}
Expand Down

0 comments on commit bd42395

Please sign in to comment.