sindresorhus/eslint-plugin-unicorn

A case for `prefer-flat-map` #311

tinovyatkin posted onGitHub

I think it will be way greater rule if it will be able to identify legacy (before .flat got supported) code and suggest to refactor to flatMap. I believe one of the most common scenario was use of [].concat with array spread:

[].concat(...someArray.map(fn))
// is the same
someArray.flatMap(fn)

Fund this Issue

$40.00
Rewarded

Rewarded pull request

Recent activities

mrhen was rewarded by sindresorhus for sindresorhus/eslint-plugin-unicorn# 311
over 5 years ago
mrhen submitted an output to  sindresorhus/ eslint-plugin-unicorn# 311
almost 6 years ago