feat: add option to skip arrow function for explicit function return … #4233
+108
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduce new option
allowArrowFunctions
to thelint/nursary/useExplicitFunctionReturnType
rule.In larger code base there are a lot of arrow functions used for a lot of inline functionality, mostly to overcome need of passing a function instead of a value. e.g.
() => object.attr
. Specifying explicit return type for such arrow functions is tedious to do and don't provide a of help, as the TS can infer the return type easily.This option is similar to
allowExpressions
option for@typescript-eslint/explicit-function-return-type
but not identical.Test Plan
Tested manually by building binary and testing against a sample code.
Could not find a way to set custom option in the test-docs for specific rule, so could not add new test cases.