Sourcery rule id:
Inline variable that is immediately returned
const var = 1; return var;
Something that we often see in people's code is assigning to a result variable and then immediately returning it.
Returning the result directly shortens the code and removes an unnecessary variable, reducing the mental load of reading the function.
Where intermediate variables can be useful is if they then get used as a parameter or a condition, and the name can act like a comment on what the variable represents. In the case where you're returning it from a function, the function name is there to tell you what the result is, so the variable name is unnecessary.