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

Build an eslint rule for omitted return or assignment of result.fail() #226

Open
Tracked by #142
minox86 opened this issue Jan 4, 2024 · 0 comments
Open
Tracked by #142
Assignees
Labels
enhancement New feature or request low priority When we have some spare time

Comments

@minox86
Copy link
Contributor

minox86 commented Jan 4, 2024

A common mistake in the implementation of a function could be the omission of the return on a result.fail(), maybe just because return can be confused with result. As an example

const body = ({ input }) => {
   if(input.value > 0) {
      result.fail({ minValue: "Value must be greater than 0." })
   }
   return result.ok(input.value)
}

We can build a custom eslint rule to warn the developer everytime a result.fail() is called but not assigned to a const/var or directly returned because it sounds to be an error.

@minox86 minox86 added enhancement New feature or request low priority When we have some spare time labels Jan 4, 2024
@edobrb edobrb mentioned this issue Jan 4, 2024
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low priority When we have some spare time
Projects
None yet
Development

No branches or pull requests

2 participants