eslint-config-node icon indicating copy to clipboard operation
eslint-config-node copied to clipboard

Discussion eslint rule `fp/no-loops`

Open lukasholzer opened this issue 3 years ago • 4 comments

I want to discuss this rule and why we are forbidding the use of for-of or for loops.

https://github.com/jfmengels/eslint-plugin-fp/blob/master/docs/rules/no-loops.md

In general if you need something performant a for loop is unbeatable on large scale

like

for (let i = 0, max = hugeSet.length(); i < max; i ++) {
...
}

a different example often you want to iterate over an iterate-able with entries in a sync manor where some async code is awaited:

for (const entry of entries) {
   await doSomeAsync(entry)
   console.log('done for entry')
}

IMO these are valid examples to use a for or forof and we should not forbid them.

cc @eduardoboucas @ehmicky @netlify-team-account-1 @ascorbic @erezrokah

lukasholzer avatar Jan 21 '22 12:01 lukasholzer

I'm okay with removing it.

eduardoboucas avatar Jan 21 '22 12:01 eduardoboucas

It looks like we can move forward with this.

danez avatar Jul 28 '22 13:07 danez

Let's do it! 🚀

eduardoboucas avatar Jul 28 '22 13:07 eduardoboucas

Can I suggest we remove the fp plugin entirely. I think it's far too opinionated for a global config like this.

ascorbic avatar Nov 28 '22 12:11 ascorbic