Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add option to skip arrow function for explicit function return … #4233

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nazarhussain
Copy link

@nazarhussain nazarhussain commented Oct 10, 2024

Summary

This PR introduce new option allowArrowFunctions to the lint/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.

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Oct 10, 2024
@ematipico
Copy link
Member

@nazarhussain thank you for your contribution.

We would appreciate it if you'd get involved first with the relative issue: #2017

The issue was assigned to another contributor, which already implemented your use case: #4036

@Conaclos
Copy link
Member

We recently renamed the rule to useExplicitTypes, you will have to update your code. Also, we should not add any options. We could just extend the rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants