Skip to content

Commit

Permalink
Use early-return
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Jan 2, 2021
1 parent 4675a23 commit a0a8432
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions rules/prefer-regexp-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ const create = context => {

return {
[regExpExecCallSelector](node) {
if (isBooleanNode(node)) {
node = node.callee.property;
context.report({
node,
messageId: MESSAGE_ID_REGEXP_EXEC,
fix: fixer => fixer.replaceText(node, 'test')
});
if (!isBooleanNode(node)) {
return;
}

node = node.callee.property;
context.report({
node,
messageId: MESSAGE_ID_REGEXP_EXEC,
fix: fixer => fixer.replaceText(node, 'test')
});
},
[stringMatchCallSelector](node) {
if (!isBooleanNode(node)) {
Expand Down

0 comments on commit a0a8432

Please sign in to comment.