You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is quite normal for a function to return T | undefined, for example with the Map.get() function. For this function it is also common to do some input checks, or return value checks, before doing something with the value. For these cases it also common to do an early exit with return, this is however conflicting with eslint/consistent-return.
Currently, the rule of no-useless-undefined would error in the following case:
It is quite normal for a function to return
T | undefined
, for example with theMap.get()
function. For this function it is also common to do some input checks, or return value checks, before doing something with the value. For these cases it also common to do an early exit withreturn
, this is however conflicting with eslint/consistent-return.Currently, the rule of
no-useless-undefined
would error in the following case:I believe it is good to let the user pick its preference in this case. Personally, I like
return undefined
in his case.Related to #1199
Related PR: https://github.com/sindresorhus/eslint-plugin-unicorn/pull/2232/files
The text was updated successfully, but these errors were encountered: