Skip to content

Commit

Permalink
refactor(eslint-plugin): remove unnecessary if-statements in `expli…
Browse files Browse the repository at this point in the history
…citReturnTypeUtils` (#3839)
  • Loading branch information
MichaelDeBoey authored Sep 22, 2021
1 parent 13b7de5 commit 9b13a86
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,11 @@ function isValidFunctionExpressionReturnType(
}

// https://github.com/typescript-eslint/typescript-eslint/issues/653
if (
options.allowDirectConstAssertionInArrowFunctions &&
return (
options.allowDirectConstAssertionInArrowFunctions === true &&
node.type === AST_NODE_TYPES.ArrowFunctionExpression &&
returnsConstAssertionDirectly(node)
) {
return true;
}

return false;
);
}

/**
Expand All @@ -250,11 +246,11 @@ function isValidFunctionReturnType(
return true;
}

if (node.returnType || isConstructor(node.parent) || isSetter(node.parent)) {
return true;
}

return false;
return (
node.returnType != null ||
isConstructor(node.parent) ||
isSetter(node.parent)
);
}

/**
Expand Down

0 comments on commit 9b13a86

Please sign in to comment.