biome icon indicating copy to clipboard operation
biome copied to clipboard

📎 Implement `lint/useIterableCallbackReturn` - `eslint/array-callback-return`

Open Conaclos opened this issue 3 months ago • 1 comments

Description

array-callback-return

Want to contribute? Lets you know you are interested! We will assign you to the issue to prevent several people to work on the same issue. Don't worry, we can unassign you later if you are no longer interested in the issue! Read our contributing guide and analyzer contributing guide.

I think we don't need any rule options. We should check that forEach don't return any value (implicit return should be allowed).

Note: Similarly to useGetterReturn, we could ensure that the callback return in every possible branches. This will require Control Flow Analysis. See the useGetterReturn implementation.

Note: Similarly to useFlatMap and noAccumulatingSpread, the rule applies to all methods with the names reduce, map, etc. This doesn't apply only to arrays. This is why I proposed a more general name useIterableCallbackReturn. We are open to suggestion if a better name can be found.

Suggested names: useIterableCallbackReturn, useArrayCallbackReturn

Conaclos avatar Apr 04 '24 11:04 Conaclos