wix-incubator / eslint-plugin-lodash

ESLint rules for lodash
MIT License
276 stars 65 forks source link

New rule: prefer-native-method (Fixes #221) #335

Open TSMMark opened 2 years ago

TSMMark commented 2 years ago

Fixes #221

The new rule in its current state in this branch only works with map as a proof of concept.

The fix for this rule is unsafe as _.map() can accept any collection and not only Array. So it has the potential to break code such as:

_.map({ a: 'c', b: 'd' }, (v, k) => whatever(v, k))

Open to feedback about how to get this rule actually in a state where it could be merged. Thanks

coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 717


Totals Coverage Status
Change from base Build 715: -0.05%
Covered Lines: 1009
Relevant Lines: 1009

💛 - Coveralls
davidbonnet commented 2 years ago

The fix could use optional chaining.

TSMMark commented 2 years ago

I'm not putting any effort into a PR that's been open since 2021 with no attention, but you can go ahead if you want