Skip to content

Commit 9b13a86

Browse files
refactor(eslint-plugin): remove unnecessary if-statements in explicitReturnTypeUtils (#3839)
1 parent 13b7de5 commit 9b13a86

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts

+8-12
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,11 @@ function isValidFunctionExpressionReturnType(
225225
}
226226

227227
// https://github.com/typescript-eslint/typescript-eslint/issues/653
228-
if (
229-
options.allowDirectConstAssertionInArrowFunctions &&
228+
return (
229+
options.allowDirectConstAssertionInArrowFunctions === true &&
230230
node.type === AST_NODE_TYPES.ArrowFunctionExpression &&
231231
returnsConstAssertionDirectly(node)
232-
) {
233-
return true;
234-
}
235-
236-
return false;
232+
);
237233
}
238234

239235
/**
@@ -250,11 +246,11 @@ function isValidFunctionReturnType(
250246
return true;
251247
}
252248

253-
if (node.returnType || isConstructor(node.parent) || isSetter(node.parent)) {
254-
return true;
255-
}
256-
257-
return false;
249+
return (
250+
node.returnType != null ||
251+
isConstructor(node.parent) ||
252+
isSetter(node.parent)
253+
);
258254
}
259255

260256
/**

0 commit comments

Comments
 (0)